Commit 637800cdf0c6435af568d01e76aa2497717a0bfb
1 parent
ddb7d3fd
积分购,拼团,订单详情的由优化
Showing
4 changed files
with
67 additions
and
15 deletions
packageE/pages/cart/cart2_inte/cart2_inte.js
@@ -225,17 +225,17 @@ Page({ | @@ -225,17 +225,17 @@ Page({ | ||
225 | util_pay.set_fir(); | 225 | util_pay.set_fir(); |
226 | 226 | ||
227 | //-- 通联的第三方支付的返回优化 -- | 227 | //-- 通联的第三方支付的返回优化 -- |
228 | - ut.is_pay_ok("/pages/payment/pay_success/pay_success?type=2&order_sn=" + this.data.ok_order_sn,null,function (){ | 228 | + ut.is_pay_ok("/pages/payment/pay_success/pay_success?type=2&order_sn=" + th.data.ok_order_sn,null,function (){ |
229 | if(!th.data.ok_order_sn) return false; | 229 | if(!th.data.ok_order_sn) return false; |
230 | getApp().request.promiseGet("/api/weshop/order/page", | 230 | getApp().request.promiseGet("/api/weshop/order/page", |
231 | - {data:{store_id:os.stoid,parent_sn:this.data.ok_order_sn}}).then(res=>{ | 231 | + {data:{store_id:os.stoid,parent_sn:th.data.ok_order_sn}}).then(res=>{ |
232 | if(ut.ajax_ok(res)){ | 232 | if(ut.ajax_ok(res)){ |
233 | - var item=res.data.data.pageData[i]; | 233 | + var item=res.data.data.pageData[0]; |
234 | if(item.pay_status==1){ | 234 | if(item.pay_status==1){ |
235 | //支付支付,返回首页 | 235 | //支付支付,返回首页 |
236 | ut.m_toast('支付成功'); | 236 | ut.m_toast('支付成功'); |
237 | setTimeout(()=>{ | 237 | setTimeout(()=>{ |
238 | - getApp().goto("/pages/payment/pay_success/pay_success?type=2&order_sn=" + this.data.ok_order_sn); | 238 | + getApp().goto("/pages/payment/pay_success/pay_success?type=2&order_sn=" + th.data.ok_order_sn); |
239 | },1000) | 239 | },1000) |
240 | 240 | ||
241 | }else{ | 241 | }else{ |
pages/cart/cart2_pt/cart2_pt.js
@@ -585,17 +585,18 @@ Page({ | @@ -585,17 +585,18 @@ Page({ | ||
585 | if(fy) return false; | 585 | if(fy) return false; |
586 | util_pay.set_fir(); | 586 | util_pay.set_fir(); |
587 | //-- 通联的第三方支付的返回优化 -- | 587 | //-- 通联的第三方支付的返回优化 -- |
588 | - ut.is_pay_ok("/pages/team/team_success/team_success?ordersn=" + this.data.ok_order_sn,null,function (){ | 588 | + ut.is_pay_ok("/pages/team/team_success/team_success?ordersn=" + th.data.ok_order_sn,null,function (){ |
589 | if(!th.data.ok_order_sn) return false; | 589 | if(!th.data.ok_order_sn) return false; |
590 | getApp().request.promiseGet("/api/weshop/order/page", | 590 | getApp().request.promiseGet("/api/weshop/order/page", |
591 | - {data:{store_id:os.stoid,parent_sn:this.data.ok_order_sn}}).then(res=>{ | 591 | + {data:{store_id:os.stoid,parent_sn:th.data.ok_order_sn}}).then(res=>{ |
592 | if(ut.ajax_ok(res)){ | 592 | if(ut.ajax_ok(res)){ |
593 | - var item=res.data.data.pageData[i]; | ||
594 | - if(item.pay_status==1){ | 593 | + var item=res.data.data.pageData[0]; |
594 | + //拼团成功的判断 | ||
595 | + if(item.pt_status==1 || item.pt_status==2){ | ||
595 | //支付支付,返回首页 | 596 | //支付支付,返回首页 |
596 | ut.m_toast('支付成功'); | 597 | ut.m_toast('支付成功'); |
597 | setTimeout(()=>{ | 598 | setTimeout(()=>{ |
598 | - getApp().goto("/pages/team/team_success/team_success?ordersn=" + this.data.ok_order_sn); | 599 | + getApp().goto("/pages/team/team_success/team_success?ordersn=" + th.data.ok_order_sn); |
599 | },1000) | 600 | },1000) |
600 | 601 | ||
601 | }else{ | 602 | }else{ |
pages/user/order_detail/order_detail.js
@@ -16,6 +16,9 @@ Page({ | @@ -16,6 +16,9 @@ Page({ | ||
16 | }, | 16 | }, |
17 | onLoad: function(e) { | 17 | onLoad: function(e) { |
18 | 18 | ||
19 | + //定义第一次进入 | ||
20 | + this.data.fir_in=1; | ||
21 | + | ||
19 | var th=this; | 22 | var th=this; |
20 | var r = void 0 !== e.isGoup && e.isGoup; | 23 | var r = void 0 !== e.isGoup && e.isGoup; |
21 | 24 | ||
@@ -64,9 +67,43 @@ Page({ | @@ -64,9 +67,43 @@ Page({ | ||
64 | }), this.requestOrderDetail(e.order_id), wx.removeStorageSync("order:order_detail:update"); | 67 | }), this.requestOrderDetail(e.order_id), wx.removeStorageSync("order:order_detail:update"); |
65 | }, | 68 | }, |
66 | onShow: function() { | 69 | onShow: function() { |
67 | - ut.fy_back('',0) | ||
68 | - this.setData({paying:0}); | ||
69 | - py.set_fir(); | 70 | + |
71 | + var th=this; | ||
72 | + //判断是不是第一次进入 | ||
73 | + if(this.data.fir_in){ | ||
74 | + this.data.fir_in=0; | ||
75 | + }else{ | ||
76 | + //富友支付 | ||
77 | + ut.fy_back('',0) | ||
78 | + this.setData({paying:0}); | ||
79 | + py.set_fir(); | ||
80 | + //通联第三方 | ||
81 | + //-- 通联的第三方支付的返回优化 -- | ||
82 | + ut.is_pay_ok("back",null,function (){ | ||
83 | + if(!th.data.ok_order_sn) return false; | ||
84 | + getApp().request.promiseGet("/api/weshop/order/page", | ||
85 | + {data:{store_id:os.stoid,order_sn:th.data.ok_order_sn}}).then(res=>{ | ||
86 | + if(ut.ajax_ok(res)){ | ||
87 | + var item=res.data.data.pageData[0]; | ||
88 | + if(item.pay_status==1){ | ||
89 | + //支付支付,返回首页 | ||
90 | + ut.m_toast('支付成功'); | ||
91 | + setTimeout(()=>{ | ||
92 | + wx.navigateBack(); | ||
93 | + },1000) | ||
94 | + | ||
95 | + }else{ | ||
96 | + //支付支付,返回首页 | ||
97 | + ut.m_toast('支付失败'); | ||
98 | + setTimeout(()=>{ | ||
99 | + wx.navigateBack(); | ||
100 | + },1000) | ||
101 | + } | ||
102 | + } | ||
103 | + }) | ||
104 | + }); | ||
105 | + } | ||
106 | + | ||
70 | wx.getStorageSync("order:order_detail:update") && (wx.removeStorageSync("order:order_detail:update"), | 107 | wx.getStorageSync("order:order_detail:update") && (wx.removeStorageSync("order:order_detail:update"), |
71 | this.requestOrderDetail(this.data.order.order_id)); | 108 | this.requestOrderDetail(this.data.order.order_id)); |
72 | }, | 109 | }, |
@@ -1132,6 +1169,7 @@ Page({ | @@ -1132,6 +1169,7 @@ Page({ | ||
1132 | } | 1169 | } |
1133 | 1170 | ||
1134 | 1171 | ||
1172 | + th.data.ok_order_sn=this.data.order.order_sn; | ||
1135 | py.pay(this.data.order.order_sn, function() { | 1173 | py.pay(this.data.order.order_sn, function() { |
1136 | th.setData({paying:0}); | 1174 | th.setData({paying:0}); |
1137 | wx.showToast({title: '支付成功'}) | 1175 | wx.showToast({title: '支付成功'}) |
utils/util.js
@@ -899,7 +899,11 @@ module.exports = { | @@ -899,7 +899,11 @@ module.exports = { | ||
899 | this.m_toast("支付成功") | 899 | this.m_toast("支付成功") |
900 | //支付失败 | 900 | //支付失败 |
901 | setTimeout(function () { | 901 | setTimeout(function () { |
902 | - wx.redirectTo({ url: back_url}); | 902 | + if(back_url=='back') { |
903 | + wx.navigateBack(); | ||
904 | + }else{ | ||
905 | + wx.redirectTo({ url: back_url}); | ||
906 | + } | ||
903 | },2000) | 907 | },2000) |
904 | } | 908 | } |
905 | // "支付已取消"; | 909 | // "支付已取消"; |
@@ -907,7 +911,12 @@ module.exports = { | @@ -907,7 +911,12 @@ module.exports = { | ||
907 | this.m_toast("取消支付") | 911 | this.m_toast("取消支付") |
908 | //支付失败 | 912 | //支付失败 |
909 | setTimeout(function () { | 913 | setTimeout(function () { |
910 | - getApp().goto(err_url); | 914 | + if(err_url=='back'){ |
915 | + wx.navigateBack(); | ||
916 | + }else{ | ||
917 | + getApp().goto(err_url); | ||
918 | + } | ||
919 | + | ||
911 | },2000) | 920 | },2000) |
912 | } | 921 | } |
913 | // "支付失败:" + extraData.errmsg; | 922 | // "支付失败:" + extraData.errmsg; |
@@ -915,7 +924,11 @@ module.exports = { | @@ -915,7 +924,11 @@ module.exports = { | ||
915 | this.m_toast("支付失败:" + extraData.errmsg) | 924 | this.m_toast("支付失败:" + extraData.errmsg) |
916 | //支付失败 | 925 | //支付失败 |
917 | setTimeout(function () { | 926 | setTimeout(function () { |
918 | - getApp().goto(err_url); | 927 | + if(err_url=='back'){ |
928 | + wx.navigateBack(); | ||
929 | + }else{ | ||
930 | + getApp().goto(err_url); | ||
931 | + } | ||
919 | },2000) | 932 | },2000) |
920 | } | 933 | } |
921 | 934 |