diff --git a/packageA/pages/cart2_ser/cart2_ser.js b/packageA/pages/cart2_ser/cart2_ser.js index 7a22e7b..7c830a5 100644 --- a/packageA/pages/cart2_ser/cart2_ser.js +++ b/packageA/pages/cart2_ser/cart2_ser.js @@ -3,7 +3,7 @@ var t = getApp(), a = t.request, e = require("../../../utils/common.js"), s = require("../../../utils/util.js"), - o = require("../../../utils/md5.js"), + ut=s, o = require("../../../utils/md5.js"), to = getApp(); var oo = t.globalData.setting, os = oo; @@ -49,6 +49,10 @@ Page({ is_cart: 0, //是不是购物车进来的购买 }, onLoad: function(t) { + + //定义第一次进入 + this.data.fir_in=1; + wx.setNavigationBarTitle({ title: "填写订单", }); @@ -274,11 +278,47 @@ Page({ //----------子页返回父页触发---------- onShow: function() { - var fy=s.fy_back("/pages/user/order_list/order_list?index=2&tabindex=1",1); - if(fy) return false; - t_pay.set_fir(); var th = this; + + //判断是不是第一次进入 + if(this.data.fir_in){ + this.data.fir_in=0; + }else{ + var fy=s.fy_back("/pages/user/order_list/order_list?index=2&tabindex=1",1); + if(fy) return false; + t_pay.set_fir(); + + var back_url="/pages/payment/pay_success/pay_success?card=1&order_id=" + th.data.order_id; + //-- 通联的第三方支付的返回优化 -- + ut.is_pay_ok(back_url,"/pages/user/order_list/order_list?index=2&tabindex=1",function (){ + + if(!th.data.order_id) return false; + getApp().request.promiseGet("/api/weshop/recharge/user/page", + {data:{store_id:os.stoid,order_id:th.data.order_id,user_id:getApp().globalData.user_id }}).then(res=>{ + if(ut.ajax_ok(res)){ + var item=res.data.data.pageData[0]; + if(item.pay_status==1){ + //支付支付,返回首页 + ut.m_toast('支付成功'); + setTimeout(()=>{ + getApp().re_to(back_url); + },1000) + + }else{ + //支付支付,返回首页 + ut.m_toast('支付失败'); + setTimeout(()=>{ + getApp().re_to("/pages/user/order_list/order_list?index=2&tabindex=1"); + },1000) + } + } + }) + }); + + } + + if (th.data.isclose == 0) { wx.navigateTo({ url: "/pages/index/index/index" diff --git a/packageA/pages/myGift/myGift.js b/packageA/pages/myGift/myGift.js index 62d17f0..ea83e63 100644 --- a/packageA/pages/myGift/myGift.js +++ b/packageA/pages/myGift/myGift.js @@ -108,7 +108,7 @@ Page({ t_pay.set_fir(); //-- 通联的第三方支付的返回优化 -- - ut.is_pay_ok("none","none",function (){ + util.is_pay_ok("none","none",function (){ if(!th.data.ok_order_sn) return false; getApp().request.promiseGet("/api/weshop/order/page", {data:{store_id:os.stoid,parent_sn:th.data.ok_order_sn}}).then(res=>{ @@ -116,10 +116,10 @@ Page({ var item=res.data.data.pageData[0]; if(item.pay_status==1){ //支付支付,返回首页 - ut.m_toast('支付成功'); + util.m_toast('支付成功'); }else{ //支付支付,返回首页 - ut.m_toast('支付失败'); + util.m_toast('支付失败'); } } }) @@ -342,14 +342,7 @@ Page({ },function (e){ th.data.is_summit_ing=0; getApp().my_warnning(e, 0, th); - },function (ordno){ - if(ordno.indexOf('_')){ - var str_arr=ordno.split('_'); - ordno=str_arr[0]; - } - th.data.ok_order_sn=ordno; - - }) + },th) // var url = "/api/weshop/libao/libaoFormvip/libaoOrder"; // getApp().request.post(url, // { diff --git a/packageA/pages/serviceCard_pd/cart/cart.js b/packageA/pages/serviceCard_pd/cart/cart.js index 754c836..6e1831d 100644 --- a/packageA/pages/serviceCard_pd/cart/cart.js +++ b/packageA/pages/serviceCard_pd/cart/cart.js @@ -1,5 +1,5 @@ var t = getApp(), app = t, a = t.request, e = require("../../../../utils/common.js"), - s = require("../../../../utils/util.js"), o = require("../../../../utils/md5.js"), to = getApp(); + s = require("../../../../utils/util.js"),ut=s, o = require("../../../../utils/md5.js"), to = getApp(); var oo = t.globalData.setting, os = oo; var regeneratorRuntime = require('../../../../utils/runtime.js'); var util_pay = require("../../../../utils/pay.js"); @@ -71,7 +71,8 @@ Page({ }, onLoad: function (t) { console.log("onLoad_pt_cart"); - + //定义第一次进入 + this.data.fir_in=1; var th = this; this.setData({ is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow, }); var appD = getApp().get_b_now(); @@ -245,12 +246,45 @@ Page({ //----------子页返回父页触发---------- onShow: function () { - s.fy_back('',0); + var th = this; + //判断是不是第一次进入 + if(this.data.fir_in){ + this.data.fir_in=0; + }else{ + s.fy_back('',0); + t_pay.set_fir(); + util_pay.set_fir(); + + var back_url="/packageA/pages/serviceCard_pd/team_success/team_success?ordersn=" + th.data.order_sn; + + //-- 通联的第三方支付的返回优化 -- + ut.is_pay_ok(back_url,"/pages/user/order_list/order_list?index=2&tabindex=1",function (){ + if(!th.data.order_id) return false; + getApp().request.promiseGet("/api/weshop/rechargeServicelist/page",{ + data: { store_id: os.stoid, order_id: th.data.order_id} + }).then(res=>{ + if(ut.ajax_ok(res)){ + var item=res.data.data.pageData[0]; + if(item.pt_status==1 || item.pt_status==2){ + //支付支付,返回首页 + ut.m_toast('支付成功'); + setTimeout(()=>{ + getApp().re_to(back_url); + },1000) + + }else{ + //支付支付,返回首页 + ut.m_toast('支付失败'); + setTimeout(()=>{ + getApp().re_to("/pages/user/order_list/order_list?index=2&tabindex=1"); + },1000) + } + } + }) + }); + } - t_pay.set_fir(); - util_pay.set_fir(); - var th = this; if (th.data.isclose == 0) { wx.navigateTo({ url: "/pages/index/index/index" diff --git a/packageA/pages/serviceCard_pd/cart_wk/cart_wk.js b/packageA/pages/serviceCard_pd/cart_wk/cart_wk.js index 4abcb1c..8710453 100644 --- a/packageA/pages/serviceCard_pd/cart_wk/cart_wk.js +++ b/packageA/pages/serviceCard_pd/cart_wk/cart_wk.js @@ -59,6 +59,8 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { + //定义第一次进入 + this.data.fir_in=1; //清空is_pick_up getApp().request.put("/api/weshop/useraddress/updatePickUp", { @@ -94,11 +96,49 @@ Page({ */ onShow: function () { - ut.fy_back('',0); this.data.paying=0; - util_pay.set_fir(); - getApp().check_can_share(); + var th = this; + //判断是不是第一次进入 + if(this.data.fir_in){ + this.data.fir_in=0; + }else{ + ut.fy_back('',0); + util_pay.set_fir(); + + + var back_url="/pages/payment/pay_success/pay_success?order_id=" + th.data.order.order_id + "&type=1&card=1"; + //-- 通联的第三方支付的返回优化 -- + ut.is_pay_ok(back_url,"/pages/user/order_list/order_list?index=2&tabindex=1",function (){ + if(!th.data.wk_pyed) return false; + getApp().request.promiseGet("/api/weshop/rechargeServicelist/page",{ + data: { store_id: os.stoid, order_id: th.data.order.order_id} + }).then(res=>{ + if(ut.ajax_ok(res)){ + var item=res.data.data.pageData[0]; + if(item.pt_status==4 || item.pt_status==5){ + //支付支付,返回首页 + ut.m_toast('支付成功'); + setTimeout(()=>{ + getApp().re_to(back_url); + },1000) + + }else{ + //支付支付,返回首页 + ut.m_toast('支付失败'); + setTimeout(()=>{ + getApp().re_to("/pages/user/order_list/order_list?index=2&tabindex=1"); + },1000) + } + } + }) + }); + + } + + + + getApp().check_can_share(); if (th.data.isclose == 0) { wx.navigateTo({ url: "/pages/index/index/index" @@ -606,6 +646,7 @@ Page({ return false; } + th.data.wk_pyed=1; util_pay.pay_data(t,function (){ var allmoney = th.data.allpice; th.jumpPaymentPage(th.data.order.order_id, allmoney); diff --git a/packageE/pages/user/cardinfo/cardinfo.js b/packageE/pages/user/cardinfo/cardinfo.js index 581f76a..9538604 100644 --- a/packageE/pages/user/cardinfo/cardinfo.js +++ b/packageE/pages/user/cardinfo/cardinfo.js @@ -845,14 +845,7 @@ Page({ t_pay.pay(req, th.success, function (e) { th.data.paying=0; getApp().my_warnning("支付失败", 0, th); - },function (ordno){ - if(ordno.indexOf('_')){ - var str_arr=ordno.split('_'); - ordno=str_arr[0]; - } - - th.data.ok_order_sn=ordno; - }); + },th); }, @@ -923,7 +916,7 @@ Page({ t_pay.pay(req, th.success, function () { th.data.paying=0; getApp().my_warnning("支付失败", 0, th); - }); + },th); }, //显示弹出框 show_change:function () { this.setData({is_show_change_pop:1}); }, diff --git a/pages/giftpack/buygiftpack/giftpackbuy.js b/pages/giftpack/buygiftpack/giftpackbuy.js index 4e09c11..123493d 100644 --- a/pages/giftpack/buygiftpack/giftpackbuy.js +++ b/pages/giftpack/buygiftpack/giftpackbuy.js @@ -165,7 +165,7 @@ Page({ if(!th.data.ok_order_sn) return false; getApp().request.promiseGet("/api/weshop/marketing/my/giftbag/detail/get", {data:{storeId:os.stoid,orderSn:th.data.ok_order_sn,userId:getApp().globalData.user_id}}).then(res=>{ - + th.data.ok_order_sn=null; if(res.data.code==0 && res.data.data){ diff --git a/pages/user/plus/plus.js b/pages/user/plus/plus.js index f3f422a..65b0f73 100644 --- a/pages/user/plus/plus.js +++ b/pages/user/plus/plus.js @@ -140,16 +140,18 @@ Page({ if(this.data.fir_in){ this.data.fir_in=0; }else{ - //富友插件支付 - ut.fy_back('',0); - t_pay.set_fir(); - //-- 通联的第三方支付的返回优化 -- - ut.is_pay_ok("func","func",function (){ + //富友插件支付 + ut.fy_back('',0); + t_pay.set_fir(); + //-- 通联的第三方支付的返回优化 -- + ut.is_pay_ok("func","func",function (){ + if(!th.data.ok_order_sn) return false; - getApp().request.promiseGet("/api/weshop/order/page", - {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[0]; + var ck_url="/api/weshop/recharge/get/"+os.stoid+"/"+th.data.ok_order_sn; + getApp().request.promiseGet(ck_url,{}).then(res=>{ + + if(res.data.code==0 && res.data.data){ + var item=res.data.data; if(item.pay_status==1){ //支付支付,返回首页 th.success() @@ -162,7 +164,7 @@ Page({ focus:true, }) } - } + } }) }, //成功的回调 function (){ @@ -240,9 +242,9 @@ Page({ var userInfo = e.data.data; if (userInfo['card_field'] && !getApp().globalData.is_card_back) { var u_url = "/packageE/pages/user/cardinfo/cardinfo"; - wx.reLaunch({ - url: u_url - }) + // wx.reLaunch({ + // url: u_url + // }) } }, }); @@ -520,7 +522,7 @@ Page({ is_select:0, focus:true, }) - }); + },th); } }, //返回会员页面 @@ -555,13 +557,7 @@ Page({ is_select:0, focus:true, }) - },function (ordno){ - if(ordno.indexOf('_')){ - var str_arr=ordno.split('_'); - ordno=str_arr[0]; - } - th.data.ok_order_sn=ordno; - }); + },th); } } else { getApp().my_warnning(res.data.msg, 0, th); diff --git a/utils/pay2.js b/utils/pay2.js index 92c6704..0dbb56a 100644 --- a/utils/pay2.js +++ b/utils/pay2.js @@ -11,7 +11,7 @@ module.exports = { }, //-- createRechargeOrder create/plus/order -- // get_order是通联专用,获取订单号 - pay: function(dd, succ,fail,get_order) { + pay: function(dd, succ,fail,th) { if(this.wx_paying) return false; this.wx_paying=1; wx.showLoading(); @@ -59,8 +59,14 @@ module.exports = { var p_data=t.data.data; delete p_data.is_pos_pay; //清理掉,不然签名不通过 - if(get_order){ - get_order(p_data.reqsn); //把单号返回 + if(th){ + + var ordno=p_data.reqsn; + if(ordno.indexOf('_')){ + var str_arr=ordno.split('_'); + ordno=str_arr[0]; + } + th.data.ok_order_sn=ordno; } wx.openEmbeddedMiniProgram({