zs 2 rokov pred
rodič
commit
73f9a08c99
3 zmenil súbory, kde vykonal 87 pridanie a 22 odobranie
  1. 22 9
      pages/week/index.vue
  2. 43 4
      pagesHome/market/search.vue
  3. 22 9
      pagesHome/market/type.vue

+ 22 - 9
pages/week/index.vue

@@ -20,13 +20,13 @@
 					<scroll-view scroll-y="true" class="scroll-view">
 						<view class="list-scroll-view">
 							<view class="list" v-for="(item,index) in list" :key="index"
-								@tap="toCommon('pagesHome/market/search',item)">
+								@tap="toCommon('pagesHome/market/search',item,'2')">
 								<view class="title">
 									{{item.label}}
 								</view>
 								<view class="market" v-if="item.children&&item.children.length>0">
 									<view class="marketList" v-for="(tag,indexs) in item.children" :key="indexs"
-										@tap.stop="toCommon('pagesHome/market/search',tag)">
+										@tap.stop="toCommon('pagesHome/market/search',tag,'3')">
 										<image class="image" :src="tag.file&&tag.file.length>0?tag.file[0].url:''"
 											mode=""></image>
 										<view class="name">
@@ -35,7 +35,7 @@
 									</view>
 								</view>
 								<view class="market" v-else>
-									<view class="marketList" @tap.stop="toCommon('pagesHome/market/search',item)">
+									<view class="marketList" @tap.stop="toCommon('pagesHome/market/search',item,'3')">
 										<image class="image" :src="item.file&&item.file.length>0?item.file[0].url:''"
 											mode=""></image>
 										<view class="name">
@@ -61,7 +61,9 @@
 				},
 				active: '0',
 				typeList: [],
-				list: []
+				list: [],
+				// 一级
+				classa: {},
 			};
 		},
 		onLoad: function() {
@@ -77,7 +79,10 @@
 				})
 				if (res.errcode == '0') {
 					that.$set(that, `typeList`, res.data);
-					if (res.total > 0) that.searchRight(res.data[0]);
+					if (res.total > 0) {
+						that.searchRight(res.data[0]);
+						that.$set(that, `classa`, res.data[0]);
+					}
 				}
 			},
 			toChange(index, e) {
@@ -85,6 +90,7 @@
 				that.$set(that, `list`, []);
 				that.$set(that, `active`, index);
 				that.searchRight(e);
+				that.$set(that, `classa`, e);
 			},
 			// 查询左侧信息
 			async searchRight(e) {
@@ -99,10 +105,17 @@
 				}
 			},
 			// 公共跳转
