5e52ed7c
刘淇
个人中心
|
1
2
3
|
<template>
<section style="width: 100%;height: 100%;background: #fff">
<van-cell-group style="border-bottom: 10px solid #fafafa">
|
5d00ef92
刘淇
会员卡续费
|
4
5
6
7
8
|
<van-cell title="车牌号" v-if="xufeiFlag==2">
<template>{{$route.query.carNumber}}</template>
</van-cell>
<van-cell title="车牌号" is-link v-else>
|
5e52ed7c
刘淇
个人中心
|
9
10
11
12
13
|
<template>
<p @click="show = true" style="color: #1989fa">{{carNum}}</p>
<van-action-sheet v-model="show" :actions="actions" @select="onSelect"/>
</template>
</van-cell>
|
5d00ef92
刘淇
会员卡续费
|
14
15
|
|
9ca46819
刘淇
购买会员卡
|
16
17
18
|
<van-cell title="适用停车场" :value="plName"/>
<van-cell title="卡类别" :value="cardNickname"/>
<van-cell title="卡名称" :value="cardName"/>
|
5d00ef92
刘淇
会员卡续费
|
19
20
21
22
23
24
25
|
<van-cell title="生效时间" v-if="xufeiFlag==2">
<template>
{{valueStart}}
</template>
</van-cell>
<van-cell title="生效时间" is-link v-else>
|
5e52ed7c
刘淇
个人中心
|
26
27
28
29
|
<template>
<p @click="showDate = true" style="color: #1989fa"> {{valueStart}}</p>
</template>
</van-cell>
|
5d00ef92
刘淇
会员卡续费
|
30
31
32
|
|
9ca46819
刘淇
购买会员卡
|
33
|
<van-cell title="失效时间" :value="effDate"/>
|
5e52ed7c
刘淇
个人中心
|
34
35
36
|
<van-cell title="购买数量">
<template>
|
5d00ef92
刘淇
会员卡续费
|
37
|
<van-stepper v-model="count" :min="1" theme="round" button-size="22" disable-input @change="changeCount"/>
|
5e52ed7c
刘淇
个人中心
|
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
</template>
</van-cell>
</van-cell-group>
<van-popup v-model="showDate" position="bottom" :style="{ height: '30%' }">
<van-datetime-picker
v-show="showDate"
v-model="currentDate"
type="date"
title="选择生效日期"
:min-date="minDate"
:max-date="maxDate"
@confirm="confirmDate"
@cancel="cancelDate"
/>
</van-popup>
<van-cell-group style="border-bottom: 10px solid #fafafa">
<van-cell title="单价">
<template>
|
9ca46819
刘淇
购买会员卡
|
60
|
<p style="font-size: 16px;font-weight: 600;color: #000;">{{actPrice|numFilter}}元</p>
|
5e52ed7c
刘淇
个人中心
|
61
62
63
64
|
</template>
</van-cell>
|
9ca46819
刘淇
购买会员卡
|
65
|
<van-cell title="优惠">
|
5d00ef92
刘淇
会员卡续费
|
66
|
|
5e52ed7c
刘淇
个人中心
|
67
|
<template>
|
5d00ef92
刘淇
会员卡续费
|
68
69
70
|
<p style="font-size: 16px;font-weight: 600;color: #f00;" v-if="discValue == undefined || discValue >= 10">
暂无优惠</p>
<p style="font-size: 16px;font-weight: 600;color: #f00;" v-else>{{discValue}}折</p>
|
5e52ed7c
刘淇
个人中心
|
71
72
73
74
75
76
|
</template>
</van-cell>
<van-cell title="支付金额">
<template>
|
9ca46819
刘淇
购买会员卡
|
77
|
<p style="font-size: 16px;font-weight: 600;color: #000;">{{ ((payPrice*discValue)/10) |numFilter}}元</p>
|
5e52ed7c
刘淇
个人中心
|
78
79
80
81
82
83
84
85
|
</template>
</van-cell>
</van-cell-group>
<div class="leftRightPadding" style="margin-top: 34px">
<!--<mt-button type="danger" size="large"></mt-button>-->
|
9ca46819
刘淇
购买会员卡
|
86
|
<van-button type="info" block @click="buyCardHandle">购买</van-button>
|
5e52ed7c
刘淇
个人中心
|
87
88
89
90
91
92
|
</div>
</section>
</template>
<script>
|
9ca46819
刘淇
购买会员卡
|
93
|
import { queryUserCars, createVipCardOrder2022 } from "@/api/card/card";
|
5e52ed7c
刘淇
个人中心
|
94
95
96
97
|
export default {
name: "buyVipCard",
data() {
return {
|
5d00ef92
刘淇
会员卡续费
|
98
99
100
|
plName: "",
cardNo: "",
plNo: "",
|
9ca46819
刘淇
购买会员卡
|
101
102
|
carList: [],
carNum: "",
|
5e52ed7c
刘淇
个人中心
|
103
|
show: false,
|
9ca46819
刘淇
购买会员卡
|
104
|
actions: [],
|
5d00ef92
刘淇
会员卡续费
|
105
|
minDate: "",
|
9ca46819
刘淇
购买会员卡
|
106
|
maxDate: new Date(2099, 10, 14),
|
5d00ef92
刘淇
会员卡续费
|
107
|
currentDate: "",
|
9ca46819
刘淇
购买会员卡
|
108
|
valueStart: "",
|
5d00ef92
刘淇
会员卡续费
|
109
|
effDate: "",// 失效时间
|
5e52ed7c
刘淇
个人中心
|
110
|
showDate: false,
|
9ca46819
刘淇
购买会员卡
|
111
112
113
114
115
116
117
|
count: 1, // 购买数量
cardName: "",//卡名称
carType: "",//车辆类型
cardType: "",//卡类型
cardNickname: "",//卡类别
actPrice: "",//单价
discValue: "",//优惠
|
5d00ef92
刘淇
会员卡续费
|
118
119
|
payPrice: "", // 支付金额
xufeiFlag: ""//判断是否续费 1否 2是
|
5e52ed7c
刘淇
个人中心
|
120
121
|
};
},
|
9ca46819
刘淇
购买会员卡
|
122
|
created() {
|
5d00ef92
刘淇
会员卡续费
|
123
|
this.xufeiFlag = this.$route.query.xufeiFlag;
|
9ca46819
刘淇
购买会员卡
|
124
125
|
this.plNo = this.$route.query.plNo;
this.cardNo = this.$route.query.cardNo;
|
9ca46819
刘淇
购买会员卡
|
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
|
this.plName = this.$route.query.plName;
this.cardName = this.$route.query.cardName;
this.carType = this.$route.query.carType;
let carTypeName;
switch (Number(this.carType)) {
case 1:
carTypeName = "大型车";
break;
case 2:
carTypeName = "小型车";
break;
default:
break;
}
this.cardType = this.$route.query.cardType;
let cardTypeName;
switch (Number(this.cardType)) {
case 1:
cardTypeName = "年卡";
break;
case 2:
cardTypeName = "半年卡";
break;
case 3:
cardTypeName = "季卡";
break;
case 4:
cardTypeName = "月卡";
break;
case 5:
cardTypeName = "日卡";
break;
default:
break;
}
this.cardNickname = carTypeName + cardTypeName;
this.actPrice = Number(this.$route.query.actPrice);
this.discValue = Number(this.$route.query.discValue);
this.payPrice = this.actPrice * this.count;
console.log(this.actPrice);
console.log(this.discValue);
console.log(this.payPrice);
|
5d00ef92
刘淇
会员卡续费
|
168
169
170
171
172
173
174
175
|
if (this.xufeiFlag == 2) { // 2代表续费
this.valueStart = this.$route.query.expDate;
// effDate
this.getEffDate(1);
} else {
this.queryUserCars();
this.getStartDate();
}
|
9ca46819
刘淇
购买会员卡
|
176
|
},
|
5e52ed7c
刘淇
个人中心
|
177
|
methods: {
|
5d00ef92
刘淇
会员卡续费
|
178
|
getStartDate() {
|
9ca46819
刘淇
购买会员卡
|
179
|
let dateTime = new Date();
|
5d00ef92
刘淇
会员卡续费
|
180
|
this.valueStart = this.$utils.formatDate(dateTime, 1);
|
9ca46819
刘淇
购买会员卡
|
181
|
// this.minDate = this.$utils.formatDate(dateTime,1)
|
5d00ef92
刘淇
会员卡续费
|
182
|
this.minDate = new Date();
|
9ca46819
刘淇
购买会员卡
|
183
|
// 计算失效日期根据卡类型
|
5d00ef92
刘淇
会员卡续费
|
184
|
this.getEffDate(1);
|
9ca46819
刘淇
购买会员卡
|
185
|
},
|
5d00ef92
刘淇
会员卡续费
|
186
187
188
189
|
getEffDate(num) {
if (this.cardType == 1) { // 年卡 给日期添加12个月
console.log(this.valueStart);
this.effDate = this.$moment(this.valueStart).add(12 * num, "M").subtract(1, "days").format("YYYY-MM-DD");
|
9ca46819
刘淇
购买会员卡
|
190
|
}
|
5d00ef92
刘淇
会员卡续费
|
191
192
193
|
if (this.cardType == 2) { // 半年卡 给日期添加6个月
console.log(this.valueStart);
this.effDate = this.$moment(this.valueStart).add(6 * num, "M").subtract(1, "days").format("YYYY-MM-DD");
|
9ca46819
刘淇
购买会员卡
|
194
|
}
|
5d00ef92
刘淇
会员卡续费
|
195
196
197
|
if (this.cardType == 3) { // 季卡 给日期添加3个月
console.log(this.valueStart);
this.effDate = this.$moment(this.valueStart).add(3 * num, "M").subtract(1, "days").format("YYYY-MM-DD");
|
9ca46819
刘淇
购买会员卡
|
198
|
}
|
5d00ef92
刘淇
会员卡续费
|
199
200
201
|
if (this.cardType == 4) { // 月卡 给日期添加1个月
console.log(this.valueStart);
this.effDate = this.$moment(this.valueStart).add(1 * num, "M").subtract(1, "days").format("YYYY-MM-DD");
|
9ca46819
刘淇
购买会员卡
|
202
|
}
|
5d00ef92
刘淇
会员卡续费
|
203
204
205
|
if (this.cardType == 5) { // 日卡 给日期添加1个月
console.log(this.valueStart);
this.effDate = this.$moment(this.valueStart).add(1 * num, "days").format("YYYY-MM-DD");
|
9ca46819
刘淇
购买会员卡
|
206
|
}
|
5d00ef92
刘淇
会员卡续费
|
207
208
209
|
if (this.cardType == 6) { // 错峰年卡(周末免费) 给日期添加12个月
console.log(this.valueStart);
this.effDate = this.$moment(this.valueStart).add(12 * num, "M").subtract(1, "days").format("YYYY-MM-DD");
|
9ca46819
刘淇
购买会员卡
|
210
|
}
|
5d00ef92
刘淇
会员卡续费
|
211
212
213
|
if (this.cardType == 7) { // 错峰月卡(周末免费) 给日期添加1个月
console.log(this.valueStart);
this.effDate = this.$moment(this.valueStart).add(1 * num, "M").subtract(1, "days").format("YYYY-MM-DD");
|
9ca46819
刘淇
购买会员卡
|
214
|
}
|
5d00ef92
刘淇
会员卡续费
|
215
216
217
|
if (this.cardType == 8) { // 错峰夜晚包月 给日期添加1个月
console.log(this.valueStart);
this.effDate = this.$moment(this.valueStart).add(1 * num, "M").subtract(1, "days").format("YYYY-MM-DD");
|
9ca46819
刘淇
购买会员卡
|
218
|
}
|
9ca46819
刘淇
购买会员卡
|
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
|
},
queryUserCars() {
let jsondata = {};
jsondata.sign = this.$utils.signObject(jsondata);
queryUserCars(jsondata).then(response => {
console.log(response);
this.carList = response.data;
if (this.carList.length == 0) {
this.carNum = "点击选择车牌";
this.carList = {
name: "前往绑定车牌页面"
};
} else if (this.carList.length == 3) {
this.carList.forEach((v, i) => {
this.actions.push({
name: v.carNumber
});
});
this.carNum = this.carList[0].carNumber;
} else {
this.carList.forEach((v, i) => {
|
5d00ef92
刘淇
会员卡续费
|
240
|
console.log(v);
|
9ca46819
刘淇
购买会员卡
|
241
242
243
244
245
246
247
248
249
250
251
|
this.actions.push({
name: v.carNumber
});
});
this.carNum = this.carList[0].carNumber;
this.actions.push({
name: "前往绑定车牌页面"
});
}
});
},
|
5d00ef92
刘淇
会员卡续费
|
252
253
254
255
|
changeCount(val) {
console.log(this.count);
this.payPrice = this.actPrice * this.count;
this.getEffDate(val);
|
9ca46819
刘淇
购买会员卡
|
256
|
},
|
5e52ed7c
刘淇
个人中心
|
257
258
259
260
261
|
onSelect(item) {
// 默认情况下点击选项时不会自动收起
// 可以通过 close-on-click-action 属性开启自动收起
this.show = false;
this.carNum = item.name;
|
9ca46819
刘淇
购买会员卡
|
262
263
264
265
266
267
268
|
console.log(item.name);
if (item.name == "前往绑定车牌页面") {
this.$router.push({
name: "addCarNum"
}
);
}
|
5e52ed7c
刘淇
个人中心
|
269
270
271
|
},
confirmDate(val) {
console.log(val);
|
5d00ef92
刘淇
会员卡续费
|
272
273
|
this.valueStart = this.$utils.formatDate(val, 1);
this.getEffDate(this.count);
|
5e52ed7c
刘淇
个人中心
|
274
275
276
277
|
this.showDate = false;
},
cancelDate() {
this.showDate = false;
|
9ca46819
刘淇
购买会员卡
|
278
|
},
|
5d00ef92
刘淇
会员卡续费
|
279
280
|
buyCardHandle() { // 购买续费
// paySrcType 301 会员卡购买单 302 会员卡续费
|
9ca46819
刘淇
购买会员卡
|
281
282
|
// cardCouponsId 是 string 已购买的会员卡id 新增不传 续费必传
// optType 是 string 操作类型 1 购买 2 续费
|
5d00ef92
刘淇
会员卡续费
|
283
284
|
if (this.carNum == "点击选择车牌") {
this.$toast("请先选择车牌");
|
9ca46819
刘淇
购买会员卡
|
285
286
|
return;
}
|
9ca46819
刘淇
购买会员卡
|
287
288
289
290
291
292
|
let jsondata = {
plNo: this.plNo,
cardNo: this.cardNo,
cardType: this.cardType,
carType: this.carType,
price: this.actPrice,
|
5d00ef92
刘淇
会员卡续费
|
293
|
totalAmount: (this.payPrice * this.discValue) / 10,
|
9ca46819
刘淇
购买会员卡
|
294
295
296
297
|
num: this.count,
effDate: this.valueStart,
expDate: this.effDate,
carNumber: this.carNum,
|
5d00ef92
刘淇
会员卡续费
|
298
299
300
|
optType: this.xufeiFlag == 1 ? "1" : "2",
cardCouponsId: this.$router.query.custCardNo,
forceBuy: "1"
|
9ca46819
刘淇
购买会员卡
|
301
302
303
304
|
};
jsondata.sign = this.$utils.signObject(jsondata);
createVipCardOrder2022(jsondata).then(response => {
console.log(response);
|
5d00ef92
刘淇
会员卡续费
|
305
306
307
308
309
310
311
|
if (response.code == 0) {
let orderId = response.data.orderId;
console.log(orderId);
} else if (response.code == 5006) {
this.$toast("请先去补缴欠费订单");
} else {
this.$toast(response.message);
|
9ca46819
刘淇
购买会员卡
|
312
|
}
|
9ca46819
刘淇
购买会员卡
|
313
|
});
|
5e52ed7c
刘淇
个人中心
|
314
315
316
317
318
319
320
321
322
323
324
325
326
327
|
}
}
};
</script>
<style scoped>
.order-line-bold {
background: #fafafa;
height: 12px;
margin-top: 12px;
padding: 0px;
overflow: hidden;
}
</style>
|