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

View File

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