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.discountPrice).toFixed(2))
}
addStationGoodsOrder(this.updata).then(res => {
if (res.code == 500) {
that.$refs.uToast.show({
title: res.msg,
type: 'error'
})
} else {
let id = res.data.id
let paydata = res.data
paydata.openid = value
paydata.payType = "WECHAT_PAY"
paydata.paymentPrice = res.data.totalPrice
appletGoodsOrderPay(paydata).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.goodsDetailsinfo(
that
.goodsInfoId,
that.updata
.patientId
)
that.$refs
.uToast
.show({
title: '支付成功',
type: 'success',
duration: 1000,
url: '/pages/paysuccess/paysuccess'
})
},
fail: function(err) {
that.goodsDetailsinfo(
that
.goodsInfoId,
that.updata
.patientId
)
that.$refs
.uToast
.show({
title: '取消支付',
type: 'error',
duration: 1000,
url: `/pages/payorderDetails/payorderDetails?goodsOrderId=${id}`
})
// uni.navigateTo({
// url: `/pages/payorderDetails/payorderDetails?goodsOrderId=${id}`
// })
}
});
} else {
that.$refs.uToast.show({
title: response.msg,
type: 'error',
duration: 1000
})
}
})
}
})
if (this.updata.totalPrice > 0) {
addStationGoodsOrder(this.updata).then(res => {
if (res.code == 500) {
that.$refs.uToast.show({
title: res.msg,
type: 'error'
})
} else {
let id = res.data.id
let paydata = res.data
paydata.openid = value
paydata.payType = "WECHAT_PAY"
paydata.paymentPrice = res.data.totalPrice
appletGoodsOrderPay(paydata).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.goodsDetailsinfo(
that
.goodsInfoId,
that
.updata
.patientId
)
that.$refs
.uToast
.show({
title: '支付成功',
type: 'success',
duration: 1000,
url: '/pages/paysuccess/paysuccess'
})
},
fail: function(err) {
that.goodsDetailsinfo(
that
.goodsInfoId,
that
.updata
.patientId
)
that.$refs
.uToast
.show({
title: '取消支付',
type: 'error',
duration: 1000,
url: `/pages/payorderDetails/payorderDetails?goodsOrderId=${id}`
})
// uni.navigateTo({
// url: `/pages/payorderDetails/payorderDetails?goodsOrderId=${id}`
// })
}
});
} else {
that.$refs.uToast.show({
title: response.msg,
type: 'error',
duration: 1000
})
}
})
}
})
} else {
that.$refs.uToast.show({
title: '订单金额为0,无法下单',
type: 'error'
})
}
}
} else {
that.$refs.uToast.show({