Commit 5d00ef92718659d82699a4ce75f6dd8460978be8
1 parent
552b3337
会员卡续费
Showing
3 changed files
with
103 additions
and
80 deletions
src/views/cards/buyVipCard.vue
1 | 1 | <template> |
2 | 2 | <section style="width: 100%;height: 100%;background: #fff"> |
3 | 3 | <van-cell-group style="border-bottom: 10px solid #fafafa"> |
4 | - <van-cell title="车牌号" is-link> | |
4 | + <van-cell title="车牌号" v-if="xufeiFlag==2"> | |
5 | + <template>{{$route.query.carNumber}}</template> | |
6 | + </van-cell> | |
7 | + | |
8 | + <van-cell title="车牌号" is-link v-else> | |
5 | 9 | <template> |
6 | 10 | <p @click="show = true" style="color: #1989fa">{{carNum}}</p> |
7 | 11 | <van-action-sheet v-model="show" :actions="actions" @select="onSelect"/> |
8 | 12 | </template> |
9 | 13 | </van-cell> |
14 | + | |
15 | + | |
10 | 16 | <van-cell title="适用停车场" :value="plName"/> |
11 | 17 | <van-cell title="卡类别" :value="cardNickname"/> |
12 | 18 | <van-cell title="卡名称" :value="cardName"/> |
13 | - <van-cell title="生效时间" is-link> | |
19 | + | |
20 | + <van-cell title="生效时间" v-if="xufeiFlag==2"> | |
21 | + <template> | |
22 | + {{valueStart}} | |
23 | + </template> | |
24 | + </van-cell> | |
25 | + <van-cell title="生效时间" is-link v-else> | |
14 | 26 | <template> |
15 | 27 | <p @click="showDate = true" style="color: #1989fa"> {{valueStart}}</p> |
16 | 28 | </template> |
17 | 29 | </van-cell> |
30 | + | |
31 | + | |
32 | + | |
18 | 33 | <van-cell title="失效时间" :value="effDate"/> |
19 | 34 | |
20 | 35 | <van-cell title="购买数量"> |
21 | 36 | <template> |
22 | - <van-stepper v-model="count" :min="1" theme="round" button-size="22" disable-input @change="changeCount"/> | |
37 | + <van-stepper v-model="count" :min="1" theme="round" button-size="22" disable-input @change="changeCount"/> | |
23 | 38 | </template> |
24 | 39 | </van-cell> |
25 | 40 | </van-cell-group> |
... | ... | @@ -48,8 +63,11 @@ |
48 | 63 | |
49 | 64 | |
50 | 65 | <van-cell title="优惠"> |
66 | + | |
51 | 67 | <template> |
52 | - <p style="font-size: 16px;font-weight: 600;color: #f00;">{{discValue}}折</p> | |
68 | + <p style="font-size: 16px;font-weight: 600;color: #f00;" v-if="discValue == undefined || discValue >= 10"> | |
69 | + 暂无优惠</p> | |
70 | + <p style="font-size: 16px;font-weight: 600;color: #f00;" v-else>{{discValue}}折</p> | |
53 | 71 | </template> |
54 | 72 | </van-cell> |
55 | 73 | |
... | ... | @@ -77,18 +95,18 @@ export default { |
77 | 95 | name: "buyVipCard", |
78 | 96 | data() { |
79 | 97 | return { |
80 | - plName:'', | |
81 | - cardNo:'', | |
82 | - plNo:'', | |
98 | + plName: "", | |
99 | + cardNo: "", | |
100 | + plNo: "", | |
83 | 101 | carList: [], |
84 | 102 | carNum: "", |
85 | 103 | show: false, |
86 | 104 | actions: [], |
87 | - minDate: '', | |
105 | + minDate: "", | |
88 | 106 | maxDate: new Date(2099, 10, 14), |
89 | - currentDate: '', | |
107 | + currentDate: "", | |
90 | 108 | valueStart: "", |
91 | - effDate:'',// 失效时间 | |
109 | + effDate: "",// 失效时间 | |
92 | 110 | showDate: false, |
93 | 111 | count: 1, // 购买数量 |
94 | 112 | cardName: "",//卡名称 |
... | ... | @@ -97,14 +115,14 @@ export default { |
97 | 115 | cardNickname: "",//卡类别 |
98 | 116 | actPrice: "",//单价 |
99 | 117 | discValue: "",//优惠 |
100 | - payPrice: "" // 支付金额 | |
118 | + payPrice: "", // 支付金额 | |
119 | + xufeiFlag: ""//判断是否续费 1否 2是 | |
101 | 120 | }; |
102 | 121 | }, |
103 | 122 | created() { |
104 | - | |
123 | + this.xufeiFlag = this.$route.query.xufeiFlag; | |
105 | 124 | this.plNo = this.$route.query.plNo; |
106 | 125 | this.cardNo = this.$route.query.cardNo; |
107 | - | |
108 | 126 | this.plName = this.$route.query.plName; |
109 | 127 | this.cardName = this.$route.query.cardName; |
110 | 128 | this.carType = this.$route.query.carType; |
... | ... | @@ -147,57 +165,57 @@ export default { |
147 | 165 | console.log(this.actPrice); |
148 | 166 | console.log(this.discValue); |
149 | 167 | console.log(this.payPrice); |
150 | - this.queryUserCars(); | |
151 | - | |
152 | - this.getStartDate() | |
168 | + if (this.xufeiFlag == 2) { // 2代表续费 | |
169 | + this.valueStart = this.$route.query.expDate; | |
170 | + // effDate | |
171 | + this.getEffDate(1); | |
172 | + } else { | |
173 | + this.queryUserCars(); | |
174 | + this.getStartDate(); | |
175 | + } | |
153 | 176 | }, |
154 | 177 | methods: { |
155 | - getStartDate(){ | |
178 | + getStartDate() { | |
156 | 179 | let dateTime = new Date(); |
157 | - this.valueStart = this.$utils.formatDate(dateTime,1) | |
180 | + this.valueStart = this.$utils.formatDate(dateTime, 1); | |
158 | 181 | // this.minDate = this.$utils.formatDate(dateTime,1) |
159 | - this.minDate = new Date() | |
160 | - | |
182 | + this.minDate = new Date(); | |
161 | 183 | // 计算失效日期根据卡类型 |
162 | - this.getEffDate(1) | |
184 | + this.getEffDate(1); | |
163 | 185 | }, |
164 | - getEffDate(num){ | |
165 | - if(this.cardType==1){ // 年卡 给日期添加12个月 | |
166 | - console.log(this.valueStart) | |
167 | - this.effDate = this.$moment(this.valueStart).add(12*num, 'M').subtract(1,'days').format('YYYY-MM-DD') | |
186 | + getEffDate(num) { | |
187 | + if (this.cardType == 1) { // 年卡 给日期添加12个月 | |
188 | + console.log(this.valueStart); | |
189 | + this.effDate = this.$moment(this.valueStart).add(12 * num, "M").subtract(1, "days").format("YYYY-MM-DD"); | |
168 | 190 | } |
169 | - if(this.cardType==2){ // 半年卡 给日期添加6个月 | |
170 | - console.log(this.valueStart) | |
171 | - this.effDate = this.$moment(this.valueStart).add(6*num, 'M').subtract(1,'days').format('YYYY-MM-DD') | |
191 | + if (this.cardType == 2) { // 半年卡 给日期添加6个月 | |
192 | + console.log(this.valueStart); | |
193 | + this.effDate = this.$moment(this.valueStart).add(6 * num, "M").subtract(1, "days").format("YYYY-MM-DD"); | |
172 | 194 | } |
173 | - if(this.cardType==3){ // 季卡 给日期添加3个月 | |
174 | - console.log(this.valueStart) | |
175 | - this.effDate = this.$moment(this.valueStart).add(3*num, 'M').subtract(1,'days').format('YYYY-MM-DD') | |
195 | + if (this.cardType == 3) { // 季卡 给日期添加3个月 | |
196 | + console.log(this.valueStart); | |
197 | + this.effDate = this.$moment(this.valueStart).add(3 * num, "M").subtract(1, "days").format("YYYY-MM-DD"); | |
176 | 198 | } |
177 | - if(this.cardType==4){ // 月卡 给日期添加1个月 | |
178 | - console.log(this.valueStart) | |
179 | - this.effDate = this.$moment(this.valueStart).add(1*num, 'M').subtract(1,'days').format('YYYY-MM-DD') | |
199 | + if (this.cardType == 4) { // 月卡 给日期添加1个月 | |
200 | + console.log(this.valueStart); | |
201 | + this.effDate = this.$moment(this.valueStart).add(1 * num, "M").subtract(1, "days").format("YYYY-MM-DD"); | |
180 | 202 | } |
181 | - if(this.cardType==5){ // 日卡 给日期添加1个月 | |
182 | - console.log(this.valueStart) | |
183 | - this.effDate = this.$moment(this.valueStart).add(1*num,'days').format('YYYY-MM-DD') | |
203 | + if (this.cardType == 5) { // 日卡 给日期添加1个月 | |
204 | + console.log(this.valueStart); | |
205 | + this.effDate = this.$moment(this.valueStart).add(1 * num, "days").format("YYYY-MM-DD"); | |
184 | 206 | } |
185 | - | |
186 | - if(this.cardType==6){ // 错峰年卡(周末免费) 给日期添加12个月 | |
187 | - console.log(this.valueStart) | |
188 | - this.effDate = this.$moment(this.valueStart).add(12*num, 'M').subtract(1,'days').format('YYYY-MM-DD') | |
207 | + if (this.cardType == 6) { // 错峰年卡(周末免费) 给日期添加12个月 | |
208 | + console.log(this.valueStart); | |
209 | + this.effDate = this.$moment(this.valueStart).add(12 * num, "M").subtract(1, "days").format("YYYY-MM-DD"); | |
189 | 210 | } |
190 | - | |
191 | - if(this.cardType==7){ // 错峰月卡(周末免费) 给日期添加1个月 | |
192 | - console.log(this.valueStart) | |
193 | - this.effDate = this.$moment(this.valueStart).add(1*num, 'M').subtract(1,'days').format('YYYY-MM-DD') | |
211 | + if (this.cardType == 7) { // 错峰月卡(周末免费) 给日期添加1个月 | |
212 | + console.log(this.valueStart); | |
213 | + this.effDate = this.$moment(this.valueStart).add(1 * num, "M").subtract(1, "days").format("YYYY-MM-DD"); | |
194 | 214 | } |
195 | - | |
196 | - if(this.cardType==8){ // 错峰夜晚包月 给日期添加1个月 | |
197 | - console.log(this.valueStart) | |
198 | - this.effDate = this.$moment(this.valueStart).add(1*num, 'M').subtract(1,'days').format('YYYY-MM-DD') | |
215 | + if (this.cardType == 8) { // 错峰夜晚包月 给日期添加1个月 | |
216 | + console.log(this.valueStart); | |
217 | + this.effDate = this.$moment(this.valueStart).add(1 * num, "M").subtract(1, "days").format("YYYY-MM-DD"); | |
199 | 218 | } |
200 | - | |
201 | 219 | }, |
202 | 220 | queryUserCars() { |
203 | 221 | let jsondata = {}; |
... | ... | @@ -219,7 +237,7 @@ export default { |
219 | 237 | this.carNum = this.carList[0].carNumber; |
220 | 238 | } else { |
221 | 239 | this.carList.forEach((v, i) => { |
222 | - console.log(v) | |
240 | + console.log(v); | |
223 | 241 | this.actions.push({ |
224 | 242 | name: v.carNumber |
225 | 243 | }); |
... | ... | @@ -231,12 +249,11 @@ export default { |
231 | 249 | } |
232 | 250 | }); |
233 | 251 | }, |
234 | - changeCount(val){ | |
235 | - console.log( this.count) | |
236 | - this.payPrice = this.actPrice * this.count | |
237 | - this.getEffDate(val) | |
252 | + changeCount(val) { | |
253 | + console.log(this.count); | |
254 | + this.payPrice = this.actPrice * this.count; | |
255 | + this.getEffDate(val); | |
238 | 256 | }, |
239 | - | |
240 | 257 | onSelect(item) { |
241 | 258 | // 默认情况下点击选项时不会自动收起 |
242 | 259 | // 可以通过 close-on-click-action 属性开启自动收起 |
... | ... | @@ -252,51 +269,48 @@ export default { |
252 | 269 | }, |
253 | 270 | confirmDate(val) { |
254 | 271 | console.log(val); |
255 | - this.valueStart = this.$utils.formatDate(val,1); | |
256 | - this.getEffDate(this.count) | |
272 | + this.valueStart = this.$utils.formatDate(val, 1); | |
273 | + this.getEffDate(this.count); | |
257 | 274 | this.showDate = false; |
258 | 275 | }, |
259 | 276 | cancelDate() { |
260 | 277 | this.showDate = false; |
261 | 278 | }, |
262 | - buyCardHandle(){ // 购买续费 | |
263 | - //mypaySrcType 301 会员卡购买单 302 会员卡续费 | |
279 | + buyCardHandle() { // 购买续费 | |
280 | + // paySrcType 301 会员卡购买单 302 会员卡续费 | |
264 | 281 | // cardCouponsId 是 string 已购买的会员卡id 新增不传 续费必传 |
265 | 282 | // optType 是 string 操作类型 1 购买 2 续费 |
266 | - if (this.carNum == '点击选择车牌') { | |
267 | - this.$toast('请先选择车牌') | |
283 | + if (this.carNum == "点击选择车牌") { | |
284 | + this.$toast("请先选择车牌"); | |
268 | 285 | return; |
269 | 286 | } |
270 | - | |
271 | 287 | let jsondata = { |
272 | 288 | plNo: this.plNo, |
273 | 289 | cardNo: this.cardNo, |
274 | 290 | cardType: this.cardType, |
275 | 291 | carType: this.carType, |
276 | 292 | price: this.actPrice, |
277 | - totalAmount: (this.payPrice*this.discValue)/10, | |
293 | + totalAmount: (this.payPrice * this.discValue) / 10, | |
278 | 294 | num: this.count, |
279 | 295 | effDate: this.valueStart, |
280 | 296 | expDate: this.effDate, |
281 | 297 | carNumber: this.carNum, |
282 | - optType: 1, | |
283 | - cardCouponsId:'', | |
284 | - forceBuy: '1' | |
298 | + optType: this.xufeiFlag == 1 ? "1" : "2", | |
299 | + cardCouponsId: this.$router.query.custCardNo, | |
300 | + forceBuy: "1" | |
285 | 301 | }; |
286 | 302 | jsondata.sign = this.$utils.signObject(jsondata); |
287 | 303 | createVipCardOrder2022(jsondata).then(response => { |
288 | 304 | console.log(response); |
289 | - if(response.code == 0){ | |
290 | - let orderId = response.data.orderId | |
291 | - console.log(orderId) | |
292 | - }else if(response.code== 5006){ | |
293 | - this.$toast('请先去补缴欠费订单') | |
294 | - }else{ | |
295 | - this.$toast(response.message) | |
305 | + if (response.code == 0) { | |
306 | + let orderId = response.data.orderId; | |
307 | + console.log(orderId); | |
308 | + } else if (response.code == 5006) { | |
309 | + this.$toast("请先去补缴欠费订单"); | |
310 | + } else { | |
311 | + this.$toast(response.message); | |
296 | 312 | } |
297 | - | |
298 | 313 | }); |
299 | - | |
300 | 314 | } |
301 | 315 | } |
302 | 316 | }; | ... | ... |
src/views/cards/cardList.vue
... | ... | @@ -11,7 +11,7 @@ |
11 | 11 | /> |
12 | 12 | </van-col> |
13 | 13 | <van-col span="6" style="margin-top: 5px;"> |
14 | - <van-button type="info" round block>续费</van-button> | |
14 | + <van-button type="info" round block @click="toOwnCards">续费</van-button> | |
15 | 15 | </van-col> |
16 | 16 | </van-row> |
17 | 17 | |
... | ... | @@ -90,6 +90,12 @@ export default { |
90 | 90 | console.log(response.data); |
91 | 91 | this.cardList = response.data; |
92 | 92 | }); |
93 | + }, | |
94 | + toOwnCards() { | |
95 | + this.$router.push({ | |
96 | + name: "ownCards", | |
97 | + } | |
98 | + ); | |
93 | 99 | } |
94 | 100 | } |
95 | 101 | }; | ... | ... |
src/views/cards/ownCards.vue
... | ... | @@ -78,7 +78,7 @@ export default { |
78 | 78 | carType: i.carType, |
79 | 79 | cardType: i.cardType, |
80 | 80 | actPrice: i.actPrice, |
81 | - discValue: i.discValue, | |
81 | + discValue: i.discount, | |
82 | 82 | plName: i.parkName, |
83 | 83 | plAddress: i.parkAddr, |
84 | 84 | plNo: i.parkNo, |
... | ... | @@ -86,10 +86,13 @@ export default { |
86 | 86 | carNumber: i.carNumber, |
87 | 87 | effDate: i.effDate, |
88 | 88 | expDate: i.expDate, |
89 | - orderPayedFee: i.orderPayedFee | |
89 | + orderPayedFee: i.orderPayedFee, | |
90 | + custCardNo: i.custCardNo, | |
91 | + xufeiFlag: 2 | |
90 | 92 | } |
91 | 93 | } |
92 | - ); | |
94 | + ) | |
95 | + ; | |
93 | 96 | } |
94 | 97 | } |
95 | 98 | }; | ... | ... |