wangguoyu 3 miesięcy temu
rodzic
commit
009841b942
1 zmienionych plików z 23 dodań i 17 usunięć
  1. 23 17
      pages/pay/svip.vue

+ 23 - 17
pages/pay/svip.vue

@@ -103,6 +103,7 @@
 		}
 	];
 	onLoad((options) => {
+		console.log('jinruaaaaaaaaaaaaa');
 		cardId.value = options.cardId
 		formPage.value = options.formPage
 	})
@@ -141,7 +142,8 @@
 
 
 		uni.showLoading({
-			title: ''
+			title: '',
+			mask: true
 		});
 		if (payType.value == 'weixin') {
 			let req = {
@@ -151,10 +153,10 @@
 				console.log('res', res);
 				console.log(' res.data.id', res.data.id);
 				orderId.value = res.data.id
-				uni.hideLoading();
 				orderPayWx({
 					id: res.data.id
 				}).then(res2 => {
+					uni.hideLoading();
 					console.log('res2', res2);
 					uni.requestPayment({
 						"provider": "wxpay",
@@ -168,10 +170,11 @@
 							"sign": res2.data.sign // 签名,这里用的 MD5 签名
 						}, //此处为服务器返回的订单信息字符串
 						success: function(res) {
+
 							//var rawdata = JSON.parse(res.rawdata);
-							console.log('res',res);	
-							console.log('支付成功');
-						//	console.log('rawdata', rawdata);
+							//	console.log('res',res);	
+							//	console.log('支付成功');
+							//	console.log('rawdata', rawdata);
 							uni.showLoading({
 								title: '会员开通中,请稍后...'
 							});
@@ -210,19 +213,21 @@
 
 						},
 						fail: function(err) {
+							uni.hideLoading();
 							//  toast('支付失败:' + JSON.stringify(err));
 							console.log('支付失败:' + JSON.stringify(err));
 						}
 					});
 				}).catch((error) => {
+					uni.hideLoading();
 					console.log(error);
 				})
 
 
-			}).catch((err)=>{
-					uni.hideLoading();
-					toast("订单创建失败")
-					return false
+			}).catch((err) => {
+				uni.hideLoading();
+				toast("订单创建失败")
+				return false
 			})
 		} else {
 			let req = {
@@ -231,18 +236,19 @@
 			orderAdd(req).then(res => {
 				console.log('res', res);
 				orderId.value = res.data.id
-				uni.hideLoading();
 				orderPayAli({
 					id: res.data.id
 				}).then(res2 => {
 					console.log('res2', res2);
+					uni.hideLoading();
 					uni.requestPayment({
 						"provider": "alipay",
 						"orderInfo": res2.data.text, //此处为服务器返回的订单信息字符串
 						success: function(res) {
-							var rawdata = JSON.parse(res.rawdata);
-							console.log('支付成功');
-							console.log('rawdata', rawdata);
+							// var rawdata = JSON.parse(res.rawdata);
+							// console.log('支付成功');
+							// console.log('rawdata', rawdata);
+
 							uni.showLoading({
 								title: '会员开通中,请稍后...'
 							});
@@ -284,10 +290,10 @@
 						}
 					});
 				})
-			}).catch((err)=>{
-					uni.hideLoading();
-					toast("订单创建失败")
-					return false
+			}).catch((err) => {
+				uni.hideLoading();
+				toast("订单创建失败")
+				return false
 			})
 		}