import {wxpay} from "../../static/js/class.js"
//请求后台接口 接受uni.requestPayment所需的参数
wxpay({
culum_id: that.culum_id,
id: that.order.order_id,
source:2
}).then(res => {
// console.log(res)
if (res.code == 200) {
let data = res.data.info
//唤起微信支付 orderInfo的属性都是小写
uni.requestPayment({
provider: 'wxpay',
timeStamp: data.timestamp,
nonceStr: data.noncestr,
package: data.package,
signType: "MD5",
paySign: data.sign,
orderInfo:{
appid: data.appid,
noncestr: data.noncestr,
package:data.package,
partnerid: data.partnerid,
prepayid: data.prepayid,
timestamp: data.timestamp,
sign: data.sign,
},
success: res1 => {
// console.log(res1)
// 支付成功跳转
uni.navigateTo({
url: './result'
})
},
fail: (err) => {
// console.log(err)
uni.showToast({
title: "支付失败",
icon: 'none'
})
},
complete: (res2) => {
// console.log(res2)
}
});
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
})
uniapp app微信支付
最新推荐文章于 2024-08-14 13:26:41 发布