diff --git a/packageA/pages/cart2_ser/cart2_ser.js b/packageA/pages/cart2_ser/cart2_ser.js index ffe3518..5911661 100644 --- a/packageA/pages/cart2_ser/cart2_ser.js +++ b/packageA/pages/cart2_ser/cart2_ser.js @@ -274,6 +274,7 @@ Page({ //----------子页返回父页触发---------- onShow: function() { + t_pay.set_fir(); var th = this; if (th.data.isclose == 0) { wx.navigateTo({ diff --git a/packageA/pages/chongzhiDetails/chongzhiDetails.js b/packageA/pages/chongzhiDetails/chongzhiDetails.js index 4b46354..bf0cc7d 100644 --- a/packageA/pages/chongzhiDetails/chongzhiDetails.js +++ b/packageA/pages/chongzhiDetails/chongzhiDetails.js @@ -22,7 +22,7 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + const self = this; if(options.type) self.setData({type:options.type}); @@ -106,6 +106,7 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { + t_pay.set_fir(); getApp().check_can_share(); }, diff --git a/packageA/pages/details_serviceCard/details_serviceCard.js b/packageA/pages/details_serviceCard/details_serviceCard.js index 307d6e1..9ac31d0 100644 --- a/packageA/pages/details_serviceCard/details_serviceCard.js +++ b/packageA/pages/details_serviceCard/details_serviceCard.js @@ -17,6 +17,7 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function(options) { + self = this; this.data.options = options; @@ -43,6 +44,7 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function() { + t_pay.set_fir(); getApp().check_can_share(); if (app.globalData.userInfo) { if (!this.data.isLogin) { diff --git a/packageA/pages/myGift/myGift.js b/packageA/pages/myGift/myGift.js index b491e8b..5e4c444 100644 --- a/packageA/pages/myGift/myGift.js +++ b/packageA/pages/myGift/myGift.js @@ -50,7 +50,8 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - self = this; + + self = this; if(options.index){ this.setData({currentIndex:1}); //查看我的礼包 } @@ -88,7 +89,7 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { - + t_pay.set_fir(); getApp().check_can_share(); if(app.globalData.userInfo) { if(!this.data.isLogin) { diff --git a/packageA/pages/myGiftDetails/myGiftDetails.js b/packageA/pages/myGiftDetails/myGiftDetails.js index 58f26ce..521d1f2 100644 --- a/packageA/pages/myGiftDetails/myGiftDetails.js +++ b/packageA/pages/myGiftDetails/myGiftDetails.js @@ -23,7 +23,8 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - self = this; + + self = this; // 如果从商品详情页点击促销栏里的礼包跳转过来的话,不显示底部按钮 // showBtn 控制按钮是否显示 @@ -66,6 +67,7 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { + t_pay.set_fir(); getApp().check_can_share(); if(app.globalData.userInfo) { if(!this.data.isLogin) { diff --git a/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js b/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js index 8d7c06e..98a249c 100644 --- a/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js +++ b/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js @@ -129,6 +129,7 @@ Page({ onLoad: function (t) { wx.setNavigationBarTitle({ title: "填写订单", }) + var th = this; this.setData({ is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow, }); th.data.param = t; @@ -156,6 +157,7 @@ Page({ //----------子页返回父页触发---------- onShow: function () { + util_pay.set_fir(); var th = this; th.setData({ show_submit: 0 }); //让提交先掩藏 th.data.g_cart_q_time = null; diff --git a/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js b/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js index 4edd122..b65bdb5 100644 --- a/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js +++ b/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js @@ -597,6 +597,7 @@ Page({ //----------子页返回父页触发---------- onShow: function () { var th = this; + util_pay.set_fir(); if (th.data.isclose == 0) { wx.navigateTo({ diff --git a/packageC/pages/presell/cart/cart.js b/packageC/pages/presell/cart/cart.js index 6ff6b5d..ebad8e1 100644 --- a/packageC/pages/presell/cart/cart.js +++ b/packageC/pages/presell/cart/cart.js @@ -157,6 +157,7 @@ Page({ //----------子页返回父页触发---------- onShow: function () { + util_pay.set_fir(); var th = this; th.setData({ show_submit: 0 }); //让提交先掩藏 th.data.g_cart_q_time = null; diff --git a/packageC/pages/presell/cart/cart2.js b/packageC/pages/presell/cart/cart2.js index 37a40fa..e25b1f5 100644 --- a/packageC/pages/presell/cart/cart2.js +++ b/packageC/pages/presell/cart/cart2.js @@ -160,6 +160,7 @@ Page({ //----------子页返回父页触发---------- onShow: function () { var th = this; + util_pay.set_fir(); th.data.g_cart_q_time = null; if (th.data.isclose == 0) { wx.navigateTo({ diff --git a/packageC/pages/presell/cart/cart2_pre.js b/packageC/pages/presell/cart/cart2_pre.js index 06c2154..d217184 100644 --- a/packageC/pages/presell/cart/cart2_pre.js +++ b/packageC/pages/presell/cart/cart2_pre.js @@ -251,6 +251,7 @@ Page({ //----------子页返回父页触发---------- onShow: function () { + util_pay.set_fir(); var th = this; if (th.data.isclose == 0) { wx.navigateTo({ diff --git a/packageD/pages/user/deposit/prepaid/prepaid.js b/packageD/pages/user/deposit/prepaid/prepaid.js index 782fc5c..bd448eb 100644 --- a/packageD/pages/user/deposit/prepaid/prepaid.js +++ b/packageD/pages/user/deposit/prepaid/prepaid.js @@ -16,7 +16,8 @@ Page({ }, /* 生命周期函数--监听页面初次渲染完成*/ onReady: function() { - var th=this; + var th=this; + getApp().request.get("/api/wx/weappSendlist/page", { data: { @@ -96,6 +97,7 @@ Page({ wx.setNavigationBarTitle({ title: "流动资金转预存", }) + t_pay.set_fir(); if(getApp().globalData.user_id && !this.data.is_get){ this.yuck(); diff --git a/packageD/pages/user/integral/integral.js b/packageD/pages/user/integral/integral.js index 63d8fae..f0baab6 100644 --- a/packageD/pages/user/integral/integral.js +++ b/packageD/pages/user/integral/integral.js @@ -207,7 +207,7 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + var th=this; getApp().request.get("/api/wx/weappSendlist/page", { data: { @@ -325,7 +325,8 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { - getApp().check_can_share(); + t_pay.set_fir(); + getApp().check_can_share(); //--先判断会员状态-- var user_info = getApp().globalData.userInfo; if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { diff --git a/packageE/pages/cart/cart2/cart2.js b/packageE/pages/cart/cart2/cart2.js index 752d428..6afa7b0 100644 --- a/packageE/pages/cart/cart2/cart2.js +++ b/packageE/pages/cart/cart2/cart2.js @@ -152,6 +152,7 @@ Page({ }, onLoad: function (t) { + wx.setNavigationBarTitle({ title: "填写订单", }) var th = this; this.setData({ is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow, }); @@ -200,6 +201,7 @@ Page({ //----------子页返回父页触发---------- onShow: function () { + util_pay.set_fir(); var th = this; th.data.g_cart_q_time = null; diff --git a/packageE/pages/user/cardinfo/cardinfo.js b/packageE/pages/user/cardinfo/cardinfo.js index afa3ae1..a89d9c6 100644 --- a/packageE/pages/user/cardinfo/cardinfo.js +++ b/packageE/pages/user/cardinfo/cardinfo.js @@ -9,7 +9,6 @@ var t = getApp(), var regeneratorRuntime = require('../../../../utils/runtime.js'); //wx.downloadFile把线上地址设为本地地址 Page({ - /** * 页面的初始数据 */ @@ -50,6 +49,7 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { + //--先判断会员状态-- var user_info = getApp().globalData.userInfo; if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { @@ -682,6 +682,7 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { + t_pay.set_fir(); //同步初始化 this.init(); diff --git a/packageE/pages/user/monthgiftbag/giftpackbuy/giftpackbuy.js b/packageE/pages/user/monthgiftbag/giftpackbuy/giftpackbuy.js index 2fa9423..f3e0030 100644 --- a/packageE/pages/user/monthgiftbag/giftpackbuy/giftpackbuy.js +++ b/packageE/pages/user/monthgiftbag/giftpackbuy/giftpackbuy.js @@ -139,6 +139,7 @@ Page({ this.getList(); }, onShow: function () { + com.set_py_fir(); getApp().check_can_share(); var th=this; //--先判断会员状态-- diff --git a/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.js b/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.js index b8855ef..d962696 100644 --- a/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.js +++ b/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.js @@ -198,6 +198,7 @@ Page({ }, onShow: function () { + com.set_py_fir(); getApp().check_can_share(); getApp().is_Single_page(this, function () { //--先判断会员状态-- diff --git a/packageE/pages/user/monthgiftbag/giftpacklist/giftpacklist.js b/packageE/pages/user/monthgiftbag/giftpacklist/giftpacklist.js index fb995e0..7101fea 100644 --- a/packageE/pages/user/monthgiftbag/giftpacklist/giftpacklist.js +++ b/packageE/pages/user/monthgiftbag/giftpacklist/giftpacklist.js @@ -173,6 +173,7 @@ Page({ }, onShow: function () { + com.set_py_fir(); getApp().check_can_share(); getApp().is_Single_page(this, function () { //--先判断会员状态-- diff --git a/packageE/pages/user/monthgiftbag/public/buy_com.js b/packageE/pages/user/monthgiftbag/public/buy_com.js index bfbf241..006edd4 100644 --- a/packageE/pages/user/monthgiftbag/public/buy_com.js +++ b/packageE/pages/user/monthgiftbag/public/buy_com.js @@ -1,6 +1,8 @@ -//-- const subscribe = require("../../../../../../MdUNIApp_new2/packageD/pages/subscribe/subscribe"); -- const t_pay = require("../../../../../utils/pay2.js"); module.exports = { + set_py_fir(){ + t_pay.set_fir(); + }, //开启定位 wait_for_store_config: function (th) { var t_time = setInterval(function () { diff --git a/pages/giftpack/buygiftpack/giftpackbuy.js b/pages/giftpack/buygiftpack/giftpackbuy.js index ae13af1..afde151 100644 --- a/pages/giftpack/buygiftpack/giftpackbuy.js +++ b/pages/giftpack/buygiftpack/giftpackbuy.js @@ -139,6 +139,7 @@ Page({ this.getList(); }, onShow: function () { + com.set_py_fir(); getApp().check_can_share(); var th=this; //--先判断会员状态-- diff --git a/pages/giftpack/giftpacklist/giftpacklist.js b/pages/giftpack/giftpacklist/giftpacklist.js index 4338b56..28607bf 100644 --- a/pages/giftpack/giftpacklist/giftpacklist.js +++ b/pages/giftpack/giftpacklist/giftpacklist.js @@ -165,6 +165,7 @@ Page({ }, onShow: function () { + com.set_py_fir(); getApp().check_can_share(); getApp().is_Single_page(this, function () { //--先判断会员状态-- diff --git a/pages/giftpack/public/buy_com.js b/pages/giftpack/public/buy_com.js index a646f31..6f37976 100644 --- a/pages/giftpack/public/buy_com.js +++ b/pages/giftpack/public/buy_com.js @@ -1,5 +1,8 @@ const t_pay = require("../../../utils/pay2.js"); module.exports = { + set_py_fir(){ + t_pay.set_fir(); + }, //开启定位 wait_for_store_config: function (th) { var t_time = setInterval(function () { diff --git a/pages/user/order_detail/order_detail.js b/pages/user/order_detail/order_detail.js index cf6b0ba..28b2a76 100644 --- a/pages/user/order_detail/order_detail.js +++ b/pages/user/order_detail/order_detail.js @@ -15,6 +15,7 @@ Page({ conf:null, }, onLoad: function(e) { + var th=this; var r = void 0 !== e.isGoup && e.isGoup; @@ -63,6 +64,7 @@ Page({ }), this.requestOrderDetail(e.order_id), wx.removeStorageSync("order:order_detail:update"); }, onShow: function() { + py.set_fir(); wx.getStorageSync("order:order_detail:update") && (wx.removeStorageSync("order:order_detail:update"), this.requestOrderDetail(this.data.order.order_id)); }, diff --git a/pages/user/order_list/order_list.js b/pages/user/order_list/order_list.js index 20164c3..332169a 100644 --- a/pages/user/order_list/order_list.js +++ b/pages/user/order_list/order_list.js @@ -78,6 +78,7 @@ Page({ searchContent: '', }, onLoad: function (t) { + self = this; // 设置日期选择器的结束时间为当前日期 var now = new Date(); @@ -108,6 +109,7 @@ Page({ s.init(this, "", "orderList"); }, onShow: function () { + t_pay.set_fir(); var th = this; //---查看会员的等级价--- getApp().getConfig2(function (e) { diff --git a/pages/user/plus/plus.js b/pages/user/plus/plus.js index 7a11fcc..e5c74b8 100644 --- a/pages/user/plus/plus.js +++ b/pages/user/plus/plus.js @@ -9,7 +9,6 @@ var t = getApp(), t_pay = require("../../../utils/pay2.js"); var regeneratorRuntime = require('../../../utils/runtime.js'); - Page({ /** * 页面的初始数据 @@ -129,6 +128,8 @@ Page({ var user_info = getApp().globalData.userInfo; if (!user_info) return false; + t_pay.set_fir(); + var th = this, that = th, app_d = getApp().globalData; diff --git a/utils/pay.js b/utils/pay.js index 58dda23..e8d1ca4 100644 --- a/utils/pay.js +++ b/utils/pay.js @@ -1,6 +1,10 @@ -var t = getApp(), n = t.request,wx_paying=0; +var t = getApp(), n = t.request; module.exports = { + wx_paying:0, + set_fir(){ + this.wx_paying=0; + }, url: "/api/weshop/order/pay/createOrder", rechange: function(t, e, a) { var i = this; @@ -21,8 +25,8 @@ module.exports = { }, pay: function(t, e, a,sto,type) { - if(wx_paying) return false; - wx_paying=1; + if(this.wx_paying) return false; + this.wx_paying=1; var i = this; var dd = { @@ -56,13 +60,13 @@ module.exports = { console.log(plugin, plugin.fuioupay) plugin.fuioupay(parseInt(t.data.data.amt),paramsJson,function (res){ console.log(res); - wx_paying=0; + i.wx_paying=0; getApp().showSuccess("支付成功!", e); },function (error){ console.log("插件支付错误",error); //支付失败的时候 - + i.wx_paying=0; var msg='取消支付'; if(error.code){ msg=error.code+":"+error.message; @@ -74,7 +78,7 @@ module.exports = { url: "/pages/user/order_list/order_list", }); },1000) - wx_paying=0; + }) }else{ i.weixinPay(t.data.data, e, a); @@ -83,33 +87,35 @@ module.exports = { }else{ + i.wx_paying=0; getApp().confirmBox(t.data.msg); setTimeout(function(){ wx.redirectTo({ url: "/pages/user/order_list/order_list", }); },1000) - wx_paying=0; + } return false; }, fail: function() { console.log('======fail', ) wx.hideLoading(); - wx_paying=0; + i.wx_paying=0; "function" == typeof a && a(); }, failStatus: function() { wx.hideLoading(); - wx_paying=0; + i.wx_paying=0; "function" == typeof a && a(); } }); }, weixinPay: function(n, e, a) { + var th=this; if(!n) return false; - getApp().globalData.no_clear=1; + getApp().globalData.no_clear=1; //有的话用最新的支付方式 if(n.orderInfo) { @@ -121,11 +127,11 @@ module.exports = { paySign: n.paySign, orderInfo: n.orderInfo, // 需要新增的 订单 信息 success (n) { - wx_paying=0; + th.wx_paying=0; t.showSuccess("支付成功!", e); }, fail (n) { - wx_paying=0; + th.wx_paying=0; if(!n.errMsg ) { getApp().showWarning("支付失败"); "function" == typeof fail && fail(); @@ -146,11 +152,11 @@ module.exports = { signType: n.signType, paySign: n.paySign, success: function (n) { - wx_paying=0; + th.wx_paying=0; console.log(n), t.showSuccess("支付成功!", e); }, fail: function (n) { - wx_paying=0; + th.wx_paying=0; console.log(n), "requestPayment:fail" == n.errMsg ? t.showWarning("支付失败") : "requestPayment:fail cancel" == n.errMsg ? t.showWarning("您已取消支付") : t.confirmBox("支付失败:" + n.errMsg.substr("requestPayment:fail ".length)), "function" == typeof a && a(); diff --git a/utils/pay2.js b/utils/pay2.js index 5f697c4..63cebbb 100644 --- a/utils/pay2.js +++ b/utils/pay2.js @@ -1,14 +1,18 @@ -var t = getApp(), n = t.request,wx_paying=0; +var t = getApp(), n = t.request; module.exports = { + wx_paying:0, url: "/api/weshop/plus/create/plus/order", set_pay_url:function (url){ this.url=url;//让链接地址进行赋值 }, + set_fir(){ + this.wx_paying=0; + }, //-- createRechargeOrder create/plus/order -- pay: function(dd, succ,fail) { - if(wx_paying) return false; - wx_paying=1; + if(this.wx_paying) return false; + this.wx_paying=1; wx.showLoading(); var i = this; n.post(this.url, { @@ -31,7 +35,7 @@ module.exports = { console.log(plugin, plugin.fuioupay) plugin.fuioupay(parseInt(t.data.data.amt),paramsJson,function (res){ console.log(res); - wx_paying=0; + i.wx_paying=0; "function" == typeof succ && succ(); },function (error){ console.log("插件支付错误",error); @@ -42,26 +46,26 @@ module.exports = { msg=error.code+":"+error.message; } fail(msg) - wx_paying=0; + i.wx_paying=0; }) }else { i.weixinPay(t.data.data, succ, fail); } } }else{ - wx_paying=0; + i.wx_paying=0; "function" == typeof fail && fail(t.data.msg); } return false; }, fail: function() { wx.hideLoading(); - wx_paying=0; + i.wx_paying=0; "function" == typeof fail && fail(); }, failStatus: function() { wx.hideLoading(); - wx_paying=0; + i.wx_paying=0; "function" == typeof fail && fail(); } }); @@ -69,8 +73,10 @@ module.exports = { //-- 这里是专享礼包的调用 -- pay_data:function (t,succ,fail){ + var th=this; var ob=t.data.data.result; if(!ob){ + this.set_fir(); fail('支付参数错误'); return false; } @@ -85,10 +91,10 @@ module.exports = { console.log(plugin, plugin.fuioupay) plugin.fuioupay(parseInt(ob.amt),paramsJson,function (res){ console.log(res); - wx_paying=0; + th.wx_paying=0; "function" == typeof succ && succ(); },function (error){ - wx_paying=0; + th.wx_paying=0; console.log("插件支付错误",error); //支付失败的时候 //getApp().confirmBox(error.code+error.message); @@ -104,8 +110,12 @@ module.exports = { } }, weixinPay: function(n, succ,fail) { - if(!n) return false; + if(!n){ + this.set_fir(); + return false; + } + var th=this; getApp().globalData.no_clear=1; wx.requestPayment({ @@ -115,11 +125,11 @@ module.exports = { signType: n.signType, paySign: n.paySign, success: function(n) { - wx_paying=0; + th.wx_paying=0; "function" == typeof succ && succ(); }, fail: function(n) { - wx_paying=0; + th.wx_paying=0; var msg=''; switch (n.errMsg){ case "requestPayment:fail": msg="支付失败";break;