diff --git a/pages/user/order_list/order_list.js b/pages/user/order_list/order_list.js index 797898e..d544170 100644 --- a/pages/user/order_list/order_list.js +++ b/pages/user/order_list/order_list.js @@ -110,29 +110,37 @@ Page({ }); s.init(this, "", "orderList"); - setTimeout(()=>{ - if(!getApp().globalData.user_id){ - getApp().goto('/packageE/pages/togoin/togoin') - return false; - } - },1500) + //先判断有没有系统缓存的信息 + this.check_user_storage(()=>{ + if(!getApp().globalData.user_id){ + th.setData({no_user:1 }) + getApp().goto('/packageE/pages/togoin/togoin') + return false; + } + }) }, onShow: function () { - wx.showLoading(); + var th=this; //-- 读取会员的信息先 --,再app.js中有 - setTimeout(()=> { + this.check_user_storage(()=> { + //在界面显示 + if(!getApp().globalData.user_id){ + wx.hideLoading(); + }else{ + th.setData({no_user:0}) + } + + ut.fy_back('', 0) - this.setData({paying: 0}); - this.data.ser_paying = 0; + th.setData({paying: 0}); + th.data.ser_paying = 0; t_pay.set_fir(); t.set_fir(); - var th = this; - //---查看会员的等级价--- getApp().getConfig2(function (e) { @@ -175,11 +183,27 @@ Page({ } }, 1) - this.resetData(), this.requestOrderList(this.data.activeCategoryId); - - this.clickTab(); + th.resetData(), th.requestOrderList(th.data.activeCategoryId); + th.clickTab(); },1500); }, + + onHide(){ + this.setData({no_user:0 }) + }, + + //判断有没有会员缓存 + check_user_storage(func){ + var user = wx.getStorageSync("userinfo"); + if(!user){ + func(); + }else{ + setTimeout(()=>{ + func(); + },1200); + } + }, + changeTab: function (t) { if (this.data.activeCategoryId == t.currentTarget.id) return false; this.resetData(), this.requestOrderList(t.currentTarget.id); @@ -191,6 +215,9 @@ Page({ /*---------获取订单列表--------*/ requestOrderList: function (t) { + if(!getApp().globalData.user_id){ + return false; + } var rd = Math.random() * 100; var e = this, th = e, r = e.data.url + "/api/weshop/order/page?rd=" + rd, a = ""; switch (t) { diff --git a/pages/user/order_list/order_list.wxml b/pages/user/order_list/order_list.wxml index e504d79..05127da 100644 --- a/pages/user/order_list/order_list.wxml +++ b/pages/user/order_list/order_list.wxml @@ -511,5 +511,13 @@ + + + + + + 会员未登陆。。 + +