//传参
let data = {
orderId: this.orderInfo.id,
total_fee: Number(total_fee) + Number(this.payList[0].payAmount),//房租+押金
description: "支付",
appid: app.appid,
list: list
}
AccountWxPay(data).then((res) => {
console.log(res);
if (res.code == 0) {
//支付成功后返回的页面路径
let redirectUrl = '&redirect_url=' +
encodeURIComponent(
'https://xxx.com/#/subpackage/PaySuccess/PaySuccess?orderType=0' + '&payAmount=' + Number(total_fee) + Number(this.payList[0].payAmount)
)
//获取当前机型
let device = uni.getSystemInfoSync().platform
console.log(device);
//判断当前机型
if (/ios/i.test(device)) {
//ios跳转
window.location.href = res.data + redirectUrl
} else {
//安卓跳转
window.open(res.data + redirectUrl)
}
}
});
这样就可以实现h5微信支付啦
刚做了个项目记录一下~~