var t = getApp(), n = t.request; module.exports = { url: "/api/weshop/order/pay/createOrder", rechange: function(t, e, a) { var i = this; n.post(this.url, { data: { account: t }, success: function(t) { i.weixinPay(t.data.result, e, a); }, fail: function() { "function" == typeof a && a(); }, failStatus: function() { "function" == typeof a && a(); } }); }, pay: function(t, e, a,sto,type) { var i = this; var dd = { parent_sn: t, store_id: sto, type: 2, }; if (type == 1) dd.type = 1; n.post(this.url, { data: dd, success: function(t) { if(t.data.code==0){ i.weixinPay(t.data.data, e, a); }else{ t.showSuccess(t.data.msg); wx.redirectTo({ url: "/pages/user/order_list/order_list", }); } return false; }, fail: function() { "function" == typeof a && a(); }, failStatus: function() { "function" == typeof a && a(); } }); }, weixinPay: function(n, e, a) { wx.requestPayment({ timeStamp: String(n.timeStamp), nonceStr: n.nonceStr, package: n.packageValue, signType: n.signType, paySign: n.paySign, success: function(n) { console.log(n), t.showSuccess("支付成功!", e); }, fail: function(n) { console.log(n), "requestPayment:fail" == n.errMsg ? t.showWarning("支付失败") : "requestPayment:fail cancel" == n.errMsg ? t.showWarning("您已取消支付") : t.showWarning("支付失败:" + n.errMsg.substr("requestPayment:fail ".length)), "function" == typeof a && a(); } }); } };