wangguoyu hace 2 semanas
padre
commit
2aad93a0ed
Se han modificado 3 ficheros con 95 adiciones y 87 borrados
  1. 3 1
      pages/mall/detailDialog.vue
  2. 4 1
      pages/mall/mallPage.vue
  3. 88 85
      pages/pay/order.vue

+ 3 - 1
pages/mall/detailDialog.vue

@@ -205,7 +205,9 @@
 		orderAdd(req).then(res => {
 			console.log('res', res);
 			if (res.code == 0) {
-				uni.hideLoading();
+			setTimeout(() => {
+				uni.hideLoading();
+			}, 1000)
 				orderId.value = res.data.id
 				// 测试ios 1元
 				applePay()

+ 4 - 1
pages/mall/mallPage.vue

@@ -317,7 +317,10 @@
 		orderAdd(req).then(res => {
 			console.log('res', res);
 			if (res.code == 0) {
-				uni.hideLoading();
+				setTimeout(() => {
+					uni.hideLoading();
+				}, 1000)
+
 				orderId.value = res.data.id
 				// 测试ios 1元
 				applePay()

+ 88 - 85
pages/pay/order.vue

@@ -29,8 +29,8 @@
 											<text v-if="item.status ==1" class="pay-status">待付款</text>
 										</view>
 									</view>
-									<view class="order-content-box" @click="goDao(item2,index2)" v-for="(item2,index2) in item.cardList"
-										:key="index2">
+									<view class="order-content-box" @click="goDao(item2,index2)"
+										v-for="(item2,index2) in item.cardList" :key="index2">
 										<!-- 需要改成从接口获取的 wgy-->
 										<img class="content-img" :src="item2.cover">
 										<view class="content-body-box">
@@ -64,8 +64,8 @@
 										<view v-if="currentPlatform =='android'" class="pay-btn"
 											@touchstart="creatOrder(item.cardList,index)">立即支付
 										</view>
-										<view v-if="currentPlatform =='ios'"
-											class="pay-btn" @touchstart="creatOrderIos(item.cardList,index,item.id)">立即支付
+										<view v-if="currentPlatform =='ios'" class="pay-btn"
+											@touchstart="creatOrderIos(item.cardList,index,item.id)">立即支付
 										</view>
 									</view>
 								</template>
@@ -96,7 +96,7 @@
 											<text v-if="item.status ==1" class="pay-status">待付款</text>
 										</view>
 									</view>
-									<view class="order-content-box"  v-for="(item2,index2) in item.cardList"
+									<view class="order-content-box" v-for="(item2,index2) in item.cardList"
 										:key="index2">
 										<!-- 需要改成从接口获取的 wgy-->
 										<img class="content-img" :src="item2.cover">
@@ -131,11 +131,11 @@
 										<view v-if="currentPlatform =='android'" class="pay-btn"
 											@touchstart="creatOrder(item.cardList,index)">立即支付
 										</view>
-										<view v-if="currentPlatform =='ios'"
-											class="pay-btn" @touchstart="creatOrderIos(item.cardList,index,item.id)">立即支付
+										<view v-if="currentPlatform =='ios'" class="pay-btn"
+											@touchstart="creatOrderIos(item.cardList,index,item.id)">立即支付
 										</view>
 									</view>
-							
+
 								</template>
 							</uni-list-item>
 							<uni-load-more :status="dingdanData.daiFukuan.state" @click="getMore(1)"
@@ -164,8 +164,8 @@
 											<text v-if="item.status ==1" class="pay-status">待付款</text>
 										</view>
 									</view>
-									<view class="order-content-box" @click="goDao(item2,index2)" v-for="(item2,index2) in item.cardList"
-										:key="index2">
+									<view class="order-content-box" @click="goDao(item2,index2)"
+										v-for="(item2,index2) in item.cardList" :key="index2">
 										<!-- 需要改成从接口获取的 wgy-->
 										<img class="content-img" :src="item2.cover">
 										<view class="content-body-box">
@@ -199,11 +199,11 @@
 										<view v-if="currentPlatform =='android'" class="pay-btn"
 											@touchstart="creatOrder(item.cardList,index)">立即支付
 										</view>
-										<view v-if="currentPlatform =='ios'"
-											class="pay-btn" @touchstart="creatOrderIos(item.cardList,index,item.id)">立即支付
+										<view v-if="currentPlatform =='ios'" class="pay-btn"
+											@touchstart="creatOrderIos(item.cardList,index,item.id)">立即支付
 										</view>
 									</view>
-							
+
 								</template>
 							</uni-list-item>
 							<uni-load-more :status="dingdanData.yiFukuan.state" @click="getMore(2)"
@@ -303,10 +303,10 @@
 		},
 	})
 
-	function goDao(data,index){
-		console.log('data',data);
-		console.log('index',index);
-		if(data.type ==0 &&data.levelList.length ==1){
+	function goDao(data, index) {
+		console.log('data', data);
+		console.log('index', index);
+		if (data.type == 0 && data.levelList.length == 1) {
 			cacheManager.updateObject('auth', {
 				typeId: data.levelList[0].typeId,
 				levelId: data.levelList[0].levelId,
@@ -319,6 +319,7 @@
 			})
 		}
 	}
+
 	function genggaiVip(data) {
 		uni.hideLoading();
 		const localList = cacheManager.get('auth').levelIdList || []
@@ -340,52 +341,54 @@
 		// }
 	}
 
-	const creatOrderIos = debounce((data, index,orderId) => {
+	const creatOrderIos = debounce((data, index, orderId) => {
 
 
 
-		console.log('data',data[0].cardId);
-		console.log('index',index);
-		console.log('orderId',orderId);
-		return 
+		console.log('data', data[0].cardId);
+		console.log('index', index);
+		console.log('orderId', orderId);
+		return
 		uni.showLoading({
 			title: '',
 			mask: true
 		});
 		const productMap = {
 			4: 'ezySxJstxL1', //计算特训 L1
-			6: 'ezySxTjmtL1',//图解母题 L1
-			7: 'ezySxJstxL2',//计算特训 L2
-			8: 'ezySxJstxL3',//计算特训 L3
-			9: 'ezySxJstxL4',//计算特训 L4
-			10: 'ezySxJstxL5',//计算特训 L5
-			11: 'ezySxJstxL6',//计算特训 L6
-			12: 'ezySxTjmtL2',//图解母题 L2
-			13: 'ezySxTjmtL3',//图解母题 L3
-			14: 'ezySxTjmtL4',//图解母题 L4
-			15: 'ezySxTjmtL5',//图解母题 L5
-			16: 'ezySxTjmtL6',//图解母题 L6
-			22: 'ezySxTjmtL1L6',//图解母题 L1-6
-			23: 'ezyYyZrpdL1',//自然拼读 L1
-			24: 'ezyYyZrpdL2',//自然拼读 L2
-			25: 'ezyYyZrpdL3',//自然拼读 L3
-			26: 'ezyYyZrpdL4',//自然拼读 L4
-			27: 'ezyYyZrpdL5',//自然拼读 L5
-			28: 'ezyYyZrpdL1L5',//自然拼读 L1-l5
-			29: ' ezySxJstxL1L6'//计算特训 L1-L6
+			6: 'ezySxTjmtL1', //图解母题 L1
+			7: 'ezySxJstxL2', //计算特训 L2
+			8: 'ezySxJstxL3', //计算特训 L3
+			9: 'ezySxJstxL4', //计算特训 L4
+			10: 'ezySxJstxL5', //计算特训 L5
+			11: 'ezySxJstxL6', //计算特训 L6
+			12: 'ezySxTjmtL2', //图解母题 L2
+			13: 'ezySxTjmtL3', //图解母题 L3
+			14: 'ezySxTjmtL4', //图解母题 L4
+			15: 'ezySxTjmtL5', //图解母题 L5
+			16: 'ezySxTjmtL6', //图解母题 L6
+			22: 'ezySxTjmtL1L6', //图解母题 L1-6
+			23: 'ezyYyZrpdL1', //自然拼读 L1
+			24: 'ezyYyZrpdL2', //自然拼读 L2
+			25: 'ezyYyZrpdL3', //自然拼读 L3
+			26: 'ezyYyZrpdL4', //自然拼读 L4
+			27: 'ezyYyZrpdL5', //自然拼读 L5
+			28: 'ezyYyZrpdL1L5', //自然拼读 L1-l5
+			29: ' ezySxJstxL1L6' //计算特训 L1-L6
 		};
 		const firstId = data.length > 0 ? data[0].cardId : null;
 		if (firstId) {
 			productId.value = productMap[firstId]
-			console.log('productId.value',productId.value);
+			console.log('productId.value', productId.value);
 		} else {
 			toast("无对应产品Id,请练习管理员")
 			uni.hideLoading();
 			return false
 		}
-		uni.hideLoading();
+		setTimeout(() => {
+			uni.hideLoading();
+		}, 1000)
 		orderId.value = orderId
-		if(!orderId.value){
+		if (!orderId.value) {
 			toast(
 				"无orderId!"
 			)
@@ -412,39 +415,39 @@
 			if (res.code == 0 && res.data) {
 				iapChannel.finishTransaction(data.transactionIdentifier)
 				console.log('resiapChanneliapChanneliapChannel', res);
-			orderCheck({
-				id: orderId.value
-			}).then(res3 => {
-				console.log('res3', res3);
-				if (res3.code == 0&&res3.data.success) {
-					genggaiVip(res3.data)
-				} else {
-					setTimeout(() => {
-						orderCheck({
-							id: orderId.value
-						}).then(res4 => {
-							if (res4.code == 0&&res4.data.success) {
-								genggaiVip(res4.data)
-							} else {
-								toast(
-									"开通失败,请联系管理员!"
-								)
-								uni
-									.hideLoading();
+				orderCheck({
+					id: orderId.value
+				}).then(res3 => {
+					console.log('res3', res3);
+					if (res3.code == 0 && res3.data.success) {
+						genggaiVip(res3.data)
+					} else {
+						setTimeout(() => {
+							orderCheck({
+								id: orderId.value
+							}).then(res4 => {
+								if (res4.code == 0 && res4.data.success) {
+									genggaiVip(res4.data)
+								} else {
+									toast(
+										"开通失败,请联系管理员!"
+									)
+									uni
+										.hideLoading();
+									return false
+								}
+							}).catch(() => {
+								uni.hideLoading();
+								toast("check接口报错")
 								return false
-							}
-						}).catch(() => {
-							uni.hideLoading();
-							toast("check接口报错")
-							return false
-						})
-					}, 5000)
-				}
-			}).catch(() => {
-				uni.hideLoading();
-				toast("check接口报错")
-				return false
-			})
+							})
+						}, 5000)
+					}
+				}).catch(() => {
+					uni.hideLoading();
+					toast("check接口报错")
+					return false
+				})
 			} else {
 
 				iapChannel.finishTransaction(data.transactionIdentifier)
@@ -539,7 +542,7 @@
 		}).then(res2 => {
 			uni.hideLoading();
 			console.log('res2', res2);
-			if(res2.code !=0){
+			if (res2.code != 0) {
 				return false
 			}
 			uni.requestPayment({
@@ -566,7 +569,7 @@
 						id: orderId.value
 					}).then(res3 => {
 						console.log('res3', res3);
-						if (res3.code == 0&&res3.data.success) {
+						if (res3.code == 0 && res3.data.success) {
 
 							genggaiVip(res3.data)
 						} else {
@@ -574,7 +577,7 @@
 								orderCheck({
 									id: orderId.value
 								}).then(res4 => {
-									if (res4.code == 0&&res4.data.success) {
+									if (res4.code == 0 && res4.data.success) {
 										genggaiVip(res4.data)
 									} else {
 										toast(
@@ -617,7 +620,7 @@
 		}).then(res2 => {
 			console.log('res2', res2);
 			uni.hideLoading();
-			if(res2.code !=0){
+			if (res2.code != 0) {
 				return false
 			}
 			uni.requestPayment({
@@ -634,7 +637,7 @@
 					orderCheck({
 						id: orderId.value
 					}).then(res3 => {
-						if (res3.code == 0&&res3.data.success) {
+						if (res3.code == 0 && res3.data.success) {
 							genggaiVip(res3.data)
 						} else {
 							setTimeout(() => {
@@ -642,7 +645,7 @@
 									id: orderId.value
 								}).then(res4 => {
 									if (res4.code ==
-										0&&res4.data.success) {
+										0 && res4.data.success) {
 										genggaiVip(res4.data)
 									} else {
 										toast(
@@ -811,7 +814,7 @@
 		const opt = {
 			page: 1,
 			size: 10, // 固定查询10条
-			status: Number(code)  // 前台索引加1为学科cardId
+			status: Number(code) // 前台索引加1为学科cardId
 		}
 
 		if (code == 0) {
@@ -927,9 +930,9 @@
 
 	}
 	onLoad((options) => {
-		dingdanData.current = Number(options.status)  || dingdanData.current
+		dingdanData.current = Number(options.status) || dingdanData.current
 		getMore(dingdanData.current);
-			isIOSorAndroid()
+		isIOSorAndroid()
 	})
 </script>