chenrui %!s(int64=2) %!d(string=hai) anos
pai
achega
fe40bfd27a
Modificáronse 5 ficheiros con 412 adicións e 342 borrados
  1. 1 0
      hybrid/html/css/common.css
  2. 288 275
      hybrid/html/index.html
  3. 22 4
      hybrid/html/js/resize.js
  4. 45 38
      pages/sales/bill.vue
  5. 56 25
      pages/sales/billHistoryDetail.vue

+ 1 - 0
hybrid/html/css/common.css

@@ -2,6 +2,7 @@
     margin:0;
     padding:0;
     font-size: 14px;
+	
 }
 .flex{
     display: -webkit-flex; 

+ 288 - 275
hybrid/html/index.html

@@ -1,308 +1,321 @@
 <!DOCTYPE html>
 <html lang="en">
 
-<head>
-    <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>{{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>
-        .content {
-            width: 100%;
-            height: 100vh;
-            background: #f3f3f3;
-        }
+	<head>
+		<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>
+		<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>
+			[v-cloak] {
+				display: none
+			}
 
-        .head {
-            /* 头部 */
-            background: #848484;
-            padding: .3rem .2rem 1rem;
-            box-sizing: border-box;
-            color: #fff;
-            position: relative;
-        }
+			.content {
+				width: 100%;
+				height: 100vh;
+				background: #f3f3f3;
+			}
 
-        .shareTime {
-            font-size: .12rem;
-            text-align: center;
-            margin-bottom: .2rem;
-        }
+			.head {
+				/* 头部 */
+				background: #848484;
+				padding: .3rem .3rem 1rem;
+				box-sizing: border-box;
+				color: #fff;
+				position: relative;
+			}
 
-        .tip {
-            font-weight: bold;
-        }
+			.shareTime {
+				text-align: center;
+				margin-bottom: .2rem;
+			}
 
-        .tipDesc {
-            font-weight: bold;
-            font-size: .12rem;
-            line-height: .5rem;
-        }
+			.tip {
+				font-weight: bold;
+			}
 
-        .orderInfo {
-            background: #fff;
-            box-sizing: border-box;
-            padding: .2rem;
-            width: calc(100% - .4rem);
-            border-radius: .3rem;
-            overflow: hidden;
-            position: absolute;
-            bottom: -1.1rem;
-            left: .2rem;
-            color: #333;
-        }
+			.tipDesc {
+				font-weight: bold;
+				font-size: .24rem;
+				line-height: .5rem;
+			}
 
-        .downLoadTip,
-        .downLoadUrl {
-            max-width: 83%;
-            font-size: .12rem;
-            word-wrap: break-word;
-            white-space: normal;
-            word-break: break-all;
-        }
+			.orderInfo {
+				background: #fff;
+				box-sizing: border-box;
+				padding: .2rem;
+				width: calc(100% - .4rem);
+				border-radius: .3rem;
+				overflow: hidden;
+				position: absolute;
+				bottom: -1.1rem;
+				left: .2rem;
+				color: #333;
+			}
 
-        .downLoadTip {
-            margin-top: .2rem;
-            line-height: .4rem;
-            color: #999;
-        }
+			.downLoadTip,
+			.downLoadUrl {
+				max-width: 83%;
+				font-size: .25rem;
+				word-wrap: break-word;
+				white-space: normal;
+				word-break: break-all;
+			}
 
-        .downLoadUrl {
-            color: #007aff;
-        }
+			.downLoadTip {
+				margin-top: .2rem;
+				line-height: .4rem;
+				color: #999;
+			}
 
-        .amount {
-            color: #f0ad4e;
-            font-weight: bold;
-        }
+			.downLoadUrl {
+				color: #007aff;
+			}
 
-        .handleOrder {
-            color: #999;
-            padding: 1.3rem .2rem .2rem;
-            font-size: .12rem;
-        }
+			.amount {
+				color: #f0ad4e;
+				font-weight: bold;
+			}
 
-        .handleOrder span:last-child {
-            color: #007aff;
-        }
+			.handleOrder {
+				color: #999;
+				padding: 1.3rem .2rem .2rem;
+			}
 
-        /* 滚动盒子 */
-        .oederBox {
-            flex-grow: 1;
-            overflow: auto;
-        }
+			.handleOrder span:last-child {
+				color: #007aff;
+			}
 
-        .oederList {
-            background: #fff;
-            border-bottom: .01rem solid #e0e0e0;
-            padding: .2rem;
-            box-sizing: border-box;
-        }
+			/* 滚动盒子 */
+			.oederBox {
+				flex-grow: 1;
+				overflow: auto;
+			}
 
-        .order-l {
-            flex: 1;
-        }
+			.oederList {
+				background: #fff;
+				border-bottom: .01rem solid #e0e0e0;
+				padding: .2rem;
+				box-sizing: border-box;
+			}
 
-        .order-t,
-        .order-b {
-            font-size: .12rem;
-            color: #999;
-        }
+			.order-l {
+				flex: 1;
+			}
 
-        .order-t span:first-child {
-            color: #333;
-        }
+			.order-t,
+			.order-b {
+				font-size: .12rem;
+				color: #999;
+			}
 
-        .order-b,
-        .list-b {
-            line-height: .5rem;
-        }
+			.order-t span:first-child {
+				color: #333;
+			}
 
-        .order-b span {
-            color: #f0ad4e;
-            vertical-align: middle;
-        }
+			.order-b,
+			.list-b {
+				line-height: .5rem;
+			}
 
-        .order-r img {
-            width: .5rem;
-            height: .5rem;
-            border-radius: 50%;
-            object-fit: contain;
-            margin-left: .2rem;
-        }
+			.order-b span {
+				color: #f0ad4e;
+				vertical-align: middle;
+			}
+
+			.order-r img {
+				width: .5rem;
+				height: .5rem;
+				border-radius: 50%;
+				object-fit: contain;
+				margin-left: .2rem;
+			}
 
-        /* 折叠列表 */
-        .otherList {
-            width: 100%;
-            box-sizing: border-box;
-            padding-left: .4rem;
-            background-color: #fff;
-        }
+			/* 折叠列表 */
+			.otherList {
+				width: 100%;
+				box-sizing: border-box;
+				padding-left: .4rem;
+				background-color: #fff;
+			}
 
-        .list {
-            box-sizing: border-box;
-            padding: .2rem;
-            border-bottom: .01rem solid #e0e0e0;
-            font-size: .12rem;
-        }
+			.list {
+				box-sizing: border-box;
+				padding: .2rem;
+				border-bottom: .01rem solid #e0e0e0;
+				font-size: .12rem;
+			}
 
-        .list:last-child {
-            border-bottom: 0 solid #e0e0e0;
-        }
+			.list:last-child {
+				border-bottom: 0 solid #e0e0e0;
+			}
 
-        .list-b div:first-child {
-            text-overflow: ellipsis;
-            overflow: hidden;
-            white-space: nowrap;
-            width: 70%;
-        }
+			.list-b div:first-child {
+				text-overflow: ellipsis;
+				overflow: hidden;
+				white-space: nowrap;
+				width: 70%;
+			}
 
-        .list-b {
-            color: #999;
-        }
-    </style>
-</head>
+			.list-b {
+				color: #999;
+			}
+		</style>
+	</head>
 
-<body>
-    <div id="app" class="content flex flex-column">
-        <div class="head">
-            <div class="shareTime">
-                分享时间:2022-11-15 09:59:29
-            </div>
-            <div class="tip">
-                尊敬的“{{customerName}}”,您好!
-            </div>
-            <div class="tipDesc">
-                以下是您2022-11-01至2022-11-30在本店的对账单,请查阅。
-            </div>
-            <div class="orderInfo">
-                <div class="flex align_center flex-between">
-                    <span>欠款金额</span>
-                    <span class="amount">¥160.00</span>
-                </div>
-                <div class="downLoadTip">
-                    单据明细Excel下载请点击下面的链接:
-                </div>
-                <div class="downLoadUrl" @click="downLoad">
-                    http://iscm.360arrow.com/bill/202211150004.xls
-                </div>
-            </div>
-        </div>
-        <div class="orderCon flex flex-column">
-            <div class="handleOrder flex flex-between align_center">
-                <span>共{{saleList.length}}个销售单</span>
-                <span>全部展开</span>
-            </div>
-            <div class="oederBox">
-                <div class="oederList flex align_center" v-for="(item,i) in saleList" :key="item.bizSn">
-                    <div class="order-l">
-                        <div class="order-t flex align_center flex-between">
-                            <span>{{item.bizDate.substr(0,10)}}</span>
-                            <span>{{item.bizNo}}</span>
-                        </div>
-                        <div class="order-b  flex align_center flex-between">
-                            <div>应付:¥{{item.bizAmount ||0}}</div>
-                            <div>已付:¥{{item.settledAmount | 0}}</div>
-                            <div>欠款:<span>¥{{item.unsettleAmount|| 0}}</span></div>
-                        </div>
-                    </div>
-                    <div class="order-r" @click="handleShow">
-                        <img src="./img/close.png" alt="" v-if="!isShow">
-                        <img src="./img/open.png" alt="" v-else>
-                    </div>
-                </div>
-                <div class="otherList" v-if="isShow">
-                    <div class="list">
-                        <div class="list-t flex align_center flex-between">
-                            <span>JA-11070N</span>
-                            <span>¥40.00</span>
-                        </div>
-                        <div class="list-b flex align_center flex-between">
-                            <div>箭牌空气滤清器 07款丰田新皇冠207款丰田新皇冠2.5 / 3.0车用</div>
-                            <div>x2</div>
-                        </div>
-                    </div>
-                    <div class="list">
-                        <div class="list-t flex align_center flex-between">
-                            <span>JA-11070N</span>
-                            <span>¥40.00</span>
-                        </div>
-                        <div class="list-b flex align_center flex-between">
-                            <div>箭牌空气滤清器 07款丰田新皇冠2.5 / 3.0车用</div>
-                            <div>x2</div>
-                        </div>
-                    </div>
-                </div>
-            </div>
-        </div>
-    </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',
-        },
-		created() {
-			// 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);
-				});
+	<body>
+		<div id="app" class="content flex flex-column">
+			<div class="head">
+				<div class="shareTime">
+					分享时间:{{info.createDate}}
+				</div>
+				<div class="tip" v-if="info.customer">
+					尊敬的“{{info.customer.customerName || '--'}}”,您好!
+				</div>
+				<div class="tipDesc">
+					以下是您{{time}}在本店的对账单,请查阅。
+				</div>
+				<div class="orderInfo">
+					<div class="flex align_center flex-between">
+						<span>欠款金额</span>
+						<span class="amount" v-if="info.totalAmount">¥{{toThousands(info.totalAmount,2)}}</span>
+						<span class="amount" v-else>¥0</span>
+					</div>
+					<div class="downLoadTip">
+						单据明细Excel下载请点击下面的链接:
+					</div>
+					<div class="downLoadUrl" @click="downLoad">
+						http://iscm.360arrow.com/bill/对账单明细.xls
+					</div>
+				</div>
+			</div>
+			<div class="orderCon flex flex-column">
+				<div class="handleOrder flex flex-between align_center">
+					<span>共{{saleList ? saleList.length : 0}}个销售单</span>
+					<span>全部展开</span>
+				</div>
+				<div class="oederBox">
+					<div v-for="(item,i) in saleList" :key="item.bizSn">
+						<div class="oederList flex align_center" @click="handleShow(item,i)">
+							<div class="order-l">
+								<div class="order-t flex align_center flex-between">
+									<span>{{item.bizDate.substr(0,10)}}</span>
+									<span>{{item.bizNo}}</span>
+								</div>
+								<div class="order-b  flex align_center flex-between">
+									<div>应付:¥{{item.bizAmount ||0}}</div>
+									<div>已付:¥{{item.settledAmount | 0}}</div>
+									<div>
+										欠款:<span>¥{{item.unsettleAmount ? toThousands(item.unsettleAmount,2): 0}}</span>
+									</div>
+								</div>
+							</div>
+							<div class="order-r">
+								<img src="./img/close.png" alt="" v-if="!item.isShow">
+								<img src="./img/open.png" alt="" v-else>
+							</div>
+						</div>
+						<div class="otherList" v-show="item.isShow">
+							<div class="list" v-for="(con,j) in saleDetailList" :key="con.id">
+								<div class="list-t flex align_center flex-between">
+									<span>{{con.dealerProductEntity.code}}</span>
+									<span>¥{{con.price?toThousands(con.price,2):0}}</span>
+								</div>
+								<div class="list-b flex align_center flex-between">
+									<div>
+										{{con.dealerProductEntity.productBrandName}}{{con.dealerProductEntity.productTypeName3}}
+									</div>
+									<div>x{{con.qty}}</div>
+								</div>
+							</div>
+						</div>
+					</div>
+				</div>
+			</div>
+		</div>
+	</body>
+	<script>
+		new Vue({
+			el: '#app',
+			data: {
+				ajaxUrl: 'http://192.168.0.215:8503/qpls-md/',
+				saleList: [],
+				saleDetailList: [],
+				info: {},
+				time: ''
 			},
-            handleShow(){
-                this.isShow = !this.isShow
-            },
-			getUrlParam(name){
-				var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
-				var r = window.location.search.substr(1).match(reg);  //匹配目标参数
-				if (r!=null) return unescape(r[2]); return null; //返回参数值
+			created() {
+				this.loadData();
+				document.title = this.getUrlParam('name');
 			},
-			downLoad(){
-				let ajaxData={
-					targetSn: this.customerSn,
-					bizBeginDate: this.startTime,
-					bizEndDate: this.endTime,
-					dealerSn:"3429"
+			methods: {
+				loadData() {
+					let ajaxData = {
+						verifySn: this.getUrlParam('verifySn'),
+						dealerSn: this.getUrlParam('userSn')
+					}
+					axios.post(this.ajaxUrl + 'verify/findBySn', ajaxData).then((res) => {
+						this.info = res.data.data;
+						res.data.data.detailList.forEach(item=>{
+							item.isShow  = false;
+						})
+						this.saleList = res.data.data.detailList;
+						if (res.data.data.bizBeginDate && res.data.data.bizEndDate) {
+							this.time = res.data.data.bizBeginDate.split(' ')[0] + '至' + res.data.data
+								.bizEndDate.split(' ')[0]
+						}
+					}).catch((error) => {
+						console.log(error);
+					});
+				},
+				handleShow(con , i) {
+					let req_data = {
+						salesBillSn: con.bizSn
+					}
+					axios.post(this.ajaxUrl + 'salesDetail/queryList', req_data).then((res) => {
+						this.saleDetailList = res.data.data;
+						this.saleList[i].isShow = !this.saleList[i].isShow ;
+					}).catch((error) => {
+						console.log(error);
+					});
+					
+				},
+				downLoad() {
+					let ajaxData = {
+						targetSn: this.customerSn,
+						bizBeginDate: this.startTime,
+						bizEndDate: this.endTime,
+						dealerSn: this.getUrlParam(userSn)
+					}
+					axios.get(this.ajaxUrl + 'verify/exportExcel', {
+						params: ajaxData
+					}, {
+						responseType: 'blob',
+						dataType: "jsonp",
+						jsonp: "callback"
+					}).then((res) => {
+						if (res.status == 200) {
+							downloadExcel(res.data, '对账单明细')
+						}
+					}).catch((error) => {
+						console.log(error);
+					});
+
+				},
+				getUrlParam(name) {
+					var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
+					var r = window.location.search.substr(1).match(reg); //匹配目标参数
+					if (r != null) return unescape(r[2]);
+					return null; //返回参数值
 				}
-				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>
+		})
+	</script>
 
-</html>
+</html>

+ 22 - 4
hybrid/html/js/resize.js

@@ -26,16 +26,12 @@ function  downloadExcel(data, fileName) {
   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)
@@ -44,3 +40,25 @@ function  downloadExcel(data, fileName) {
     window.URL.revokeObjectURL(href) // 释放掉blob对象
   }
 }
+
+function toThousands (num, decimal) {
+  if (decimal) {
+    num = formatDecimal(num, decimal)
+  }
+  return num.toString().replace(/\d+/, function (n) { // 先提取整数部分
+    return n.replace(/(\d)(?=(\d{3})+$)/g, function ($1) {
+      return $1 + ','
+    })
+  })
+}
+
+function formatDecimal (num, decimal) {
+  num = num.toString()
+  const index = num.indexOf('.')
+  if (index !== -1) {
+    num = num.substring(0, decimal + index + 1)
+  } else {
+    num = num.substring(0)
+  }
+  return parseFloat(num).toFixed(decimal)
+}

+ 45 - 38
pages/sales/bill.vue

@@ -134,7 +134,7 @@ export default {
 			tipShow: false,
 			discountVal: null, //折让金额
 			tipContent: `账单周期指<br>销售单的创建时间`,
-			shareContent:`是否同意发送对账单给微信好友?`,
+			shareContent: `是否同意发送对账单给微信好友?`,
 			placeTab: [
 				{
 					name: '今日',
@@ -191,7 +191,8 @@ export default {
 			chooseList: [],
 			isDetailShow: false,
 			submitLoading: false,
-			shareShow: false
+			shareShow: false,
+			verifySn:''
 		};
 	},
 	onReady() {
@@ -242,7 +243,7 @@ export default {
 	},
 	computed: {
 		//经销商信息
-		userData(){
+		userData() {
 			return this.$store.state.vuex_userData;
 		},
 		totalPayPrice() {
@@ -307,8 +308,8 @@ export default {
 					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;
+							const row = chooseArr.findIndex(k => k.bizSn == item.bizSn);
+							item.checked = row > -1;
 						});
 					}
 					this.$refs.bill.setData(res.data);
@@ -383,7 +384,7 @@ export default {
 			let obj = {
 				detailNum: this.chooseList.length,
 				totalAmount: this.chooseTotalPayPrice,
-				discountAmount: this.discountVal,
+				discountAmount: this.discountVal || 0,
 				settleAmount: this.settlement,
 				detailList: this.chooseList
 			};
@@ -391,8 +392,9 @@ export default {
 			this.submitLoading = true;
 			insert(ajaxData).then(res => {
 				if (res.status == 200) {
-					this.submitLoading = true;
+					this.submitLoading = false;
 					this.shareShow = true;
+					this.verifySn  = res.data.verifySn
 				} else {
 					uni.showToast({
 						title: res.message,
@@ -423,31 +425,36 @@ export default {
 			this.allChecked = isAllChecked;
 		},
 		// 分享图文
-		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: function(err) {
-					console.log('fail:' + JSON.stringify(err));
-				}
-			});
+		handleShare() {
+			let url = 'http://p.iscm.360arrow.com/dzd/index.html?userSn=' + this.userData.orgSn + '&verifySn='+this.verifySn + '&name='+this.userData.orgName;
+			if (uni.getSystemInfoSync().platform == 'ios') {
+				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: function(err) {
+						console.log('fail:' + JSON.stringify(err));
+					}
+				});
+			} else {
+				uni.shareWithSystem({
+					summary: this.customerObj.customerName + '您好,您有一个对账单共' + this.settlement + '元,请您查阅',
+					href: url,
+					success() {
+						console.log('调取微信列表成功,分享不一定成功')
+					},
+					fail() {
+						console.log('分享失败')
+					}
+				});
+			}
 		}
 	}
 };
@@ -480,7 +487,7 @@ export default {
 				width: calc(100% - 208rpx);
 			}
 		}
-		
+
 		.statistical {
 			padding: 20rpx;
 			background: #fff;
@@ -498,19 +505,19 @@ export default {
 			}
 		}
 	}
-	
+
 	.chooseCon {
 		flex-grow: 1;
-		flex-basis:0;
+		flex-basis: 0;
 		overflow: auto;
 		background-color: #fff;
 	}
 	.footerCon {
 		background-color: #f8f8f8;
-		padding:10rpx 20rpx;
+		padding: 10rpx 20rpx;
 		box-sizing: border-box;
 		.f-mid {
-			flex:1;
+			flex: 1;
 			color: #666;
 			font-size: 0.8rem;
 			> view {
@@ -622,7 +629,7 @@ export default {
 	.slot-content {
 		font-size: 28rpx;
 		color: $u-content-color;
-		padding:60rpx 30rpx;
+		padding: 60rpx 30rpx;
 		text-align: center;
 	}
 }

+ 56 - 25
pages/sales/billHistoryDetail.vue

@@ -5,7 +5,7 @@
 				<text>分享时间</text>
 				<text>{{billInfo.createDate}}</text>
 			</view>
-			<view class="head_list" v-if="billList.customer">
+			<view class="head_list" v-if="billArr.customer">
 				<text>客户名称</text>
 				<text>{{billInfo.customer.customerName}}</text>
 			</view>
@@ -41,11 +41,13 @@
 			</view>
 		</view>
 		<view class="detail_con">
-			<billList ref="billInfo" :list="billList" ></billList>
+			<billList ref="billBox" :list="billArr" ></billList>
 		</view>
-		<view class="footer">
-			<u-button type="primary" :custom-style="customStyle" shape="circle">再次发送对账单</u-button>
+		<view class="footer" v-if="billInfo.billStatus != 'UNSETTLE'">
+			<u-button type="primary" :loading="btnLoading" @click="submitOrder" :custom-style="customStyle" shape="circle">再次发送对账单</u-button>
 		</view>
+		<!-- 分享询问弹窗 -->
+		<u-modal v-model="shareShow" :content="shareContent" @confirm="handleShare" @cancel="shareShow = false"></u-modal>
 	</view>
 </template>
 
@@ -63,8 +65,10 @@ export default {
 				verifySn:''
 			},
 			billInfo:null,
-			billList:[],
-			timeInfo:''
+			billArr:[],
+			timeInfo:'',
+			btnLoading:false,
+			shareShow:false
 		};
 	},
 	onReady() {
@@ -79,35 +83,62 @@ export default {
 			this.loadData({verifySn:options.billId})
 		}
 	},
+	computed: {
+		//经销商信息
+		userData() {
+			return this.$store.state.vuex_userData;
+		}
+		},
 	methods:{
 		loadData(ajaxData){
+			let that=this
 			findBySn(ajaxData).then(res => {
 				if (res.status == 200) {
-					this.billInfo=res.data;
-					this.billList=res.data.detailList;
+					that.billInfo=res.data;
+					that.billArr=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);
+					that.timeInfo= timeobj.starttime +'~'+timeobj.endtime
+					that.$nextTick(()=>{
+						that.$refs.billBox.setData(res.data.detailList);
+					})
 				}
 			});
 		},
 		submitOrder(){//发送对账单
-			let ajaxData={
-				detailNum:this.billInfo.detailNum,
-				totalAmount:this.billInfo.totalAmount,
-				discountAmount:this.billInfo.discountAmount,
-				settleAmount:this.billInfo.settleAmount,
-				detailList:this.billList,
-				targetSn: this.billInfo.customer.customerSn,
-				bizBeginDate: this.billInfo.bizBeginDate,
-				bizEndDate: this.billInfo.bizEndDate
-			}
-			insert(ajaxData).then(res => {
-				if (res.status == 200) {
-					//去分享
-				}
-			});
+			this.shareShow = true;
 		},
+		// 分享图文
+		handleShare(){
+			let url = 'http://p.iscm.360arrow.com/dzd/index.html?userSn=' + this.userData.orgSn + '&verifySn='+this.verifySn + '&name='+this.userData.orgName;
+			if (uni.getSystemInfoSync().platform == 'ios') {
+				uni.share({
+					provider: 'weixin',
+					scene: 'WXSceneSession',
+					type: 0,
+					href: url,
+					title: this.billInfo.customer.customerName,
+					summary: '共' + this.billInfo.settleAmount + '元,请您查阅',
+					imageUrl: '../../static/logo.png',
+					success: function(res) {
+						console.log('success:' + JSON.stringify(res));
+					},
+					fail: function(err) {
+						console.log('fail:' + JSON.stringify(err));
+					}
+				});
+			} else {
+				uni.shareWithSystem({
+					summary: this.billInfo.customer.customerName + '您好,您有一个对账单共' + this.billInfo.settleAmount + '元,请您查阅',
+					href: url,
+					success() {
+						console.log('调取微信列表成功,分享不一定成功')
+					},
+					fail() {
+						console.log('分享失败')
+					}
+				});
+			}
+		}
 	}
 };
 </script>