wangguoyu 1 week ago
parent
commit
26f2a70836
3 changed files with 116 additions and 53 deletions
  1. 33 10
      pages/mall/detailDialog.vue
  2. 34 9
      pages/mall/mallPage.vue
  3. 49 34
      pages/pay/order.vue

+ 33 - 10
pages/mall/detailDialog.vue

@@ -156,7 +156,7 @@
 			.filter(item => selectedIds.value.includes(item.id));
 			.filter(item => selectedIds.value.includes(item.id));
 		console.log('selectedItems', selectedItems);
 		console.log('selectedItems', selectedItems);
 		const cardIds = selectedItems.map(item => item.id);
 		const cardIds = selectedItems.map(item => item.id);
-		if (cardIds.length === 0) {
+		if (cardIds.length == 0) {
 			uni.showToast({
 			uni.showToast({
 				title: '请选择至少一个商品',
 				title: '请选择至少一个商品',
 				icon: 'none'
 				icon: 'none'
@@ -167,15 +167,38 @@
 			title: '',
 			title: '',
 			mask: true
 			mask: true
 		});
 		});
-		if (appleFlag.value.toString() == 'true') {
-			productId.value = 'llisoftEzhuangyuanceshi'
-		} else {
-			if (cardId.value == 1) {
-				productId.value = 'llisoftEzhuangyuan'
-			} else {
-				productId.value = 'llisoftEzhuangyuanYingyu'
-			}
-		}
+	
+	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
+	};
+	const firstId = cardIds.length > 0 ? cardIds[0] : null;
+	if (firstId) {
+		productId.value = productMap[firstId]
+		console.log('productId.value',productId.value);
+	} else {
+		toast("无对应产品Id,请练习管理员")
+		uni.hideLoading();
+		return false
+	}
 		let req = {
 		let req = {
 			cardIds: cardIds
 			cardIds: cardIds
 		}
 		}

+ 34 - 9
pages/mall/mallPage.vue

@@ -260,9 +260,8 @@
 		// 	})
 		// 	})
 		// }
 		// }
 	}
 	}
