Cards.vue
5.57 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
<template>
<div style="height: 100%;display: flex;flex-direction: column;">
<div style="flex: 1;overflow-y: auto;padding: 15px">
<div class="noCardData" v-if="cardList.length == 0">
<p>您目前没有任何会员卡,</p>
</div>
<div v-else>
<div v-for="(i ,index) in cardList" class="cardBg"
:class="{'nianka':i.cardType==1,'bannianka':i.cardType==2,'jika':i.cardType==3,'yueka':i.cardType==4,'rika':i.cardType==5,shixiao:i.cardStatus==0}"
>
<ul class="cardList">
<li style="padding-left: 25px;">
会员卡-
{{i.cardType=="1"?"年卡":(i.cardType=="2"?"半年卡":(i.cardType=="3"?"季卡":(i.cardType=="4"?"月卡":(i.cardType=="5"?"日卡":""))))}}
</li>
<li>
绑定车牌号: {{ i.carNumber }}
</li>
<li>
有效时间段: {{i.effDate}} 至 {{i.expDate}}
</li>
<li>
卡名称: {{ i.cardName }}
</li>
</ul>
<div class="cardStatus"
v-if="i.cardStatus==1"
:class="{'niankaStatus':i.cardType==1,'banniankaStatus':i.cardType==2,'jikaStatus':i.cardType==3,'yuekaStatus':i.cardType==4,'rikaStatus':i.cardType==5}"
>
月卡生效中
</div>
<div class="cardStatus shixiaocardStatus" v-else>月卡已失效</div>
<div class="renewBtn" @click="toReNew(i)"
v-if="i.cardStatus==1"
:class="{'niankaStatus':i.cardType==1,'banniankaStatus':i.cardType==2,'jikaStatus':i.cardType==3,'yuekaStatus':i.cardType==4,'rikaStatus':i.cardType==5}"
>续费</div>
</div>
<!--cardType=='1'?'年卡':(cardType=='2'?'半年卡':(cardType=='3'?'季卡':(cardType=='4'?'月卡':(cardType=='5'?'日卡':''))))-->
</div>
</div>
<!--<x-button type="primary" ></x-button>-->
<!--<mt-button type="primary" size="large" @click.native="$router.push({path:'buyCard'})">购买会员卡</mt-button>-->
<mt-button type="primary" size="large" @click.native="toBuy">购买会员卡</mt-button>
</div>
</template>
<script>
import { queryVipCardsByCustId, queryVipCardsByCarNumberForH5 } from "@/api/cards/cards";
export default {
name: "Cards",
data() {
return {
cardList: [],
custId:''
};
},
mounted() {
// this.queryVipCardsByCustId();
this.queryVipCardsByCarNumberForH5()
},
methods: {
// 获取会员卡列表
queryVipCardsByCarNumberForH5:function(){
let jsondata = this.$utils.commonParams();
jsondata.carNumber = this.$route.query.carNumber
jsondata.carNumberColor = this.$route.query.carNumberColor
jsondata.sign = this.$utils.signObject(jsondata);
queryVipCardsByCarNumberForH5(jsondata).then(data => {
console.log(data);
if (data.code == 0) {
this.cardList = data.data
if(this.cardList.length>0){
this.custId = this.cardList[0].custId
}
} else {
this.$vux.toast.text(data.message, "top");
}
});
},
queryVipCardsByCustId: function() {
let jsondata = this.$utils.commonParams();
jsondata.sign = this.$utils.signObject(jsondata);
queryVipCardsByCustId(jsondata).then(data => {
console.log(data);
if (data.code == 0) {
let res = data.data;
this.cardList = res;
} else {
this.$vux.toast.text(data.message, "top");
}
});
},
// 续费
toReNew: function(i) {
console.log(i);
sessionStorage.setItem("renewData", JSON.stringify(i));
this.$router.push("renew");
},
// 购买
toBuy:function() {
this.$router.push({
path:'buyCard',
query:{
carNumber:this.$route.query.carNumber,
carNumberColor: this.$route.query.carNumberColor,
custId:this.custId
}
})
}
}
};
</script>
<style scoped lang="scss">
.noCardData {
padding-top: 130px;
background: url("../../assets/images/cards/nodata.png") no-repeat center 0;
background-size: 121px 100px;
text-align: center;
}
.cardBg {
width: 100%;
height: 150px;
position: relative;
background-image: url("../../assets/images/cards/cards.png");
background-repeat: no-repeat;
background-position: 20px 20px;
background-size: 90% 90%;
border-radius: 8px;
margin-bottom: 15px;
overflow: hidden;
}
.nianka{
background-color: #dd6c1e;
}
.bannianka{
background-color: #2A1DD2;
}
.jika{
background-color: #DF6B1B;
}
.yueka{
background-color: #33CCFF;
}
.rika{
background-color: #498816;
}
.shixiao{
background-color: #ccc;
}
.cardList {
padding: 20px 0 0 20px;
color: #fff;
li {
line-height: 30px;
}
}
.cardStatus{
position: absolute;
left: -22px;
top: 21px;
font-size: 12px;
-webkit-transform: rotate(30deg);
transform: rotate(-43deg);
width: 100px;
text-align: center;
color: #fff;
}
.niankaStatus{
background-color: #c17b12;
}
.yuekaStatus{
background-color: #3989a3;
}
.banniankaStatus{
background-color: #7972cb;
}
.jikaStatus{
background-color: #f19f67;
}
.rikaStatus{
background-color: #7edb33;
}
.shixiaocardStatus{
background-color: #a59d9d;
}
.renewBtn {
position: absolute;
top: 20px;
right: 20px;
/*border: 1px solid #ffbe00;*/
/*background: #ffbe00;*/
color: #fff;
padding: 2px 10px;
border-radius: 4px;
cursor: pointer;
}
</style>