This commit is contained in:
曹辉 2023-03-03 17:02:34 +08:00
parent 245f1a3f37
commit 9df3d5f5b7

View File

@ -434,78 +434,87 @@
this.updata.totalPrice = Number((this.updata.originalTotalPrice - this.updata.totalPrice = Number((this.updata.originalTotalPrice -
this.updata.discountPrice).toFixed(2)) this.updata.discountPrice).toFixed(2))
} }
addStationGoodsOrder(this.updata).then(res => { if (this.updata.totalPrice > 0) {
if (res.code == 500) { addStationGoodsOrder(this.updata).then(res => {
that.$refs.uToast.show({ if (res.code == 500) {
title: res.msg, that.$refs.uToast.show({
type: 'error' title: res.msg,
}) type: 'error'
} else { })
let id = res.data.id } else {
let paydata = res.data let id = res.data.id
paydata.openid = value let paydata = res.data
paydata.payType = "WECHAT_PAY" paydata.openid = value
paydata.paymentPrice = res.data.totalPrice paydata.payType = "WECHAT_PAY"
appletGoodsOrderPay(paydata).then(response => { paydata.paymentPrice = res.data.totalPrice
if (response.code == 200) { appletGoodsOrderPay(paydata).then(response => {
uni.requestPayment({ if (response.code == 200) {
timeStamp: response uni.requestPayment({
.data.timeStamp, timeStamp: response
nonceStr: response.data .data.timeStamp,
.nonceStr, nonceStr: response.data
package: response.data .nonceStr,
.prepayId, package: response.data
signType: response.data .prepayId,
.signType, signType: response.data
paySign: response.data .signType,
.paySign, paySign: response.data
success: function( .paySign,
res) { success: function(
that.goodsDetailsinfo( res) {
that that.goodsDetailsinfo(
.goodsInfoId, that
that.updata .goodsInfoId,
.patientId that
) .updata
that.$refs .patientId
.uToast )
.show({ that.$refs
title: '支付成功', .uToast
type: 'success', .show({
duration: 1000, title: '支付成功',
url: '/pages/paysuccess/paysuccess' type: 'success',
}) duration: 1000,
}, url: '/pages/paysuccess/paysuccess'
fail: function(err) { })
that.goodsDetailsinfo( },
that fail: function(err) {
.goodsInfoId, that.goodsDetailsinfo(
that.updata that
.patientId .goodsInfoId,
) that
that.$refs .updata
.uToast .patientId
.show({ )
title: '取消支付', that.$refs
type: 'error', .uToast
duration: 1000, .show({
url: `/pages/payorderDetails/payorderDetails?goodsOrderId=${id}` title: '取消支付',
}) type: 'error',
// uni.navigateTo({ duration: 1000,
// url: `/pages/payorderDetails/payorderDetails?goodsOrderId=${id}` url: `/pages/payorderDetails/payorderDetails?goodsOrderId=${id}`
// }) })
} // uni.navigateTo({
}); // url: `/pages/payorderDetails/payorderDetails?goodsOrderId=${id}`
} else { // })
that.$refs.uToast.show({ }
title: response.msg, });
type: 'error', } else {
duration: 1000 that.$refs.uToast.show({
}) title: response.msg,
} type: 'error',
}) duration: 1000
} })
}) }
})
}
})
} else {
that.$refs.uToast.show({
title: '订单金额为0,无法下单',
type: 'error'
})
}
} }
} else { } else {
that.$refs.uToast.show({ that.$refs.uToast.show({