var t = getApp(), n = t.request,wx_paying=0; module.exports = { url: "/api/weshop/plus/create/plus/order", pay: function(dd, succ,fail) { if(wx_paying) return false; wx_paying=1; if(getApp().globalData.scene) dd.scene=getApp().globalData.scene; console.log(dd,'支付场景'); wx.showLoading(); var i = this; n.post(this.url, { data: dd, success: function(t) { wx.hideLoading(); 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() { wx.hideLoading(); wx_paying=0; "function" == typeof fail && fail(); }, failStatus: function() { wx.hideLoading(); wx_paying=0; "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) { wx_paying=0; "function" == typeof succ && succ(); }, fail: function(n) { wx_paying=0; "function" == typeof fail && fail(); } }); } };