|  |  | @ -35,6 +35,7 @@ Page({ | 
			
		
	
		
			
				
					|  |  |  |     pay_xs: true, | 
			
		
	
		
			
				
					|  |  |  |     pages_sx: true, | 
			
		
	
		
			
				
					|  |  |  |     dz_stu: false, | 
			
		
	
		
			
				
					|  |  |  |     productAry: '', | 
			
		
	
		
			
				
					|  |  |  |   }, | 
			
		
	
		
			
				
					|  |  |  |   go: function (e) { | 
			
		
	
		
			
				
					|  |  |  |     console.log(e); | 
			
		
	
	
		
			
				
					|  |  | @ -96,8 +97,6 @@ Page({ | 
			
		
	
		
			
				
					|  |  |  |       wallet: wallet, // 钱包状态
 | 
			
		
	
		
			
				
					|  |  |  |     }); | 
			
		
	
		
			
				
					|  |  |  |     this.Settlement(options); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |   }, | 
			
		
	
		
			
				
					|  |  |  |   //页面加载完成函数
 | 
			
		
	
		
			
				
					|  |  |  |   onReady: function () { | 
			
		
	
	
		
			
				
					|  |  | @ -185,7 +184,15 @@ Page({ | 
			
		
	
		
			
				
					|  |  |  |         if (that.data.d_yuan) { | 
			
		
	
		
			
				
					|  |  |  |           data.coupon_money = Number(data.coupon_money) - Number(that.data.user_money); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         var pays = [] | 
			
		
	
		
			
				
					|  |  |  |         if (data.payment.bank_pay == 1) { | 
			
		
	
		
			
				
					|  |  |  |           pays.push({'name':'银行转账','icon':'/images/order_success.png'}) | 
			
		
	
		
			
				
					|  |  |  |         }  | 
			
		
	
		
			
				
					|  |  |  |         // if (data.payment.wallet_pay == 1) {
 | 
			
		
	
		
			
				
					|  |  |  |         //   pays.push({'name':'余额支付','icon':'/images/wx.png'})
 | 
			
		
	
		
			
				
					|  |  |  |         // }
 | 
			
		
	
		
			
				
					|  |  |  |         that.setData({ | 
			
		
	
		
			
				
					|  |  |  |           productAry: options.product, | 
			
		
	
		
			
				
					|  |  |  |           addemt: data.addemt, // 是否有收货地址
 | 
			
		
	
		
			
				
					|  |  |  |           address: data.address, // 收货地址
 | 
			
		
	
		
			
				
					|  |  |  |           addrId: data.address.id ? data.address.id : '', // 收货地址id
 | 
			
		
	
	
		
			
				
					|  |  | @ -199,7 +206,8 @@ Page({ | 
			
		
	
		
			
				
					|  |  |  |           scorebuy: data.grade_rate_amount, //积分消费规则
 | 
			
		
	
		
			
				
					|  |  |  |           zhekou: data.preferential_amount ? data.preferential_amount : '', //会员折扣
 | 
			
		
	
		
			
				
					|  |  |  |           freight: data.freight ? data.freight : 0, //运费
 | 
			
		
	
		
			
				
					|  |  |  |           remind: false | 
			
		
	
		
			
				
					|  |  |  |           remind: false, | 
			
		
	
		
			
				
					|  |  |  |           pays: pays, | 
			
		
	
		
			
				
					|  |  |  |         }); | 
			
		
	
		
			
				
					|  |  |  |       } else { | 
			
		
	
		
			
				
					|  |  |  |         that.setData({ | 
			
		
	
	
		
			
				
					|  |  | @ -421,92 +429,91 @@ Page({ | 
			
		
	
		
			
				
					|  |  |  |   // 提交订单支付
 | 
			
		
	
		
			
				
					|  |  |  |   createProductOrderByWX: function (e) { | 
			
		
	
		
			
				
					|  |  |  |     var that = this; | 
			
		
	
		
			
				
					|  |  |  |     if (this.data.ispayOrder) { | 
			
		
	
		
			
				
					|  |  |  |       return | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |     this.setData({ | 
			
		
	
		
			
				
					|  |  |  |       ispayOrder: true | 
			
		
	
		
			
				
					|  |  |  |     }) | 
			
		
	
		
			
				
					|  |  |  |     // if (that.data.ispayOrder) {
 | 
			
		
	
		
			
				
					|  |  |  |     //   return
 | 
			
		
	
		
			
				
					|  |  |  |     // }
 | 
			
		
	
		
			
				
					|  |  |  |     // that.setData({
 | 
			
		
	
		
			
				
					|  |  |  |     //   ispayOrder: true
 | 
			
		
	
		
			
				
					|  |  |  |     // })
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     var paytype = that.data.paytype; | 
			
		
	
		
			
				
					|  |  |  |     if (paytype) { | 
			
		
	
		
			
				
					|  |  |  |       that.setData({ | 
			
		
	
		
			
				
					|  |  |  |         paytype: paytype, | 
			
		
	
		
			
				
					|  |  |  |       }); | 
			
		
	
		
			
				
					|  |  |  |     } else { | 
			
		
	
		
			
				
					|  |  |  |       wx.showToast({ | 
			
		
	
		
			
				
					|  |  |  |         title: '已为您选择默认支付方式', | 
			
		
	
		
			
				
					|  |  |  |         icon: 'none', | 
			
		
	
		
			
				
					|  |  |  |         duration: 2000, | 
			
		
	
		
			
				
					|  |  |  |       }); | 
			
		
	
		
			
				
					|  |  |  |       //当都没有选中时 循环找到默认的支付方式 在设置支付方式数据
 | 
			
		
	
		
			
				
					|  |  |  |       var pays = that.data.pays, | 
			
		
	
		
			
				
					|  |  |  |         j = 0; | 
			
		
	
		
			
				
					|  |  |  |       for (j = 0; j < pays.length; j++) { | 
			
		
	
		
			
				
					|  |  |  |         if (pays[j].value == 'wxPay') { | 
			
		
	
		
			
				
					|  |  |  |           pays[j].checked = true; | 
			
		
	
		
			
				
					|  |  |  |         } else { | 
			
		
	
		
			
				
					|  |  |  |           pays[j].checked = false; | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |       } | 
			
		
	
		
			
				
					|  |  |  |     // var paytype = that.data.paytype;
 | 
			
		
	
		
			
				
					|  |  |  |     // if (paytype) {
 | 
			
		
	
		
			
				
					|  |  |  |     //   that.setData({
 | 
			
		
	
		
			
				
					|  |  |  |     //     paytype: paytype,
 | 
			
		
	
		
			
				
					|  |  |  |     //   });
 | 
			
		
	
		
			
				
					|  |  |  |     // } else {
 | 
			
		
	
		
			
				
					|  |  |  |     //   wx.showToast({
 | 
			
		
	
		
			
				
					|  |  |  |     //     title: '已为您选择默认支付方式',
 | 
			
		
	
		
			
				
					|  |  |  |     //     icon: 'none',
 | 
			
		
	
		
			
				
					|  |  |  |     //     duration: 2000,
 | 
			
		
	
		
			
				
					|  |  |  |     //   });
 | 
			
		
	
		
			
				
					|  |  |  |     //   //当都没有选中时 循环找到默认的支付方式 在设置支付方式数据
 | 
			
		
	
		
			
				
					|  |  |  |     //   var pays = that.data.pays,
 | 
			
		
	
		
			
				
					|  |  |  |     //     j = 0;
 | 
			
		
	
		
			
				
					|  |  |  |     //   for (j = 0; j < pays.length; j++) {
 | 
			
		
	
		
			
				
					|  |  |  |     //     if (pays[j].value == 'wxPay') {
 | 
			
		
	
		
			
				
					|  |  |  |     //       pays[j].checked = true;
 | 
			
		
	
		
			
				
					|  |  |  |     //     } else {
 | 
			
		
	
		
			
				
					|  |  |  |     //       pays[j].checked = false;
 | 
			
		
	
		
			
				
					|  |  |  |     //     }
 | 
			
		
	
		
			
				
					|  |  |  |     //   }
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |       that.setData({ | 
			
		
	
		
			
				
					|  |  |  |         pays: pays, | 
			
		
	
		
			
				
					|  |  |  |         paytype: 'wxPay', | 
			
		
	
		
			
				
					|  |  |  |       }); | 
			
		
	
		
			
				
					|  |  |  |     //   that.setData({
 | 
			
		
	
		
			
				
					|  |  |  |     //     pays: pays,
 | 
			
		
	
		
			
				
					|  |  |  |     //     paytype: 'wxPay',
 | 
			
		
	
		
			
				
					|  |  |  |     //   });
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |       paytype = 'wxPay'; | 
			
		
	
		
			
				
					|  |  |  |       return; | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |     that.setData({ | 
			
		
	
		
			
				
					|  |  |  |       form_id: e.detail.formId, | 
			
		
	
		
			
				
					|  |  |  |     }); | 
			
		
	
		
			
				
					|  |  |  |     var address = e.detail.value.address; | 
			
		
	
		
			
				
					|  |  |  |     //   paytype = 'wxPay';
 | 
			
		
	
		
			
				
					|  |  |  |     //   return;
 | 
			
		
	
		
			
				
					|  |  |  |     // }
 | 
			
		
	
		
			
				
					|  |  |  |     // that.setData({
 | 
			
		
	
		
			
				
					|  |  |  |     //   form_id: e.detail.formId,
 | 
			
		
	
		
			
				
					|  |  |  |     // });
 | 
			
		
	
		
			
				
					|  |  |  |     var address = that.data.address; | 
			
		
	
		
			
				
					|  |  |  |     if (address) { | 
			
		
	
		
			
				
					|  |  |  |       // 收货地址存在
 | 
			
		
	
		
			
				
					|  |  |  |       if (paytype == 'wallet_Pay') { | 
			
		
	
		
			
				
					|  |  |  |         if (that.data.pay_xs) { | 
			
		
	
		
			
				
					|  |  |  |           wx.showModal({ | 
			
		
	
		
			
				
					|  |  |  |             title: '余额支付', | 
			
		
	
		
			
				
					|  |  |  |             content: '是否使用余额支付?', | 
			
		
	
		
			
				
					|  |  |  |             success: function (res) { | 
			
		
	
		
			
				
					|  |  |  |               if (res.confirm) { | 
			
		
	
		
			
				
					|  |  |  |                 //组合支付 替换数据
 | 
			
		
	
		
			
				
					|  |  |  |                 that.createProductOrder(); | 
			
		
	
		
			
				
					|  |  |  |                 console.log('用户点击确定'); | 
			
		
	
		
			
				
					|  |  |  |               } else if (res.cancel) { | 
			
		
	
		
			
				
					|  |  |  |                 that.setData({ | 
			
		
	
		
			
				
					|  |  |  |                   ispayOrder: false | 
			
		
	
		
			
				
					|  |  |  |                 }) | 
			
		
	
		
			
				
					|  |  |  |                 wx.hideLoading() | 
			
		
	
		
			
				
					|  |  |  |                 console.log('用户点击取消') | 
			
		
	
		
			
				
					|  |  |  |               } | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |           }) | 
			
		
	
		
			
				
					|  |  |  |         } else { | 
			
		
	
		
			
				
					|  |  |  |           wx.showModal({ | 
			
		
	
		
			
				
					|  |  |  |             title: '订单提交', | 
			
		
	
		
			
				
					|  |  |  |             content: '是否使用消费金支付?', | 
			
		
	
		
			
				
					|  |  |  |             success: function (res) { | 
			
		
	
		
			
				
					|  |  |  |               if (res.confirm) { | 
			
		
	
		
			
				
					|  |  |  |                 //组合支付 替换数据
 | 
			
		
	
		
			
				
					|  |  |  |                 that.createProductOrder(); | 
			
		
	
		
			
				
					|  |  |  |                 console.log('用户点击确定'); | 
			
		
	
		
			
				
					|  |  |  |               } else if (res.cancel) { | 
			
		
	
		
			
				
					|  |  |  |                 this.setData({ | 
			
		
	
		
			
				
					|  |  |  |                   ispayOrder: false | 
			
		
	
		
			
				
					|  |  |  |                 }) | 
			
		
	
		
			
				
					|  |  |  |                 wx.hideLoading() | 
			
		
	
		
			
				
					|  |  |  |                 console.log('用户点击取消') | 
			
		
	
		
			
				
					|  |  |  |               } | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |           }) | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |       } else { | 
			
		
	
		
			
				
					|  |  |  |         that.createProductOrder(); | 
			
		
	
		
			
				
					|  |  |  |       } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |       // // 收货地址存在
 | 
			
		
	
		
			
				
					|  |  |  |       // if (paytype == 'wallet_Pay') {
 | 
			
		
	
		
			
				
					|  |  |  |       //   if (that.data.pay_xs) {
 | 
			
		
	
		
			
				
					|  |  |  |       //     wx.showModal({
 | 
			
		
	
		
			
				
					|  |  |  |       //       title: '余额支付',
 | 
			
		
	
		
			
				
					|  |  |  |       //       content: '是否使用余额支付?',
 | 
			
		
	
		
			
				
					|  |  |  |       //       success: function (res) {
 | 
			
		
	
		
			
				
					|  |  |  |       //         if (res.confirm) {
 | 
			
		
	
		
			
				
					|  |  |  |       //           //组合支付 替换数据
 | 
			
		
	
		
			
				
					|  |  |  |       //           that.createProductOrder();
 | 
			
		
	
		
			
				
					|  |  |  |       //           console.log('用户点击确定');
 | 
			
		
	
		
			
				
					|  |  |  |       //         } else if (res.cancel) {
 | 
			
		
	
		
			
				
					|  |  |  |       //           that.setData({
 | 
			
		
	
		
			
				
					|  |  |  |       //             ispayOrder: false
 | 
			
		
	
		
			
				
					|  |  |  |       //           })
 | 
			
		
	
		
			
				
					|  |  |  |       //           wx.hideLoading()
 | 
			
		
	
		
			
				
					|  |  |  |       //           console.log('用户点击取消')
 | 
			
		
	
		
			
				
					|  |  |  |       //         }
 | 
			
		
	
		
			
				
					|  |  |  |       //       }
 | 
			
		
	
		
			
				
					|  |  |  |       //     })
 | 
			
		
	
		
			
				
					|  |  |  |       //   } else {
 | 
			
		
	
		
			
				
					|  |  |  |       //     wx.showModal({
 | 
			
		
	
		
			
				
					|  |  |  |       //       title: '订单提交',
 | 
			
		
	
		
			
				
					|  |  |  |       //       content: '是否使用消费金支付?',
 | 
			
		
	
		
			
				
					|  |  |  |       //       success: function (res) {
 | 
			
		
	
		
			
				
					|  |  |  |       //         if (res.confirm) {
 | 
			
		
	
		
			
				
					|  |  |  |       //           //组合支付 替换数据
 | 
			
		
	
		
			
				
					|  |  |  |       //           that.createProductOrder();
 | 
			
		
	
		
			
				
					|  |  |  |       //           console.log('用户点击确定');
 | 
			
		
	
		
			
				
					|  |  |  |       //         } else if (res.cancel) {
 | 
			
		
	
		
			
				
					|  |  |  |       //           this.setData({
 | 
			
		
	
		
			
				
					|  |  |  |       //             ispayOrder: false
 | 
			
		
	
		
			
				
					|  |  |  |       //           })
 | 
			
		
	
		
			
				
					|  |  |  |       //           wx.hideLoading()
 | 
			
		
	
		
			
				
					|  |  |  |       //           console.log('用户点击取消')
 | 
			
		
	
		
			
				
					|  |  |  |       //         }
 | 
			
		
	
		
			
				
					|  |  |  |       //       }
 | 
			
		
	
		
			
				
					|  |  |  |       //     })
 | 
			
		
	
		
			
				
					|  |  |  |       //   }
 | 
			
		
	
		
			
				
					|  |  |  |       // } else {
 | 
			
		
	
		
			
				
					|  |  |  |         // that.createProductOrder();
 | 
			
		
	
		
			
				
					|  |  |  |       // }
 | 
			
		
	
		
			
				
					|  |  |  |       that.createProductOrder(); | 
			
		
	
		
			
				
					|  |  |  |     } else { | 
			
		
	
		
			
				
					|  |  |  |       // 没有收货地址
 | 
			
		
	
		
			
				
					|  |  |  |       wx.showToast({ | 
			
		
	
	
		
			
				
					|  |  | @ -519,67 +526,119 @@ Page({ | 
			
		
	
		
			
				
					|  |  |  |   // 确认订单
 | 
			
		
	
		
			
				
					|  |  |  |   createProductOrder: function () { | 
			
		
	
		
			
				
					|  |  |  |     var that = this; | 
			
		
	
		
			
				
					|  |  |  |     this.setData({ | 
			
		
	
		
			
				
					|  |  |  |       btnDisabledbtnDisabled: false, | 
			
		
	
		
			
				
					|  |  |  |       pages_sx: false | 
			
		
	
		
			
				
					|  |  |  |     }) | 
			
		
	
		
			
				
					|  |  |  |     var paytype = that.data.paytype; | 
			
		
	
		
			
				
					|  |  |  |     var type1 = that.data.type1; | 
			
		
	
		
			
				
					|  |  |  |     app.d.purchase = 1; //设置购物车刷新
 | 
			
		
	
		
			
				
					|  |  |  |     wx.request({ | 
			
		
	
		
			
				
					|  |  |  |       url: app.d.ceshiUrl + '&action=product&m=payment', | 
			
		
	
		
			
				
					|  |  |  |       method: 'post', | 
			
		
	
		
			
				
					|  |  |  |       data: { | 
			
		
	
		
			
				
					|  |  |  |         uid: that.data.userId, // 微信id
 | 
			
		
	
		
			
				
					|  |  |  |         cart_id: that.data.cartId, // 购物车id
 | 
			
		
	
		
			
				
					|  |  |  |         type: paytype, // 支付方式
 | 
			
		
	
		
			
				
					|  |  |  |         total: that.data.coupon_money, // 付款金额
 | 
			
		
	
		
			
				
					|  |  |  |         coupon_id: that.data.coupon_id, // 优惠券ID
 | 
			
		
	
		
			
				
					|  |  |  |         allow: that.data.allow, // 用户使用消费金
 | 
			
		
	
		
			
				
					|  |  |  |         name: that.data.name, // 满减金额名称
 | 
			
		
	
		
			
				
					|  |  |  |         reduce_money: that.data.reduce_money, // 满减金额
 | 
			
		
	
		
			
				
					|  |  |  |         dkyuan: that.data.d_yuan, | 
			
		
	
		
			
				
					|  |  |  |         freight: that.data.freight, | 
			
		
	
		
			
				
					|  |  |  |         num: that.data.num1 ? that.data.num1 : 0, //直接购买数量
 | 
			
		
	
		
			
				
					|  |  |  |         typee: that.data.type ? that.data.type : 0, //购买类型1直接购买,0从购物车买
 | 
			
		
	
		
			
				
					|  |  |  |       }, | 
			
		
	
		
			
				
					|  |  |  |       header: { | 
			
		
	
		
			
				
					|  |  |  |         'Content-Type': 'application/x-www-form-urlencoded' | 
			
		
	
		
			
				
					|  |  |  |       }, | 
			
		
	
		
			
				
					|  |  |  |       success: function (res) { | 
			
		
	
		
			
				
					|  |  |  |         var data = res.data; | 
			
		
	
		
			
				
					|  |  |  |         console.log(res) | 
			
		
	
		
			
				
					|  |  |  |         if (data.status == 1) { | 
			
		
	
		
			
				
					|  |  |  |           // 余额支付
 | 
			
		
	
		
			
				
					|  |  |  |           if (data.arr.pay_type == 'wallet_Pay') { | 
			
		
	
		
			
				
					|  |  |  |             that.wallet_pay(data.arr); | 
			
		
	
		
			
				
					|  |  |  |           } | 
			
		
	
		
			
				
					|  |  |  |           if (data.arr.pay_type == 'wxPay') { | 
			
		
	
		
			
				
					|  |  |  |             // 微信支付
 | 
			
		
	
		
			
				
					|  |  |  |             wx.showLoading({ | 
			
		
	
		
			
				
					|  |  |  |               title: '加载中', | 
			
		
	
		
			
				
					|  |  |  |             }) | 
			
		
	
		
			
				
					|  |  |  |             that.wxpay(data.arr); | 
			
		
	
		
			
				
					|  |  |  |           } | 
			
		
	
		
			
				
					|  |  |  |         } else { | 
			
		
	
		
			
				
					|  |  |  |           wx.showToast({ | 
			
		
	
		
			
				
					|  |  |  |             title: res.data.err, | 
			
		
	
		
			
				
					|  |  |  |             icon: 'none', | 
			
		
	
		
			
				
					|  |  |  |             duration: 2500 | 
			
		
	
		
			
				
					|  |  |  |           }); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     WXAPI.orderPayment({ | 
			
		
	
		
			
				
					|  |  |  |       accessId: app.globalData.accessId, | 
			
		
	
		
			
				
					|  |  |  |       storeId: 239, | 
			
		
	
		
			
				
					|  |  |  |       storeType: 1, | 
			
		
	
		
			
				
					|  |  |  |       cart_id: '', | 
			
		
	
		
			
				
					|  |  |  |       address_id: that.data.addrId, | 
			
		
	
		
			
				
					|  |  |  |       coupon_id: 0, | 
			
		
	
		
			
				
					|  |  |  |       remarks: '', | 
			
		
	
		
			
				
					|  |  |  |       vipSource: 0, | 
			
		
	
		
			
				
					|  |  |  |       product: that.data.productAry, | 
			
		
	
		
			
				
					|  |  |  |       pay_type: '', | 
			
		
	
		
			
				
					|  |  |  |     }).then(res => { | 
			
		
	
		
			
				
					|  |  |  |       if (res.code == 200) { | 
			
		
	
		
			
				
					|  |  |  |         var data = res.data | 
			
		
	
		
			
				
					|  |  |  |         var jsonstr = JSON.stringify(data) | 
			
		
	
		
			
				
					|  |  |  |         var result = { | 
			
		
	
		
			
				
					|  |  |  |           orderStr: jsonstr, | 
			
		
	
		
			
				
					|  |  |  |           price: data.total | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |       }, | 
			
		
	
		
			
				
					|  |  |  |       fail: function (e) { | 
			
		
	
		
			
				
					|  |  |  |         wx.navigateTo({ | 
			
		
	
		
			
				
					|  |  |  |           url: "/pages/order/payment?orderId="+data.sNo+"&price="+data.total, | 
			
		
	
		
			
				
					|  |  |  |         }) | 
			
		
	
		
			
				
					|  |  |  |         // that.leaveSettlement(result)
 | 
			
		
	
		
			
				
					|  |  |  |       } else { | 
			
		
	
		
			
				
					|  |  |  |         wx.showToast({ | 
			
		
	
		
			
				
					|  |  |  |           title: '网络异常!err:createProductOrder', | 
			
		
	
		
			
				
					|  |  |  |           title: res.message, | 
			
		
	
		
			
				
					|  |  |  |           icon: 'none', | 
			
		
	
		
			
				
					|  |  |  |           duration: 2000 | 
			
		
	
		
			
				
					|  |  |  |         }); | 
			
		
	
		
			
				
					|  |  |  |       } | 
			
		
	
		
			
				
					|  |  |  |       }        | 
			
		
	
		
			
				
					|  |  |  |     }); | 
			
		
	
		
			
				
					|  |  |  |     // this.setData({
 | 
			
		
	
		
			
				
					|  |  |  |     //   btnDisabledbtnDisabled: false,
 | 
			
		
	
		
			
				
					|  |  |  |     //   pages_sx: false
 | 
			
		
	
		
			
				
					|  |  |  |     // })
 | 
			
		
	
		
			
				
					|  |  |  |     // var paytype = that.data.paytype;
 | 
			
		
	
		
			
				
					|  |  |  |     // var type1 = that.data.type1;
 | 
			
		
	
		
			
				
					|  |  |  |     // app.d.purchase = 1; //设置购物车刷新
 | 
			
		
	
		
			
				
					|  |  |  |     // wx.request({
 | 
			
		
	
		
			
				
					|  |  |  |     //   url: app.d.ceshiUrl + '&action=product&m=payment',
 | 
			
		
	
		
			
				
					|  |  |  |     //   method: 'post',
 | 
			
		
	
		
			
				
					|  |  |  |     //   data: {
 | 
			
		
	
		
			
				
					|  |  |  |     //     uid: that.data.userId, // 微信id
 | 
			
		
	
		
			
				
					|  |  |  |     //     cart_id: that.data.cartId, // 购物车id
 | 
			
		
	
		
			
				
					|  |  |  |     //     type: paytype, // 支付方式
 | 
			
		
	
		
			
				
					|  |  |  |     //     total: that.data.coupon_money, // 付款金额
 | 
			
		
	
		
			
				
					|  |  |  |     //     coupon_id: that.data.coupon_id, // 优惠券ID
 | 
			
		
	
		
			
				
					|  |  |  |     //     allow: that.data.allow, // 用户使用消费金
 | 
			
		
	
		
			
				
					|  |  |  |     //     name: that.data.name, // 满减金额名称
 | 
			
		
	
		
			
				
					|  |  |  |     //     reduce_money: that.data.reduce_money, // 满减金额
 | 
			
		
	
		
			
				
					|  |  |  |     //     dkyuan: that.data.d_yuan,
 | 
			
		
	
		
			
				
					|  |  |  |     //     freight: that.data.freight,
 | 
			
		
	
		
			
				
					|  |  |  |     //     num: that.data.num1 ? that.data.num1 : 0, //直接购买数量
 | 
			
		
	
		
			
				
					|  |  |  |     //     typee: that.data.type ? that.data.type : 0, //购买类型1直接购买,0从购物车买
 | 
			
		
	
		
			
				
					|  |  |  |     //   },
 | 
			
		
	
		
			
				
					|  |  |  |     //   header: {
 | 
			
		
	
		
			
				
					|  |  |  |     //     'Content-Type': 'application/x-www-form-urlencoded'
 | 
			
		
	
		
			
				
					|  |  |  |     //   },
 | 
			
		
	
		
			
				
					|  |  |  |     //   success: function (res) {
 | 
			
		
	
		
			
				
					|  |  |  |     //     var data = res.data;
 | 
			
		
	
		
			
				
					|  |  |  |     //     console.log(res)
 | 
			
		
	
		
			
				
					|  |  |  |     //     if (data.status == 1) {
 | 
			
		
	
		
			
				
					|  |  |  |     //       // 余额支付
 | 
			
		
	
		
			
				
					|  |  |  |     //       if (data.arr.pay_type == 'wallet_Pay') {
 | 
			
		
	
		
			
				
					|  |  |  |     //         that.wallet_pay(data.arr);
 | 
			
		
	
		
			
				
					|  |  |  |     //       }
 | 
			
		
	
		
			
				
					|  |  |  |     //       if (data.arr.pay_type == 'wxPay') {
 | 
			
		
	
		
			
				
					|  |  |  |     //         // 微信支付
 | 
			
		
	
		
			
				
					|  |  |  |     //         wx.showLoading({
 | 
			
		
	
		
			
				
					|  |  |  |     //           title: '加载中',
 | 
			
		
	
		
			
				
					|  |  |  |     //         })
 | 
			
		
	
		
			
				
					|  |  |  |     //         that.wxpay(data.arr);
 | 
			
		
	
		
			
				
					|  |  |  |     //       }
 | 
			
		
	
		
			
				
					|  |  |  |     //     } else {
 | 
			
		
	
		
			
				
					|  |  |  |     //       wx.showToast({
 | 
			
		
	
		
			
				
					|  |  |  |     //         title: res.data.err,
 | 
			
		
	
		
			
				
					|  |  |  |     //         icon: 'none',
 | 
			
		
	
		
			
				
					|  |  |  |     //         duration: 2500
 | 
			
		
	
		
			
				
					|  |  |  |     //       });
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     //     }
 | 
			
		
	
		
			
				
					|  |  |  |     //   },
 | 
			
		
	
		
			
				
					|  |  |  |     //   fail: function (e) {
 | 
			
		
	
		
			
				
					|  |  |  |     //     wx.showToast({
 | 
			
		
	
		
			
				
					|  |  |  |     //       title: '网络异常!err:createProductOrder',
 | 
			
		
	
		
			
				
					|  |  |  |     //       duration: 2000
 | 
			
		
	
		
			
				
					|  |  |  |     //     });
 | 
			
		
	
		
			
				
					|  |  |  |     //   }
 | 
			
		
	
		
			
				
					|  |  |  |     // });
 | 
			
		
	
		
			
				
					|  |  |  |     // }
 | 
			
		
	
		
			
				
					|  |  |  |   }, | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |   //结算支付
 | 
			
		
	
		
			
				
					|  |  |  |   leaveSettlement(result) { | 
			
		
	
		
			
				
					|  |  |  |     var that = this; | 
			
		
	
		
			
				
					|  |  |  |     WXAPI.leaveSettlement({ | 
			
		
	
		
			
				
					|  |  |  |       accessId: app.globalData.accessId, | 
			
		
	
		
			
				
					|  |  |  |       storeId: 239, | 
			
		
	
		
			
				
					|  |  |  |       storeType: 1, | 
			
		
	
		
			
				
					|  |  |  |       order_list: result.orderStr, | 
			
		
	
		
			
				
					|  |  |  |       price: result.price | 
			
		
	
		
			
				
					|  |  |  |     }).then(res => { | 
			
		
	
		
			
				
					|  |  |  |       if (res.code == 200) { | 
			
		
	
		
			
				
					|  |  |  |         var data = res.data | 
			
		
	
		
			
				
					|  |  |  |         console.log(data) | 
			
		
	
		
			
				
					|  |  |  |       } else { | 
			
		
	
		
			
				
					|  |  |  |         wx.showToast({ | 
			
		
	
		
			
				
					|  |  |  |           title: res.message, | 
			
		
	
		
			
				
					|  |  |  |           icon: 'none', | 
			
		
	
		
			
				
					|  |  |  |           duration: 2000 | 
			
		
	
		
			
				
					|  |  |  |         }); | 
			
		
	
		
			
				
					|  |  |  |       }    | 
			
		
	
		
			
				
					|  |  |  |     }); | 
			
		
	
		
			
				
					|  |  |  |   }, | 
			
		
	
		
			
				
					|  |  |  |   // 发起钱包支付
 | 
			
		
	
		
			
				
					|  |  |  |   wallet_pay: function (order) { | 
			
		
	
		
			
				
					|  |  |  |     wx.hideLoading() | 
			
		
	
	
		
			
				
					|  |  | 
 |