From d67d567c8f7e174e6b6ba4772814b880f69aa367 Mon Sep 17 00:00:00 2001 From: yvan.ni Date: Sat, 15 Jul 2023 21:47:21 +0800 Subject: [PATCH] 支付的优化 --- pages/giftpack/public/buy_com.js | 4 +--- pages/user/plus/plus.js | 4 ++++ utils/pay2.js | 27 +++++++++++++++++++++++++-- utils/util.js | 2 +- 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/pages/giftpack/public/buy_com.js b/pages/giftpack/public/buy_com.js index 4c127b5..112d068 100644 --- a/pages/giftpack/public/buy_com.js +++ b/pages/giftpack/public/buy_com.js @@ -251,9 +251,6 @@ module.exports = { function (res) { if (res.data.code == 0 && res.data.data) { - - - switch(that.data.buyType){ case 1://立即兑换 var order_sn = res.data.data; @@ -266,6 +263,7 @@ module.exports = { case 2://立即购买 var order_sn = res.data.data.orderSn; + that.data.ok_order_sn=order_sn; var money=that.data.payMoney; var url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + order_sn; diff --git a/pages/user/plus/plus.js b/pages/user/plus/plus.js index 581319d..f3f422a 100644 --- a/pages/user/plus/plus.js +++ b/pages/user/plus/plus.js @@ -556,6 +556,10 @@ Page({ focus:true, }) },function (ordno){ + if(ordno.indexOf('_')){ + var str_arr=ordno.split('_'); + ordno=str_arr[0]; + } th.data.ok_order_sn=ordno; }); } diff --git a/utils/pay2.js b/utils/pay2.js index 8956b24..92c6704 100644 --- a/utils/pay2.js +++ b/utils/pay2.js @@ -96,9 +96,11 @@ module.exports = { }, //-- 这里是专享礼包的调用 -- - pay_data:function (t,succ,fail){ + pay_data:function (t,succ,fail,get_order){ var th=this; var ob=t.data.data.result; + this.wx_paying=1; + if(!ob){ this.set_fir(); fail('支付参数错误'); @@ -134,7 +136,28 @@ module.exports = { fail(msg) }) - }else { + } + + //-- 通联的支付插件 -- + else if(ob.is_pos_pay){ + var p_data=ob; + delete p_data.is_pos_pay; //清理掉,不然签名不通过 + if(get_order){ + get_order(p_data.reqsn); //把单号返回 + } + + wx.openEmbeddedMiniProgram({ + appId: 'wxef277996acc166c3', + extraData: p_data, + fail(){ + //-- 取消不支付 -- + th.wx_paying=0; + "function" == typeof a && a(); + } + }) + } + + else { this.weixinPay(ob, succ, fail); } }, diff --git a/utils/util.js b/utils/util.js index aed1d41..88bb0ef 100644 --- a/utils/util.js +++ b/utils/util.js @@ -913,7 +913,7 @@ module.exports = { else if(back_url=='func'){ success(); } - else{ + else if(back_url!='none'){ wx.redirectTo({ url: back_url}); } },2000) -- libgit2 0.21.4