瀏覽代碼

店铺详情

guhongwei 2 年之前
父節點
當前提交
1f02eb8ff4
共有 2 個文件被更改,包括 104 次插入67 次删除
  1. 3 3
      pagesHome/order/detail.vue
  2. 101 64
      pagesHome/shop/index.vue

+ 3 - 3
pagesHome/order/detail.vue

@@ -49,9 +49,9 @@
 								</view>
 							</view>
 							<view class="four_2">
-								<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 class="grade">商品:<text>{{shop.goods_score||0}}</text></view>|
+								<view class="grade">发货:<text>{{shop.send_score||0}}</text></view>|
+								<view class="grade">服务:<text>{{shop.service_score||0}}</text></view>
 							</view>
 							<view class="four_2">
 								<view class="btn" @tap="toShop('pagesHome/shop/index')">进入店铺</view>

+ 101 - 64
pagesHome/shop/index.vue

@@ -9,7 +9,7 @@
 					<view class="second">
 						<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="toBuy(item)">
+								<view class="list" v-for="(item,index) in shoplist" :key="index">
 									<image class="image" :src="item.file&&item.file.length>0?item.file[0].url:''" mode=""></image>
 									<view class="name">
 										{{item.name}}
@@ -20,7 +20,7 @@
 											<text>{{item.sell_money}}</text>
 										</view>
 										<view class="btn">
-											<button type="default" size="mini">购买</button>
+											<button type="default" size="mini" @click="toBuy(item)">购买</button>
 										</view>
 									</view>
 								</view>
@@ -42,18 +42,18 @@
 										</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=='1'"></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=='-1'"></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">
+									<view class="list" v-for="(item,index) in list" :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>
@@ -66,9 +66,8 @@
 												<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 class="btn">
+												<button type="default" size="mini" @click="toBuy(item)">购买</button>
 											</view>
 										</view>
 									</view>
@@ -99,7 +98,7 @@
 						</view>
 						<view class="second_2">
 							<view class="second_2_bor">
-								<image class="image" :src="info.logo&&info.logo.length>0?info.logo[0].url:''" mode=""></image>
+								<image class="image" :src="info.qrcode&&info.qrcode.length>0?info.qrcode[0].url:''" mode=""></image>
 							</view>
 							<view class="txt">
 								店铺二维码
@@ -142,7 +141,7 @@
 						icon: 'icon-shangpinfenlei',
 						acticon: "icon-shangpinfenlei-copy",
 						name: '全部商品'
-					}, 
+					},
 					{
 						icon: 'icon-qiyejianjie',
 						acticon: "icon-qiyejianjie-copy",
@@ -153,38 +152,18 @@
 				info: {},
 				// 店铺部分商品
 				shoplist: [],
-				active: '0',
-				typeList: [ //
-					{
-						label: '进口食品'
-					}
-				],
-				list: [ //
-					{
-						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
-					}
-				],
+				list: [],
+				total: 0,
+				page: 0,
+				skip: 0,
+				limit: 5,
 				condActive: 0,
-				shang: false,
-				xia: false,
+				shang: '',
+				xia: '',
 				condList: [ // 筛选
 					{
 						name: '默认',
@@ -229,6 +208,8 @@
 					if (res.errcode == '0') that.$set(that, `info`, res.data);
 					// 查询店铺商品
 					that.searchShopMarket();
+					// 查询全部商品
+					that.searchAll();
 				}
 			},
 			// 查询店铺商品
@@ -241,6 +222,28 @@
 				})
 				if (res.errcode == '0') that.$set(that, `shoplist`, res.data);
 			},
+			// 查询全部产品
+			async searchAll() {
+				const that = this;
+				let info = {
+					shop: that.id,
+					skip: that.skip,
+					limit: that.limit
+				}
+				const res = await that.$api(`/viewGoods/indexGoodsList`, `GET`, {
+					...info,
+					...that.searchInfo
+				})
+				if (res.errcode == '0') {
+					let list = [...that.list, ...res.data];
+					that.$set(that, `list`, list)
+					that.$set(that, `total`, res.total)
+				} else {
+					uni.showToast({
+						title: res.errmsg,
+					});
+				}
+			},
 			// 购买
 			toBuy(item) {
 				if (item && item._id) {
@@ -249,41 +252,65 @@
 					})
 				}
 			},
-			// 选择底部菜单
-			barChange(index, item) {
+			// 全部产品-分页
+			async toPage() {
 				const that = this;
-				that.$set(that, `barActive`, index);
-				uni.setNavigationBarTitle({
-					title: item.name
+				let list = that.list;
+				let limit = that.limit;
+				if (that.total > list.length) {
+					uni.showLoading({
+						title: '加载中',
+						mask: true
+					})
+					let page = that.page + 1;
+					that.$set(that, `page`, page)
+					let skip = page * limit;
+					that.$set(that, `skip`, skip)
+					that.searchAll();
+					uni.hideLoading();
+				} else uni.showToast({
+					title: '没有更多数据了'
 				});
 			},
-			// 公共跳转
-			toCommon(e) {
-				uni.navigateTo({
-					url: `/${e}`
-				})
-			},
 			// 输入框
 			toInput(e) {
 				const that = this;
-				that.$set(that.searchInfo, `name`, e.detail.value)
-			},
-			toChange(index, e) {
-				const that = this;
-				that.$set(that, `active`, index);
-				// that.searchRight(e);
+				that.$set(that.searchInfo, `name`, e.detail.value);
+				that.searchAll();
 			},
 			// 筛选
 			toCond(index, e) {
 				const that = this;
+				let condActive = that.condActive;
 				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);
+				if (condActive != index && that.xia == '') {
+					that.$set(that, `shang`, '0');
+					that.$set(that, `xia`, '-1');
+				} else if (condActive == index && that.xia == '-1') {
+					that.$set(that, `shang`, '1');
+					that.$set(that, `xia`, '0');
+				} else if (condActive == index && that.shang == '1') {
+					that.$set(that, `shang`, '0');
+					that.$set(that, `xia`, '-1');
+				} else if (condActive = index && that.shang == '1') {
+					that.$set(that, `shang`, '0');
+					that.$set(that, `xia`, '-1');
+				}
+				let key = '';
+				let value;
+				if (index != 0) {
+					value = that.shang == '0' ? that.xia : that.shang;
+				}
+				if (index == 1) {
+					key = 'sell_num';
+				} else if (index == 2) {
+					key = 'sell_money';
+				} else if (index == 3) {
+					key = 'view_num';
 				}
+				that.$set(that.searchInfo, `key`, key);
+				that.$set(that.searchInfo, `value`, value);
+				that.searchAll();
 			},
 			// 收藏
 			toCollect() {
@@ -301,8 +328,14 @@
 					})
 				}
 			},
-			// 分页
-			toPage() {}
+			// 选择底部菜单
+			barChange(index, item) {
+				const that = this;
+				that.$set(that, `barActive`, index);
+				uni.setNavigationBarTitle({
+					title: item.name
+				});
+			},
 		}
 	}
 </script>
@@ -583,7 +616,11 @@
 
 								.btn {
 									button {
-										font-size: var(--font20Size);
+										border-radius: 25px;
+										color: var(--fffColor);
+										background-color: var(--ff0Color);
+										font-size: var(--font12Size);
+
 									}
 								}
 							}