-			toCommon(e, code) {
-				uni.navigateTo({
-					url: `/${e}?tags=${code.code}`
-				})
+			toCommon(e, code, num) {
+				const that = this;
+				if (num == '2') {
+					uni.navigateTo({
+						url: `/${e}?tags=${code.code}&pid=${that.classa._id}`
+					})
+				} else {
+					uni.navigateTo({
+						url: `/${e}?tags=${code.code}`
+					})
+				}
 			},
 			// 菜单跳转
 			toPath(e) {

+ 43 - 4
pagesHome/market/search.vue

@@ -26,6 +26,12 @@
 									</view>
 								</view>
 							</view>
+							<view class="screenList" v-if="pid">
+								<picker @change="screenChange" name="screen" :value="screen" :range="screenList"
+									range-key="label">
+									<view class="uni-input">{{screen_name||'筛选'}}</view>
+								</picker>
+							</view>
 						</view>
 						<view class="two_2">
 							<view class="list" v-for="(item,index) in list" :key="index" @tap="toBuy(item)">
@@ -63,6 +69,8 @@
 		data() {
 			return {
 				tags: '',
+				// 一级id
+				pid: '',
 				searchInfo: {},
 				list: [],
 				total: 0,
@@ -97,21 +105,51 @@
 						xia: 'icon-xiajiantou',
 						xiaActive: 'icon-xiajiantou-copy'
 					}
-				]
+				],
+				// 筛选
+				screenList: [],
+				screen: '',
+				screen_name: ''
 			};
 		},
 		onLoad: async function(e) {
 			const that = this;
 			that.$set(that, `tags`, e.tags || '');
-			that.search();
+			that.$set(that, `pid`, e.pid || '');
+			await that.searchOther();
+			await that.search();
 		},
 		methods: {
+			// 选择二级
+			screenChange(e) {
+				const that = this;
+				let data = that.screenList[e.detail.value];
+				if (data) {
+					that.$set(that, `tags`, data.code);
+					that.$set(that, `screen_name`, data.label);
+					that.clearPage();
+					that.search();
+				}
+			},
+			async searchOther() {
+				const that = this;
+				if (that.pid) {
+					let info = {};
+					info.pid = that.pid;
+					const res = await that.$api(`/goodsTags/tree`, 'GET', {
+						...info
+					})
+					if (res.errcode == '0' && res.data.length > 0) {
+						that.$set(that, `screenList`, res.data[0].children)
+					}
+				}
+			},
 			async search() {
 				const that = this;
 				let info = {
 					skip: that.skip,
 					limit: that.limit,
-					tags:that.tags
+					tags: that.tags
 				}
 				const res = await that.$api(`/viewGoods/indexGoodsList`, `GET`, {
 					...info,
@@ -320,10 +358,11 @@
 								font-size: var(--font12Size);
 							}
 						}
+
 						.other_1 {
 							font-size: var(--font12Size);
 							color: var(--f85Color);
-						
+
 							text {
 								font-weight: bold;
 								padding: 0 2vw;

+ 22 - 9
pagesHome/market/type.vue

@@ -20,13 +20,13 @@
 					<scroll-view scroll-y="true" class="scroll-view">
 						<view class="list-scroll-view">
 							<view class="list" v-for="(item,index) in list" :key="index"
-								@tap="toCommon('pagesHome/market/search',item)">
+								@tap="toCommon('pagesHome/market/search',item,'2')">
 								<view class="title">
 									{{item.label}}
 								</view>
 								<view class="market" v-if="item.children&&item.children.length>0">
 									<view class="marketList" v-for="(tag,indexs) in item.children" :key="indexs"
-										@tap.stop="toCommon('pagesHome/market/search',tag)">
+										@tap.stop="toCommon('pagesHome/market/search',tag,'3')">
 										<image class="image" :src="tag.file&&tag.file.length>0?tag.file[0].url:''"
 											mode=""></image>
 										<view class="name">
@@ -35,7 +35,7 @@
 									</view>
 								</view>
 								<view class="market" v-else>
-									<view class="marketList" @tap.stop="toCommon('pagesHome/market/search',item)">
+									<view class="marketList" @tap.stop="toCommon('pagesHome/market/search',item,'3')">
 										<image class="image" :src="item.file&&item.file.length>0?item.file[0].url:''"
 											mode=""></image>
 										<view class="name">
@@ -58,7 +58,9 @@
 			return {
 				active: '0',
 				typeList: [],
-				list: []
+				list: [],
+				// 一级
+				classa: {},
 			};
 		},
 		onLoad: function() {
@@ -75,7 +77,10 @@
 				})
 				if (res.errcode == '0') {
 					that.$set(that, `typeList`, res.data);
-					if (res.total > 0) that.searchRight(res.data[0]);
+					if (res.total > 0) {
+						that.searchRight(res.data[0]);
+						that.$set(that, `classa`, res.data[0]);
+					}
 				}
 			},
 			toChange(index, e) {
@@ -83,6 +88,7 @@
 				that.$set(that, `list`, []);
 				that.$set(that, `active`, index);
 				that.searchRight(e);
+				that.$set(that, `classa`, e);
 			},
 			// 查询左侧信息
 			async searchRight(e) {
@@ -97,10 +103,17 @@
 				}
 			},
 			// 公共跳转
-			toCommon(e, code) {
-				uni.navigateTo({
-					url: `/${e}?tags=${code.code}`
-				})
+			toCommon(e, code, num) {
+				const that = this;
+				if (num == '2') {
+					uni.navigateTo({
+						url: `/${e}?tags=${code.code}&pid=${that.classa._id}`
+					})
+				} else {
+					uni.navigateTo({
+						url: `/${e}?tags=${code.code}`
+					})
+				}
 			},
 		},