This commit is contained in:
曹辉 2023-03-13 17:09:32 +08:00
parent 904df19c7f
commit 2c5424924e

View File

@ -85,43 +85,51 @@
buy() { buy() {
var that = this var that = this
addHealthConsultationOrder(this.updata).then(res => { addHealthConsultationOrder(this.updata).then(res => {
res.data.payType = "WECHAT_PAY" if (res.code == 200) {
res.data.paymentPrice = res.data.totalPrice res.data.payType = "WECHAT_PAY"
res.data.openid = this.openid res.data.paymentPrice = res.data.totalPrice
let id = res.data.id res.data.openid = this.openid
appletGoodsOrderPay(res.data).then(response => { let id = res.data.id
if (response.code == 200) { appletGoodsOrderPay(res.data).then(response => {
uni.requestPayment({ if (response.code == 200) {
timeStamp: response.data.timeStamp, uni.requestPayment({
nonceStr: response.data.nonceStr, timeStamp: response.data.timeStamp,
package: response.data.prepayId, nonceStr: response.data.nonceStr,
signType: response.data.signType, package: response.data.prepayId,
paySign: response.data.paySign, signType: response.data.signType,
success: function(res) { paySign: response.data.paySign,
that.$refs.uToast.show({ success: function(res) {
title: '支付成功', that.$refs.uToast.show({
type: 'success', title: '支付成功',
duration: 1500, type: 'success',
url: `/pages/paysuccess/paysuccess` duration: 1500,
}) url: `/pages/paysuccess/paysuccess`
}, })
fail: function(err) { },
that.$refs.uToast.show({ fail: function(err) {
title: '取消支付', that.$refs.uToast.show({
type: 'error', title: '取消支付',
duration: 1500, type: 'error',
url: `/pages/payorderDetails/payorderDetails?goodsOrderId=${id}` duration: 1500,
}) url: `/pages/payorderDetails/payorderDetails?goodsOrderId=${id}`
} })
}); }
} else { });
that.$refs.uToast.show({ } else {
title: response.msg, that.$refs.uToast.show({
type: 'error', title: response.msg,
duration: 2000 type: 'error',
}) duration: 2000
} })
}) }
})
} else {
that.$refs.uToast.show({
title: res.msg,
type: 'error',
duration: 2000
})
}
}) })
}, },
}, },