-
 	const creatOrderIos = debounce((data => {
 	const creatOrderIos = debounce((data => {
-		if (productData.selectedIds.length === 0) {
+		if (productData.selectedIds.length == 0) {
 			toast("请选择至少一个商品");
 			toast("请选择至少一个商品");
 			return;
 			return;
 		}
 		}
@@ -276,14 +275,36 @@
 			title: '',
 			title: '',
 			mask: true
 			mask: true
 		});
 		});
-		if (appleFlag.value.toString() == 'true') {
-			productId.value = 'llisoftEzhuangyuanceshi'
+		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
+		};
+		const firstId = cardIds.length > 0 ? cardIds[0] : null;
+		if (firstId) {
+			productId.value = productMap[firstId]
+			console.log('productId.value',productId.value);
 		} else {
 		} else {
-			if (cardId.value == 1) {
-				productId.value = 'llisoftEzhuangyuan'
-			} else {
-				productId.value = 'llisoftEzhuangyuanYingyu'
-			}
+			toast("无对应产品Id,请练习管理员")
+			uni.hideLoading();
+			return false
 		}
 		}
 		let req = {
 		let req = {
 			cardIds: cardIds
 			cardIds: cardIds
@@ -797,6 +818,10 @@
 				productData.current = Number(options.subjectId) - 1
 				productData.current = Number(options.subjectId) - 1
 				productData.cardId = options.cardId
 				productData.cardId = options.cardId
 				productData.from = options.from
 				productData.from = options.from
+			}else if(options.from == 'myPage'){
+				productData.current = Number(options.subjectId) - 1
+				productData.cardId = options.cardId
+				productData.from = options.from
 			} else {
 			} else {
 				productData.current = Number(cacheManager.get('auth').subjectId) - 1
 				productData.current = Number(cacheManager.get('auth').subjectId) - 1
 			}
 			}

+ 49 - 34
pages/pay/order.vue

@@ -65,16 +65,9 @@
 											@touchstart="creatOrder(item.cardList,index)">立即支付
 											@touchstart="creatOrder(item.cardList,index)">立即支付
 										</view>
 										</view>
 										<view v-if="currentPlatform =='ios'"
 										<view v-if="currentPlatform =='ios'"
-											class="pay-btn" @touchstart="creatOrderIos(item.cardList,index)">立即支付
+											class="pay-btn" @touchstart="creatOrderIos(item.cardList,index,item.id)">立即支付
 										</view>
 										</view>
 									</view>
 									</view>
-									<!-- 未付款显示付款按钮 wgy-->
-									<!-- 		<payComponents ref="payComponentsRef">
-										<view v-if="currentPlatform =='android'" class="pay-btn" @touchstart="creatOrder(item,index)">立即支付
-										</view>
-										<view v-if="currentPlatform =='ios'" class="pay-btn"
-											@touchstart="creatOrderIos(item,index)">立即支付</view>
-									</payComponents> -->
 								</template>
 								</template>
 							</uni-list-item>
 							</uni-list-item>
 							<uni-load-more :status="dingdanData.quanbu.state" @click="getMore(0)"
 							<uni-load-more :status="dingdanData.quanbu.state" @click="getMore(0)"
@@ -139,16 +132,10 @@
 											@touchstart="creatOrder(item.cardList,index)">立即支付
 											@touchstart="creatOrder(item.cardList,index)">立即支付
 										</view>
 										</view>
 										<view v-if="currentPlatform =='ios'"
 										<view v-if="currentPlatform =='ios'"
-											class="pay-btn" @touchstart="creatOrderIos(item.cardList,index)">立即支付
+											class="pay-btn" @touchstart="creatOrderIos(item.cardList,index,item.id)">立即支付
 										</view>
 										</view>
 									</view>
 									</view>
-									<!-- 未付款显示付款按钮 wgy-->
-									<!-- 		<payComponents ref="payComponentsRef">
-										<view v-if="currentPlatform =='android'" class="pay-btn" @touchstart="creatOrder(item,index)">立即支付
-										</view>
-										<view v-if="currentPlatform =='ios'" class="pay-btn"
-											@touchstart="creatOrderIos(item,index)">立即支付</view>
-									</payComponents> -->
+							
 								</template>
 								</template>
 							</uni-list-item>
 							</uni-list-item>
 							<uni-load-more :status="dingdanData.daiFukuan.state" @click="getMore(1)"
 							<uni-load-more :status="dingdanData.daiFukuan.state" @click="getMore(1)"
@@ -213,16 +200,10 @@
 											@touchstart="creatOrder(item.cardList,index)">立即支付
 											@touchstart="creatOrder(item.cardList,index)">立即支付
 										</view>
 										</view>
 										<view v-if="currentPlatform =='ios'"
 										<view v-if="currentPlatform =='ios'"
-											class="pay-btn" @touchstart="creatOrderIos(item.cardList,index)">立即支付
+											class="pay-btn" @touchstart="creatOrderIos(item.cardList,index,item.id)">立即支付
 										</view>
 										</view>
 									</view>
 									</view>
-									<!-- 未付款显示付款按钮 wgy-->
-									<!-- 		<payComponents ref="payComponentsRef">
-										<view v-if="currentPlatform =='android'" class="pay-btn" @touchstart="creatOrder(item,index)">立即支付
-										</view>
-										<view v-if="currentPlatform =='ios'" class="pay-btn"
-											@touchstart="creatOrderIos(item,index)">立即支付</view>
-									</payComponents> -->
+							
 								</template>
 								</template>
 							</uni-list-item>
 							</uni-list-item>
 							<uni-load-more :status="dingdanData.yiFukuan.state" @click="getMore(2)"
 							<uni-load-more :status="dingdanData.yiFukuan.state" @click="getMore(2)"
@@ -359,23 +340,57 @@
 		// }
 		// }
 	}
 	}
 
 
-	const creatOrderIos = debounce((data, index) => {
+	const creatOrderIos = debounce((data, index,orderId) => {
+
+
 
 
+		console.log('data',data[0].cardId);
+		console.log('index',index);
+		console.log('orderId',orderId);
+		return 
 		uni.showLoading({
 		uni.showLoading({
 			title: '',
 			title: '',
 			mask: true
 			mask: true
 		});
 		});
-		if (appleFlag.value.toString() == 'true') {
-			productId.value = 'llisoftEzhuangyuanceshi'
+		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
+		};
+		const firstId = data.length > 0 ? data[0].cardId : null;
+		if (firstId) {
+			productId.value = productMap[firstId]
+			console.log('productId.value',productId.value);
 		} else {
 		} else {
-			if (cardId.value == 1) {
-				productId.value = 'llisoftEzhuangyuan'
-			} else {
-				productId.value = 'llisoftEzhuangyuanYingyu'
-			}
+			toast("无对应产品Id,请练习管理员")
+			uni.hideLoading();
+			return false
 		}
 		}
 		uni.hideLoading();
 		uni.hideLoading();
-		orderId.value = data.id
+		orderId.value = orderId
+		if(!orderId.value){
+			toast(
+				"无orderId!"
+			)
+			return false
+		}
 		// 测试ios 1元
 		// 测试ios 1元
 		applePay()
 		applePay()
 
 
@@ -914,7 +929,7 @@
 	onLoad((options) => {
 	onLoad((options) => {
 		dingdanData.current = Number(options.status)  || dingdanData.current
 		dingdanData.current = Number(options.status)  || dingdanData.current
 		getMore(dingdanData.current);
 		getMore(dingdanData.current);
-		//	isIOSorAndroid()
+			isIOSorAndroid()
 	})
 	})
 </script>
 </script>