guhongwei 2 лет назад
Родитель
Сommit
7ff5231ffb
7 измененных файлов с 145 добавлено и 247 удалено
  1. 7 1
      pages.json
  2. 17 4
      pages/home/index.vue
  3. 5 33
      pages/index/index.vue
  4. 23 0
      pagesHome/exchange/index.vue
  5. 1 1
      pagesHome/market/type.vue
  6. 14 7
      pagesHome/order/detail.vue
  7. 78 201
      pagesHome/shop/index.vue

+ 7 - 1
pages.json

@@ -198,6 +198,12 @@
 						"navigationBarTitleText": "扶贫专区"
 					}
 				},
+				{
+					"path": "exchange/index",
+					"style": {
+						"navigationBarTitleText": "兑换中心"
+					}
+				},
 				{
 					"path": "activity/index",
 					"style": {
@@ -222,7 +228,7 @@
 						"navigationBarTitleText": "店铺"
 					}
 				}
-			]
+            ]
 		}
 	],
 	"globalStyle": {

+ 17 - 4
pages/home/index.vue

@@ -13,7 +13,7 @@
 					</swiper>
 				</view>
 				<view class="zero thr">
-					<view class="list" v-for="(item,index) in btnList" :key="index" @tap="toCommon(item.to)">
+					<view class="list" v-for="(item,index) in btnList" :key="index" @tap="toIndexModel(item)">
 						<image class="image" :src="item.url&&item.url.length>0?item.url[0].url:''" mode=""></image>
 						<view class="textOver name">
 							{{item.name}}
@@ -98,15 +98,14 @@
 				});
 				if (res.errcode == '0') that.$set(that, `bannerList`, res.data);
 				// 首页模块管理
-				res = await that.$api(`/indexModule`, 'GET', {
-					status: '0'
-				});
+				res = await that.$api(`/indexModule`, 'GET', {});
 				if (res.errcode == '0') {
 					let data = res.data.sort(function(a, b) {
 						return a.sort - b.sort
 					});
 					that.$set(that, `btnList`, data);
 				}
+				// 首页产品列表
 				res = await that.$api(`/viewGoods/indexGoodsList`, `GET`, {
 					limit: 20
 				});
@@ -120,6 +119,20 @@
 					url: `/${e}`
 				})
 			},
