ticket.vue
2.5 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
<template>
<div>
<template v-for="(item, index) in orderShow">
<div class="flex-top m-b-8" v-show="coupontData[item].list.length" :key="index">
<div class="content-meal-logo" :key="item.discountType">
<img :src="coupontData[item].logo" alt="" />
</div>
<div class="flex-align content-meal-list">
<template v-for="(subItem, subIndex) in coupontData[item].list">
<div class="every color-3 text-14 weight-4 line-20" :key="subIndex">{{ subItem.couponName }} × {{ subItem.serviceQuantity }}</div>
</template>
</div>
</div>
</template>
</div>
</template>
<script>
export default {
data() {
return {
orderShow: ['service', 'cash', 'discount', 'exchange'],
couponObj: {
// 折扣券
discount: {
label: '折扣券',
discountType: 2,
list: [],
logo: require('../../../assets/coupon/icon-discount.png')
},
// 代金券
cash: {
label: '代金券',
discountType: 3,
list: [],
logo: require('../../../assets/coupon/icon-cash.png')
},
// 兑换券
exchange: {
label: '兑换券',
discountType: 4,
list: [],
logo: require('../../../assets/coupon/icon-exchange.png')
},
service: {
label: '会员服务',
discountType: 7,
list: [],
logo: require('../../../assets/coupon/icon-service.png')
}
},
numToCoupon: {
2: 'discount',
3: 'cash',
4: 'exchange',
7: 'service'
}
}
},
computed: {
coupontData() {
let { couponObj, orderShow, choseItemList, numToCoupon } = this
orderShow.forEach(item => {
couponObj[item].list = []
})
choseItemList.forEach(item => {
couponObj[numToCoupon[item.discountType]].list.push(item)
})
return couponObj
}
},
props: {
choseItemList: {
type: Array,
default: () => []
}
}
}
</script>
<style lang="scss" scoped>
.content-meal-logo {
width: 58px;
height: 22px;
margin-right: 20px;
img {
width: 100%;
}
}
.content-meal-list {
width: calc(100% - 86px);
flex-wrap: wrap;
.every {
margin-right: 80px;
display: flex;
align-items: center;
}
.every::before {
content: '';
width: 6px;
height: 6px;
background: #5850ff;
border-radius: 50%;
margin-right: 7px;
display: inline-block;
}
}
</style>