chenrui 2 gadi atpakaļ
vecāks
revīzija
51567f8b33

+ 33 - 10
hybrid/html/index.html

@@ -5,9 +5,10 @@
     <meta charset="UTF-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <title>箭冠东莞汽配-对账单</title>
+    <title>{{userName}}-对账单</title>
     <link rel="stylesheet" href="./css/common.css">
     <script src="./js/resize.js"></script>
+	<script src="./js/moent.min.js"></script>
 	 <script src="./js/vue.min.js"></script>
     <script src="./js/axios.min.js"></script>
     <style>
@@ -186,7 +187,7 @@
                 <div class="downLoadTip">
                     单据明细Excel下载请点击下面的链接:
                 </div>
-                <div class="downLoadUrl">
+                <div class="downLoadUrl" @click="downLoad">
                     http://iscm.360arrow.com/bill/202211150004.xls
                 </div>
             </div>
@@ -241,22 +242,40 @@
     </div>
 </body>
 <script>
+	
     new Vue({
         el: '#app',
         data: {
             isShow:false,
 			ajaxUrl:'http://192.168.0.215:8503/qpls-md/',
+			// customerName:'',
+			// userName:'',
+			saleList:[],
 			customerName:'名字名字',
 			customerSn:'437705264826884096',
 			startTime:'2022-11-01 00:00:00',
 			endTime:'2022-11-30 23:59:59',
-
-			saleList:[]
         },
 		created() {
-			this.loadData();
+			// let dataInfo=JSON.parse(this.getUrlParam(data));
+			// this.customerName = dataInfo.customerName;
+			// this.userName  = dataInfo.userName;
+			// this.newObj= dataInfo;
+			// this.loadData(dataInfo);
 		},
         methods:{
+			loadData(item){
+				let ajaxData={
+					targetSn: item.customerSn,
+					bizBeginDate: item.startTime,
+					bizEndDate: item.endTime
+				}
+				axios.post(this.ajaxUrl+'verify/queryUnsettleSaleList',ajaxData).then((res)=> {
+				   this.saleList=res.data;
+				}).catch((error)=> {
+				    console.log(error);
+				});
+			},
             handleShow(){
                 this.isShow = !this.isShow
             },
@@ -265,19 +284,23 @@
 				var r = window.location.search.substr(1).match(reg);  //匹配目标参数
 				if (r!=null) return unescape(r[2]); return null; //返回参数值
 			},
-			loadData(){
+			downLoad(){
 				let ajaxData={
 					targetSn: this.customerSn,
 					bizBeginDate: this.startTime,
-					bizEndDate: this.endTime
+					bizEndDate: this.endTime,
+					dealerSn:"3429"
 				}
-				axios.post(this.ajaxUrl+'verify/queryUnsettleSaleList',ajaxData).then((res)=> {
-				   this.saleList=res.data;
+				axios.get(this.ajaxUrl+'verify/exportExcel',{params:ajaxData},{responseType: 'blob', dataType:"jsonp",jsonp:"callback"}).then((res)=> {
+					console.log('res',res)
+				  if(res.status == 200){
+					  downloadExcel(res.data, '对账单明细')
+				  }
 				}).catch((error)=> {
 				    console.log(error);
 				});
+				
 			}
-
         }
     })
 </script>

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
hybrid/html/js/moent.min.js


+ 45 - 16
hybrid/html/js/resize.js

@@ -1,17 +1,46 @@
 (function(doc, win) {
-    var docEl = doc.documentElement,
-        resizeEvt = "orientationchange" in window ? "orientationchange" : "resize",
-        recalc = function() {
-            if (docEl.clientWidth > 750) {
-                docEl.style.fontSize = "100px";
-                doc.getElementById("app").style.width = "750px";
-            } else {
-                var width = docEl.clientWidth / 7.5;
-                docEl.style.fontSize = width + "px";
-                doc.getElementById("app").style.width = "auto";
-            }
-        };
-    if (!doc.addEventListener) return;
-    win.addEventListener(resizeEvt, recalc, false);
-    doc.addEventListener("DOMContentLoaded", recalc, false);
-})(document, window);
+   var docEl = doc.documentElement,
+    resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
+    recalc = function() {
+     var clientWidth = docEl.clientWidth;
+     if(!clientWidth) return;
+     if(clientWidth >= 1080) {
+      docEl.style.fontSize = '100px';
+     } else {
+      docEl.style.fontSize = 100 * (clientWidth / 750) + 'px';
+     }
+    };
+
+   if(!doc.addEventListener) return;
+   win.addEventListener(resizeEvt, recalc, false);
+   doc.addEventListener('DOMContentLoaded', recalc, false);
+   var docEl = document.documentElement;
+   var clientWidth = docEl.clientHeight;
+  })(document, window);
+
+
+// 导出
+function  downloadExcel(data, fileName) {
+  if (!data) { return }
+  const a = moment().format('YYYYMMDDHHmmss')
+  const fname = fileName + a
+  const blob = new Blob([data], { type: 'application/vnd.ms-excel' })
+  if (window.navigator && window.navigator.msSaveOrOpenBlob) {
+	   console.log('22222')
+    navigator.msSaveBlob(blob, fname + '.xlsx')
+  } else {
+    const link = document.createElement('a')
+    link.style.display = 'none'
+    var href = URL.createObjectURL(blob)
+    link.href = href
+   alert('111111')
+	// window.location.href = 'https://jg-ocs.oss-cn-beijing.aliyuncs.com/templ/promo/sendOutOrderImport.xlsx'
+	
+    link.setAttribute('download', fname + '.xlsx')
+
+    document.body.appendChild(link)
+    link.click()
+    document.body.removeChild(link)
+    window.URL.revokeObjectURL(href) // 释放掉blob对象
+  }
+}

