|
|
@@ -154,7 +154,9 @@ |
|
|
|
CardBillQuery, |
|
|
|
CardBillPlaceOrder, |
|
|
|
CardBillPayStatus, |
|
|
|
wechatPayConfigId |
|
|
|
wechatPayConfigId, |
|
|
|
aliPayConfigId, |
|
|
|
obtainUserId |
|
|
|
} from "@/utils/network/api.js"; |
|
|
|
import { |
|
|
|
request |
|
|
@@ -281,44 +283,100 @@ |
|
|
|
|
|
|
|
//掉起微信支付 |
|
|
|
const wxPayment = () => { |
|
|
|
if (state.suppleNoList.length > 0) { |
|
|
|
// #ifdef MP-WEIXIN |
|
|
|
const options = { |
|
|
|
type: 2, |
|
|
|
data: { |
|
|
|
openid: state.openid, |
|
|
|
suppleNoList: state.suppleNoList, |
|
|
|
totalFee: allPrice.value * 100, |
|
|
|
payConfigId: wechatPayConfigId, |
|
|
|
}, |
|
|
|
method: "POST", |
|
|
|
showLoading: true, |
|
|
|
}; |
|
|
|
request(CardBillPlaceOrder, options).then((res) => { |
|
|
|
const data = stringToJson(res.bizContent); |
|
|
|
state.orderId = data.orderId |
|
|
|
uni.requestPayment({ |
|
|
|
provider: "wxpay", |
|
|
|
orderInfo: "", |
|
|
|
timeStamp: data.timestamp, |
|
|
|
nonceStr: data.noncestr, |
|
|
|
package: data.wxPackage ?data.wxPackage: "", |
|
|
|
signType: data.signType, |
|
|
|
paySign: data.sign, |
|
|
|
success: function(e) { |
|
|
|
console.log("支付成功", e); |
|
|
|
checkOrder(); |
|
|
|
}, |
|
|
|
fail: function(err) { |
|
|
|
confirm(err, () => {}, "支付失败", false); |
|
|
|
if (state.suppleNoList.length > 0) { |
|
|
|
// #ifdef MP-WEIXIN |
|
|
|
const options = { |
|
|
|
type: 2, |
|
|
|
data: { |
|
|
|
openid: state.openid, |
|
|
|
suppleNoList: state.suppleNoList, |
|
|
|
totalFee: allPrice.value * 100, |
|
|
|
payConfigId: wechatPayConfigId, |
|
|
|
}, |
|
|
|
method: "POST", |
|
|
|
showLoading: true, |
|
|
|
}; |
|
|
|
request(CardBillPlaceOrder, options).then((res) => { |
|
|
|
const data = stringToJson(res.bizContent); |
|
|
|
state.orderId = data.orderId |
|
|
|
uni.requestPayment({ |
|
|
|
provider: "wxpay", |
|
|
|
orderInfo: "", |
|
|
|
timeStamp: data.timestamp, |
|
|
|
nonceStr: data.noncestr, |
|
|
|
package: data.wxPackage ?data.wxPackage: "", |
|
|
|
signType: data.signType, |
|
|
|
paySign: data.sign, |
|
|
|
success: function(e) { |
|
|
|
console.log("支付成功", e); |
|
|
|
checkOrder(); |
|
|
|
}, |
|
|
|
fail: function(err) { |
|
|
|
confirm(err, () => {}, "支付失败", false); |
|
|
|
}, |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
// #endif |
|
|
|
} else { |
|
|
|
msg("未勾选补缴订单!") |
|
|
|
} |
|
|
|
|
|
|
|
// #endif |
|
|
|
// #ifdef MP-ALIPAY |
|
|
|
|
|
|
|
my.getAuthCode({ |
|
|
|
scopes: 'auth_user', |
|
|
|
success: res => { |
|
|
|
const optionsUser = { |
|
|
|
type: 2, |
|
|
|
data: { |
|
|
|
payConfigId: aliPayConfigId, |
|
|
|
code: res.authCode |
|
|
|
}, |
|
|
|
method: "POST", |
|
|
|
showLoading: true, |
|
|
|
}; |
|
|
|
console.log('支付宝用户编号请求:',optionsUser) |
|
|
|
request(obtainUserId, optionsUser).then((res) => { |
|
|
|
console.log('支付宝用户编号返回:',res) |
|
|
|
const data = stringToJson(res.bizContent); |
|
|
|
const optionsali = { |
|
|
|
type: 2, |
|
|
|
data: { |
|
|
|
openid: data.userId, |
|
|
|
suppleNoList: state.suppleNoList, |
|
|
|
totalFee: allPrice.value * 100, |
|
|
|
payConfigId: aliPayConfigId, |
|
|
|
}, |
|
|
|
method: "POST", |
|
|
|
showLoading: true, |
|
|
|
}; |
|
|
|
console.log('支付下单请求:',optionsali) |
|
|
|
request(CardBillPlaceOrder, optionsali).then((res) => { |
|
|
|
console.log('支付下单返回:',res) |
|
|
|
const data = stringToJson(res.bizContent); |
|
|
|
state.orderId = data.orderId |
|
|
|
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 |
|
|
|
} else { |
|
|
|
msg("未勾选补缴订单!") |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|