lilei 7 months ago
parent
commit
ed8a0503e8
2 changed files with 32 additions and 9 deletions
  1. 2 2
      App.vue
  2. 30 7
      pagesB/shopiing/productDetail.vue

+ 2 - 2
App.vue

@@ -1,8 +1,8 @@
 <script>
 	export default {
 		globalData: {
-			// baseUrl: 'http://192.168.2.10:7002/saas/clz/', // 本地
-			baseUrl: 'https://md.test.zyucgj.com/saas/clz/', // 预发布
+			baseUrl: 'http://192.168.2.131:7002/saas/clz/', // 本地
+			// baseUrl: 'https://md.test.zyucgj.com/saas/clz/', // 预发布
 			// baseUrl: 'https://car.zyucgj.com/saas/clz/' // 生产
 		},
 		onLaunch: function() {

+ 30 - 7
pagesB/shopiing/productDetail.vue

@@ -585,9 +585,10 @@
 			},
 			// 关闭之前
 			beforeClosePopu(){
+				console.log(this.showPay,this.submitOk,this.cacelOk)
 				// 正在支付
-				if(this.showPay&&!this.submitOk){
-					this.showPay = false
+				if(this.cacelOk&&!this.submitOk){
+					this.cacelOk = false
 					this.cancelPay()
 				}
 			},
@@ -639,13 +640,31 @@
 				// })
 				// 确认付款
 				const data = _this.payData
+				uni.requestPayment({
+					provider: 'wxpay',
+					timeStamp: data.timeStamp,
+					nonceStr: data.nonceStr,
+					package: data.packageValue,
+					signType: data.signType,
+					paySign: data.paySign,
+					success: (res) =>{
+						console.log('success:', res);
+						_this.payComplete(1,data)
+					},
+					fail: (err)=> {
+						console.log('fail:',err);
+						_this.payComplete(err.errMsg.indexOf("cancel")>=0 ? 2 : 0,data)
+					}
+				});
+			},
+			payComplete(type,data){
 				uni.showToast({
 					mask: true,
-					title: data ? '支付成功' : '支付失败',
+					title: data==1 ? '支付成功' : (type==2?'支付取消':'支付失败'),
 					icon: 'none'
 				})
-				_this.showPopu = false
-				_this.submitOk = true
+				this.showPopu = false
+				this.submitOk = true
 			},
 			// 确认取消付款弹框
 			cancelPay(){
@@ -657,16 +676,20 @@
 					cancelText: '取消支付',
 					success(ret) {
 						// 确定取消,跳转到订单详情页
-						if(!ret.confirm){
+						if(ret.cancel){
 							// 支付弹框打开中
 							if(_this.showPopu){
+								console.log(0)
 								_this.showPopu = false
 								_this.cacelOk = true
 							}else{
+								console.log(1)
 								// 未打开直接跳转
 								_this.toOrderDetial()
 							}
-						}else{
+						}
+						if(ret.confirm){
+							console.log(2)
 							// 继续支付
 							_this.showPopu = true
 							_this.showPay = true