Commit 1bbbf3d659c37a4412635365707f3937d2ffadaa

Authored by yvan.ni
1 parent 4bd67de6

支付的优化

Showing 1 changed file with 40 additions and 0 deletions
utils/pay.js
... ... @@ -111,6 +111,46 @@ module.exports = {
111 111 }
112 112 });
113 113 },
  114 +
  115 + //-- 这里是专享礼包的调用 --
  116 + pay_data:function (t,succ,fail){
  117 + var th=this;
  118 + var ob=t.data.data;
  119 + if(!ob){
  120 + this.set_fir();
  121 + fail('支付参数错误');
  122 + return false;
  123 + }
  124 + if(ob.is_fuioupay){
  125 + const plugin = requirePlugin('fuiou-pay')
  126 +
  127 + var paramsJson={
  128 + reqType:"11",//必填 01-商户模式,11-机构模式
  129 + reqData:ob.reqData,//必填 富友加密参数
  130 + }
  131 + getApp().globalData.no_clear=1;
  132 + console.log(plugin, plugin.fuioupay)
  133 + plugin.fuioupay(parseInt(ob.amt),paramsJson,function (res){
  134 + console.log(res);
  135 + th.wx_paying=0;
  136 + "function" == typeof succ && succ();
  137 + },function (error){
  138 + th.wx_paying=0;
  139 + console.log("插件支付错误",error);
  140 + //支付失败的时候
  141 + //getApp().confirmBox(error.code+error.message);
  142 + var msg='取消支付';
  143 + if(error && error.code){
  144 + msg=error.code+":"+error.message;
  145 + }
  146 + fail(msg)
  147 +
  148 + })
  149 + }else {
  150 + this.weixinPay(ob, succ, fail);
  151 + }
  152 + },
  153 +
114 154 weixinPay: function(n, e, a) {
115 155 var th=this;
116 156 if(!n) return false;
... ...