修复无法支付的问题

This commit is contained in:
gyq
2026-01-29 18:19:26 +08:00
parent 696a39da99
commit 3e64567d52
4 changed files with 30 additions and 23 deletions

View File

@@ -22,7 +22,6 @@ export default {
return {
payAmount: '',
openId: null,
// openId: '2088112837517234',
shopImage: null,
shopName: null,
shopId: null,
@@ -113,7 +112,6 @@ export default {
this.getOpenId(_code, '2021004174605036'); //微信 WECHAT 支付宝 ALIPAY
}
}
// this.getOpenId('1321312123123', '2021004174605036');
},
/**
@@ -130,7 +128,8 @@ export default {
shopId: this.getUrlParam('shopId') //微信 WECHAT 支付宝 ALIPAY
};
getOpenId(params).then((res) => {
if (res.code == 0) {
console.log('获取微信/支付宝openid', res);
if (res.code == 200) {
this.openId = res.data.openId;
this.shopImage = res.data.shopImage;
this.shopName = res.data.shopName;
@@ -214,15 +213,21 @@ export default {
// }
// };
console.log('createOrder.params', params);
if (this.orderId) {
params.orderId = this.orderId;
}
// if (this.orderId) {
// params.orderId = this.orderId;
// }
// if (this.isWechat()) {
// this.wxH5Pay(params);
// }
// if (this.isAlipay()) {
// this.alipay(params);
// }
createOrder(params)
.then((res) => {
console.log('createOrder.res', res);
// alert("创建订单=="+JSON.stringify(res))
if (res.code == '100015') {
this.orderId = res.data.orderInfo.id;
if (res.code == 200) {
// this.orderId = res.data.orderInfo.id;
if (this.isWechat()) {
this.wxH5Pay(res);
}
@@ -250,12 +255,12 @@ export default {
'getBrandWCPayRequest',
{
debug: true,
appId: res.data.payInfo.appId,
timeStamp: res.data.payInfo.timeStamp,
nonceStr: res.data.payInfo.nonceStr,
package: res.data.payInfo.package,
paySign: res.data.payInfo.paySign,
signType: res.data.payInfo.signType
appId: res.data.appId,
timeStamp: res.data.timeStamp,
nonceStr: res.data.nonceStr,
package: res.data.package,
paySign: res.data.paySign,
signType: res.data.signType
},
function (res) {
console.log(res);
@@ -297,7 +302,7 @@ export default {
AlipayJSBridge.call(
'tradePay',
{
tradeNO: res.data.payInfo.tradeNo
tradeNO: res.data.tradeNo
},
function (result) {
if (result.resultCode === '9000') {
@@ -310,7 +315,7 @@ export default {
window.AlipayJSBridge.call('closeWebview');
}, 500);
} else {
cancelOrderPay({ orderId: this.orderId });
// cancelOrderPay({ orderId: this.orderId });
// 支付失败
uni.showToast({
title: '支付失败',