guhongwei 2 years ago
parent
commit
2bcfcc30d9
2 changed files with 184 additions and 3 deletions
  1. 1 1
      pages/index/index.vue
  2. 183 2
      pages/week/index.vue

+ 1 - 1
pages/index/index.vue

@@ -33,7 +33,7 @@
 							data: res,
 							data: res,
 							success: function() {
 							success: function() {
 								uni.redirectTo({
 								uni.redirectTo({
-									url: `/pages/home/index`
+									url: `/pages/week/index`
 								})
 								})
 							}
 							}
 						});
 						});

+ 183 - 2
pages/week/index.vue

@@ -1,6 +1,40 @@
 <template>
 <template>
 	<mobile-frame :frameStyle="frameStyle" @toPath="toPath">
 	<mobile-frame :frameStyle="frameStyle" @toPath="toPath">
-		周边
+		<view class="main">
+			<view class="one">
+				<input type="text" placeholder="搜索商品" @tap="toCommon('pagesHome/market/search')" placeholder-class="placss">
+			</view>
+			<view class="two">
+				<view class="two_1">
+					<scroll-view scroll-y="true" class="scroll-view">
+						<view class="list-scroll-view">
+							<view class="list" :class="[active==index?'listActive':'']" v-for="(item,index) in typeList" :key="index" @tap="toChange(index,item)">
+								<text>{{item.label}}</text>
+							</view>
+						</view>
+					</scroll-view>
+				</view>
+				<view class="two_2">
+					<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')">
+								<view class="title">
+									{{item.label}}
+								</view>
+								<view class="market">
+									<view class="marketList" v-for="(tag,indexs) in item.children" :key="indexs">
+										<image class="image" :src="tag.file&&tag.file.length>0?tag.file[0].url:''" mode=""></image>
+										<view class="name">
+											{{tag.label}}
+										</view>
+									</view>
+								</view>
+							</view>
+						</view>
+					</scroll-view>
+				</view>
+			</view>
+		</view>
 	</mobile-frame>
 	</mobile-frame>
 </template>
 </template>
 
 
@@ -11,10 +45,51 @@
 				frameStyle: {
 				frameStyle: {
 					useBar: true
 					useBar: true
 				},
 				},
+				active: '0',
+				typeList: [],
+				list: []
 			};
 			};
 		},
 		},
-		onShow: function() {},
+		onShow: function() {
+			const that = this;
+			that.searchOther();
+		},
 		methods: {
 		methods: {
+			async searchOther() {
+				const that = this;
+				let res;
+				res = await that.$api(`/goodsTags`, 'GET', {
+					status: '0'
+				})
+				if (res.errcode == '0') {
+					that.$set(that, `typeList`, res.data);
+					if (res.total > 0) that.searchRight(res.data[0]);
+				}
+			},
+			toChange(index, e) {
+				const that = this;
+				that.$set(that, `active`, index);
+				that.searchRight(e);
+			},
+			// 查询左侧信息
+			async searchRight(e) {
+				const that = this;
+				let info = {};
+				if (e.id) info.pid = e.id;
+				const res = await that.$api(`/goodsTags/tree`, 'GET', {
+					...info
+				})
+				if (res.errcode == '0' && res.data.length > 0) {
+					that.$set(that, `list`, res.data[0].children)
+				}
+			},
+			// 公共跳转
+			toCommon(e) {
+				uni.navigateTo({
+					url: `/${e}`
+				})
+			},
+			// 菜单跳转
 			toPath(e) {
 			toPath(e) {
 				if (e && e.route && e.type == '0') {
 				if (e && e.route && e.type == '0') {
 					uni.redirectTo({
 					uni.redirectTo({
@@ -31,5 +106,111 @@
 </script>
 </script>
 
 
 <style lang="scss">
 <style lang="scss">
+	.main {
+		display: flex;
+		flex-direction: column;
+		width: 100vw;
+		height: 91vh;
+
+		.one {
+			padding: 2vw;
+			border: 1px solid var(--f1Color);
+
+			input {
+				background-color: var(--fFB1Color);
+				border-radius: 30px;
+				padding: 2vw;
+				color: var(--fffColor);
+				font-size: var(--font15Size);
+			}
+
+			.placss {
+				color: var(--fffColor);
+			}
+		}
+
+		.two {
+			height: 83vh;
+			display: flex;
+			flex-direction: row;
+
+			.two_1 {
+				position: relative;
+				width: 25vw;
+				background-color: #fafafa;
+				display: flex;
+				flex-direction: column;
+
+				.list {
+					text-align: center;
+					padding: 2.5vw 0;
+					border-bottom: 1px solid var(--f1Color);
+
+					text {
+						font-size: var(--font14Size);
+					}
+				}
+
+				.listActive {
+					background-color: var(--fffColor);
+				}
+			}
+
+			.two_2 {
+				padding: 2vw;
+				flex-grow: 1;
+				position: relative;
+				display: flex;
+				flex-direction: column;
+
+				.list {
+					margin: 0 0 2vw 0;
+					padding: 2vw;
+
+					.title {
+						font-size: var(--font16Size);
+						margin: 0 0 2vw 0;
+					}
+
+					.market {
+						display: flex;
+						flex-direction: row;
+						flex-wrap: wrap;
+
+						.marketList {
+							text-align: center;
+							margin: 0 2vw 2vw 0;
+							width: 22vw;
+
+							.image {
+								width: 100%;
+								height: 15vw;
+							}
+
+							.name {
+								font-size: var(--font14Size);
+							}
+						}
 
 
+						.marketList:nth-child(3n) {
+							margin: 0 0 2vw 0;
+						}
+					}
+				}
+			}
+		}
+	}
+
+	.scroll-view {
+		position: absolute;
+		top: 0;
+		left: 0;
+		right: 0;
+		bottom: 0;
+
+		.list-scroll-view {
+			display: flex;
+			flex-direction: column;
+		}
+	}
 </style>
 </style>