diff --git a/coupon/myOrder.html b/coupon/myOrder.html index 9e1a9fb..b841007 100644 --- a/coupon/myOrder.html +++ b/coupon/myOrder.html @@ -81,8 +81,8 @@ - + @@ -119,6 +119,7 @@ bottomText: '' /*1 成功 2提示 3失败 */, goodsCount: 0,/* 商品数量 */ href: '',/* 支付链接 */ + isCancel: false, /* toast */ toastShow: '', @@ -210,19 +211,9 @@ /* 取消订单按钮 */ immediatelyCancel (item) { - const token = localStorage.getItem('token') - - req.axiosPut(`/key/order/cancel/${item.order_number}?token=${token}`).then(({ code, message }) => { - if (code === 403) { - this.popFunction({ title: '温馨提示', text: message, status: 2, b_text: '我知道了', show: true }) - this.toPage(3) - return this.redirect = true - } - if (code === 200) { - this.popFunction({ title: '温馨提示', text: '取消订单成功', status: 2, b_text: '我知道了', show: true }) - this.getOrderList() - } - }) + this.isCancel = true; + this.activeOrder = item; + this.popFunction({ title: '温馨提示', text: '是否确认取消订单', status: 2, b_text: '', show: true }) }, /* 去支付 */ @@ -253,7 +244,7 @@ /* 调用支付 */ payRealFunction (isSupport) { - req.axiosGet(`/key/coupon/createPay/${this.activeOrder.order_number}`,{token:localStorage.getItem('token')}).then(({ code, data, message }) => { + req.axiosGet(`/key/coupon/createPay/${this.activeOrder.order_number}`, { token: localStorage.getItem('token') }).then(({ code, data, message }) => { if (code === 403) { this.popFunction({ title: '温馨提示', text: message, status: 2, b_text: '我知道了', show: true }) this.toPage(3) @@ -326,6 +317,23 @@ if (this.redirect) { this.toPage() } + + /* 二次确认提示 */ + if (this.isCancel && type === 2) { + const token = localStorage.getItem('token') + req.axiosPut(`/key/order/cancel/${this.activeOrder.order_number}?token=${token}`).then(({ code, message }) => { + if (code === 403) { + this.popFunction({ title: '温馨提示', text: message, status: 2, b_text: '我知道了', show: true }) + this.toPage(3) + return this.redirect = true + } + if (code === 200) { + this.popFunction({ title: '温馨提示', text: '取消订单成功', status: 2, b_text: '我知道了', show: true }) + this.getOrderList() + } + }) + this.isCancel = false; + } },