mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
synced 2025-12-18 16:35:53 +08:00
封装商品展示模块,全局统一管理格式,将旧版商品展示部分优化。
This commit is contained in:
@@ -60,18 +60,7 @@
|
||||
<!-- 商品 -->
|
||||
<div class="contant" v-if="current == 0">
|
||||
<view v-if="!goodsList.length" class="empty">暂无商品信息</view>
|
||||
<view v-else class="item" v-for="(item,index) in goodsList" :key="index" @click="navigateToGoodsDetail(item)">
|
||||
<u-image width="100%" height="330rpx" mode="aspectFit" :src="item.content.thumbnail">
|
||||
<u-loading slot="loading"></u-loading>
|
||||
</u-image>
|
||||
<div class="name wes-2">{{ item.content.goodsName }}</div>
|
||||
<div class="price">
|
||||
<div>¥{{ item.content.price | unitPrice }}</div>
|
||||
</div>
|
||||
<view class="buyCount">
|
||||
<div>已售 {{ item.content.buyCount || "0" }}</div>
|
||||
</view>
|
||||
</view>
|
||||
<goodsTemplate :res="goodsList" :storeName="false" />
|
||||
</div>
|
||||
<!-- 全部分类 -->
|
||||
<div class="category" v-if="current == 1">
|
||||
@@ -94,7 +83,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getStoreBaseInfo, getStoreCategory } from "@/api/store.js";
|
||||
import { getStoreBaseInfo, getStoreCategory } from "@/api/store.js";
|
||||
import goodsTemplate from '@/components/m-goods-list/list'
|
||||
import {
|
||||
receiveCoupons,
|
||||
deleteStoreCollection,
|
||||
@@ -128,7 +118,8 @@ export default {
|
||||
current(val) {
|
||||
val == 0 ? ()=>{ this.goodsList = []; this.getGoodsData()} : this.getCategoryData();
|
||||
},
|
||||
},
|
||||
},
|
||||
components:{goodsTemplate},
|
||||
|
||||
/**
|
||||
* 加载
|
||||
@@ -277,15 +268,6 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 跳转到商品详情
|
||||
*/
|
||||
navigateToGoodsDetail(val) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/product/goods?id=${val.content.id}&goodsId=${val.content.goodsId}`,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 是否收藏
|
||||
*/
|
||||
@@ -404,42 +386,6 @@ export default {
|
||||
justify-content: center;
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
.item {
|
||||
overflow: hidden;
|
||||
|
||||
background: #fff;
|
||||
width: 49%;
|
||||
height: 484rpx;
|
||||
font-size: 26rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border: 1px solid #f8f8f8;
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
.name {
|
||||
text-align: left !important;
|
||||
color: #333;
|
||||
padding: 0 20rpx;
|
||||
margin-top: 20rpx;
|
||||
height: 80rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
.price {
|
||||
font-weight: 500;
|
||||
color: $main-color;
|
||||
font-size: 30rpx;
|
||||
padding: 0 20rpx;
|
||||
margin-top: 20rpx;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.buyCount {
|
||||
display: flex;
|
||||
padding: 0 20rpx;
|
||||
font-size: 24upx;
|
||||
justify-content: space-between;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
.discount {
|
||||
height: 154rpx;
|
||||
|
||||
Reference in New Issue
Block a user