wangguoyu 3 ヶ月 前
コミット
17c9984117
1 ファイル変更26 行追加9 行削除
  1. 26 9
      pages/pay/svip.vue

+ 26 - 9
pages/pay/svip.vue

@@ -20,10 +20,10 @@
 		<view class="open-svip-box">
 			<view class="svip-price-box" v-if="cardId ==1">
 				<view>原价:<text class="original-price">¥499</text></view>
-				<view class="discount-price">活动价:¥299</view>
+				<view class="discount-price">活动价:¥399</view>
 			</view>
 			<view class="svip-price-box" v-if="cardId ==2">
-				<view>原价:<text class="original-price">¥399</text></view>
+				<view>原价:<text class="original-price">¥299</text></view>
 				<view class="discount-price">活动价:¥199</view>
 			</view>
 			<radio-group @change="radioChange" class="pay-type-box">
@@ -139,6 +139,10 @@
 
 	function creatOrder(data) {
 
+
+		uni.showLoading({
+			title: ''
+		});
 		if (payType.value == 'weixin') {
 			let req = {
 				cardId: cardId.value
@@ -147,6 +151,7 @@
 				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 => {
@@ -172,13 +177,15 @@
 							orderCheck({
 								id: orderId.value
 							}).then(res3 => {
-								console.log('res3',res3);
+								console.log('res3', res3);
 								if (res3.code == 0 && res3.data) {
-									
+
 									genggaiVip()
 								} else {
 									setTimeout(() => {
-										orderCheck({id:orderId.value}).then(res4 => {
+										orderCheck({
+											id: orderId.value
+										}).then(res4 => {
 											if (res4.code == 0 && res4
 												.data) {
 												genggaiVip()
@@ -211,6 +218,10 @@
 				})
 
 
+			}).catch((err)=>{
+					uni.hideLoading();
+					toast("订单创建失败")
+					return false
 			})
 		} else {
 			let req = {
@@ -218,7 +229,8 @@
 			}
 			orderAdd(req).then(res => {
 				console.log('res', res);
-					orderId.value = res.data.id
+				orderId.value = res.data.id
+				uni.hideLoading();
 				orderPayAli({
 					id: res.data.id
 				}).then(res2 => {
@@ -240,7 +252,9 @@
 									genggaiVip()
 								} else {
 									setTimeout(() => {
-										orderCheck({id:orderId.value}).then(res4 => {
+										orderCheck({
+											id: orderId.value
+										}).then(res4 => {
 											if (res4.code == 0 && res4
 												.data) {
 												genggaiVip()
@@ -265,11 +279,14 @@
 						fail: function(err) {
 							//  toast('支付失败:' + JSON.stringify(err));
 							console.log('支付失败:' + JSON.stringify(err));
+							uni.hideLoading();
 						}
 					});
 				})
-
-
+			}).catch((err)=>{
+					uni.hideLoading();
+					toast("订单创建失败")
+					return false
 			})
 		}