VipDialog.vue
3.68 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<template>
<van-action-sheet
v-model="showBox"
cancel-text="取消"
close-on-click-action
@cancel="onCancel"
@click-overlay="onCancel"
close-on-popstate
>
<div class="box">
<div class="title flex">
<div class="name text-hide">{{data.packageName}}</div>
<div class="subtitle">内含{{data.couponsDetailList&&data.couponsDetailList.length}}项权益项目</div>
</div>
<div class="items">
<template v-for="(i,index) in data.couponsDetailList">
<div
:key="index"
class="item"
>
<div class="name flex">
{{index + 1}}、{{i.couponName}}
<div class="num">数量:x{{i.serviceQuantity}}</div>
</div>
<div class="decoration flex">
<template v-if="i.effectiveType == 1">
有效期:{{i.effectiveDays}}天
</template>
<template v-else-if="i.effectiveType == 2">
有效期:{{new Date(i.effectiveStartTime).format('yyyy-MM-dd')}} ~ {{new Date(i.effectiveEndTime).format('yyyy-MM-dd')}}
</template>
<template v-else>
无有效期
</template>
<span>
<template v-if="i.useType == '0'">
不限制次数
</template>
<template v-if="i.useType == 1">
有效期内可用{{i.useAmount}}次
</template>
<template v-if="i.useType == 2">
{{i.useLimitDays}}天内使用{{i.useAmount}}次
</template>
</span>
</div>
</div>
</template>
</div>
<div class="tips">
<template v-if="data.notes">
附:{{data.notes}}
</template>
</div>
</div>
</van-action-sheet>
</template>
<script type='text/ecmascript-6'>
import { equityApi } from '@/api'
export default {
name: 'VipDialog',
props: ['value', 'id'],
watch: {
value (n) {
let { id, component_id } = this
if (component_id == id && n) {
this.showBox = true
return
}
if (n) {
this.showLoading()
this.component_id = id
equityApi.getEquityDetail({ id }).then(res => {
console.log(res)
this.data = res
this.hideLoading()
this.showBox = true
}).catch(() => {
this.hideLoading()
})
}
}
},
data () {
return {
showBox: false,
data: {},
component_id: ''
}
},
mounted () {
},
methods: {
onCancel () {
this.$emit('cancel')
}
}
}
</script>
<style scoped lang='scss'>
.box {
padding: 0 16px;
.title {
height: 56px;
color: #333333;
font-size: 16px;
position: sticky;
top: 0;
background-color: #fff;
z-index: 2;
.name{
max-width: 70%;
}
.subtitle {
font-size: 12px;
color: #3a3a3a;
margin-left: auto;
}
}
.tips {
color: #656566;
font-size: 11px;
padding: 9px 0 22px;
word-break: break-all;
}
.items {
padding-left: 23px;
.item {
height: 61px;
border-bottom: 1px solid #f8f8f8;
position: relative;
font-size: 14px;
color: #333333;
padding: 12px 0;
box-sizing: border-box;
.name {
width: calc(100% + 23px);
margin-left: -23px;
font-weight: 500;
.num {
margin-left: auto;
color: #282829;
font-size: 12px;
}
}
.decoration {
font-size: 12px;
color: #cfcfd1;
span {
margin-left: auto;
}
}
}
}
}
</style>