wangguoyu преди 4 седмици
родител
ревизия
cf563b88b4
променени са 3 файла, в които са добавени 124 реда и са изтрити 8 реда
  1. 41 3
      pages/mall/detailDialog.vue
  2. 44 4
      pages/mall/mallPage.vue
  3. 39 1
      pages/pay/order.vue

+ 41 - 3
pages/mall/detailDialog.vue

@@ -214,7 +214,39 @@
 			if (res.code == 0 && res.data) {
 				iapChannel.finishTransaction(data.transactionIdentifier)
 				console.log('resiapChanneliapChanneliapChannel', res);
-				genggaiVip()
+				orderCheck({
+					id: orderId.value
+				}).then(res3 => {
+					console.log('res3', res3);
+					if (res3.code == 0) {
+						genggaiVip(res3.data)
+					} else {
+						setTimeout(() => {
+							orderCheck({
+								id: orderId.value
+							}).then(res4 => {
+								if (res4.code == 0) {
+									genggaiVip(res4.data)
+								} else {
+									toast(
+										"开通失败,请联系管理员!"
+									)
+									uni
+										.hideLoading();
+									return false
+								}
+							}).catch(() => {
+								uni.hideLoading();
+								toast("check接口报错")
+								return false
+							})
+						}, 5000)
+					}
+				}).catch(() => {
+					uni.hideLoading();
+					toast("check接口报错")
+					return false
+				})
 			} else {
 				iapChannel.finishTransaction(data.transactionIdentifier)
 				uni.hideLoading();
@@ -307,7 +339,10 @@
 			id: orderId.value
 		}).then(res2 => {
 			uni.hideLoading();
-			console.log('res2', res2);
+			console.log('res2', res2);
+			if(res2.code !=0){
+				return false
+			}
 			uni.requestPayment({
 				"provider": "wxpay",
 				"orderInfo": {
@@ -382,7 +417,10 @@
 			id: orderId.value
 		}).then(res2 => {
 			console.log('res2', res2);
-			uni.hideLoading();
+			uni.hideLoading();
+			if(res2.code !=0){
+				return false
+			}
 			uni.requestPayment({
 				"provider": "alipay",
 				"orderInfo": res2.data.text, //此处为服务器返回的订单信息字符串

+ 44 - 4
pages/mall/mallPage.vue

@@ -308,8 +308,42 @@
 		orderPayApple(req).then(res => {
 			if (res.code == 0 && res.data) {
 				iapChannel.finishTransaction(data.transactionIdentifier)
-				console.log('resiapChanneliapChanneliapChannel', res);
-				genggaiVip()
+				console.log('resiapChanneliapChanneliapChannel', res);		
+				orderCheck({
+					id: orderId.value
+				}).then(res3 => {
+					console.log('res3', res3);
+					if (res3.code == 0) {
+						genggaiVip(res3.data)
+					} else {
+						setTimeout(() => {
+							orderCheck({
+								id: orderId.value
+							}).then(res4 => {
+								if (res4.code == 0) {
+									genggaiVip(res4.data)
+								} else {
+									toast(
+										"开通失败,请联系管理员!"
+									)
+									uni
+										.hideLoading();
+									return false
+								}
+							}).catch(() => {
+								uni.hideLoading();
+								toast("check接口报错")
+								return false
+							})
+						}, 5000)
+					}
+				}).catch(() => {
+					uni.hideLoading();
+					toast("check接口报错")
+					return false
+				})
+				
+				
 			} else {
 
 				iapChannel.finishTransaction(data.transactionIdentifier)
@@ -403,7 +437,10 @@
 			id: orderId.value
 		}).then(res2 => {
 			uni.hideLoading();
-			console.log('res2', res2);
+			console.log('res2', res2);
+			if(res2.code !=0){
+				return false
+			}
 			uni.requestPayment({
 				"provider": "wxpay",
 				"orderInfo": {
@@ -477,7 +514,10 @@
 		orderPayAli({
 			id: orderId.value
 		}).then(res2 => {
-			console.log('res2', res2);
+			console.log('res2', res2);
+			if(res2.code !=0){
+				return false
+			}
 			uni.hideLoading();
 			uni.requestPayment({
 				"provider": "alipay",

+ 39 - 1
pages/pay/order.vue

@@ -393,7 +393,39 @@
 			if (res.code == 0 && res.data) {
 				iapChannel.finishTransaction(data.transactionIdentifier)
 				console.log('resiapChanneliapChanneliapChannel', res);
-				genggaiVip()
+			orderCheck({
+				id: orderId.value
+			}).then(res3 => {
+				console.log('res3', res3);
+				if (res3.code == 0) {
+					genggaiVip(res3.data)
+				} else {
+					setTimeout(() => {
+						orderCheck({
+							id: orderId.value
+						}).then(res4 => {
+							if (res4.code == 0) {
+								genggaiVip(res4.data)
+							} else {
+								toast(
+									"开通失败,请联系管理员!"
+								)
+								uni
+									.hideLoading();
+								return false
+							}
+						}).catch(() => {
+							uni.hideLoading();
+							toast("check接口报错")
+							return false
+						})
+					}, 5000)
+				}
+			}).catch(() => {
+				uni.hideLoading();
+				toast("check接口报错")
+				return false
+			})
 			} else {
 
 				iapChannel.finishTransaction(data.transactionIdentifier)
@@ -488,6 +520,9 @@
 		}).then(res2 => {
 			uni.hideLoading();
 			console.log('res2', res2);
+			if(res2.code !=0){
+				return false
+			}
 			uni.requestPayment({
 				"provider": "wxpay",
 				"orderInfo": {
@@ -563,6 +598,9 @@
 		}).then(res2 => {
 			console.log('res2', res2);
 			uni.hideLoading();
+			if(res2.code !=0){
+				return false
+			}
 			uni.requestPayment({
 				"provider": "alipay",
 				"orderInfo": res2.data.text, //此处为服务器返回的订单信息字符串