caiyunyi/pages/useConfig/FavoriteStore.vue
ylj20011123 2ab1f11566 update
2025-05-20 18:39:54 +08:00

265 lines
9.3 KiB
Vue

<template>
<view class="main">
<scroll-view :scroll-y="true" class="shopList" v-if="shopList && shopList.length > 0"
:style="{ height: `calc(100vh - ${safeHeight}px)` }">
<div v-for="(item, i) in shopList" :key="item.COMMODITY_ID" class="shopDetailItem"
:style="{ marginBottom: index + 1 === shopList.length ? '0' : '8rpx' }" @click="showDetail(item)">
<image class="leftImg" style="width: 80px; height: 80px"
:src="item.DEFAULT_IMG || '/static/images/home/defultImg.png'" :lazy-load="true"
@error="e => e.target.src = '/static/images/home/defultImg.png'" :key="item.COMMODITY_ID" />
<div class="rightBox">
<p class="detailTitle">{{ item.COMMODITY_NAME }}</p>
<div class="bottom">
<div class="detailPrice">
<span class="priceUnit">¥</span>
<span class="number" style="font-size: 20px">
{{ item.bigNumber || "" }}</span>
<span class="number" style="font-size: 14px">.{{ item.smallNumber || "00" }}</span>
<span class="unit">/ {{ item.COMMODITY_UNIT }}</span>
</div>
</div>
</div>
</div>
</scroll-view>
<view v-else>
<NoData :text="'暂无商品'" :show="true" />
</view>
</view>
</template>
<script>
import NoData from '../../components/noData.vue';
export default {
data() {
return {
shopList: [],
safeHeight: 0
}
},
onLoad() {
let systemInfo = uni.getSystemInfoSync();
let height = systemInfo.safeAreaInsets.bottom;
this.safeHeight = Number(height);
let collectGoodList = uni.getStorageSync('collectGood')
this.shopList = collectGoodList
},
methods: {
// 商品列表
showDetail(obj) {
uni.navigateTo({
url: `/pages/shopPages/shopDetail/index?id=${obj.COMMODITY_ID}&pageType=${obj.COMMODITY_NATURE === 5070 ? 'UnionMall' : ''}`,
});
},
}
}
</script>
<style lang="less" scoped>
.main {
width: 100vw;
height: 100vh;
box-sizing: border-box;
background-color: #F5F5F5;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
.shopList {
width: 100%;
.shopDetailItem {
width: 100%;
height: 104px;
box-sizing: border-box;
padding: 8px 16px;
display: flex;
border-bottom: 1px solid #f5f7f7;
background-color: #fff;
.leftImg {
width: 80px;
height: 80px;
border-radius: 8px;
}
.rightBox {
margin-left: 12px;
width: calc(100% - 92px);
height: 80px;
display: flex;
flex-direction: column;
justify-content: space-between;
.detailTitle {
display: -webkit-box;
height: 40px;
width: 100%;
font-size: 14px;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #020e1a;
line-height: 20px;
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.bottom {
display: flex;
//margin-top: 12px;
align-items: flex-end;
justify-content: space-between;
.detailPrice {
width: calc(100% - 160rpx);
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
.priceUnit {
color: #ff6219;
}
.number {
font-size: 16px;
color: #ff6219;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
line-height: 20px;
}
.unit {
display: inline-block;
width: 30%;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
font-size: 12px;
line-height: 12px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #9fa3a8;
}
}
.addReduceBox {
width: 80px;
display: flex;
align-items: center;
justify-content: flex-end;
.reduceShopCar {
width: 25px;
height: 25px;
border-radius: 50%;
overflow: hidden;
.optionBtn {
width: 100%;
height: 100%;
}
}
.itemCount {
width: 60rpx;
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 28rpx;
color: #020e1a;
line-height: 36rpx;
text-align: center;
font-style: normal;
display: inline-block;
}
.addShopCar {
width: 25px;
height: 25px;
border-radius: 50%;
overflow: hidden;
.optionBtn {
width: 100%;
height: 100%;
}
}
.shopState {
font-size: 24rpx;
color: #fff;
background: #bbbbbb;
padding: 4rpx 16rpx;
border-radius: 8rpx;
}
}
.specifications {
background: linear-gradient(270deg, #fb6c6c 0%, #fd4a4a 100%);
border-radius: 20rpx;
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 28rpx;
color: #fff;
line-height: 32rpx;
text-align: justify;
font-style: normal;
padding: 8rpx 16rpx;
position: relative;
.specificationsCount {
border: 1px solid #fd4a4a;
border-radius: 16rpx;
color: #fd4a4a;
font-size: 20rpx;
line-height: 20rpx;
padding: 4rpx 8rpx;
position: absolute;
top: 0;
right: 0;
transform: translate(40%, -80%);
background: #fff;
}
}
.cartcontrol {
width: 80px;
height: 24px;
line-height: 24px;
display: flex;
justify-content: flex-start;
border: 2rpx solid rgba(2, 14, 26, 0.06);
border-radius: 4rpx;
.subtract {
width: 24px;
height: 24px;
background: #f2f4f5;
display: flex;
justify-content: center;
align-items: center;
border-radius: 4rpx 0rpx 0rpx 4rpx;
font-size: 16rpx;
color: #9fa3a8;
.img {
width: 16px;
height: 16px;
}
}
.cart-count {
font-size: 24rpx;
flex: 1;
}
}
}
}
}
}
}
</style>