zs 2 年之前
父节点
当前提交
63456f1679
共有 1 个文件被更改,包括 710 次插入0 次删除
  1. 710 0
      pagesHome/shop/index.vue

+ 710 - 0
pagesHome/shop/index.vue

@@ -0,0 +1,710 @@
+<template>
+	<mobile-frame>
+		<view class="main">
+			<view class="one">
+				<view class="one_1" v-if="barActive=='0'">
+					<view class="first">
+						<image class="image" :src="oneUrl" mode=""></image>
+					</view>
+					<view class="second">
+						<scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage">
+							<view class="list-scroll-view">
+								<view class="list" v-for="(item,index) in list" :key="index"
+									@tap="toCommon('pagesHome/order/detail')">
+									<image class="image" :src="item.url" mode=""></image>
+									<view class="name">
+										{{item.name}}
+									</view>
+									<view class="other">
+										<view class="money">
+											<text>¥</text>
+											<text>{{item.money}}</text>
+										</view>
+										<view class="btn">
+											<button type="default" size="mini">购买</button>
+										</view>
+									</view>
+								</view>
+							</view>
+						</scroll-view>
+					</view>
+				</view>
+				<view class="one_2" v-else-if="barActive=='1'">
+					商品分类
+				</view>
+				<view class="one_3" v-else-if="barActive=='2'">
+					<view class="first">
+						<input type="text" v-model="searchInfo.name" @input="toInput" placeholder="搜索商品">
+					</view>
+					<view class="second">
+						<scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage">
+							<view class="list-scroll-view">
+								<view class="second_1">
+									<view :class="['list',condActive==index?'activeList':'']"
+										v-for="(item,index) in condList" :key="index" @tap="toCond(index,item)">
+										<view class="name">
+											{{item.name}}
+										</view>
+										<view class="icon">
+											<view class="icon_1">
+												<text :class="['iconfont',item.shangActive]"
+													v-if="condActive==index&&shang==true"></text>
+												<text :class="['iconfont',item.shang]" v-else></text>
+											</view>
+											<view class="icon_1">
+												<text :class="['iconfont', item.xiaActive]"
+													v-if="condActive==index&&xia==true"></text>
+												<text :class="['iconfont', item.xia]" v-else></text>
+											</view>
+										</view>
+									</view>
+								</view>
+								<view class="second_2">
+									<view class="list" v-for="(item,index) in allList" :key="index">
+										<image class="image" :src="item.file&&item.file.length>0?item.file[0].url:''"
+											mode=""></image>
+										<view class="sale" v-if="item.is_sale==true">
+											<text>已售尽</text>
+										</view>
+										<view class="name">
+											{{item.name}}
+										</view>
+										<view class="other">
+											<view class="money">
+												<text>¥</text>
+												<text>{{item.sell_money}}</text>
+											</view>
+											<view class="other_1">{{item.evaluate||0}}人评价</view>
+											<view class="btn" v-if="item.is_sale==false">
+												<text class="iconfont icon-gouwuche"></text>
+											</view>
+										</view>
+									</view>
+								</view>
+							</view>
+						</scroll-view>
+					</view>
+				</view>
+				<view class="one_4" v-else-if="barActive=='3'">
+					<view class="first">
+						<image class="image" :src="info.url" mode=""></image>
+						<view class="name">{{info.name}}</view>
+					</view>
+					<view class="second">
+						<view class="second_1">
+							<view class="grade">
+								<view>{{info.grade||'5'}}</view>
+								商品
+							</view>
+							<view class="grade">
+								<view>{{info.grade||'5'}}</view>
+								发货
+							</view>
+							<view class="grade">
+								<view>{{info.grade||'5'}}</view>
+								服务
+							</view>
+						</view>
+						<view class="second_2">
+							<view class="second_2_bor">
+								<image class="image" :src="info.url" mode=""></image>
+							</view>
+							<view class="txt">
+								店铺二维码
+							</view>
+						</view>
+					</view>
+					<view class="collect">
+						<text v-if="!collection" @click="toCollect" class="iconfont icon-yduishoucangkongxin"></text>
+						<text v-else @click="toCollect" class="iconfont icon-yduishoucangshixin"></text>
+					</view>
+				</view>
+			</view>
+			<view class="two">
+				<view class="list" v-for="(item,index) in barList" :key="index" @tap="barChange(index,item)">
+					<view class="icon">
+						<text :class="['iconfont',barActive==index?item.acticon:item.icon]"></text>
+					</view>
+					<view :class="['name',barActive==index?'activename':'']">
+						{{item.name}}
+					</view>
+				</view>
+			</view>
+		</view>
+	</mobile-frame>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				barActive: '0',
+				barList: [ //底部菜单
+					{
+						icon: 'icon-shangdian',
+						acticon: "icon-shangdian-copy",
+						name: '微店首页'
+					}, {
+						icon: 'icon-fenlei',
+						acticon: "icon-fenlei-copy",
+						name: '商品分类'
+					}, {
+						icon: 'icon-shangpinfenlei',
+						acticon: "icon-shangpinfenlei-copy",
+						name: '全部商品'
+					}, {
+						icon: 'icon-qiyejianjie',
+						acticon: "icon-qiyejianjie-copy",
+						name: '店铺简介'
+					}
+				],
+				oneUrl: require('@/static/test.png'),
+				info: {
+					url: require('@/static/test.png'),
+					name: '首农食品旗舰店',
+					money: 100,
+				},
+				list: [ //
+					{
+						url: require('@/static/test.png'),
+						name: '商品名称',
+						money: 100,
+					},
+					{
+						url: require('@/static/test.png'),
+						name: '商品名称',
+						money: 100,
+					},
+					{
+						url: require('@/static/test.png'),
+						name: '商品名称',
+						money: 100,
+					},
+					{
+						url: require('@/static/test.png'),
+						name: '商品名称',
+						money: 100,
+					},
+					{
+						url: require('@/static/test.png'),
+						name: '商品名称',
+						money: 100,
+					},
+				],
+				// 收藏
+				collection: false,
+				searchInfo: {},
+				allList: [{
+					"_id": "63353758101f3c01048c4f61",
+					"file": [{
+						"id": "20220929141236",
+						"name": "f0e22552dddcf494f9720c655a8420a.png",
+						"uri": "/files/point/goods/20220929141236.png",
+						"url": "https://broadcast.waityou24.cn/files/point/goods/20220929141236.png",
+						"uid": 1664431956868,
+						"status": "success"
+					}],
+					"name": "test",
+					"sell_money": 0.1
+				}, {
+					"_id": "63355854a4e39d34f499904a",
+					"file": [{
+						"id": "20220929163309",
+						"name": "f0e22552dddcf494f9720c655a8420a.png",
+						"uri": "/files/point/goods/20220929163309.png",
+						"url": "https://broadcast.waityou24.cn/files/point/goods/20220929163309.png",
+						"uid": 1664440389135,
+						"status": "success"
+					}, {
+						"id": "20220929163312",
+						"name": "1469_ev_etc05a.jpg",
+						"uri": "/files/point/goods/20220929163312.jpg",
+						"url": "https://broadcast.waityou24.cn/files/point/goods/20220929163312.jpg",
+						"uid": 1664440392548,
+						"status": "success"
+					}, {
+						"id": "20220929163316",
+						"name": "f0e22552dddcf494f9720c655a8420a.png",
+						"uri": "/files/point/goods/20220929163316.png",
+						"url": "https://broadcast.waityou24.cn/files/point/goods/20220929163316.png",
+						"uid": 1664440396001,
+						"status": "success"
+					}],
+					"name": "商品2",
+					"sell_money": 0.1
+				}, {
+					"_id": "633558c1a4e39d34f4999073",
+					"file": [{
+						"id": "20220929163502",
+						"name": "f0e22552dddcf494f9720c655a8420a.png",
+						"uri": "/files/point/goods/20220929163502.png",
+						"url": "https://broadcast.waityou24.cn/files/point/goods/20220929163502.png",
+						"uid": 1664440501843,
+						"status": "success"
+					}],
+					"name": "商品3",
+					"sell_money": 0.1
+				}, {
+					"_id": "63355975a4e39d34f49990a1",
+					"file": [{
+						"id": "20220929163805",
+						"name": "1469_ev_etc05a.jpg",
+						"uri": "/files/point/goods/20220929163805.jpg",
+						"url": "https://broadcast.waityou24.cn/files/point/goods/20220929163805.jpg",
+						"uid": 1664440685351,
+						"status": "success"
+					}, {
+						"id": "20220929163812",
+						"name": "f0e22552dddcf494f9720c655a8420a.png",
+						"uri": "/files/point/goods/20220929163812.png",
+						"url": "https://broadcast.waityou24.cn/files/point/goods/20220929163812.png",
+						"uid": 1664440692196,
+						"status": "success"
+					}],
+					"name": "商品4",
+					"sell_money": 0.1
+				}, {
+					"_id": "633559a7a4e39d34f49990a8",
+					"file": [{
+						"id": "20220929163900",
+						"name": "f0e22552dddcf494f9720c655a8420a.png",
+						"uri": "/files/point/goods/20220929163900.png",
+						"url": "https://broadcast.waityou24.cn/files/point/goods/20220929163900.png",
+						"uid": 1664440739910,
+						"status": "success"
+					}],
+					"name": "商品5",
+					"sell_money": 0.1
+				}, {
+					"_id": "633559dfa4e39d34f49990af",
+					"file": [{
+						"id": "20220929163955",
+						"name": "f0e22552dddcf494f9720c655a8420a.png",
+						"uri": "/files/point/goods/20220929163955.png",
+						"url": "https://broadcast.waityou24.cn/files/point/goods/20220929163955.png",
+						"uid": 1664440795110,
+						"status": "success"
+					}],
+					"name": "商品6",
+					"sell_money": 0.1
+				}],
+				condActive: 0,
+				shang: false,
+				xia: false,
+				condList: [ // 筛选
+					{
+						name: '默认',
+					},
+					{
+						name: '销量',
+						shang: 'icon-shangjiantou',
+						shangActive: 'icon-shangjiantou-copy',
+						xia: 'icon-xiajiantou',
+						xiaActive: 'icon-xiajiantou-copy'
+					},
+					{
+						name: '价格',
+						shang: 'icon-shangjiantou',
+						shangActive: 'icon-shangjiantou-copy',
+						xia: 'icon-xiajiantou',
+						xiaActive: 'icon-xiajiantou-copy'
+					},
+					{
+						name: '浏览量',
+						shang: 'icon-shangjiantou',
+						shangActive: 'icon-shangjiantou-copy',
+						xia: 'icon-xiajiantou',
+						xiaActive: 'icon-xiajiantou-copy'
+					}
+				]
+			};
+		},
+		onShow: function() {},
+		methods: {
+			// 选择底部菜单
+			barChange(index, item) {
+				const that = this;
+				that.$set(that, `barActive`, index);
+			},
+			// 公共跳转
+			toCommon(e) {
+				uni.navigateTo({
+					url: `/${e}`
+				})
+			},
+			// 输入框
+			toInput(e) {
+				const that = this;
+				that.$set(that.searchInfo, `name`, e.detail.value)
+			},
+			// 筛选
+			toCond(index, e) {
+				const that = this;
+				that.$set(that, `condActive`, index);
+				if (that.xia == false) {
+					that.$set(that, `shang`, false);
+					that.$set(that, `xia`, true);
+				} else if (that.xia == true) {
+					that.$set(that, `shang`, true);
+					that.$set(that, `xia`, false);
+				}
+			},
+			// 收藏
+			toCollect() {
+				const that = this;
+				that.collection = !that.collection;
+				if (that.collection == true) {
+					uni.showToast({
+						title: `收藏成功`,
+						icon: 'none'
+					})
+				} else {
+					uni.showToast({
+						title: `取消成功`,
+						icon: 'none'
+					})
+				}
+			},
+			// 分页
+			toPage() {}
+		}
+	}
+</script>
+
+<style lang="scss">
+	.main {
+		display: flex;
+		flex-direction: column;
+		width: 100vw;
+		height: 100vh;
+
+		.one {
+			position: relative;
+			flex-grow: 1;
+
+			.one_1 {
+				display: flex;
+				flex-direction: column;
+				width: 96vw;
+				height: 90vh;
+				padding: 2vw;
+				background-color: var(--fFB1Color);
+
+				.first {
+					margin: 0 0 2vw 0;
+
+					.image {
+						width: 100%;
+						height: 50vw;
+					}
+				}
+
+				.second {
+					position: relative;
+					flex-grow: 1;
+
+					.list {
+						margin: 0 2vw 2vw 0;
+						background-color: var(--fffColor);
+						padding: 2vw;
+						width: 43vw;
+						border-radius: 5px;
+
+						.image {
+							width: 100%;
+							height: 49vw;
+							margin: 0 0 1vw 0;
+						}
+
+						.name {
+							font-size: var(--font15Size);
+							margin: 0 0 2vw 0;
+						}
+
+						.other {
+							display: flex;
+							flex-direction: row;
+							justify-content: space-between;
+
+							.money {
+								color: var(--ff0Color);
+
+								text:nth-child(1) {
+									font-size: var(--font12Size);
+								}
+							}
+
+							.btn {
+								button {
+									border-radius: 25px;
+									color: var(--fffColor);
+									background-color: var(--ff0Color);
+									font-size: var(--font12Size);
+								}
+							}
+						}
+					}
+
+					.list:nth-child(2n) {
+						margin: 0 0 2vw 0;
+					}
+				}
+			}
+
+			.one_3 {
+				display: flex;
+				flex-direction: column;
+				width: 100vw;
+				height: 90vh;
+
+				.first {
+					border-bottom: 1px solid var(--f85Color);
+					padding: 2vw;
+
+					input {
+						padding: 2vw;
+						background-color: var(--f1Color);
+						font-size: var(--font14Size);
+						border-radius: 5px;
+					}
+				}
+
+				.second {
+					position: relative;
+					flex-grow: 1;
+
+					.second_1 {
+						width: 96vw;
+						background-color: var(--fffColor);
+						padding: 2vw;
+						display: flex;
+						flex-direction: row;
+						justify-content: space-around;
+
+						.list {
+							display: flex;
+							flex-direction: row;
+
+							.icon {
+								position: relative;
+								top: -5px;
+								left: 2px;
+
+								.icon_1 {
+									height: 10px;
+
+									.iconfont {
+										font-size: 12px;
+									}
+								}
+							}
+						}
+
+						.activeList {
+							.name {
+								color: #ff0000;
+							}
+
+						}
+					}
+
+					.second_2 {
+						display: flex;
+						flex-direction: row;
+						flex-wrap: wrap;
+						padding: 2vw 2vw 0 2vw;
+						background-color: var(--f1Color);
+
+						.list {
+							position: relative;
+							width: 43vw;
+							margin: 0 2vw 2vw 0;
+							padding: 2vw;
+							border-radius: 9px;
+							background-color: var(--fffColor);
+
+							.image {
+
+								width: 100%;
+								height: 40vw;
+							}
+
+							.sale {
+								position: absolute;
+								top: 18vw;
+								text-align: center;
+								width: 43vw;
+
+								text {
+									background-color: #0000005f;
+									border-radius: 90px;
+									display: inline-block;
+									width: 15vw;
+									height: 15vw;
+									color: var(--fffColor);
+									text-align: center;
+									line-height: 15vw;
+								}
+							}
+
+							.name {
+								font-size: var(--font16Size);
+								margin: 0 0 1vw 0;
+							}
+
+							.other {
+								display: flex;
+								flex-direction: row;
+								justify-content: space-between;
+
+								.money {
+									font-size: var(--font14Size);
+									color: var(--ff0Color);
+
+									text:nth-child(1) {
+										font-size: var(--font12Size);
+									}
+								}
+
+								.other_1 {
+									flex-grow: 1;
+									margin: 0 0 0 2vw;
+									font-size: var(--font12Size);
+									color: var(--f85Color);
+								}
+
+								.btn {
+									button {
+										font-size: var(--font20Size);
+									}
+								}
+							}
+						}
+
+						.list:nth-child(2n) {
+							margin: 0 0 2vw 0;
+						}
+
+
+					}
+				}
+			}
+
+			.one_4 {
+				.first {
+					display: flex;
+					flex-direction: column;
+					align-items: center;
+					background-color: var(--fFB1Color);
+					border-bottom-right-radius: 10vw;
+					border-bottom-left-radius: 10vw;
+
+					.image {
+						width: 20vw;
+						height: 20vw;
+						border-radius: 20vw;
+					}
+
+					.name {
+						margin: 2vw 0;
+						font-size: var(--font16Szie);
+						font-weight: bold;
+						color: var(--mainColor);
+					}
+				}
+
+				.second {
+					margin: 2vw 0;
+
+					.second_1 {
+						display: flex;
+						justify-content: space-evenly;
+
+						.grade {
+							display: flex;
+							flex-direction: column;
+							align-items: center;
+							color: var(--f85Color);
+							font-size: var(--font13Size);
+
+							view {
+								margin: 1vw 0 0 0;
+								color: var(--ff0Color);
+							}
+						}
+					}
+
+					.second_2 {
+						display: flex;
+						justify-content: center;
+						flex-direction: column;
+						margin: 15vw 25vw 0 25vw;
+						text-align: center;
+						background: #b2b2b2;
+						padding: 2vw;
+						border-radius: 5px;
+
+						.second_2_bor {
+							.image {
+								width: 100%;
+								height: 40vw;
+							}
+						}
+
+						.txt {
+							color: #fff;
+							font-size: 14px;
+							margin: 2vw 0;
+						}
+					}
+				}
+			}
+
+			.collect {
+				position: fixed;
+				top: 0;
+				right: 2vw;
+
+				.iconfont {
+					font-size: 25px;
+				}
+			}
+		}
+
+		.two {
+			display: flex;
+			flex-direction: row;
+			justify-content: space-around;
+			border-top: 1px solid #f1f1f1;
+
+			.list {
+				padding: 1vw 0;
+				text-align: center;
+
+				.icon {}
+
+				.name {
+					font-size: 12px;
+				}
+
+				.activename {
+					color: var(--fFB1Color);
+				}
+			}
+		}
+	}
+
+	.scroll-view {
+		position: absolute;
+		top: 0;
+		left: 0;
+		right: 0;
+		bottom: 0;
+
+		.list-scroll-view {
+			display: flex;
+			flex-direction: row;
+			flex-wrap: wrap;
+		}
+	}
+</style>