diff --git a/coupon/details.html b/coupon/details.html index 84a3d36..b6c00a3 100644 --- a/coupon/details.html +++ b/coupon/details.html @@ -346,15 +346,21 @@ } if (this.isLogin) { - /*跳转起始页面*/ - let entryLink = localStorage.getItem('entryLink'); - setTimeout(() => { - window.location.replace(entryLink); - }, 3000); + this.delayedOut() } }, + /* 延时自动退出 */ + delayedOut (time = 1) { + let entryLink = localStorage.getItem('entryLink'); + setTimeout(() => { + window.location.replace(entryLink); + }, time * 1000); + }, + + + //兑换商品 exchangeGoodsFn () { if (this.goodsDetail.type === 1) { /* 兑换码 */ @@ -433,6 +439,7 @@ } else { this.openErrorDialog(res.message); if (res.code == 403) { + this.delayedOut(3) this.isLogin = true } } diff --git a/coupon/myCoupon.html b/coupon/myCoupon.html index f56b823..5089420 100644 --- a/coupon/myCoupon.html +++ b/coupon/myCoupon.html @@ -156,13 +156,18 @@ /* 重定向 */ backFunction () { if (this.redirect) { - let entryLink = localStorage.getItem('entryLink'); - setTimeout(() => { - window.location.replace(entryLink); - }, 1000); + this.delayedOut() } }, + /* 延时自动退出 */ + delayedOut (time = 1) { + let entryLink = localStorage.getItem('entryLink'); + setTimeout(() => { + window.location.replace(entryLink); + }, time * 1000); + }, + /* 请求数据 */ getCouponList () { const token = localStorage.getItem('token') @@ -179,7 +184,9 @@ this.popText = message this.popStatus = 2 this.popShow = true - return this.redirect = true + this.redirect = true + this.delayedOut(3) + return } if (code === 200) { const productArray = [] diff --git a/coupon/myOrder.html b/coupon/myOrder.html index ad5e626..c4982a5 100644 --- a/coupon/myOrder.html +++ b/coupon/myOrder.html @@ -208,6 +208,7 @@ req.axiosPut(`/key/order/setPayType/${this.activeOrder.order_number}/${this.active}`).then(({ code, message }) => { if (code === 403) { this.popFunction({ title: '温馨提示', text: message, status: 2, b_text: '我知道了', show: true }) + this.toPage(3) return this.redirect = true } @@ -226,6 +227,7 @@ req.axiosGet(`/key/coupon/createPay/${this.activeOrder.order_number}`).then(({ code, data, message }) => { if (code === 403) { this.popFunction({ title: '温馨提示', text: message, status: 2, b_text: '我知道了', show: true }) + this.toPage(3) return this.redirect = true } @@ -260,6 +262,7 @@ req.axiosGet(`/key/order/${token}`, { page: this.page, limit: this.limit }).then(({ data, 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) { @@ -272,11 +275,11 @@ }, /*跳转起始页面*/ - toPage () { + toPage (time = 1) { let entryLink = localStorage.getItem('entryLink'); setTimeout(() => { window.location.replace(entryLink); - }, 1000); + }, time * 1000); }, /* 弹窗回调 */