shops.vue
2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<template>
<!-- 商品 -->
<view class="flexW">
<view class="shopBox" v-for="item in list" :key="item.id" @click="toDetaile(item.id)">
<view class="shopPhoto">
<image :src="item.image" mode=""></image>
</view>
<view class="btomBox">
<view class="shopName ellipsis">{{ item.name }}</view>
<view class="desc ellipsis">{{ item.describe }}</view>
<view class="shopPrice flexA" v-if="!pointShop">
<view class="new">¥{{ item.goods_price || item.spprice }}</view>
<view class="original" v-if="shopHeight == 322">¥{{ item.line_price }}</view>
<view class="original" v-if="isClass">¥{{ item.spyprice }}</view>
</view>
<view class="points" v-else>
<image src="/static/shopCarIc/pointsIc.png" mode=""></image>
{{ item.coscore }}
</view>
<view v-if="shopWidth == 344" class="sold">{{ pointShop ? '已兑换:' : '已售:' }}{{ item.sales_actual }}份</view>
<view v-if="shopHeight == 322" class="sold">库存:{{ item.stock_num }}件</view>
</view>
</view>
</view>
</template>
<script setup>
import { ref, defineProps, onMounted } from 'vue'
const props = defineProps({
shopWidth: {
type: Number,
default: 322
},
shopHeight: {
type: Number,
default: 344
},
pointShop: {
type: Boolean,
default: false
},
list: {
type: Array,
default: []
},
isClass: Boolean
})
const wide = ref(props.shopWidth + 'rpx')
const heig = ref(props.shopHeight + 'rpx')
onMounted(() => {
// console.log(props.shopWidth,typeof(props.shopHeight),props.pointShop,'宽高')
})
const toDetaile = id => {
uni.navigateTo({
url: `/pages/index/shopDetaile?id=${id}`
})
}
</script>
<style lang="scss">
.shopBox {
width: v-bind(wide);
border-radius: 12rpx;
background: #ffffffff;
margin-bottom: 14rpx;
.shopPhoto {
width: v-bind(wide);
height: v-bind(heig);
image {
width: 100%;
height: 100%;
border-radius: 12rpx 12rpx 0 0;
}
}
.btomBox {
padding: 0 16rpx 16rpx;
.shopName {
color: #000000e6;
font-size: 26rpx;
line-height: 32rpx;
margin: 16rpx 0 8rpx;
}
.desc {
color: #00000066;
font-size: 20rpx;
margin-bottom: 12rpx;
}
.shopPrice {
margin-bottom: 8rpx;
.new {
color: #fc4338ff;
font-size: 28rpx;
font-weight: 700;
}
.original {
margin-left: 4rpx;
color: #00000042;
font-size: 20rpx;
text-decoration: line-through;
}
}
.points {
color: #fc4338ff;
font-size: 28rpx;
font-weight: 700;
image {
margin-left: 4rpx;
width: 24rpx;
height: 24rpx;
}
}
.sold {
color: #00000066;
font-size: 22rpx;
line-height: 28rpx;
}
}
}
</style>