+ 5 - 4
libs/getDate.js

@@ -190,8 +190,9 @@ export default {
 			starttime: '',
 			endtime: ''
 		}
-		obj.starttime = moment(dateInfo).startOf("day").format('YYYY-MM-DD 00:00:00')
-		obj.endtime =moment(dateInfo).endOf("day").format('YYYY-MM-DD 23:59:59')
+		let date_info=moment().year()+'-'+dateInfo;
+		obj.starttime = moment(date_info.replace('.','-')).startOf("day").format('YYYY-MM-DD 00:00:00')
+		obj.endtime =moment(date_info.replace('.','-')).endOf("day").format('YYYY-MM-DD 23:59:59')
 		return obj
 	},
 	//根据所传日期获取当前月份第一天和最后一天
@@ -200,8 +201,8 @@ export default {
 		  starttime: '',
 		  endtime: ''
 		}
-		obj.starttime = moment(month).startOf("month").format('YYYY-MM-DD 00:00:00')
-		obj.endtime = moment(month).endOf("month").format('YYYY-MM-DD 23:59:59')
+		obj.starttime = moment(month.replace('.','-')).startOf("month").format('YYYY-MM-DD 00:00:00')
+		obj.endtime = moment(month.replace('.','-')).endOf("month").format('YYYY-MM-DD 23:59:59')
 		return obj
 	  },
 	  // 获取今日/昨日/本周/上周/本月/上月 年月日时间

+ 104 - 47
pages/sales/bill.vue

@@ -18,23 +18,23 @@
 					<u-icon name="question-circle-fill" @click="tipShow = true" :color="wordColor" size="32"></u-icon>
 				</view>
 				<view class="list_r u-flex">
-					<u-input v-model="cycleName" @click="showSearch = true" disabled placeholder="请选择对账日期" />
+					<u-input v-model="cycleName" @click="chooseCycleData" disabled placeholder="请选择对账日期" />
 					<u-icon name="arrow-right" color="#999" size="30"></u-icon>
 				</view>
 			</view>
-		</view>
-		<view class="statistical u-flex">
-			<view class="statisticalList">
-				<text>总单数:</text>
-				<text>{{ bill.length }}</text>
-			</view>
-			<view class="statisticalList">
-				<text>待收金额合计:</text>
-				<text>¥{{ totalPayPrice }}</text>
+			<view class="statistical u-flex">
+				<view class="statisticalList">
+					<text>总单数:</text>
+					<text>{{ bill.length }}</text>
+				</view>
+				<view class="statisticalList">
+					<text>待收金额合计:</text>
+					<text>¥{{ totalPayPrice }}</text>
+				</view>
 			</view>
 		</view>
 		<view class="chooseCon"><billList ref="bill" :showCheck="true" :list="bill" @allChecked="allCheckedCallback"></billList></view>
-		<view class="footer u-flex">
+		<view class="footerCon u-flex">
 			<view class="f-left">
 				<u-checkbox @change="allCheckeChange" v-model="allChecked" shape="circle">{{ allChecked ? '取消全选' : '全选' }}</u-checkbox>
 			</view>
@@ -56,7 +56,9 @@
 				</view>
 			</view>
 			<view class="f-btns">
-				<u-button size="medium" @click="submitOrder" :custom-style="customBtnStyle" shape="circle" type="primary" hover-class="none">发送对账单</u-button>
+				<u-button size="medium" @click="submitOrder" :custom-style="customBtnStyle" :loading="submitLoading" shape="circle" type="primary" hover-class="none">
+					发送对账单
+				</u-button>
 			</view>
 		</view>
 		<!-- 对账周期弹窗 -->
@@ -99,7 +101,11 @@
 			</view>
 		</u-popup>
 		<!-- 对账周期弹窗 -->
