ソースを参照

Merge branch '2024鹅状元' of https://gogs.mtavip.com/wangguoyu/uniProject into 2024鹅状元

tanxue 1 ヶ月 前
コミット
47c41b402b

+ 12 - 0
api/productMall.js

@@ -10,3 +10,15 @@ export function getMallist(data = {}) {
     timeout: 20000
   })
 }
+
+export function mallCardInfo(data = {}) {
+  return request({
+    'url': '/app/card/info',
+    headers: {
+      isToken: true
+    },
+    method: 'post',
+    data,
+    timeout: 20000
+  })
+}

+ 18 - 9
pages/mall/detailDialog.vue

@@ -36,9 +36,10 @@
 				<view class="mall-left-box">
 					<view class="price-icon-box">
 						<text class="red-price fh-text">¥</text>
-						<text class="red-price">{{totalPrice}}</text>明细
-						<icon :class="mxjtClass"></icon>
+						<text class="red-price">{{totalPrice}}</text>
+
 					</view>
+					<view>购买即同意虚拟产品不支持退订</view>
 				</view>
 				<view class="pay-status-box" v-if="payType =='weixin'&&currentPlatform =='android'"
 					@click="switchPayWay">
@@ -94,19 +95,24 @@
 	const localList = ref([]);
 	const selectedIds = ref([]); // 存储选中项的id
 	let orderId = ref('');
+	let productId = ref(null)
+	let iapChannel = ref(null)
+	let quantity = ref(1)
+	let channel = ref('')
+	let appleFlag = ref('')
 	// 本地选中状态管理
 	const localSelectedMap = ref({});
 	let currentPlatform = ref('android')
 	// 初始化本地数据
 	// 初始化数据
-	watch(() => props.selectedList, (newVal) => {
+	// watch(() => props.selectedList, (newVal) => {
 
-		localList.value = [...newVal];
-		selectedIds.value = newVal.map(item => item.id); // 初始全部选中
+	// 	localList.value = [...newVal];
+	// 	selectedIds.value = newVal.map(item => item.id); // 初始全部选中
 
-	}, {
-		immediate: true
-	});
+	// }, {
+	// 	immediate: true
+	// });
 	onMounted(() => {
 		isIOSorAndroid()
 	})
@@ -523,7 +529,10 @@
 
 	const detailPopup = ref(null);
 
-	function detailShow() {
+	function detailShow(newVal) {
+		console.log('getSelectedProducts', newVal);
+		localList.value = [...newVal];
+		selectedIds.value = newVal.map(item => item.id); // 初始全部选中
 		detailPopup.value.open();
 	}
 

+ 41 - 13
pages/mall/mallPage.vue

@@ -16,14 +16,14 @@
 							class="mall-list-item">
 							<view class="mall-content-box">
 								<img :src='item.cover' class="mall-image" />
-								<view class="content-body-box">
+								<view class="content-body-box" :class="item.yigou ==1?'mall-yigou-box':''">
 									<view class="content-name">
 										<view class="name-text">{{item.name}}</view>
 									</view>
 									<view class="content-text">{{item.intro}}</view>
 									<view class="content-row">
 										<view class="content-yuanjia">原价:{{item.yuanjia}}</view>
-										<view class="shop-car-box" @click="addProduct(item)">
+										<view class="shop-car-box" v-if="item.yigou !=1" @click="addProduct(item)">
 											<icon v-if="productData.selectedIds.includes(item.id)" class="car-change">
 											</icon>
 										</view>
@@ -31,7 +31,7 @@
 								</view>
 							</view>
 							<view class="mall-bottom-row">
-								<view v-if="item.type ==1" class="kcb-btn" @click="productBtn">课程包明细<icon>
+								<view v-if="item.type ==1" class="kcb-btn" @click="productBtn(item)">课程包明细<icon>
 									</icon>
 								</view>
 								<view class="hdj-text">活动价:{{item.xianjia}}</view>
@@ -40,7 +40,34 @@
 					</scroll-view>
 				</view>
 				<view v-if="productData.current === 1">
-					<view>英语</view>
+				<scroll-view scroll-y="true" :scroll-into-view="scrollIntoId" class="order-scroll-view">
+					<!--数学-->
+					<view :id="'item-' + item.id" v-for="item in productData.list" :key="item.id"
+						class="mall-list-item">
+						<view class="mall-content-box" :class="item.yigou ==1?'mall-yigou-box':''">
+							<img :src='item.cover' class="mall-image" />
+							<view class="content-body-box">
+								<view class="content-name">
+									<view class="name-text">{{item.name}}</view>
+								</view>
+								<view class="content-text">{{item.intro}}</view>
+								<view class="content-row">
+									<view class="content-yuanjia">原价:{{item.yuanjia}}</view>
+									<view class="shop-car-box"  v-if="item.yigou !=1" @click="addProduct(item)">
+										<icon v-if="productData.selectedIds.includes(item.id)" class="car-change">
+										</icon>
+									</view>
+								</view>
+							</view>
+						</view>
+						<view class="mall-bottom-row">
+							<view v-if="item.type ==1" class="kcb-btn" @click="productBtn(item)">课程包明细<icon>
+								</icon>
+							</view>
+							<view class="hdj-text">活动价:{{item.xianjia}}</view>
+						</view>
+					</view>
+				</scroll-view>
 				</view>
 				<!-- 	<view v-if="productData.current === 2">
 					<view>语文</view>
@@ -75,8 +102,8 @@
 		</view>
 		<detail-dialog ref="mallDetailPopup" :selected-list="getSelectedProducts"></detail-dialog>
 
-		<!-- 
-		<product-dialog ref="mallProductPopup" @payBtn="payBtn"></product-dialog> -->
+
+		<product-dialog ref="mallProductPopup" @payBtn="payBtn"></product-dialog>
 	</view>
 </template>
 
@@ -145,13 +172,11 @@
 		payType.value = payType.value == 'weixin' ? 'zhifubao' : 'weixin'
 	}
 
