新增商品列表

master
lemon橪 2021-11-29 09:58:39 +08:00
parent f600b628ce
commit deed875c1b
5 changed files with 183 additions and 9 deletions

View File

@ -4,11 +4,14 @@
import {http, Method} from '@/utils/request.js'; import {http, Method} from '@/utils/request.js';
/** /**
* 获取店铺列表 * 获取店铺列表
* @param params * @param params
*/ */
export function getstoreList(params) { export function getStoreList(params) {
return http.request({ return http.request({
url: '/store', url: '/store',
method: Method.GET, method: Method.GET,

View File

@ -338,6 +338,12 @@
"navigationBarTitleText": "", "navigationBarTitleText": "",
"navigationStyle": "custom" "navigationStyle": "custom"
} }
},{
"path": "shopList",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
},{ },{
"path": "licencePhoto", "path": "licencePhoto",
"style": { "style": {
@ -460,7 +466,6 @@
"style": { "style": {
"navigationBarTitleText": "拼团活动", "navigationBarTitleText": "拼团活动",
"navigationStyle": "custom", // "navigationStyle": "custom", //
"app-plus": { "app-plus": {
// //
"bounce": "none" "bounce": "none"

View File

@ -113,7 +113,7 @@ export default {
}, },
onLoad() { onLoad() {
this.getGoodList(); this.getGoodList();
this.getstoreList(); this.getStoreList();
}, },
methods: { methods: {
@ -151,7 +151,7 @@ export default {
deleteStoreCollection(val.storeId).then((res) => { deleteStoreCollection(val.storeId).then((res) => {
if (res.statusCode == 200) { if (res.statusCode == 200) {
this.storeList = []; this.storeList = [];
this.getstoreList(); this.getStoreList();
} }
}); });
}, },
@ -213,7 +213,7 @@ export default {
/** /**
* 获取店铺集合 * 获取店铺集合
*/ */
getstoreList() { getStoreList() {
uni.showLoading({ uni.showLoading({
title: "加载中", title: "加载中",
}); });
@ -246,7 +246,7 @@ export default {
this.getGoodList(); this.getGoodList();
} else { } else {
this.navList[1].params.pageNumber++; this.navList[1].params.pageNumber++;
this.getstoreList(); this.getStoreList();
} }
}, },
}, },
@ -262,7 +262,7 @@ export default {
} else { } else {
this.navList[1].params.pageNumber = 1; this.navList[1].params.pageNumber = 1;
this.storeList = []; this.storeList = [];
this.getstoreList(); this.getStoreList();
} }
}, },
}; };

163
pages/product/shopList.vue Normal file
View File

@ -0,0 +1,163 @@
<template>
<div>
<u-navbar>
<u-search placeholder="请输入店铺名称" @search="search" @clear="search" @custom="search" v-model="params.storeName">
</u-search>
</u-navbar>
<div class="wrapper" v-if="storeList.length!=0">
<div class="store-item" @click="handleClickStore(item)" v-for="(item,index) in storeList" :key="index">
<div>
<u-image shape="circle" width="100" height="100" :src="item.storeLogo">
</u-image>
</div>
<div class="store-msg">
<div class="store-name">
{{item.storeName}}
</div>
<div class="goods-num">
商品 {{item.goodsNum}}
</div>
<div class="flex store-distance">
<div>
<span class="store-score">{{item.serviceScore | unitPrice}}</span>
<span class="line">|</span>
<span class="store-collection">收藏 {{item.collectionNum}}</span>
</div>
</div>
</div>
<!--
#TODO 后续将和后端补充从此处
<div class="flex store-goods">
<div class="store-goods-item" v-for="i in 3" :key="i">
<div>
<u-image src="https://picsum.photos/id/341/200/200" border-radius="20" width="215rpx" height="215rpx">
</u-image>
</div>
<div class="price">
<span>
<span class=" goods-price-bigshow">{{ formatPrice(16)[0] }}</span>
.{{ formatPrice(16)[1] }}
</span>
</div>
<div class="wes">test</div>
</div>
</div>
-->
</div>
</div>
<u-empty style="margin-top:20%;" text="暂无店铺信息" v-else></u-empty>
</div>
</template>
<script>
import { getStoreList } from "@/api/store";
export default {
data() {
return {
keyword: "",
params: {
pageNumber: 1,
pageSize: 10,
storeName: "",
},
storeList: [], //
};
},
onReachBottom() {
this.params.pageNumber++;
this.init();
},
mounted() {
this.init();
},
methods: {
handleClickStore(val){
uni.navigateTo({
url: `/pages/product/shopPage?id=${val.id}`
});
},
search() {
this.storeList = [];
this.init();
},
// 1999 --> [1999,00]
formatPrice(val) {
if (typeof val == "undefined") {
return val;
}
return val.toFixed(2).split(".");
},
async init() {
let res = await getStoreList(this.params);
if (res.data.success) {
let data = res.data.result;
this.storeList.push(...data.records);
}
},
},
};
</script>
<style lang="scss" scoped>
.wrapper {
padding: 0 16rpx;
}
.store-item {
display: flex;
background: #fff;
border-radius: 20rpx;
margin: 20rpx 0;
padding: 24rpx;
}
.store-msg {
margin-left: 20rpx;
}
.store-name {
font-weight: bold;
font-size: 30rpx;
}
.goods-num,
.store-collection {
color: #999;
font-size: 24rpx;
line-height: 1.5;
}
.store-goods {
margin: 20rpx 0;
}
.store-goods-item {
flex: 1;
overflow: hidden;
display: flex;
justify-content: flex-start;
flex-direction: column;
margin: 0 5rpx;
}
.wes {
margin: 10rpx 0;
width: 100%;
}
.store-score {
color: $light-color;
font-size: 24rpx;
font-weight: bold;
}
.line {
margin: 0 6rpx;
color: #999;
}
.store-distance {
justify-content: space-between;
}
.price {
margin-top: 10rpx;
color: $main-color;
}
.goods-price-bigshow {
font-size: 34rpx;
font-weight: bold;
}
</style>

View File

@ -3,7 +3,6 @@ export function modelNavigateTo(item) {
let val = item.url; let val = item.url;
switch (val.___type) { switch (val.___type) {
case "goods": case "goods":
uni.navigateTo({ uni.navigateTo({
url: "/pages/product/goods?id=" + val.id + "&goodsId=" + val.goodsId, url: "/pages/product/goods?id=" + val.id + "&goodsId=" + val.goodsId,
@ -38,7 +37,6 @@ export function modelNavigateTo(item) {
break; break;
case "other": case "other":
switch (val.title) { switch (val.title) {
case "首页": case "首页":
uni.switchTab({ uni.switchTab({
url: `/pages/tabbar/home/index`, url: `/pages/tabbar/home/index`,
@ -99,6 +97,11 @@ export function modelNavigateTo(item) {
url: `/pages/promotion/point/pointList`, url: `/pages/promotion/point/pointList`,
}); });
break; break;
case "店铺列表":
uni.navigateTo({
url: `/pages/product/shopList`,
});
break;
} }
break; break;