guhongwei 2 years ago
parent
commit
7903a3d1ab
4 changed files with 248 additions and 166 deletions
  1. 1 1
      pages.json
  2. 1 1
      pages/home/index.vue
  3. 0 164
      pagesHome/market/sort.vue
  4. 246 0
      pagesHome/market/type.vue

+ 1 - 1
pages.json

@@ -127,7 +127,7 @@
 					}
 				},
 				{
-					"path": "market/sort",
+					"path": "market/type",
 					"style": {
 						"navigationBarTitleText": "商品分类"
 					}

+ 1 - 1
pages/home/index.vue

@@ -83,7 +83,7 @@
 					{
 						name: '商品分类',
 						url: require('@/static/logo.png'),
-						route: 'pagesHome/market/sort'
+						route: 'pagesHome/market/type'
 					},
 					{
 						name: '首农专区',

+ 0 - 164
pagesHome/market/sort.vue

@@ -1,164 +0,0 @@
-<template>
-	<mobile-frame>
-		<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">
-					<view class="list" v-for="(item,index) in typeList" :key="index">
-						<text>{{item.name}}</text>
-					</view>
-				</view>
-				<view class="two_2">
-					<view class="marketList" v-for="(tag,indexs) in marketList" :key="indexs">
-						<view class="title">
-							{{tag.name}}
-						</view>
-					</view>
-				</view>
-			</view>
-		</view>
-	</mobile-frame>
-</template>
-
-<script>
-	export default {
-		data() {
-			return {
-				active: '0',
-				typeList: [ //商品分类
-					{
-						name: '休闲食品'
-					},
-					{
-						name: '进口食品'
-					},
-					{
-						name: '粮油调味'
-					},
-					{
-						name: '酒饮冲调'
-					},
-					{
-						name: '时令水果'
-					},
-					{
-						name: '品质生鲜'
-					},
-					{
-						name: '居家用品'
-					},
-					{
-						name: '个护清洁'
-					},
-					{
-						name: '3C产品'
-					},
-					{
-						name: '母婴玩具'
-					},
-					{
-						name: '服饰配件'
-					},
-					{
-						name: '礼卡专区'
-					},
-					{
-						name: '植物饮食'
-					}
-				],
-				marketList: [ //产品列表
-					{
-						name: '坚果炒货'
-
-					},
-					{
-						name: '坚果炒货'
-					}
-				]
-			};
-		},
-		onShow: function() {},
-		methods: {
-
-		}
-	}
-</script>
-
-<style lang="scss">
-	.main {
-		display: flex;
-		flex-direction: column;
-		width: 100vw;
-		height: 100vh;
-
-		.one {
-			border-bottom: 1px solid var(--f85Color);
-			padding: 2vw;
-
-			input {
-				padding: 2vw;
-				background-color: var(--f1Color);
-				font-size: var(--font14Size);
-				border-radius: 5px;
-			}
-		}
-
-		.two {
-			position: relative;
-			flex-grow: 1;
-			display: flex;
-			flex-direction: row;
-
-			.two_1 {
-				width: 25vw;
-				height: 91vh;
-				background-color: #FAFAFA;
-
-				.list {
-					text-align: center;
-					padding: 2.5vw 0;
-					border-bottom: 1px solid #ff0000;
-
-					text {
-						font-size: 14px;
-					}
-				}
-			}
-
-			.two_2 {
-				width: 75vw;
-				border: 1px solid #0000ff;
-
-				// .marketList {
-				// 	.title {
-				// 		font-size: 16px;
-				// 		margin: 0 0 2vw 0;
-				// 	}
-
-				// 	.market {
-				// 		display: flex;
-				// 		flex-direction: row;
-				// 		justify-content: space-around;
-				// 		flex-wrap: wrap;
-
-				// 		.list {
-				// 			text-align: center;
-
-				// 			.image {
-				// 				width: 10vw;
-				// 				height: 10vw;
-				// 			}
-
-				// 			.name {
-				// 				font-size: 14px;
-				// 			}
-				// 		}
-				// 	}
-				// }
-			}
-
-		}
-	}
-</style>

+ 246 - 0
pagesHome/market/type.vue

@@ -0,0 +1,246 @@
+<template>
+	<mobile-frame>
+		<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.name}}</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">
+								<view class="title">
+									{{item.name}}
+								</view>
+								<view class="market">
+									<view class="marketList" v-for="(tag,indexs) in item.marketList" :key="indexs">
+										<image class="image" :src="tag.url" mode=""></image>
+										<view class="name">
+											{{tag.name}}
+										</view>
+									</view>
+								</view>
+							</view>
+						</view>
+					</scroll-view>
+				</view>
+			</view>
+		</view>
+	</mobile-frame>
+</template>
+
+<script>
+	export default {
+		name: 'sort',
+		data() {
+			return {
+				active: '0',
+				typeList: [ //商品分类
+					{
+						name: '休闲食品'
+					},
+					{
+						name: '进口食品'
+					},
+					{
+						name: '粮油调味'
+					},
+					{
+						name: '酒饮冲调'
+					},
+					{
+						name: '时令水果'
+					},
+					{
+						name: '品质生鲜'
+					},
+					{
+						name: '居家用品'
+					},
+					{
+						name: '个护清洁'
+					},
+					{
+						name: '3C产品'
+					},
+					{
+						name: '母婴玩具'
+					},
+					{
+						name: '服饰配件'
+					},
+					{
+						name: '礼卡专区'
+					},
+					{
+						name: '植物饮食'
+					}
+				],
+				list: [ //
+					{
+						name: '商品一',
+						marketList: [ //
+							{
+								url: require('@/static/test.png'),
+								name: '核桃'
+							},
+							{
+								url: require('@/static/test.png'),
+								name: '核桃'
+							},
+							{
+								url: require('@/static/test.png'),
+								name: '核桃'
+							},
+							{
+								url: require('@/static/test.png'),
+								name: '核桃2'
+							}
+						]
+					},
+					{
+						name: '商品二',
+						marketList: [ //
+							{
+								url: require('@/static/test.png'),
+								name: '核桃'
+							},
+							{
+								url: require('@/static/test.png'),
+								name: '核桃2'
+							}
+						]
+					}
+				]
+
+			};
+		},
+		onShow: function() {},
+		methods: {
+			toChange(index, e) {
+				const that = this;
+				that.$set(that, `active`, index)
+			},
+			// 公共跳转
+			toCommon(e) {
+				uni.navigateTo({
+					url: `/${e}`
+				})
+			},
+		}
+	}
+</script>
+
+<style lang="scss">
+	.main {
+		display: flex;
+		flex-direction: column;
+		width: 100vw;
+		height: 100vh;
+
+		.one {
+			border-bottom: 1px solid var(--f85Color);
+			padding: 2vw;
+
+			input {
+				padding: 2vw;
+				background-color: var(--f1Color);
+				font-size: var(--font14Size);
+				border-radius: 5px;
+			}
+		}
+
+		.two {
+			height: 91vh;
+			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>