-	function productBtn() {
-		mallProductPopup.value.detailShow();
+	function productBtn(item) {
+		mallProductPopup.value.detailShow(item.id);
 	}
 
 	function detailBtn() {
-
-
 		// // 获取选中商品的cardId列表
 		// const selectedProducts = productData.list.filter(
 		// 	item => productData.selectedIds.includes(item.id)
@@ -164,11 +189,14 @@
 			toast("请选择至少一个商品查看明细");
 			return;
 		}
-
+		
 		showDetail.value = !showDetail.value;
-		if (showDetail.value) {
+		if (showDetail.value) {
+			 const selected = productData.list.filter(item =>
+			    productData.selectedIds.includes(item.id)
+			  );
 			mxjtClass.value = 'mxjt-zk-icon';
-			mallDetailPopup.value.detailShow();
+			mallDetailPopup.value.detailShow(selected);
 		} else {
 			mxjtClass.value = 'mxjt-sq-icon';
 			mallDetailPopup.value.detailCloseBtn();

+ 52 - 26
pages/mall/productDialog.vue

@@ -1,43 +1,69 @@
 <template>
 	<uni-popup ref="detailPopup" :animation="false" :is-mask-click="false"
-	 mask-background-color="rgba(51, 137, 217, 0.65);" style="z-index: 101;">
-	 <view class="mall-detail-dialog">
-		 <view class="detail-content-box">
-			 <icon class="cpmx-title"></icon>
-			 <icon class="dialog-close-btn" @click="detailCloseBtn"></icon>
-			 <view class="product-body-box">
-				 <!-- ↓需要换成从接口中取得 wgy -->
-			 	<view class="detail-item-box">
-			 		<img src="/static/images/my/about-icon.png" class="mall-image"/>
-			 		<view class="content-body-box">
-			 			<view class="content-name">
-			 				<view class="name-text">数学暑假进阶L1</view>
-			 			</view>
-			 			<view class="content-text">适用于L1和学前,介绍介绍,适用于L1和学前,介绍介绍适用于L1和学前,介绍介绍</view>
-			 		</view>
-			 	</view>
-			 </view>
-		 </view>
-	 </view>
+		mask-background-color="rgba(51, 137, 217, 0.65);" style="z-index: 101;">
+		<view class="mall-detail-dialog">
+			<view class="detail-content-box">
+				<icon class="cpmx-title"></icon>
+				<icon class="dialog-close-btn" @click="detailCloseBtn"></icon>
+				<view class="product-body-box">
+					<!-- ↓需要换成从接口中取得 wgy -->
+					<view class="detail-item-box" v-for="(item,index) in productList " :key="index">
+						<img :src="item.cover" class="mall-image" />
+						<view class="content-body-box">
+							<view class="content-name">
+								<view class="name-text">{{item.name}}</view>
+							</view>
+							<view class="content-text">{{item.intro}}</view>
+						</view>
+					</view>
+				</view>
+			</view>
+		</view>
 	</uni-popup>
 </template>
 
 <script setup>
-	import { ref } from 'vue';
+	import {
+		mallCardInfo
+	} from "@/api/productMall.js"
+	import {
+		toast,
+		debounce,
+		getUserIdentity
+	} from "@/utils/common";
+	import {
+		ref
+	} from 'vue';
 	const $emit = defineEmits(['payBtn'])
 	const detailPopup = ref(null); // 索引
+	let productList = ref([])
 	// 打开弹窗
-	function detailShow() {
-		detailPopup.value.open();
+	function detailShow(data) {
+
+		let req = {
+			id: data
+		}
+		mallCardInfo(req).then(res => {
+			console.log('res', res);
+			if (res.code == 0) {
+				productList.value = res.data
+				detailPopup.value.open();
+			} else {
+				toast('获取产品明细失败')
+				return false
+			}
+		})
+
 	}
 	// 开启提分之旅按钮
-	function detailPayBtn(){
+	function detailPayBtn() {
 		$emit('payBtn')
 	}
-	function detailCloseBtn(){
+
+	function detailCloseBtn() {
 		detailPopup.value.close();
 	}
 	defineExpose({
-			detailShow
-		})
+		detailShow
+	})
 </script>

+ 25 - 11
pages/selectGradesTerms/index.vue

@@ -8,16 +8,18 @@
 			<view :key="xueke.id" @click="handleSelectXueke(xueke)" v-for="xueke in xuekeData"
 				:class="['grade-item',{active: xueke.id == activeXueke}]">{{xueke.lable}}</view>
 		</view>
-		<view class="subject-body">
-			<view class="subject-content-box">
-				<!-- 产品 -->
-				<view v-for="item in xuekeList" :key="item.id" @click="handleSelectGrade(item)"
-					:class="['subject-item', {active: item.id == activeProduct}]">
-						<img :src="item.cover" class="subject-item-img" />
-						<view class="subject-item-text">{{item.lable}}</view>
+		<scroll-view scroll-y="true" class="subject-body"  :scroll-into-view="scrollTop">
+			<!-- <view class="subject-body"> -->
+				<view class="subject-content-box">
+					<!-- 产品 -->
+					<view v-for="item in xuekeList" :key="item.id" :id="`s_${item.id}`"  @click="handleSelectGrade(item)"
+						:class="['subject-item', {active: item.id == activeProduct}]">
+							<img :src="item.cover" class="subject-item-img" />
+							<view class="subject-item-text">{{item.lable}}</view>
+					</view>
 				</view>
-			</view>
-		</view>
+			<!-- </view> -->
+		</scroll-view>
 		<view class="grade-line"></view>
 		<button class="grade-confirm-btn" @click="handleConfirm"></button>
 	</view>
@@ -27,7 +29,8 @@
 	import {
 		reactive,
 		toRefs,
-		computed
+		computed,
+		nextTick
 	} from "vue";
 	import * as httpApi from "@/api/selectGradesTerms.js";
 	import {
@@ -52,7 +55,12 @@
 			activeXueke: 1, // 当前学期
 			activeTipFlag: null, // 当前学期
 			xuekeData: [], // 学科总数据
+			scrollTop: '',
 		});
+		
+		function handleScroll() {
+			
+		}
 
 		onLoad(({
 			productId,
@@ -92,6 +100,11 @@
 					data.activeProduct = null;
 					data.activeXueke = 1
 				}
+				
+				nextTick(() => {
+					// 滚动到某个元素显示
+					data.scrollTop = `s_${data.activeProduct}`
+				})
 			})
 		}
 
@@ -180,7 +193,8 @@
 		activeXueke,
 		xuekeData,
 		handleConfirm,
-		handleBack
+		handleBack,
+		scrollTop
 	} = useSelectGrade()
 
 	const xuekeList = computed(() => {