|
|
@ -4,44 +4,48 @@ import { getProvider } from "@/utils"; |
|
|
|
export const weappPay = (option) => { |
|
|
|
export const weappPay = (option) => { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
// 吊起微信支付
|
|
|
|
// 吊起微信支付
|
|
|
|
getProvider().then(provider => { |
|
|
|
// getProvider('payment').then(provider => {
|
|
|
|
let orderInfo = { |
|
|
|
let orderInfo = { |
|
|
|
...option, |
|
|
|
appid: option.appid, |
|
|
|
timeStamp: option.timestamp + '', |
|
|
|
noncestr: option.noncestr, |
|
|
|
|
|
|
|
package: option.package, |
|
|
|
|
|
|
|
partnerid: option.partnerid, |
|
|
|
|
|
|
|
prepayid: option.prepayid, |
|
|
|
|
|
|
|
sign: option.sign, |
|
|
|
|
|
|
|
timestamp: option.timestamp + '', |
|
|
|
} |
|
|
|
} |
|
|
|
console.log({ |
|
|
|
console.log({ |
|
|
|
provider: provider, |
|
|
|
provider: 'wxpay', |
|
|
|
signType: "MD5", |
|
|
|
// signType: "MD5",
|
|
|
|
timeStamp: orderInfo.timestamp, |
|
|
|
// timeStamp: orderInfo.timeStamp,
|
|
|
|
nonceStr: orderInfo.noncestr, |
|
|
|
// nonceStr: orderInfo.noncestr,
|
|
|
|
package: orderInfo.prepayid, |
|
|
|
// package: orderInfo.prepayid,
|
|
|
|
signType: "MD5", |
|
|
|
// signType: "MD5",
|
|
|
|
paySign: orderInfo.sign, |
|
|
|
// paySign: orderInfo.sign,
|
|
|
|
orderInfo, |
|
|
|
orderInfo, |
|
|
|
},'发起支付') |
|
|
|
}, '发起支付') |
|
|
|
// 调用登录接口
|
|
|
|
// 调用登录接口
|
|
|
|
uni.requestPayment({ |
|
|
|
uni.requestPayment({ |
|
|
|
provider: provider, |
|
|
|
provider: 'wxpay', |
|
|
|
signType: "MD5", |
|
|
|
// timeStamp: orderInfo.timeStamp,
|
|
|
|
timeStamp: orderInfo.timeStamp, |
|
|
|
// nonceStr: orderInfo.noncestr,
|
|
|
|
nonceStr: orderInfo.noncestr, |
|
|
|
// package: orderInfo.prepayid,
|
|
|
|
package: orderInfo.prepayid, |
|
|
|
// signType: "MD5",
|
|
|
|
signType: "MD5", |
|
|
|
// paySign: orderInfo.sign,
|
|
|
|
paySign: orderInfo.sign, |
|
|
|
|
|
|
|
orderInfo, |
|
|
|
orderInfo, |
|
|
|
success: (success) => { |
|
|
|
success: (success) => { |
|
|
|
console.log(error) |
|
|
|
console.log(success) |
|
|
|
uni.showToast({ |
|
|
|
uni.showToast({ |
|
|
|
title: '支付成功', icon: 'success', duration: 2000 |
|
|
|
title: JSON.stringify(success), icon: 'success', duration: 5000 |
|
|
|
}); |
|
|
|
}); |
|
|
|
resolve(success) |
|
|
|
resolve(success) |
|
|
|
}, |
|
|
|
}, |
|
|
|
fail: (error) => { |
|
|
|
fail: (error) => { |
|
|
|
console.log(error) |
|
|
|
console.log(error) |
|
|
|
uni.showToast({ title: '支付失败', icon: 'none', duration: 2000 }); |
|
|
|
uni.showToast({ title: JSON.stringify(error), icon: 'none', duration: 5000 }); |
|
|
|
reject(error) |
|
|
|
reject(error) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
// })
|
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|