增加支付宝支付

This commit is contained in:
GaoHao
2024-09-11 09:17:49 +08:00
parent 84a545d393
commit 5d83068d61
2 changed files with 69 additions and 4 deletions

View File

@@ -367,6 +367,33 @@
}
});
// #endif
// #ifdef MP-ALIPAY
uni.requestPayment({
provider: 'alipay', //支付类型-固定值
orderInfo: item.id, // 微信支付商户号
success: (res) => {
let _this = this
uni.requestSubscribeMessage({
tmplIds: ['z0fUG7-jhSfYCrw6poOvSRzh4_hgnPkm_5C7E5s5bCQ'],
complete() {
uni.showToast({
title: "支付成功"
})
// uni.cache.set('shopUser', '') //删除shopUser
_this.paymodfiyOrderInfo()
uni.redirectTo({
url: '/pages/order/order_detail?orderId=' + _this
.listinfoid
});
},
})
},
fail: () => {
uni.hideLoading()
}
});
// #endif
}
},
/**

View File

@@ -171,7 +171,12 @@
],
paymentMethodList:[
{ name: "余额支付", type: "1", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png"},
// #ifdef MP-WEIXIN
{ name: "微信支付", type: "2", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/weChat.png"},
// #endif
// #ifdef MP-ALIPAY
{ name: "支付宝支付", type: "3", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/alipay.png"},
// #endif
],
order: {
phone: "",
@@ -193,6 +198,7 @@
listinfoid: null,
paymentBtnText: "余额支付",
isSocket: false,
socketTicket: null,
}
},
computed: {
@@ -202,13 +208,17 @@
},
onUnload() {
console.log(this)
this.socketTicket.Close()
uni.$off('getMessage')
if (this.socketTicket) {
this.socketTicket.Close()
uni.$off('message')
}
this.ispws = false
},
onHide() {
this.socketTicket.Close()
uni.$off('message')
if (this.socketTicket) {
this.socketTicket.Close()
uni.$off('message')
}
},
onLoad(e) {
console.log(JSON.parse(e.cartList))
@@ -499,6 +509,34 @@
}
});
// #endif
// #ifdef MP-ALIPAY
uni.requestPayment({
provider: 'alipay', //支付类型-固定值
orderInfo: res.data.appId, // 微信支付商户号
success: (res) => {
let _this = this
uni.requestSubscribeMessage({
tmplIds: ['z0fUG7-jhSfYCrw6poOvSRzh4_hgnPkm_5C7E5s5bCQ'],
complete() {
uni.showToast({
title: "支付成功"
})
// uni.cache.set('shopUser', '') //删除shopUser
_this.paymodfiyOrderInfo()
uni.redirectTo({
url: '/pages/order/order_detail?orderId=' + _this
.listinfoid
});
},
})
},
fail: () => {
uni.hideLoading()
}
});
// #endif
uni.hideLoading()
}
},