Commit b85909cb53a1ef3f112cf3633eba59e277e101b3

Authored by yvan.ni
1 parent ff1702f8

支付的优化

... ... @@ -519,6 +519,9 @@ App({
519 519 }
520 520  
521 521 },
  522 + re_to(url){
  523 + wx.redirectTo({ url: url, }) //跳到非tabbar页
  524 + },
522 525  
523 526 //显示提示,word提示内容,type 0失败,提示 1成功
524 527 my_warnning(word, type, that, width) {
... ...
packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js
... ... @@ -128,6 +128,9 @@ Page({
128 128 },
129 129 onLoad: function (t) {
130 130  
  131 + //定义第一次进入
  132 + this.data.fir_in=1;
  133 +
131 134 // console.log('收到的传参', t);
132 135 wx.setNavigationBarTitle({
133 136 title: '填写订单',
... ... @@ -654,11 +657,48 @@ Page({
654 657 //----------子页返回父页触发----------
655 658 onShow: function () {
656 659  
657   - var fy=ut.fy_back('/pages/user/order_list/order_list',1);
658   - if(fy) return false;
659   -
660 660 var th = this;
661   - util_pay.set_fir();
  661 +
  662 + //判断是不是第一次进入
  663 + if(this.data.fir_in){
  664 + this.data.fir_in=0;
  665 + }else{
  666 + var fy=ut.fy_back('/pages/user/order_list/order_list',1);
  667 + if(fy) return false;
  668 + util_pay.set_fir();
  669 +
  670 + var back="/packageC/pages/luckyGo/luckyGo_details/luckyGo_details?type=1&ordersn=" + this.data.ok_order_sn +
  671 + "&group_id=" + th.data.param.group_id + "&goods_id=" + th.data.param.goods_id +
  672 + "&goods_name=" + th.data.bn_goods.goods_name;
  673 +
  674 + //-- 通联的第三方支付的返回优化 --
  675 + ut.is_pay_ok(back,'/pages/user/order_list/order_list',function (){
  676 + if(!th.data.ok_order_sn) return false;
  677 + getApp().request.promiseGet("/api/weshop/order/page",
  678 + {data:{store_id:os.stoid,parent_sn:th.data.ok_order_sn}}).then(res=>{
  679 + if(ut.ajax_ok(res)){
  680 + var item=res.data.data.pageData[0];
  681 + if(item.pay_status==1){
  682 + //支付支付,返回首页
  683 + ut.m_toast('支付成功');
  684 + setTimeout(()=>{
  685 + getApp().re_to(back);
  686 + },1000)
  687 +
  688 + }else{
  689 + //支付支付,返回首页
  690 + ut.m_toast('支付失败');
  691 + setTimeout(()=>{
  692 + getApp().re_to("/pages/user/order_list/order_list");
  693 + },1000)
  694 + }
  695 + }
  696 + })
  697 + });
  698 +
  699 + }
  700 +
  701 +
662 702  
663 703 if (th.data.isclose == 0) {
664 704 wx.navigateTo({
... ... @@ -1477,6 +1517,8 @@ Page({
1477 1517 // order_sn: data.data,
1478 1518 // type:1,
1479 1519 // }, 1);
  1520 +
  1521 + th.data.ok_order_sn=data.data;
1480 1522 util_pay.pay(data.data, function () {
1481 1523 setTimeout(function () {
1482 1524 // wx.reLaunch({
... ...
packageC/pages/presell/cart/cart2.js
... ... @@ -157,6 +157,10 @@ Page({
157 157 })
158 158 },
159 159 onLoad: function (t) {
  160 +
  161 + //定义第一次进入
  162 + this.data.fir_in=1;
  163 +
160 164 wx.setNavigationBarTitle({ title: "填写订单", })
161 165 var th = this;
162 166  
... ... @@ -191,19 +195,50 @@ Page({
191 195 //----------子页返回父页触发----------
192 196 onShow: function () {
193 197 var th = this;
194   - var fy= ut.fy_back('',0,function (){
195   - var cps = getCurrentPages();
196   - if (cps.length > 1) {
197   - wx.navigateBack({ delta: 1 })
198   - } else {
199   - getApp().goto("/pages/index/index/index");
200   - }
  198 + //判断是不是第一次进入
  199 + if(this.data.fir_in){
  200 + this.data.fir_in=0;
  201 + }else{
  202 + //富友支付插件
  203 + var fy= ut.fy_back('',0,function (){
  204 + var cps = getCurrentPages();
  205 + if (cps.length > 1) {
  206 + wx.navigateBack({ delta: 1 })
  207 + } else {
  208 + getApp().goto("/pages/index/index/index");
  209 + }
201 210  
202   - })
203   - if(fy) return false;
  211 + })
  212 + if(fy) return false;
  213 + util_pay.set_fir();
  214 +
  215 + //-- 通联的第三方支付的返回优化 --
  216 + ut.is_pay_ok("/pages/payment/pay_success/pay_success?type=2&order_sn=" + this.data.ok_order_sn,null,function (){
  217 + if(!th.data.ok_order_sn) return false;
  218 + getApp().request.promiseGet("/api/weshop/order/page",
  219 + {data:{store_id:os.stoid,parent_sn:th.data.ok_order_sn}}).then(res=>{
  220 + if(ut.ajax_ok(res)){
  221 + var item=res.data.data.pageData[0];
  222 + if(item.pay_status==1){
  223 + //支付支付,返回首页
  224 + ut.m_toast('支付成功');
  225 + setTimeout(()=>{
  226 + getApp().re_to("/pages/payment/pay_success/pay_success?type=2&order_sn=" + th.data.ok_order_sn);
  227 + },1000)
  228 +
  229 + }else{
  230 + //支付支付,返回首页
  231 + ut.m_toast('支付失败');
  232 + setTimeout(()=>{
  233 + getApp().goto("/pages/index/index/index");
  234 + },1000)
  235 + }
  236 + }
  237 + })
  238 + });
  239 + }
204 240  
205 241  
206   - util_pay.set_fir();
207 242 th.data.g_cart_q_time = null;
208 243 if (th.data.isclose == 0) {
209 244 wx.navigateTo({
... ... @@ -1667,6 +1702,8 @@ Page({
1667 1702 //void e.jumpToCart4({
1668 1703 // order_sn: data.data,
1669 1704 //}, 1);
  1705 + th.data.ok_order_sn=data.data;
  1706 +
1670 1707 util_pay.pay(data.data, function () {
1671 1708 //app.my_warnning("支付成功",1,th);
1672 1709 //setTimeout(function () {
... ...
packageC/pages/presell/cart/cart2_pre.js
... ... @@ -304,14 +304,14 @@ Page({
304 304 //支付支付,返回首页
305 305 ut.m_toast('支付成功');
306 306 setTimeout(()=>{
307   - getApp().goto(ok_url);
  307 + getApp().re_to(ok_url);
308 308 },1000)
309 309  
310 310 }else{
311 311 //支付支付,返回首页
312 312 ut.m_toast('支付失败');
313 313 setTimeout(()=>{
314   - getApp().goto(err_url);
  314 + getApp().re_to(err_url);
315 315 },1000)
316 316 }
317 317 }
... ...
packageD/pages/user/deposit/prepaid/prepaid.js
... ... @@ -15,6 +15,10 @@ Page({
15 15 perpaid: [], //数据,
16 16 paying:0
17 17 },
  18 + onLoad:function (){
  19 + //定义第一次进入
  20 + this.data.fir_in=1;
  21 + },
18 22 /* 生命周期函数--监听页面初次渲染完成*/
19 23 onReady: function() {
20 24 var th=this;
... ... @@ -96,19 +100,27 @@ Page({
96 100 */
97 101 onShow: function () {
98 102  
  103 + var th=this;
  104 + //判断是不是第一次进入
  105 + if(this.data.fir_in){
  106 + this.data.fir_in=0;
  107 + }else{
99 108  
  109 + //富友插件
  110 + ut.fy_back('',0)
  111 + t_pay.set_fir();
  112 + }
100 113  
101 114 wx.setNavigationBarTitle({
102 115 title: "流动资金转预存",
103 116 })
104 117  
105 118 this.data.paying=0;
106   - ut.fy_back('',0)
107   - t_pay.set_fir();
108 119  
109   - if(getApp().globalData.user_id && !this.data.is_get){
110   - this.yuck();
111   - }
  120 +
  121 + if(getApp().globalData.user_id && !this.data.is_get){
  122 + this.yuck();
  123 + }
112 124  
113 125 },
114 126 //确定充值
... ...
packageE/pages/cart/cart2/cart2.js
... ... @@ -296,7 +296,7 @@ Page({
296 296 //支付支付,返回首页
297 297 ut.m_toast('支付成功');
298 298 setTimeout(()=>{
299   - getApp().goto("/pages/payment/pay_success/pay_success?type=2&order_sn=" + th.data.ok_order_sn);
  299 + getApp().re_to("/pages/payment/pay_success/pay_success?type=2&order_sn=" + th.data.ok_order_sn);
300 300 },1000)
301 301  
302 302 }else{
... ...
packageE/pages/cart/cart2_inte/cart2_inte.js
... ... @@ -235,7 +235,7 @@ Page({
235 235 //支付支付,返回首页
236 236 ut.m_toast('支付成功');
237 237 setTimeout(()=>{
238   - getApp().goto("/pages/payment/pay_success/pay_success?type=2&order_sn=" + th.data.ok_order_sn);
  238 + getApp().re_to("/pages/payment/pay_success/pay_success?type=2&order_sn=" + th.data.ok_order_sn);
239 239 },1000)
240 240  
241 241 }else{
... ...
pages/cart/cart2_pt/cart2_pt.js
... ... @@ -596,7 +596,7 @@ Page({
596 596 //支付支付,返回首页
597 597 ut.m_toast('支付成功');
598 598 setTimeout(()=>{
599   - getApp().goto("/pages/team/team_success/team_success?ordersn=" + th.data.ok_order_sn);
  599 + getApp().re_to("/pages/team/team_success/team_success?ordersn=" + th.data.ok_order_sn);
600 600 },1000)
601 601  
602 602 }else{
... ...
pages/cart/cart_wk/cart_wk.js
... ... @@ -120,7 +120,7 @@ Page({
120 120 //支付支付,返回首页
121 121 ut.m_toast('支付成功');
122 122 setTimeout(()=>{
123   - getApp().goto("/pages/payment/pay_success/pay_success?type=1&order_sn=" + th.data.ok_order_sn);
  123 + getApp().re_to("/pages/payment/pay_success/pay_success?type=1&order_sn=" + th.data.ok_order_sn);
124 124 },1000)
125 125  
126 126 }else{
... ...
pages/user/order_detail/order_detail.js
... ... @@ -69,14 +69,16 @@ Page({
69 69 onShow: function() {
70 70  
71 71 var th=this;
  72 + this.setData({paying:0});
  73 +
72 74 //判断是不是第一次进入
73 75 if(this.data.fir_in){
74 76 this.data.fir_in=0;
75 77 }else{
76 78 //富友支付
77 79 ut.fy_back('',0)
78   - this.setData({paying:0});
79 80 py.set_fir();
  81 +
80 82 //通联第三方
81 83 //-- 通联的第三方支付的返回优化 --
82 84 ut.is_pay_ok("back",null,function (){
... ...