pay2.js
1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
var t = getApp(), n = t.request;
module.exports = {
url: "/api/weshop/plus/create/plus/order",
pay: function(dd, succ,fail) {
var i = this;
n.post(this.url, {
data: dd,
success: function(t) {
if(t.data.code==0){
if(t.data.data=="升级成功"){
"function" == typeof succ && succ(1);
}else{
i.weixinPay(t.data.data, succ,fail);
}
}else{
"function" == typeof fail && fail();
}
return false;
},
fail: function() {
"function" == typeof fail && fail();
},
failStatus: function() {
"function" == typeof fail && fail();
}
});
},
weixinPay: function(n, succ,fail) {
if(!n) return false;
wx.requestPayment({
timeStamp: String(n.timeStamp),
nonceStr: n.nonceStr,
package: n.packageValue,
signType: n.signType,
paySign: n.paySign,
success: function(n) {
"function" == typeof succ && succ();
},
fail: function(n) {
"function" == typeof fail && fail();
}
});
}
};