fix:修复支付宝环境 支付方式没有默认选中bug
This commit is contained in:
parent
e583925e8d
commit
bb19b29702
|
@ -111,7 +111,7 @@
|
||||||
href: '',/* 支付地址 */
|
href: '',/* 支付地址 */
|
||||||
orderNumber: '',
|
orderNumber: '',
|
||||||
isLogin: false,/* 是否跳登录页 */
|
isLogin: false,/* 是否跳登录页 */
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
modelPop,
|
modelPop,
|
||||||
|
@ -120,35 +120,35 @@
|
||||||
|
|
||||||
created () {
|
created () {
|
||||||
//商品详情
|
//商品详情
|
||||||
let goodsData=JSON.parse(localStorage.getItem('goodsInfo'));
|
let goodsData = JSON.parse(localStorage.getItem('goodsInfo'));
|
||||||
let goodsId = goodsData.id;
|
let goodsId = goodsData.id;
|
||||||
let code_batch_id =goodsData.coupon && goodsData.coupon.code_batch_id || goodsData.code_batch_id;
|
let code_batch_id = goodsData.coupon && goodsData.coupon.code_batch_id || goodsData.code_batch_id;
|
||||||
this.orderNumber = this.getQueryString('orderNumber')
|
this.orderNumber = this.getQueryString('orderNumber');
|
||||||
const payType = Number(this.getQueryString('payType'))
|
const payType = Number(this.getQueryString('payType'));
|
||||||
if (isWx()) {
|
if (isWx()) {
|
||||||
this.payType = 1
|
this.payType = 1;
|
||||||
this.getweixin();
|
this.getweixin();
|
||||||
} else {
|
} else {
|
||||||
payType && this.payType === 5 ? 1 : 2
|
this.payType = payType === 5 ? 1 : 2;
|
||||||
}
|
}
|
||||||
if(!this.getQueryString('orderNumber')){
|
if (!this.getQueryString('orderNumber')) {
|
||||||
this.getDetails(goodsId,code_batch_id);
|
this.getDetails(goodsId, code_batch_id);
|
||||||
}else{
|
} else {
|
||||||
let data={
|
let data = {
|
||||||
type:goodsData.type,
|
type: goodsData.type,
|
||||||
entity:{
|
entity: {
|
||||||
show_url:goodsData.show_url,
|
show_url: goodsData.show_url,
|
||||||
channel:goodsData.goods.channel,
|
channel: goodsData.goods.channel,
|
||||||
product_name:goodsData.goods.product_name,
|
product_name: goodsData.goods.product_name,
|
||||||
batch_goods_name:goodsData.goods.batch_goods_name,
|
batch_goods_name: goodsData.goods.batch_goods_name,
|
||||||
},
|
},
|
||||||
origin_price:goodsData.official_price,
|
origin_price: goodsData.official_price,
|
||||||
coupon_price:goodsData.pay_amount
|
coupon_price: goodsData.pay_amount
|
||||||
}
|
};
|
||||||
this.goodsDetail = data
|
this.goodsDetail = data;
|
||||||
this.goodInfo = data.entity;
|
this.goodInfo = data.entity;
|
||||||
this.isView=true;
|
this.isView = true;
|
||||||
console.log(151,this.goodsDetail);
|
console.log(151, this.goodsDetail);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -160,21 +160,21 @@
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
/* 请求详情 */
|
/* 请求详情 */
|
||||||
getDetails (goods_id,code_batch_id) {
|
getDetails (goods_id, code_batch_id) {
|
||||||
const token = localStorage.getItem('token')
|
const token = localStorage.getItem('token');
|
||||||
let data={ token,code_batch_id }
|
let data = { token, code_batch_id };
|
||||||
return new Promise((resolve, reject) => {
|
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) {
|
if (code == 200) {
|
||||||
this.goodsDetail = data
|
this.goodsDetail = data;
|
||||||
goodsDetail = data
|
goodsDetail = data;
|
||||||
this.goodInfo = data.entity;
|
this.goodInfo = data.entity;
|
||||||
this.isView = true;
|
this.isView = true;
|
||||||
} else {
|
} else {
|
||||||
this.openErrorDialog(message);
|
this.openErrorDialog(message);
|
||||||
if (code == 403) {
|
if (code == 403) {
|
||||||
this.delayedOut(3)
|
this.delayedOut(3);
|
||||||
this.isLogin = true
|
this.isLogin = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
|
@ -183,25 +183,25 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
openErrorDialog (tip, bottomText) {
|
openErrorDialog (tip, bottomText) {
|
||||||
this.popTitle = '温馨提示'
|
this.popTitle = '温馨提示';
|
||||||
this.popText = tip
|
this.popText = tip;
|
||||||
this.popStatus = 2
|
this.popStatus = 2;
|
||||||
this.popShow = true
|
this.popShow = true;
|
||||||
this.bottomText = bottomText
|
this.bottomText = bottomText;
|
||||||
},
|
},
|
||||||
|
|
||||||
backHandler () {
|
backHandler () {
|
||||||
history.go(-1)
|
history.go(-1);
|
||||||
},
|
},
|
||||||
|
|
||||||
// 单条弹框
|
// 单条弹框
|
||||||
openDialog (tip) {
|
openDialog (tip) {
|
||||||
this.promtshow = true;
|
this.promtshow = true;
|
||||||
this.promttip = tip
|
this.promttip = tip;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.promtshow = false;
|
this.promtshow = false;
|
||||||
this.promttip = '';
|
this.promttip = '';
|
||||||
}, 3000)
|
}, 3000);
|
||||||
},
|
},
|
||||||
|
|
||||||
/* 弹窗回调 */
|
/* 弹窗回调 */
|
||||||
|
@ -213,11 +213,11 @@
|
||||||
aux.select();
|
aux.select();
|
||||||
document.execCommand("copy");
|
document.execCommand("copy");
|
||||||
document.body.removeChild(aux);
|
document.body.removeChild(aux);
|
||||||
this.openDialog('复制成功')
|
this.openDialog('复制成功');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isLogin) {
|
if (this.isLogin) {
|
||||||
this.delayedOut()
|
this.delayedOut();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -234,16 +234,16 @@
|
||||||
if (this.goodsDetail.type === 1 && this.goodInfo.product_type === 1 && !this.orderNumber) { /* 兑换码 */
|
if (this.goodsDetail.type === 1 && this.goodInfo.product_type === 1 && !this.orderNumber) { /* 兑换码 */
|
||||||
if (goodsDetail.available != 1) {
|
if (goodsDetail.available != 1) {
|
||||||
this.openErrorDialog(product_status(goodsDetail.available, goodsDetail));
|
this.openErrorDialog(product_status(goodsDetail.available, goodsDetail));
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.show = true
|
this.show = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
/* 去支付 */
|
/* 去支付 */
|
||||||
async payFunction ({ payType, isSupport }) {
|
async payFunction ({ payType, isSupport }) {
|
||||||
this.payType = payType
|
this.payType = payType;
|
||||||
this.show = false
|
this.show = false;
|
||||||
if (!this.getQueryString('orderNumber')) {
|
if (!this.getQueryString('orderNumber')) {
|
||||||
let orderInfo = await this.createdOrder(payType);
|
let orderInfo = await this.createdOrder(payType);
|
||||||
if (orderInfo.pay_status == 2 || [1, 2].includes(orderInfo.channel)) {//pay_status 2已支付 channel 1 支付宝 2微信
|
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);
|
this.createdPay(orderInfo.order_number);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.setOrderPayType(payType)
|
this.setOrderPayType(payType);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -263,19 +263,19 @@
|
||||||
/* payType 1:微信 2:支付宝 */
|
/* payType 1:微信 2:支付宝 */
|
||||||
/* 后端 微信是5 支付宝是1 */
|
/* 后端 微信是5 支付宝是1 */
|
||||||
/* 设置支付类型 */
|
/* 设置支付类型 */
|
||||||
const payTypeCopy = payType === 2 ? 1 : 5
|
const payTypeCopy = payType === 2 ? 1 : 5;
|
||||||
if (this.payType !== payTypeCopy) { /* 支付类型是否变化 */
|
if (this.payType !== payTypeCopy) { /* 支付类型是否变化 */
|
||||||
req.axiosPut(`/key/order/setPayType/${this.orderNumber}/${payTypeCopy}`).then(({ code, message }) => {
|
req.axiosPut(`/key/order/setPayType/${this.orderNumber}/${payTypeCopy}`).then(({ code, message }) => {
|
||||||
if (code === 403) {
|
if (code === 403) {
|
||||||
this.openErrorDialog(message, '我知道了')
|
this.openErrorDialog(message, '我知道了');
|
||||||
this.delayedOut(3)
|
this.delayedOut(3);
|
||||||
return this.redirect = true
|
return this.redirect = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (code === 200) {
|
if (code === 200) {
|
||||||
this.createdPay(this.orderNumber);
|
this.createdPay(this.orderNumber);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
this.createdPay(this.orderNumber);
|
this.createdPay(this.orderNumber);
|
||||||
}
|
}
|
||||||
|
@ -292,7 +292,7 @@
|
||||||
"account": this.account || '888888', /* 卡密时默认账号 */
|
"account": this.account || '888888', /* 卡密时默认账号 */
|
||||||
"pay_type": payType == 2 ? 1 : 5,
|
"pay_type": payType == 2 ? 1 : 5,
|
||||||
"pay_amount": this.goodsDetail.coupon_price
|
"pay_amount": this.goodsDetail.coupon_price
|
||||||
}
|
};
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
req.axiosPost('/key/createCouponOrder', data).then(res => {
|
req.axiosPost('/key/createCouponOrder', data).then(res => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
|
@ -300,8 +300,8 @@
|
||||||
} else {
|
} else {
|
||||||
this.openErrorDialog(res.message);
|
this.openErrorDialog(res.message);
|
||||||
if (res.code == 403) {
|
if (res.code == 403) {
|
||||||
this.delayedOut(3)
|
this.delayedOut(3);
|
||||||
this.isLogin = true
|
this.isLogin = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
|
@ -312,11 +312,11 @@
|
||||||
createdPay (orderNumber) {
|
createdPay (orderNumber) {
|
||||||
console.log(582, orderNumber);
|
console.log(582, orderNumber);
|
||||||
this.orderNumber = orderNumber;
|
this.orderNumber = orderNumber;
|
||||||
let open_id = localStorage.getItem('code_weixin')
|
let open_id = localStorage.getItem('code_weixin');
|
||||||
console.log(582, open_id);
|
console.log(582, open_id);
|
||||||
let data = {
|
let data = {
|
||||||
token: localStorage.getItem('token'),
|
token: localStorage.getItem('token'),
|
||||||
}
|
};
|
||||||
if (open_id) {
|
if (open_id) {
|
||||||
data.open_id = encodeURIComponent(open_id);
|
data.open_id = encodeURIComponent(open_id);
|
||||||
}
|
}
|
||||||
|
@ -333,7 +333,7 @@
|
||||||
if (this.payType == 1) {// 1微信支付 2 支付宝支付
|
if (this.payType == 1) {// 1微信支付 2 支付宝支付
|
||||||
if (isWx()) {
|
if (isWx()) {
|
||||||
//进行微信支付
|
//进行微信支付
|
||||||
this.gotoWeiXinPay(result)
|
this.gotoWeiXinPay(result);
|
||||||
} else {
|
} else {
|
||||||
window.location.href = result;
|
window.location.href = result;
|
||||||
}
|
}
|
||||||
|
@ -384,7 +384,7 @@
|
||||||
},
|
},
|
||||||
getweixin () {
|
getweixin () {
|
||||||
let code_weixin = this.getQueryString('openid');
|
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) {
|
||||||
if (code_weixin != code_weixin_history) {
|
if (code_weixin != code_weixin_history) {
|
||||||
console.log(2381, code_weixin);
|
console.log(2381, code_weixin);
|
||||||
|
|
Loading…
Reference in New Issue