|
@@ -126,14 +126,14 @@ export default {
|
|
|
uni.showLoading({
|
|
|
title: '加载中',
|
|
|
});
|
|
|
- // const res = await paperCoupon(couponCode);
|
|
|
- const res = {
|
|
|
+ const res = await paperCoupon(couponCode, this.$route.query.vehicleNo);
|
|
|
+ /*const res = {
|
|
|
"status": "1",
|
|
|
"discountCode": "91354260",
|
|
|
"discountFee": 1,
|
|
|
"used": "0",
|
|
|
"content": "嘉里卡券测试"
|
|
|
- }
|
|
|
+ }*/
|
|
|
if ( /0/.test(res.status)) {
|
|
|
return Toast({
|
|
|
message: '该纸质优惠券未激活',
|
|
@@ -154,17 +154,25 @@ export default {
|
|
|
message: '该纸质优惠券已核销',
|
|
|
});
|
|
|
}
|
|
|
+ console.log(157, res)
|
|
|
+ console.log(158, this.paperCoupons)
|
|
|
+ console.log(158, this.paperCoupons.findIndex(item => {
|
|
|
+ console.log(160, item.discountCode, couponCode)
|
|
|
+ return item.discountCode === couponCode
|
|
|
+ }))
|
|
|
// 如果纸质优惠券不存在的话,则往 paperCoupons 添加
|
|
|
if ( this.paperCoupons.findIndex(item => item.discountCode === couponCode) < 0 ) {
|
|
|
const {hourPrice} = this.orderDetail.parkingRule
|
|
|
const discountTime = Number(res.discountFee) / hourPrice
|
|
|
- this.$store.commit('order/setPaperCoupons',[
|
|
|
+ const paperCoupons = [
|
|
|
...this.paperCoupons,
|
|
|
{
|
|
|
...res,
|
|
|
discountTime: res.discountFee / hourPrice
|
|
|
}
|
|
|
- ])
|
|
|
+ ]
|
|
|
+ this.paperCouponList = paperCoupons
|
|
|
+ this.$store.commit('order/setPaperCoupons',paperCoupons)
|
|
|
// 金额
|
|
|
this.$store.commit('order/setPaperDiscountFee',this.paperDiscountFee + Number(res.discountFee))
|
|
|
// 时间
|
|
@@ -187,6 +195,7 @@ export default {
|
|
|
// 确认
|
|
|
confirm() {
|
|
|
console.log(310,this.orderDetail);
|
|
|
+
|
|
|
this.$store.dispatch('order/savePaperCoupon', {
|
|
|
couponList: this.paperCoupons,
|
|
|
callback: () => {
|