skx пре 1 година
родитељ
комит
ab81144203

+ 66
- 2
pages/recharge/recharge.vue Прегледај датотеку

@@ -63,6 +63,8 @@
wechatAppID,
wechatPayConfigId,
wechatSecret,
aliPayConfigId,
obtainUserId,
} from "@/utils/network/api.js";
import {
request
@@ -177,8 +179,10 @@ const selectConfirm = (item: any) => {
// }
onLoad((option) => {
/*获取openId 用途:(用户支付)*/
getOpenID();
/*传参*/
// #ifdef MP-WEIXIN
getOpenID();/*传参*/
// #endif
state.cardId = option.cardId;
state.connectSuccess = option.connectSuccess;
state.orderNum = getItem("orderNum");
@@ -277,7 +281,13 @@ const selectConfirm = (item: any) => {
if (applyResult.orderStatus === "ORDER_NOT_PAY") {
//走支付
console.log("走支付");
// #ifdef MP-WEIXIN
wxPayment();
// #endif
// #ifdef MP-ALIPAY
aliPayment()
// #endif
}
});
}
@@ -740,6 +750,60 @@ const selectConfirm = (item: any) => {
});
// #endif
};
//掉起支付宝支付
const aliPayment = () => {
// #ifdef MP-ALIPAY
my.getAuthCode({
scopes: 'auth_user',
success: res => {
const optionsUser = {
type: 2,
data: {
payConfigId: aliPayConfigId,
code: res.authCode
},
method: "POST",
showLoading: true,
};
request(obtainUserId, optionsUser).then((res) => {
const data = stringToJson(res.bizContent);
const optionsali= {
type: 2,
data: {
openId: getItem(StorageKeys.OpenId),
wxOpenId: data.openId,
cardId: state.cardId,
orderNum: state.orderNum,
payConfigId: wechatPayConfigId,
body: "储值卡充值",
},
method: "POST",
showLoading: true,
};
request(cardCzPay, optionsali).then((res) => {
const data = stringToJson(res.bizContent);
my.tradePay ({
// 调用统一收单交易创建接口(alipay.trade.create),获得返回字段支付宝交易号 trade_no
tradeNO: data.prepayId,
success: res => {
console.log("支付成功", res);
checkOrder();
},
fail: res => {
confirm(res, () => {}, "支付失败", false);
},
});
});
});
},
fail: err => {
console.log('my.getAuthCode 调用失败', err)
}
});
// #endif
};
//支付成功改变订单状态
const checkOrder = () => {

+ 1
- 1
subpackage/after-sale/arrears/arrears.vue Прегледај датотеку

@@ -338,7 +338,7 @@
const optionsali = {
type: 2,
data: {
openid: data.userId,
openid: data.openId,
suppleNoList: state.suppleNoList,
totalFee: allPrice.value * 100,
payConfigId: aliPayConfigId,

+ 1
- 1
subpackage/orders/payment.vue Прегледај датотеку

@@ -229,7 +229,7 @@ const aliPayment = () => {
const optionsali= {
type: 2,
data: {
openid: data.userId,
openid: data.openId,
productId: state.orderData.productId, //产品id
orderId: state.orderData.orderId,
payConfigId: aliPayConfigId,

Loading…
Откажи
Сачувај