diff --git a/packageE/pages/cart/cart2_inte/cart2_inte.js b/packageE/pages/cart/cart2_inte/cart2_inte.js index 942aec1..e8902c2 100644 --- a/packageE/pages/cart/cart2_inte/cart2_inte.js +++ b/packageE/pages/cart/cart2_inte/cart2_inte.js @@ -225,17 +225,17 @@ Page({ util_pay.set_fir(); //-- 通联的第三方支付的返回优化 -- - ut.is_pay_ok("/pages/payment/pay_success/pay_success?type=2&order_sn=" + this.data.ok_order_sn,null,function (){ + ut.is_pay_ok("/pages/payment/pay_success/pay_success?type=2&order_sn=" + th.data.ok_order_sn,null,function (){ if(!th.data.ok_order_sn) return false; getApp().request.promiseGet("/api/weshop/order/page", - {data:{store_id:os.stoid,parent_sn:this.data.ok_order_sn}}).then(res=>{ + {data:{store_id:os.stoid,parent_sn:th.data.ok_order_sn}}).then(res=>{ if(ut.ajax_ok(res)){ - var item=res.data.data.pageData[i]; + var item=res.data.data.pageData[0]; if(item.pay_status==1){ //支付支付,返回首页 ut.m_toast('支付成功'); setTimeout(()=>{ - getApp().goto("/pages/payment/pay_success/pay_success?type=2&order_sn=" + this.data.ok_order_sn); + getApp().goto("/pages/payment/pay_success/pay_success?type=2&order_sn=" + th.data.ok_order_sn); },1000) }else{ diff --git a/pages/cart/cart2_pt/cart2_pt.js b/pages/cart/cart2_pt/cart2_pt.js index e1e91b6..f6e3cfe 100644 --- a/pages/cart/cart2_pt/cart2_pt.js +++ b/pages/cart/cart2_pt/cart2_pt.js @@ -585,17 +585,18 @@ Page({ if(fy) return false; util_pay.set_fir(); //-- 通联的第三方支付的返回优化 -- - ut.is_pay_ok("/pages/team/team_success/team_success?ordersn=" + this.data.ok_order_sn,null,function (){ + ut.is_pay_ok("/pages/team/team_success/team_success?ordersn=" + th.data.ok_order_sn,null,function (){ if(!th.data.ok_order_sn) return false; getApp().request.promiseGet("/api/weshop/order/page", - {data:{store_id:os.stoid,parent_sn:this.data.ok_order_sn}}).then(res=>{ + {data:{store_id:os.stoid,parent_sn:th.data.ok_order_sn}}).then(res=>{ if(ut.ajax_ok(res)){ - var item=res.data.data.pageData[i]; - if(item.pay_status==1){ + var item=res.data.data.pageData[0]; + //拼团成功的判断 + if(item.pt_status==1 || item.pt_status==2){ //支付支付,返回首页 ut.m_toast('支付成功'); setTimeout(()=>{ - getApp().goto("/pages/team/team_success/team_success?ordersn=" + this.data.ok_order_sn); + getApp().goto("/pages/team/team_success/team_success?ordersn=" + th.data.ok_order_sn); },1000) }else{ diff --git a/pages/user/order_detail/order_detail.js b/pages/user/order_detail/order_detail.js index 3c8276e..604459a 100644 --- a/pages/user/order_detail/order_detail.js +++ b/pages/user/order_detail/order_detail.js @@ -16,6 +16,9 @@ Page({ }, onLoad: function(e) { + //定义第一次进入 + this.data.fir_in=1; + var th=this; var r = void 0 !== e.isGoup && e.isGoup; @@ -64,9 +67,43 @@ Page({ }), this.requestOrderDetail(e.order_id), wx.removeStorageSync("order:order_detail:update"); }, onShow: function() { - ut.fy_back('',0) - this.setData({paying:0}); - py.set_fir(); + + var th=this; + //判断是不是第一次进入 + if(this.data.fir_in){ + this.data.fir_in=0; + }else{ + //富友支付 + ut.fy_back('',0) + this.setData({paying:0}); + py.set_fir(); + //通联第三方 + //-- 通联的第三方支付的返回优化 -- + ut.is_pay_ok("back",null,function (){ + if(!th.data.ok_order_sn) return false; + getApp().request.promiseGet("/api/weshop/order/page", + {data:{store_id:os.stoid,order_sn:th.data.ok_order_sn}}).then(res=>{ + if(ut.ajax_ok(res)){ + var item=res.data.data.pageData[0]; + if(item.pay_status==1){ + //支付支付,返回首页 + ut.m_toast('支付成功'); + setTimeout(()=>{ + wx.navigateBack(); + },1000) + + }else{ + //支付支付,返回首页 + ut.m_toast('支付失败'); + setTimeout(()=>{ + wx.navigateBack(); + },1000) + } + } + }) + }); + } + wx.getStorageSync("order:order_detail:update") && (wx.removeStorageSync("order:order_detail:update"), this.requestOrderDetail(this.data.order.order_id)); }, @@ -1132,6 +1169,7 @@ Page({ } + th.data.ok_order_sn=this.data.order.order_sn; py.pay(this.data.order.order_sn, function() { th.setData({paying:0}); wx.showToast({title: '支付成功'}) diff --git a/utils/util.js b/utils/util.js index fa9cc29..a8732e5 100644 --- a/utils/util.js +++ b/utils/util.js @@ -899,7 +899,11 @@ module.exports = { this.m_toast("支付成功") //支付失败 setTimeout(function () { - wx.redirectTo({ url: back_url}); + if(back_url=='back') { + wx.navigateBack(); + }else{ + wx.redirectTo({ url: back_url}); + } },2000) } // "支付已取消"; @@ -907,7 +911,12 @@ module.exports = { this.m_toast("取消支付") //支付失败 setTimeout(function () { - getApp().goto(err_url); + if(err_url=='back'){ + wx.navigateBack(); + }else{ + getApp().goto(err_url); + } + },2000) } // "支付失败:" + extraData.errmsg; @@ -915,7 +924,11 @@ module.exports = { this.m_toast("支付失败:" + extraData.errmsg) //支付失败 setTimeout(function () { - getApp().goto(err_url); + if(err_url=='back'){ + wx.navigateBack(); + }else{ + getApp().goto(err_url); + } },2000) }