priceCard.vue
1.4 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
<template>
<view class="priceCard" :style="{backgroundColor: active ? '#FFE6B4' : '#fff'}" @click="toggle">
<text class="card_name">{{ info.name }}</text>
<text class="price">¥<text style="font-size: 72rpx; line-height: 96rpx;">{{ info.price }}</text></text>
<text class="old_price">¥{{ info.oldPrice }}</text>
<view class="avg_price" :style="{backgroundColor: active ? '#FFC675' : '#FFFAF1', color: active ? '#722F06' : '#DEB468'}">{{ info.avgText }}</view>
</view>
</template>
<script>
export default {
props: {
active: {
type: Number,
default: false
},
info: {
type: Object,
require: true
}
},
methods: {
toggle(){
this.$emit('toggle')
}
}
}
</script>
<style lang="scss" scoped>
.priceCard{
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
padding-top: 8rpx;
width: 330rpx;
height: 240rpx;
border-radius: 16rpx 16rpx 16rpx 16rpx;
overflow: hidden;
border: 2rpx solid #EEEEEE;
box-sizing: border-box;
color: #722F06;
.card_name, .price{
font-size: 32rpx;
line-height: 42rpx;
font-weight: 500;
}
.old_price{
color: #BF9363;
font-size: 28rpx;
line-height: 38rpx;
text-decoration: line-through;
}
.avg_price{
height: 48rpx;
line-height: 48rpx;
color: #DEB468;
font-size: 28rpx;
width: 100%;
text-align: center;
}
}
</style>