|
|
|
@ -104,7 +104,8 @@ export default { |
|
|
|
state: "", |
|
|
|
stateText: "", |
|
|
|
orderNo: "", |
|
|
|
info: {} |
|
|
|
info: {}, |
|
|
|
authUrl: "" |
|
|
|
}; |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
@ -146,6 +147,7 @@ export default { |
|
|
|
}) |
|
|
|
.then(res => { |
|
|
|
if (res.code === 0 && res.response.data) { |
|
|
|
this.authUrl = res.response.authUrl || ""; |
|
|
|
let info = res.response.data; |
|
|
|
this.wechat(info.merchantNo); |
|
|
|
info.create = info.createdAt |
|
|
|
@ -232,71 +234,66 @@ export default { |
|
|
|
}); |
|
|
|
}, |
|
|
|
pay() { |
|
|
|
this.addOrder().then(res => { |
|
|
|
this.$vux.loading.show({ |
|
|
|
text: "正在调起支付" |
|
|
|
}); |
|
|
|
if (isWeixin() && res.data.payPrice > 0) { |
|
|
|
//微信内打开,直接调起微信公众号支付 |
|
|
|
this.$vux.loading.hide(); |
|
|
|
location.href = res.authUrl.replace( |
|
|
|
"state=2", |
|
|
|
"state=2" + "," + res.data.orderNo |
|
|
|
); |
|
|
|
} else { |
|
|
|
var paymentType = res.data.payPrice > 0 ? 7 : 10; |
|
|
|
orderApi |
|
|
|
.pay({ |
|
|
|
orderNo: res.data.orderNo, |
|
|
|
paymentType: paymentType |
|
|
|
}) |
|
|
|
.then(data => { |
|
|
|
this.$vux.loading.hide(); |
|
|
|
if (data.code === 0) { |
|
|
|
if (paymentType === 7) { |
|
|
|
var transMessageOutput = data.response; |
|
|
|
var transInfo = |
|
|
|
transMessageOutput.weixinTransParameters; |
|
|
|
if ( |
|
|
|
transInfo.prepayid !== "" && |
|
|
|
transInfo.prepayid !== undefined && |
|
|
|
transInfo.prepayid != null |
|
|
|
) { |
|
|
|
window.location.href = |
|
|
|
transInfo.mwebUrl; |
|
|
|
} |
|
|
|
} else { |
|
|
|
setTimeout(function() { |
|
|
|
window.location.href = |
|
|
|
"/mall/web/order_index"; |
|
|
|
}, 2000); |
|
|
|
} |
|
|
|
} else if (data.code === 666) { |
|
|
|
this.$vux.toast.text( |
|
|
|
"您还没登录,请先登录!", |
|
|
|
"middle" |
|
|
|
); |
|
|
|
setTimeout(function() { |
|
|
|
window.location.href = |
|
|
|
"/mall/web/user/login"; |
|
|
|
}, 2000); |
|
|
|
} else { |
|
|
|
this.$vux.loading.show({ |
|
|
|
text: "正在调起支付" |
|
|
|
}); |
|
|
|
if (isWeixin() && this.info.payPrice > 0) { |
|
|
|
//微信内打开,直接调起微信公众号支付 |
|
|
|
this.$vux.loading.hide(); |
|
|
|
location.href = this.authUrl.replace( |
|
|
|
"state=2", |
|
|
|
"state=2" + "," + this.info.orderNo |
|
|
|
); |
|
|
|
} else { |
|
|
|
let paymentType = this.info.payPrice > 0 ? 7 : 10; |
|
|
|
orderApi |
|
|
|
.pay({ |
|
|
|
orderNo: this.info.orderNo, |
|
|
|
paymentType: paymentType |
|
|
|
}) |
|
|
|
.then(data => { |
|
|
|
this.$vux.loading.hide(); |
|
|
|
if (data.code === 0) { |
|
|
|
if (paymentType === 7) { |
|
|
|
var transMessageOutput = data.response; |
|
|
|
var transInfo = |
|
|
|
transMessageOutput.weixinTransParameters; |
|
|
|
if ( |
|
|
|
data.msg === "" || |
|
|
|
data.msg === undefined || |
|
|
|
data.msg == null |
|
|
|
transInfo.prepayid !== "" && |
|
|
|
transInfo.prepayid !== undefined && |
|
|
|
transInfo.prepayid != null |
|
|
|
) { |
|
|
|
data.msg = "操作失败,请刷新重试"; |
|
|
|
window.location.href = transInfo.mwebUrl; |
|
|
|
} |
|
|
|
this.$vux.toast.text(data.msg, "middle"); |
|
|
|
} else { |
|
|
|
setTimeout(function() { |
|
|
|
window.location.href = |
|
|
|
"/mall/web/order_index"; |
|
|
|
"/v2/order-list"; |
|
|
|
}, 2000); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
} else if (data.code === 666) { |
|
|
|
this.$vux.toast.text( |
|
|
|
"您还没登录,请先登录!", |
|
|
|
"middle" |
|
|
|
); |
|
|
|
setTimeout(function() { |
|
|
|
window.location.href = "/mall/web/user/login"; |
|
|
|
}, 2000); |
|
|
|
} else { |
|
|
|
if ( |
|
|
|
data.msg === "" || |
|
|
|
data.msg === undefined || |
|
|
|
data.msg == null |
|
|
|
) { |
|
|
|
data.msg = "操作失败,请刷新重试"; |
|
|
|
} |
|
|
|
this.$vux.toast.text(data.msg, "middle"); |
|
|
|
setTimeout(function() { |
|
|
|
window.location.href = "/v2/order-list"; |
|
|
|
}, 2000); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
addOrder() { |
|
|
|
let goodsNo = this.info.goodsNo; |
|
|
|
|