diff --git a/pages/confirmation/confirmation.vue b/pages/confirmation/confirmation.vue index 1e25ec2..a6a8d7e 100644 --- a/pages/confirmation/confirmation.vue +++ b/pages/confirmation/confirmation.vue @@ -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 + }) + } }) }, },