Files
xdd-uniapp-new/pages/home/components/goods.vue
T

134 lines
2.6 KiB
Vue

<template>
<view class="list-box flex flex-wrap">
<view
v-for="item in goods"
:key="item.id"
class="item"
@click="goGoods(item.productId)"
>
<image
:src="webUrl + '/home/mark-land.png'"
class="mark-img"
/>
<image
:src="item.storeImage"
mode="scaleToFill"
class="good-img"
/>
<view class="content flex flex-col jc-between">
<view class="more-t bold">{{ item.title }}</view>
<view class="one-t desc">{{ item.description }}</view>
<view class="flex jc-between ai-center">
<text class="price">{{ item.price }}</text>
<image
:src="webUrl + '/home/icon-cart.png'"
class="btn"
/>
</view>
</view>
</view>
<image
v-if="goods.length === 0"
:src="webUrl + '/20231023131208675588.png'"
class="img-nodata"
mode="scaleToFill"
/>
</view>
</template>
<script>
export default {
props: {
goods: {
default: () => []
}
},
data() {
return {
webUrl: this.$VUE_APP_RESOURCES_URL,
}
},
methods: {
goGoods(id) {
uni.navigateTo({
url: `/pages/shop/GoodsCon/index?id=${id}&from=landmark`
})
}
}
}
</script>
<style lang="scss" scoped>
.img-nodata {
position: relative;
top: 0;
left: 50%;
transform: translate(-50%, 0);
width: 352rpx;
height: 338rpx;
margin-bottom: 60rpx;
}
.list-box {
margin-top: 24rpx;
padding: 0 20rpx;
.item {
position: relative;
width: 344rpx;
margin-right: 22rpx;
margin-bottom: 22rpx;
border-radius: 20rpx;
background: #FFFFFF;
overflow: hidden;
.mark-img {
position: absolute;
top: 0;
right: 0;
z-index: 3;
display: block;
width: 84rpx;
height: 74rpx;
}
.good-img {
display: block;
width: 344rpx;
height: 344rpx;
}
.content {
height: 156rpx;
padding: 8rpx 8rpx 18rpx 8rpx;
.more-t {
font-size: 28rpx;
line-height: 36rpx;
color: #333;
}
.desc {
padding: 5rpx 0;
height: 34rpx;
color: #FFC543;
font-size: 24rpx;
}
.price {
font-size: 40rpx;
line-height: 40rpx;
font-weight: bold;
color: #C52733;
}
.btn {
display: block;
width: 48rpx;
height: 48rpx;
}
}
}
.item:nth-child(2n) {
margin-right: 0;
}
}
.list-wrap {
margin: 20rpx 0 0 0;
padding: 0 20rpx;
.loadend {
width: 100%;
}
}
</style>