-		<u-modal v-model="tipShow" :show-title="false" :content="tipContent" confirm-text="知道了"></u-modal>
+		<u-modal v-model="tipShow" :show-title="false" confirm-text="知道了">
+			<view class="slot-content"><rich-text :nodes="tipContent"></rich-text></view>
+		</u-modal>
+		<!-- 分享询问弹窗 -->
+		<u-modal v-model="shareShow" :content="shareContent" @confirm="handleShare" @cancel="shareShow = false"></u-modal>
 	</view>
 </template>
 
@@ -127,7 +133,8 @@ export default {
 			allChecked: false,
 			tipShow: false,
 			discountVal: null, //折让金额
-			tipContent: `账单周期指销售单的创建时间`,
+			tipContent: `账单周期指<br>销售单的创建时间`,
+			shareContent:`是否同意发送对账单给微信好友?`,
 			placeTab: [
 				{
 					name: '今日',
@@ -182,7 +189,9 @@ export default {
 			bill: [],
 			dateArray: '',
 			chooseList: [],
-			isDetailShow:false
+			isDetailShow: false,
+			submitLoading: false,
+			shareShow: false
 		};
 	},
 	onReady() {
@@ -224,12 +233,18 @@ export default {
 			this.showSearch = false;
 		} else {
 			uni.removeStorageSync('curTab');
+			uni.removeStorageSync('chooseList');
 		}
 	},
 	onUnload() {
 		uni.removeStorageSync('curTab');
+		uni.removeStorageSync('chooseList');
 	},
 	computed: {
+		//经销商信息
+		userData(){
+			return this.$store.state.vuex_userData;
+		},
 		totalPayPrice() {
 			let totalPrice = 0;
 			for (let i = 0; i < this.bill.length; i++) {
@@ -251,7 +266,11 @@ export default {
 		}
 	},
 	methods: {
-		handleClean(){
+		chooseCycleData() {
+			uni.setStorageSync('chooseList', this.chooseList);
+			this.showSearch = true;
+		},
+		handleClean() {
 			this.showSearch = false;
 			let systemList = this.$store.state.vuex_systemSetList;
 			let cycleObj = systemList.find(item => {
@@ -285,6 +304,13 @@ export default {
 			queryUnsettleSaleList(this.params).then(res => {
 				if (res.status == 200) {
 					this.bill = res.data;
+					let chooseArr = uni.getStorageSync('chooseList');
+					if (chooseArr && chooseArr.length > 0) {
+						res.data.map(item => {
+							const row = chooseArr.find(k => k.bizSn == item.bizSn);
+							item.checked = !!row;
+						});
+					}
 					this.$refs.bill.setData(res.data);
 				}
 			});
@@ -328,20 +354,20 @@ export default {
 			});
 		},
 		handleDisCount() {
-			if(this.discountVal > this.chooseTotalPayPrice){
+			if (this.discountVal > this.chooseTotalPayPrice) {
 				uni.showToast({
 					title: '折让金额不能大于待收金额,请重新输入',
 					icon: 'none'
 				});
-				return
+				return;
 			}
-			let reg=/^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/;
-			if(!reg.test(this.discountVal)){
+			let reg = /^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/;
+			if (!reg.test(this.discountVal)) {
 				uni.showToast({
 					title: '折让金额格式不正确,请重新输入',
 					icon: 'none'
 				});
-				return
+				return;
 			}
 			this.costShow = false;
 		},
@@ -362,9 +388,16 @@ export default {
 				detailList: this.chooseList
 			};
 			let ajaxData = Object.assign(this.params, obj);
+			this.submitLoading = true;
 			insert(ajaxData).then(res => {
 				if (res.status == 200) {
-					this.goShare();
+					this.submitLoading = true;
+					this.shareShow = true;
+				} else {
+					uni.showToast({
+						title: res.message,
+						icon: 'none'
+					});
 				}
 			});
 		},
@@ -390,15 +423,29 @@ export default {
 			this.allChecked = isAllChecked;
 		},
 		// 分享图文
-		goShare() {
-			uni.shareWithSystem({
-				summary: '',
-				href: '',
-				success() {
-					// 分享完成,请注意此时不一定是成功分享
+		handleShare(){
+			let obj = {
+				endTime: this.params.bizEndDate,
+				startTime: this.params.bizBeginDate,
+				customerSn: this.customerObj.customerSn,
+				customerName: this.customerObj.customerName,
+				userName:this.userData.orgName,
+				userSn:this.userData.orgSn
+			};
+			let url = '/hybrid/html/index.html?data=' + JSON.stringify(obj);
+			uni.share({
+				provider: 'weixin',
+				scene: 'WXSceneSession',
+				type: 0,
+				href: url,
+				title: this.customerObj.customerName,
+				summary: '共' + this.settlement + '元,请您查阅',
+				imageUrl: '../../static/logo.png',
+				success: function(res) {
+					console.log('success:' + JSON.stringify(res));
 				},
-				fail() {
-					// 分享失败
+				fail: function(err) {
+					console.log('fail:' + JSON.stringify(err));
 				}
 			});
 		}
@@ -417,7 +464,7 @@ export default {
 			box-sizing: border-box;
 			padding: 16rpx 20rpx;
 			background: #fff;
-			&:last-child {
+			&:nth-child(2) {
 				border-top: 1rpx solid #e4e7ed;
 			}
 			.list_l {
@@ -433,33 +480,37 @@ export default {
 				width: calc(100% - 208rpx);
 			}
 		}
-	}
-	.statistical {
-		padding: 20rpx;
-		background: #fff;
-		margin: 10rpx 0;
-		.statisticalList {
-			&:first-child {
-				width: 210rpx;
+		
+		.statistical {
+			padding: 20rpx;
+			background: #fff;
+			margin: 10rpx 0;
+			.statisticalList {
+				&:first-child {
+					width: 210rpx;
+				}
 			}
-		}
-		text {
-			&:last-child {
-				color: $uni-color-warning;
-				font-weight: 600;
+			text {
+				&:last-child {
+					color: $uni-color-warning;
+					font-weight: 600;
+				}
 			}
 		}
 	}
+	
 	.chooseCon {
 		flex-grow: 1;
+		flex-basis:0;
 		overflow: auto;
 		background-color: #fff;
 	}
-	.footer {
+	.footerCon {
 		background-color: #f8f8f8;
-		padding: 10rpx 20rpx;
+		padding:10rpx 20rpx;
+		box-sizing: border-box;
 		.f-mid {
-			flex-grow: 1;
+			flex:1;
 			color: #666;
 			font-size: 0.8rem;
 			> view {
@@ -568,5 +619,11 @@ export default {
 			}
 		}
 	}
+	.slot-content {
+		font-size: 28rpx;
+		color: $u-content-color;
+		padding:60rpx 30rpx;
+		text-align: center;
+	}
 }
 </style>

+ 2 - 1
pages/sales/billHistoryDetail.vue

@@ -41,7 +41,7 @@
 			</view>
 		</view>
 		<view class="detail_con">
-			<billList :list="billList"></billList>
+			<billList ref="billInfo" :list="billList" ></billList>
 		</view>
 		<view class="footer">
 			<u-button type="primary" :custom-style="customStyle" shape="circle">再次发送对账单</u-button>
@@ -87,6 +87,7 @@ export default {
 					this.billList=res.data.detailList;
 					let timeobj=getDate.editDay(res.data.bizBeginDate,res.data.bizEndDate);
 					this.timeInfo= timeobj.starttime +'~'+timeobj.endtime
+					this.$refs.billInfo.setData(res.data.detailList);
 				}
 			});
 		},

+ 3 - 2
pages/sales/billListComponent.vue

@@ -21,7 +21,7 @@
 				</view>
 			</view>
 		</view>
-		<view v-if="listData&&listData.length==0">
+		<view v-if="listData&&listData.length==0" @click="jumpPage('/pages/test')">
 			<u-empty :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="180" :text="noDataText" mode="list" :margin-top="50"></u-empty>
 		</view>
 	</view>
@@ -81,8 +81,9 @@ export default {
 };
 </script>
 
-<style lang="less">
+<style lang="scss" scoped>
 .bill-list-component {
+	height: 100%;
 	.chooseList {
 		padding: 30rpx 20rpx;
 		border-bottom: 1rpx solid #e4e7ed;

+ 14 - 2
pages/sales/chooseCustomerBill.vue

@@ -139,19 +139,27 @@ export default {
 				let obj=result.find(item=>{return item.remarks == 'verify_default_customer'})
 				if(obj.paramValue == 'all'){
 					this.params.allCustomerFlag = 1;
+					this.refreshList();
 				}else if(obj.paramValue == 'month'){
 					this.showType = true
 				}else{
 					this.showType = false
 				}
-				this.momentTime(0)
+				if(this.params.allCustomerFlag != 1){
+					this.momentTime(0)
+				}
 				//获取系统对账周期设置
 				this.$store.state.vuex_systemSetList = result
 			});
 		},
 		changeTabs(index) {
 			this.params.allCustomerFlag = index;
-			this.$refs.customer.getList(1);
+			if(index==1){
+				this.clearTime();
+				this.$refs.customer.getList(1);
+			}else{
+				this.momentTime(0)
+			}
 		},
 		handleDate(i) {
 			this.chooseNum = i;
@@ -194,6 +202,10 @@ export default {
 			this.$nextTick(()=>{
 				_this.$refs.customer.getList(1);
 			})
+		},
+		clearTime(){
+			this.params.bizBeginDate = undefined;
+			this.params.bizEndDate = undefined;
 		}
 	}
 };

BIN
static/logo.png


Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels