From b0a3fa4411940ef1a0f7a2c4556ba97341e38b76 Mon Sep 17 00:00:00 2001 From: yvan.ni Date: Thu, 2 Sep 2021 11:32:45 +0800 Subject: [PATCH] 支付优化 --- utils/pay.js | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/utils/pay.js b/utils/pay.js index 8ca5dc9..cd76b8b 100644 --- a/utils/pay.js +++ b/utils/pay.js @@ -80,27 +80,21 @@ module.exports = { }) }else{ - wx.requestOrderPayment({ + wx.requestPayment({ timeStamp: String(n.timeStamp), nonceStr: n.nonceStr, package: n.packageValue, signType: n.signType, paySign: n.paySign, - success (n) { - t.showSuccess("支付成功!", e); + success: function (n) { + console.log(n), t.showSuccess("支付成功!", e); }, - fail (n) { - if(!n.errMsg ) { - getApp().showWarning("支付失败"); - "function" == typeof fail && fail(); - return false; - } - - console.log(n), "requestOrderPayment:fail" == n.errMsg ? t.showWarning("支付失败") : "requestOrderPayment:fail cancel" == n.errMsg ? t.showWarning("您已取消支付") : - t.confirmBox("支付失败:" + n.errMsg.substr("requestOrderPayment:fail ".length)), + fail: function (n) { + console.log(n), "requestPayment:fail" == n.errMsg ? t.showWarning("支付失败") : "requestPayment:fail cancel" == n.errMsg ? t.showWarning("您已取消支付") : + t.confirmBox("支付失败:" + n.errMsg.substr("requestPayment:fail ".length)), "function" == typeof a && a(); } - }) + }); } -- libgit2 0.21.4