style: 调整商品选择器,店铺选择器代码

master
Yer 2023-09-22 10:49:11 +08:00
parent e13fc57ae7
commit 9f94c2013a
3 changed files with 57 additions and 42 deletions

View File

@ -46,10 +46,8 @@
</div> </div>
</div> </div>
<div> <div>
<Scroll <div
class="wap-content-list" class="wap-content-list"
:on-reach-bottom="handleReachBottom"
:distance-to-edge="[3, 3]"
> >
<div <div
class="wap-content-item" class="wap-content-item"
@ -63,8 +61,8 @@
</div> </div>
<div class="wap-content-desc"> <div class="wap-content-desc">
<div class="wap-content-desc-title">{{ item.goodsName }}</div> <div class="wap-content-desc-title">{{ item.goodsName }}</div>
<div class="wap-sku">{{ item.goodsUnit }}</div>
<div class="wap-sku"><Tag :color="item.salesModel === 'RETAIL' ? 'default' : 'geekblue'">{{item.salesModel === "RETAIL" ? "零售型" : "批发型"}}</Tag></div> <div class="wap-sku">{{ item.goodsUnit }}<Tag style="margin-left: 10px;" :color="item.salesModel === 'RETAIL' ? 'default' : 'geekblue'">{{item.salesModel === "RETAIL" ? "零售型" : "批发型"}}</Tag></div>
<div class="wap-content-desc-bottom"> <div class="wap-content-desc-bottom">
<div>{{ item.price | unitPrice }}</div> <div>{{ item.price | unitPrice }}</div>
</div> </div>
@ -73,7 +71,18 @@
<Spin size="large" fix v-if="loading"></Spin> <Spin size="large" fix v-if="loading"></Spin>
<div v-if="empty" class="empty"></div> <div v-if="empty" class="empty"></div>
</Scroll> </div>
<Page
:total="total"
class="pageration"
@on-change="changePageSize"
:page-size="goodsParams.pageSize"
size="small"
show-total
show-elevator
>
</Page>
</div> </div>
</div> </div>
</div> </div>
@ -89,7 +98,7 @@ export default {
goodsParams: { goodsParams: {
// //
pageNumber: 1, pageNumber: 1,
pageSize: 18, pageSize: 15,
order: "desc", order: "desc",
goodsName: "", goodsName: "",
sn: "", sn: "",
@ -135,17 +144,9 @@ export default {
this.init(); this.init();
}, },
methods: { methods: {
// changePageSize(v){
handleReachBottom() { this.goodsParams.pageNumber = v;
setTimeout(() => {
if (
this.goodsParams.pageNumber * this.goodsParams.pageSize <=
this.total
) {
this.goodsParams.pageNumber++;
this.getQueryGoodsList(); this.getQueryGoodsList();
}
}, 1500);
}, },
// //
getQueryGoodsList() { getQueryGoodsList() {
@ -169,7 +170,7 @@ export default {
* 解决数据请求中滚动栏会一直上下跳动 * 解决数据请求中滚动栏会一直上下跳动
*/ */
this.total = res.result.total; this.total = res.result.total;
this.goodsData.push(...res.result.records); this.goodsData = res.result.records;
} else { } else {
this.empty = true; this.empty = true;
} }
@ -180,13 +181,11 @@ export default {
// //
this.initGoods(res); this.initGoods(res);
}); });
if (localStorage.getItem("category")) { API_Goods.getCategoryTree({deleteFlag: false}).then((res) => {
this.deepGroup(JSON.parse(localStorage.getItem("category"))); if (res.success) {
} else { this.deepGroup(res.result);
setTimeout(() => {
this.deepGroup(JSON.parse(localStorage.getItem("category")));
}, 3000);
} }
});
}, },
deepGroup(val) { deepGroup(val) {
@ -271,7 +270,10 @@ export default {
padding: 0; padding: 0;
} }
.wap-content-list { .wap-content-list {
display: flex;
position: relative; position: relative;
flex-wrap: wrap;
height: 340px;
} }
.wap-content-item { .wap-content-item {
width: 210px; width: 210px;

View File

@ -21,7 +21,8 @@
font-size: 12px; font-size: 12px;
color: #999; color: #999;
overflow: hidden; overflow: hidden;
display: flex;
align-items: center;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
@ -65,13 +66,16 @@
background: #ededed; background: #ededed;
} }
.pageration {
text-align: right;
padding-right: 20px;
}
.wap-content-item { .wap-content-item {
cursor: pointer; cursor: pointer;
display: flex; display: flex;
height: 100px; height: 90px;
padding: 2px; padding: 2px;
overflow: hidden; overflow: hidden;
align-items: center; align-items: center;

View File

@ -13,7 +13,7 @@
</div> </div>
</div> </div>
<div> <div>
<Scroll class="wap-content-list" :on-reach-bottom="handleReachBottom" :distance-to-edge="23"> <div class="wap-content-list" >
<div class="wap-content-item" @click="clickShop(item,index)" :class="{ active:selected == index }" v-for="(item, index) in shopsData" :key="index"> <div class="wap-content-item" @click="clickShop(item,index)" :class="{ active:selected == index }" v-for="(item, index) in shopsData" :key="index">
<div> <div>
<img class="shop-logo" :src="item.storeLogo" alt="" /> <img class="shop-logo" :src="item.storeLogo" alt="" />
@ -26,7 +26,18 @@
</div> </div>
</div> </div>
<Spin size="large" fix v-if="loading"></Spin> <Spin size="large" fix v-if="loading"></Spin>
</Scroll> </div>
<Page
:total="total"
class="pageration"
@on-change="changePageSize"
:page-size="params.pageSize"
size="small"
show-total
show-elevator
>
</Page>
</div> </div>
</div> </div>
</div> </div>
@ -40,7 +51,7 @@ export default {
total: "", // total: "", //
params: { // params: { //
pageNumber: 1, pageNumber: 1,
pageSize: 10, pageSize: 12,
storeDisable: "OPEN", storeDisable: "OPEN",
storeName: "", storeName: "",
}, },
@ -54,13 +65,9 @@ export default {
this.init(); this.init();
}, },
methods: { methods: {
handleReachBottom() { changePageSize(v){
setTimeout(() => { this.params.pageNumber = v;
if (this.params.pageNumber * this.params.pageSize <= this.total) {
this.params.pageNumber++;
this.init(); this.init();
}
}, 1500);
}, },
init() { init() {
this.loading = true; this.loading = true;
@ -71,7 +78,7 @@ export default {
*/ */
this.total = res.result.total; this.total = res.result.total;
this.shopsData.push(...res.result.records); this.shopsData = res.result.records;
this.loading = false; this.loading = false;
} }
@ -95,13 +102,15 @@ export default {
color: #999; color: #999;
} }
.wap-content-list { .wap-content-list {
display: flex;
flex-wrap: wrap; flex-wrap: wrap;
height: 340px;
} }
.shop-logo { .shop-logo {
object-fit: cover; object-fit: cover;
} }
.wap-content-item {
}
.active { .active {
background: url("../../../assets/selected.png") no-repeat; background: url("../../../assets/selected.png") no-repeat;
background-position: right; background-position: right;