From bb19b29702fab67a057fd23c8e25a6c86e25232d Mon Sep 17 00:00:00 2001 From: wangsongsole Date: Thu, 17 Nov 2022 14:12:25 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E5=AE=9D=E7=8E=AF=E5=A2=83=20=E6=94=AF=E4=BB=98=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=E6=B2=A1=E6=9C=89=E9=BB=98=E8=AE=A4=E9=80=89=E4=B8=AD?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- coupon/settlement.html | 116 ++++++++++++++++++++--------------------- 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/coupon/settlement.html b/coupon/settlement.html index 67c92aa..aa752f0 100644 --- a/coupon/settlement.html +++ b/coupon/settlement.html @@ -111,7 +111,7 @@ href: '',/* 支付地址 */ orderNumber: '', isLogin: false,/* 是否跳登录页 */ - } + }; }, components: { modelPop, @@ -120,35 +120,35 @@ created () { //商品详情 - let goodsData=JSON.parse(localStorage.getItem('goodsInfo')); + let goodsData = JSON.parse(localStorage.getItem('goodsInfo')); let goodsId = goodsData.id; - let code_batch_id =goodsData.coupon && goodsData.coupon.code_batch_id || goodsData.code_batch_id; - this.orderNumber = this.getQueryString('orderNumber') - const payType = Number(this.getQueryString('payType')) + let code_batch_id = goodsData.coupon && goodsData.coupon.code_batch_id || goodsData.code_batch_id; + this.orderNumber = this.getQueryString('orderNumber'); + const payType = Number(this.getQueryString('payType')); if (isWx()) { - this.payType = 1 + this.payType = 1; this.getweixin(); } else { - payType && this.payType === 5 ? 1 : 2 + this.payType = payType === 5 ? 1 : 2; } - if(!this.getQueryString('orderNumber')){ - this.getDetails(goodsId,code_batch_id); - }else{ - let data={ - type:goodsData.type, - entity:{ - show_url:goodsData.show_url, - channel:goodsData.goods.channel, - product_name:goodsData.goods.product_name, - batch_goods_name:goodsData.goods.batch_goods_name, + if (!this.getQueryString('orderNumber')) { + this.getDetails(goodsId, code_batch_id); + } else { + let data = { + type: goodsData.type, + entity: { + show_url: goodsData.show_url, + channel: goodsData.goods.channel, + product_name: goodsData.goods.product_name, + batch_goods_name: goodsData.goods.batch_goods_name, }, - origin_price:goodsData.official_price, - coupon_price:goodsData.pay_amount - } - this.goodsDetail = data + origin_price: goodsData.official_price, + coupon_price: goodsData.pay_amount + }; + this.goodsDetail = data; this.goodInfo = data.entity; - this.isView=true; - console.log(151,this.goodsDetail); + this.isView = true; + console.log(151, this.goodsDetail); } }, @@ -160,21 +160,21 @@ return null; }, /* 请求详情 */ - getDetails (goods_id,code_batch_id) { - const token = localStorage.getItem('token') - let data={ token,code_batch_id } + getDetails (goods_id, code_batch_id) { + const token = localStorage.getItem('token'); + let data = { token, code_batch_id }; return new Promise((resolve, reject) => { - req.axiosPost(`/key/product_detail/${goods_id}`,data ).then(({ code, data, message }) => { + req.axiosPost(`/key/product_detail/${goods_id}`, data).then(({ code, data, message }) => { if (code == 200) { - this.goodsDetail = data - goodsDetail = data + this.goodsDetail = data; + goodsDetail = data; this.goodInfo = data.entity; this.isView = true; } else { this.openErrorDialog(message); if (code == 403) { - this.delayedOut(3) - this.isLogin = true + this.delayedOut(3); + this.isLogin = true; } } }).catch(err => { @@ -183,25 +183,25 @@ }, openErrorDialog (tip, bottomText) { - this.popTitle = '温馨提示' - this.popText = tip - this.popStatus = 2 - this.popShow = true - this.bottomText = bottomText + this.popTitle = '温馨提示'; + this.popText = tip; + this.popStatus = 2; + this.popShow = true; + this.bottomText = bottomText; }, backHandler () { - history.go(-1) + history.go(-1); }, // 单条弹框 openDialog (tip) { this.promtshow = true; - this.promttip = tip + this.promttip = tip; setTimeout(() => { this.promtshow = false; this.promttip = ''; - }, 3000) + }, 3000); }, /* 弹窗回调 */ @@ -213,11 +213,11 @@ aux.select(); document.execCommand("copy"); document.body.removeChild(aux); - this.openDialog('复制成功') + this.openDialog('复制成功'); } if (this.isLogin) { - this.delayedOut() + this.delayedOut(); } }, @@ -234,16 +234,16 @@ if (this.goodsDetail.type === 1 && this.goodInfo.product_type === 1 && !this.orderNumber) { /* 兑换码 */ if (goodsDetail.available != 1) { this.openErrorDialog(product_status(goodsDetail.available, goodsDetail)); - return + return; } } - this.show = true + this.show = true; }, /* 去支付 */ async payFunction ({ payType, isSupport }) { - this.payType = payType - this.show = false + this.payType = payType; + this.show = false; if (!this.getQueryString('orderNumber')) { let orderInfo = await this.createdOrder(payType); if (orderInfo.pay_status == 2 || [1, 2].includes(orderInfo.channel)) {//pay_status 2已支付 channel 1 支付宝 2微信 @@ -253,7 +253,7 @@ this.createdPay(orderInfo.order_number); } } else { - this.setOrderPayType(payType) + this.setOrderPayType(payType); } }, @@ -263,19 +263,19 @@ /* payType 1:微信 2:支付宝 */ /* 后端 微信是5 支付宝是1 */ /* 设置支付类型 */ - const payTypeCopy = payType === 2 ? 1 : 5 + const payTypeCopy = payType === 2 ? 1 : 5; if (this.payType !== payTypeCopy) { /* 支付类型是否变化 */ req.axiosPut(`/key/order/setPayType/${this.orderNumber}/${payTypeCopy}`).then(({ code, message }) => { if (code === 403) { - this.openErrorDialog(message, '我知道了') - this.delayedOut(3) - return this.redirect = true + this.openErrorDialog(message, '我知道了'); + this.delayedOut(3); + return this.redirect = true; } if (code === 200) { this.createdPay(this.orderNumber); } - }) + }); } else { this.createdPay(this.orderNumber); } @@ -292,7 +292,7 @@ "account": this.account || '888888', /* 卡密时默认账号 */ "pay_type": payType == 2 ? 1 : 5, "pay_amount": this.goodsDetail.coupon_price - } + }; return new Promise((resolve, reject) => { req.axiosPost('/key/createCouponOrder', data).then(res => { if (res.code == 200) { @@ -300,8 +300,8 @@ } else { this.openErrorDialog(res.message); if (res.code == 403) { - this.delayedOut(3) - this.isLogin = true + this.delayedOut(3); + this.isLogin = true; } } }).catch(err => { @@ -312,11 +312,11 @@ createdPay (orderNumber) { console.log(582, orderNumber); this.orderNumber = orderNumber; - let open_id = localStorage.getItem('code_weixin') + let open_id = localStorage.getItem('code_weixin'); console.log(582, open_id); let data = { token: localStorage.getItem('token'), - } + }; if (open_id) { data.open_id = encodeURIComponent(open_id); } @@ -333,7 +333,7 @@ if (this.payType == 1) {// 1微信支付 2 支付宝支付 if (isWx()) { //进行微信支付 - this.gotoWeiXinPay(result) + this.gotoWeiXinPay(result); } else { window.location.href = result; } @@ -384,7 +384,7 @@ }, getweixin () { let code_weixin = this.getQueryString('openid'); - let code_weixin_history = localStorage.getItem('code_weixin') + let code_weixin_history = localStorage.getItem('code_weixin'); if (code_weixin) { if (code_weixin != code_weixin_history) { console.log(2381, code_weixin);