Commit 8d0c5060bf1bdf87c8e3492e15f6ad56f5c6b84d
1 parent
21dae003
取消支付的优化
Showing
2 changed files
with
23 additions
and
4 deletions
utils/pay.js
... | ... | @@ -47,6 +47,7 @@ module.exports = { |
47 | 47 | |
48 | 48 | if(t.data.data.is_fuioupay){ |
49 | 49 | const plugin = requirePlugin('fuiou-pay') |
50 | + getApp().globalData.no_clear=1; | |
50 | 51 | |
51 | 52 | var paramsJson={ |
52 | 53 | reqType:"11",//必填 01-商户模式,11-机构模式 |
... | ... | @@ -61,7 +62,13 @@ module.exports = { |
61 | 62 | },function (error){ |
62 | 63 | console.log("插件支付错误",error); |
63 | 64 | //支付失败的时候 |
64 | - getApp().confirmBox(error.code+error.message); | |
65 | + | |
66 | + var msg='取消支付'; | |
67 | + if(error.code){ | |
68 | + msg=error.code+":"+error.message; | |
69 | + } | |
70 | + getApp().confirmBox(msg); | |
71 | + | |
65 | 72 | setTimeout(function(){ |
66 | 73 | wx.redirectTo({ |
67 | 74 | url: "/pages/user/order_list/order_list", | ... | ... |
utils/pay2.js
... | ... | @@ -19,8 +19,10 @@ module.exports = { |
19 | 19 | if(t.data.data=="升级成功"){ |
20 | 20 | "function" == typeof succ && succ(1); |
21 | 21 | }else{ |
22 | + | |
22 | 23 | if(t.data.data.is_fuioupay){ |
23 | 24 | const plugin = requirePlugin('fuiou-pay') |
25 | + getApp().globalData.no_clear=1; | |
24 | 26 | |
25 | 27 | var paramsJson={ |
26 | 28 | reqType:"11",//必填 01-商户模式,11-机构模式 |
... | ... | @@ -35,7 +37,11 @@ module.exports = { |
35 | 37 | console.log("插件支付错误",error); |
36 | 38 | //支付失败的时候 |
37 | 39 | //getApp().confirmBox(error.code+error.message); |
38 | - fail(error.code+":"+error.message) | |
40 | + var msg='取消支付'; | |
41 | + if(error.code){ | |
42 | + msg=error.code+":"+error.message; | |
43 | + } | |
44 | + fail(msg) | |
39 | 45 | wx_paying=0; |
40 | 46 | }) |
41 | 47 | }else { |
... | ... | @@ -75,17 +81,23 @@ module.exports = { |
75 | 81 | reqType:"11",//必填 01-商户模式,11-机构模式 |
76 | 82 | reqData:ob.reqData,//必填 富友加密参数 |
77 | 83 | } |
84 | + getApp().globalData.no_clear=1; | |
78 | 85 | console.log(plugin, plugin.fuioupay) |
79 | 86 | plugin.fuioupay(parseInt(ob.amt),paramsJson,function (res){ |
80 | 87 | console.log(res); |
81 | 88 | wx_paying=0; |
82 | 89 | "function" == typeof succ && succ(); |
83 | 90 | },function (error){ |
91 | + wx_paying=0; | |
84 | 92 | console.log("插件支付错误",error); |
85 | 93 | //支付失败的时候 |
86 | 94 | //getApp().confirmBox(error.code+error.message); |
87 | - fail(error.code+":"+error.message) | |
88 | - wx_paying=0; | |
95 | + var msg='取消支付'; | |
96 | + if(error && error.code){ | |
97 | + msg=error.code+":"+error.message; | |
98 | + } | |
99 | + fail(msg) | |
100 | + | |
89 | 101 | }) |
90 | 102 | }else { |
91 | 103 | this.weixinPay(ob, succ, fail); | ... | ... |