app支付–>支付宝支付
// #ifdef APP-PLUS
// 获取服务供应商
uni.getProvider({
service: 'payment',
success: (res) => {
if (res.provider.includes('alipay')) {
// 需要调用接口 将后端需要的数据传过去,接口返回orderInfo
// this.$api封装的请求方法
this.$api('...获取orderInfo接口', '参数').then(res => {
// 后端返回orderInfo
// orderInfo支付宝支付为字符串 微信支付为对象
let orderInfo = res.data.orderInfo
uni.requestPayment({
provider: 'alipay',
orderInfo, //orderInfo后端提供
success: (res) => {
console.log(res)
},
fail: (err) => {
console.log(err);
}
})
})
}
}
});
// #endif