Commit d67d567c8f7e174e6b6ba4772814b880f69aa367

Authored by yvan.ni
1 parent 0904f37f

支付的优化

pages/giftpack/public/buy_com.js
@@ -251,9 +251,6 @@ module.exports = { @@ -251,9 +251,6 @@ module.exports = {
251 function (res) { 251 function (res) {
252 if (res.data.code == 0 && res.data.data) { 252 if (res.data.code == 0 && res.data.data) {
253 253
254 -  
255 -  
256 -  
257 switch(that.data.buyType){ 254 switch(that.data.buyType){
258 case 1://立即兑换 255 case 1://立即兑换
259 var order_sn = res.data.data; 256 var order_sn = res.data.data;
@@ -266,6 +263,7 @@ module.exports = { @@ -266,6 +263,7 @@ module.exports = {
266 case 2://立即购买 263 case 2://立即购买
267 264
268 var order_sn = res.data.data.orderSn; 265 var order_sn = res.data.data.orderSn;
  266 + that.data.ok_order_sn=order_sn;
269 267
270 var money=that.data.payMoney; 268 var money=that.data.payMoney;
271 var url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + order_sn; 269 var url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + order_sn;
pages/user/plus/plus.js
@@ -556,6 +556,10 @@ Page({ @@ -556,6 +556,10 @@ Page({
556 focus:true, 556 focus:true,
557 }) 557 })
558 },function (ordno){ 558 },function (ordno){
  559 + if(ordno.indexOf('_')){
  560 + var str_arr=ordno.split('_');
  561 + ordno=str_arr[0];
  562 + }
559 th.data.ok_order_sn=ordno; 563 th.data.ok_order_sn=ordno;
560 }); 564 });
561 } 565 }
utils/pay2.js
@@ -96,9 +96,11 @@ module.exports = { @@ -96,9 +96,11 @@ module.exports = {
96 }, 96 },
97 97
98 //-- 这里是专享礼包的调用 -- 98 //-- 这里是专享礼包的调用 --
99 - pay_data:function (t,succ,fail){ 99 + pay_data:function (t,succ,fail,get_order){
100 var th=this; 100 var th=this;
101 var ob=t.data.data.result; 101 var ob=t.data.data.result;
  102 + this.wx_paying=1;
  103 +
102 if(!ob){ 104 if(!ob){
103 this.set_fir(); 105 this.set_fir();
104 fail('支付参数错误'); 106 fail('支付参数错误');
@@ -134,7 +136,28 @@ module.exports = { @@ -134,7 +136,28 @@ module.exports = {
134 fail(msg) 136 fail(msg)
135 137
136 }) 138 })
137 - }else { 139 + }
  140 +
  141 + //-- 通联的支付插件 --
  142 + else if(ob.is_pos_pay){
  143 + var p_data=ob;
  144 + delete p_data.is_pos_pay; //清理掉,不然签名不通过
  145 + if(get_order){
  146 + get_order(p_data.reqsn); //把单号返回
  147 + }
  148 +
  149 + wx.openEmbeddedMiniProgram({
  150 + appId: 'wxef277996acc166c3',
  151 + extraData: p_data,
  152 + fail(){
  153 + //-- 取消不支付 --
  154 + th.wx_paying=0;
  155 + "function" == typeof a && a();
  156 + }
  157 + })
  158 + }
  159 +
  160 + else {
138 this.weixinPay(ob, succ, fail); 161 this.weixinPay(ob, succ, fail);
139 } 162 }
140 }, 163 },
utils/util.js
@@ -913,7 +913,7 @@ module.exports = { @@ -913,7 +913,7 @@ module.exports = {
913 else if(back_url=='func'){ 913 else if(back_url=='func'){
914 success(); 914 success();
915 } 915 }
916 - else{ 916 + else if(back_url!='none'){
917 wx.redirectTo({ url: back_url}); 917 wx.redirectTo({ url: back_url});
918 } 918 }
919 },2000) 919 },2000)