fix:修复支付宝环境 支付方式没有默认选中bug
This commit is contained in:
parent
e583925e8d
commit
bb19b29702
|
@ -111,7 +111,7 @@
|
|||
href: '',/* 支付地址 */
|
||||
orderNumber: '',
|
||||
isLogin: false,/* 是否跳登录页 */
|
||||
}
|
||||
};
|
||||
},
|
||||
components: {
|
||||
modelPop,
|
||||
|
@ -123,13 +123,13 @@
|
|||
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'))
|
||||
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);
|
||||
|
@ -144,8 +144,8 @@
|
|||
},
|
||||
origin_price: goodsData.official_price,
|
||||
coupon_price: goodsData.pay_amount
|
||||
}
|
||||
this.goodsDetail = data
|
||||
};
|
||||
this.goodsDetail = data;
|
||||
this.goodInfo = data.entity;
|
||||
this.isView = true;
|
||||
console.log(151, this.goodsDetail);
|
||||
|
@ -161,20 +161,20 @@
|
|||
},
|
||||
/* 请求详情 */
|
||||
getDetails (goods_id, code_batch_id) {
|
||||
const token = localStorage.getItem('token')
|
||||
let data={ token,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 }) => {
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue