wangguoyu пре 2 месеци
родитељ
комит
dc9f6adc8b
1 измењених фајлова са 19 додато и 21 уклоњено
  1. 19 21
      pages/pay/svip.vue

+ 19 - 21
pages/pay/svip.vue

@@ -43,11 +43,13 @@
 					</view>
 				</view>
 			</radio-group>
-			<view v-if="currentPlatform =='android'" class="open-svip-btn" @touchstart="creatOrder">立即开通</view>
-			<view v-if="currentPlatform =='ios'&&!disabled" style="margin-top: 20rpx;"  class="open-svip-btn"
+			<view v-if="currentPlatform =='android'&&!disabled" class="open-svip-btn" @touchstart="creatOrder">立即开通
+			</view>
+			<view v-if="currentPlatform =='android'&&disabled" class="open-svip-btn-hui"></view>
+			<view v-if="currentPlatform =='ios'&&!disabled" style="margin-top: 20rpx;" class="open-svip-btn"
 				@touchstart="creatOrderIos">立即开通</view>
-				<view v-if="currentPlatform =='ios'&&disabled" style="margin-top: 20rpx;"  class="open-svip-btn-hui"
-				>立即开通</view>
+			<view v-if="currentPlatform =='ios'&&disabled" style="margin-top: 20rpx;" class="open-svip-btn-hui">立即开通
+			</view>
 		</view>
 		<view class="hyfw-tip-box">请点击<text @click="hyfyClick">《会员服务协议》</text>了解SVIP权益</view>
 		<CustomTabBar></CustomTabBar>
@@ -90,7 +92,6 @@
 	let payType = ref('zhifubao')
 	let cardId = ref('')
 	let formPage = ref('')
-	let isLoading = ref(false)
 	const daoPokeRef = ref(null);
 	const daoPokeAllRef = ref(null);
 	let orderId = ref('');
@@ -161,7 +162,7 @@
 
 	function genggaiVip() {
 		uni.hideLoading();
-		isLoading.value = false;
+		disabled.value = false
 		cacheManager.updateVipStatus('auth', cardId.value)
 		cacheManager.updateObject('auth', {
 			growthType: 1
@@ -342,10 +343,8 @@
 	const creatOrder = debounce((data) => {
 
 		console.log('123123123123');
-		if (isLoading.value) {
-			return
-		}
-		isLoading.value = true;
+
+		disabled.value = true
 		uni.showLoading({
 			title: '',
 			mask: true
@@ -363,7 +362,6 @@
 					id: res.data.id
 				}).then(res2 => {
 					uni.hideLoading();
-					isLoading.value = false;
 					console.log('res2', res2);
 					uni.requestPayment({
 						"provider": "wxpay",
@@ -431,14 +429,15 @@
 					});
 				}).catch((error) => {
 					uni.hideLoading();
-					isLoading.value = false;
+					disabled.value = false
+
 					console.log(error);
 				})
 
 
 			}).catch((err) => {
 				uni.hideLoading();
-				isLoading.value = false;
+				disabled.value = false
 				toast("订单创建失败")
 				return false
 			})
@@ -454,7 +453,6 @@
 				}).then(res2 => {
 					console.log('res2', res2);
 					uni.hideLoading();
-					isLoading.value = false;
 					uni.requestPayment({
 						"provider": "alipay",
 						"orderInfo": res2.data.text, //此处为服务器返回的订单信息字符串
@@ -481,9 +479,9 @@
 												.data) {
 												genggaiVip()
 											} else {
-												isLoading
+												disabled
 													.value =
-													false;
+													false
 												toast(
 													"开通失败,请联系管理员!"
 												)
@@ -492,8 +490,8 @@
 												return false
 											}
 										}).catch(() => {
-											isLoading.value =
-												false;
+											disabled.value =
+												false
 											uni.hideLoading();
 											toast("check接口报错")
 											return false
@@ -501,14 +499,14 @@
 									}, 5000)
 								}
 							}).catch(() => {
-								isLoading.value = false;
+								disabled.value = false
 								uni.hideLoading();
 								toast("check接口报错")
 								return false
 							})
 						},
 						fail: function(err) {
-							isLoading.value = false;
+							disabled.value = false
 							//  toast('支付失败:' + JSON.stringify(err));
 							console.log('支付失败:' + JSON.stringify(err));
 							uni.hideLoading();
@@ -516,7 +514,7 @@
 					});
 				})
 			}).catch((err) => {
-				isLoading.value = false;
+				disabled.value = false
 				uni.hideLoading();
 				toast("订单创建失败")
 				return false