+			// 首页模块菜单跳转
+			toIndexModel(data) {
+				if (data && data.status == '1') {
+					uni.showToast({
+						title: '模块禁用',
+						icon: 'none'
+					})
+				} else {
+					uni.navigateTo({
+						url: `/${data.to}`
+					})
+				}
+			},
+			// 购买
 			toBuy(e) {
 				uni.navigateTo({
 					url: `/pagesHome/order/detail?id=${e.id||e._id}`

+ 5 - 33
pages/index/index.vue

@@ -1,19 +1,8 @@
 <template>
 	<mobile-frame>
 		<view class="main">
-			<view class="one">
-				<button size="mini" @click="toCommon('pages/login/index')">登录页面</button>
-				<button size="mini" @click="toCommon('pages/home/index')">首页</button>
-				<button size="mini" @click="toCommon('pages/store/index')">微店</button>
-				<button size="mini" @click="toCommon('pages/week/index')">周边</button>
-				<button size="mini" @click="toCommon('pages/market/index')">购物车</button>
-				<button size="mini" @click="toCommon('pages/my/index')">我的1</button>
-			</view>
-			<view class="two">
-				<!-- <button @click="toChange">地址选择</button> -->
-			</view>
+			系统首页
 		</view>
-
 	</mobile-frame>
 </template>
 
@@ -21,24 +10,16 @@
 	export default {
 		components: {},
 		data() {
-			return {
-
-			};
+			return {};
 		},
 		onLoad: function() {},
 		onShow: function() {
 			const that = this;
-			// 监听用户是否登录
-			that.watchLogin();
+			that.search();
 		},
 		methods: {
-			// 公共跳转
-			toCommon(e) {
-				uni.navigateTo({
-					url: `/${e}`
-				});
-			},
-			watchLogin() {
+			search() {
+				// 查询当前所在平台
 				uni.getSystemInfo({
 					success: async function(res) {
 						uni.setStorage({
@@ -58,13 +39,4 @@
 </script>
 
 <style lang="scss">
-	.main {
-		.one {
-			text-align: center;
-
-			button {
-				margin: 2vw;
-			}
-		}
-	}
 </style>

+ 23 - 0
pagesHome/exchange/index.vue

@@ -0,0 +1,23 @@
+<template>
+	<mobile-frame>
+		兑换中心
+	</mobile-frame>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+
+			};
+		},
+		onShow: function() {},
+		methods: {
+
+		}
+	}
+</script>
+
+<style lang="scss">
+
+</style>

+ 1 - 1
pagesHome/market/type.vue

@@ -23,7 +23,7 @@
 								</view>
 								<view class="market">
 									<view class="marketList" v-for="(tag,indexs) in item.children" :key="indexs">
-										<image class="image" :src="tag.url" mode=""></image>
+										<image class="image" :src="tag.file&&tag.file.length>0?tag.file[0].url:''" mode=""></image>
 										<view class="name">
 											{{tag.label}}
 										</view>

+ 14 - 7
pagesHome/order/detail.vue

@@ -49,12 +49,12 @@
 								</view>
 							</view>
 							<view class="four_2">
-								<view class="grade">商品:<text>{{shop.grade||'5.00'}}</text></view>|
-								<view class="grade">发货:<text>{{shop.grade||'5.00'}}</text></view>|
-								<view class="grade">服务:<text>{{shop.grade||'5.00'}}</text></view>
+								<view class="grade">商品:<text>{{shop.grade||0}}</text></view>|
+								<view class="grade">发货:<text>{{shop.grade||0}}</text></view>|
+								<view class="grade">服务:<text>{{shop.grade||0}}</text></view>
 							</view>
 							<view class="four_2">
-								<view class="btn" @tap="toCommon('pagesHome/shop/index')">进入店铺</view>
+								<view class="btn" @tap="toShop('pagesHome/shop/index')">进入店铺</view>
 								<view class="btn">关注</view>
 							</view>
 						</view>
@@ -222,16 +222,23 @@
 			//店铺,
 			// 购物车,客服跳转
 			onClick(e) {
+				const that = this;
 				if (e.index == '0' && e.content.route) {
-					uni.navigateTo({
-						url: `/${e.content.route}`
-					})
+					// 进入店铺
+					that.toShop();
 				} else {
 					uni.reLaunch({
 						url: `/${e.content.route}`
 					})
 				}
 			},
+			// 进入店铺
+			toShop() {
+				const that = this;
+				uni.navigateTo({
+					url: `/pagesHome/shop/index?id=${that.shop._id}`
+				})
+			},
 			// 公共跳转
 			toCommon(e) {
 				uni.navigateTo({

+ 78 - 201
pagesHome/shop/index.vue

@@ -4,21 +4,20 @@
 			<view class="one">
 				<view class="one_1" v-if="barActive=='0'">
 					<view class="first">
-						<image class="image" :src="oneUrl" mode=""></image>
+						<image class="image" :src="info.logo&&info.logo.length>0?info.logo[0].url:''" mode=""></image>
 					</view>
 					<view class="second">
-						<scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage">
+						<scroll-view scroll-y="true" class="scroll-view">
 							<view class="list-scroll-view">
-								<view class="list" v-for="(item,index) in shoplist" :key="index"
-									@tap="toCommon('pagesHome/order/detail')">
-									<image class="image" :src="item.url" mode=""></image>
+								<view class="list" v-for="(item,index) in shoplist" :key="index" @tap="toBuy(item)">
+									<image class="image" :src="item.file&&item.file.length>0?item.file[0].url:''" mode=""></image>
 									<view class="name">
 										{{item.name}}
 									</view>
 									<view class="other">
 										<view class="money">
 											<text>¥</text>
-											<text>{{item.money}}</text>
+											<text>{{item.sell_money}}</text>
 										</view>
 										<view class="btn">
 											<button type="default" size="mini">购买</button>
@@ -29,38 +28,7 @@
 						</scroll-view>
 					</view>
 				</view>
-				<view class="one_2" v-else-if="barActive=='1'">
-					<view class="first_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="first_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.label}}
-									</view>
-									<view class="market">
-										<view class="marketList" v-for="(tag,indexs) in item.children" :key="indexs">
-											<image class="image" :src="tag.url" mode=""></image>
-											<view class="name">
-												{{tag.label}}
-											</view>
-										</view>
-									</view>
-								</view>
-							</view>
-						</scroll-view>
-					</view>
-				</view>
-				<view class="one_3" v-else-if="barActive=='2'">
+				<view class="one_3" v-else-if="barActive=='1'">
 					<view class="first">
 						<input type="text" v-model="searchInfo.name" @input="toInput" placeholder="搜索商品">
 					</view>
@@ -68,20 +36,17 @@
 						<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="['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.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.xiaActive]" v-if="condActive==index&&xia==true"></text>
 												<text :class="['iconfont', item.xia]" v-else></text>
 											</view>
 										</view>
@@ -89,8 +54,7 @@
 								</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>
+										<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>
@@ -113,29 +77,29 @@
 						</scroll-view>
 					</view>
 				</view>
-				<view class="one_4" v-else-if="barActive=='3'">
+				<view class="one_4" v-else-if="barActive=='2'">
 					<view class="first">
-						<image class="image" :src="info.url" mode=""></image>
+						<image class="image" :src="info.logo&&info.logo.length>0?info.logo[0].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>{{info.goods_score||0}}</view>
 								商品
 							</view>
 							<view class="grade">
-								<view>{{info.grade||'5'}}</view>
+								<view>{{info.send_score||0}}</view>
 								发货
 							</view>
 							<view class="grade">
-								<view>{{info.grade||'5'}}</view>
+								<view>{{info.service_score||0}}</view>
 								服务
 							</view>
 						</view>
 						<view class="second_2">
 							<view class="second_2_bor">
-								<image class="image" :src="info.url" mode=""></image>
+								<image class="image" :src="info.logo&&info.logo.length>0?info.logo[0].url:''" mode=""></image>
 							</view>
 							<view class="txt">
 								店铺二维码
@@ -166,179 +130,58 @@
 	export default {
 		data() {
 			return {
+				id: '',
 				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,
-				},
-				shoplist: [ //
-					{
-						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,
-					},
-				],
+				// 店铺信息
+				info: {},
+				// 店铺部分商品
+				shoplist: [],
 				active: '0',
-				typeList: [{
-						label: '进口食品'
-					},
+				typeList: [ //
 					{
-						label: '品质生鲜'
-					}, {
-						label: '饮料冲调'
-					}, {
-						label: '居家用品'
+						label: '进口食品'
 					}
 				],
-				list: [{
-						label: '进口食品'
-					},
+				list: [ //
 					{
-						label: '品质生鲜'
-					}, {
-						label: '饮料冲调'
-					}, {
-						label: '居家用品'
+						label: '进口食品'
 					}
 				],
 				// 收藏
 				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
-				}],
+				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
+					}
+				],
 				condActive: 0,
 				shang: false,
 				xia: false,
@@ -370,8 +213,42 @@
 				]
 			};
 		},
+		onLoad: function(e) {
+			const that = this;
+			that.$set(that, `id`, e.id || '6333d71d32c5f69745f9bd32');
+			that.search()
+		},
 		onShow: function() {},
 		methods: {
+			// 查询信息
+			async search() {
+				const that = this;
+				if (that.id) {
+					// 查询店铺信息
+					const res = await that.$api(`/shop/${that.id}`, 'GET');
+					if (res.errcode == '0') that.$set(that, `info`, res.data);
+					// 查询店铺商品
+					that.searchShopMarket();
+				}
+			},
+			// 查询店铺商品
+			async searchShopMarket() {
+				const that = this;
+				const res = await that.$api(`/viewGoods/indexGoodsList`, 'GET', {
+					shop: that.id,
+					skip: 0,
+					limit: 20
+				})
+				if (res.errcode == '0') that.$set(that, `shoplist`, res.data);
+			},
+			// 购买
+			toBuy(item) {
+				if (item && item._id) {
+					uni.navigateTo({
+						url: `/pagesHome/order/detail?id=${item._id}`
+					})
+				}
+			},
 			// 选择底部菜单
 			barChange(index, item) {
 				const that = this;