Commit ad39a8f00762b4799851acac284379bd3ab57b0a
1 parent
b47136d9
定时器推迟读取订单的信息
Showing
1 changed file
with
63 additions
and
47 deletions
pages/user/order_list/order_list.js
| @@ -109,62 +109,76 @@ Page({ | @@ -109,62 +109,76 @@ Page({ | ||
| 109 | activeCategoryId: t.type | 109 | activeCategoryId: t.type |
| 110 | }); | 110 | }); |
| 111 | s.init(this, "", "orderList"); | 111 | s.init(this, "", "orderList"); |
| 112 | - }, | ||
| 113 | - onShow: function () { | ||
| 114 | - | ||
| 115 | - | ||
| 116 | - ut.fy_back('',0) | ||
| 117 | - this.setData({ paying: 0 }); | ||
| 118 | - this.data.ser_paying=0; | ||
| 119 | - | ||
| 120 | - t_pay.set_fir(); | ||
| 121 | - t.set_fir(); | ||
| 122 | - | ||
| 123 | - var th = this; | ||
| 124 | - //---查看会员的等级价--- | ||
| 125 | - getApp().getConfig2(function (e) { | ||
| 126 | 112 | ||
| 113 | + setTimeout(()=>{ | ||
| 114 | + if(!getApp().globalData.user_id){ | ||
| 115 | + getApp().goto('/packageE/pages/togoin/togoin') | ||
| 116 | + return false; | ||
| 117 | + } | ||
| 118 | + },1500) | ||
| 127 | 119 | ||
| 128 | 120 | ||
| 129 | - th.setData({ conf: e, sales_rules: e.sales_rules }); | ||
| 130 | - //--- 看后台是不是有开通等级卡 --- | ||
| 131 | - if (e.switch_list) { | ||
| 132 | - var s_list = JSON.parse(e.switch_list); | ||
| 133 | - th.setData({ appoint_pick_keyid: s_list.appoint_pick_keyid }) | 121 | + }, |
| 122 | + onShow: function () { | ||
| 134 | 123 | ||
| 135 | - var user = getApp().globalData.userInfo; | ||
| 136 | - var is_open_offline = s_list.is_pricing_open; | ||
| 137 | - //-- 如果后台有开启等级价的功能 -- | ||
| 138 | - if (parseInt(s_list.rank_switch) == 2 && user['card_expiredate']) { | ||
| 139 | - var str = user['card_expiredate'].replace(/-/g, '/'); | ||
| 140 | - var end = new Date(str); | ||
| 141 | - end = Date.parse(end) / 1000; | ||
| 142 | - var now = ut.gettimestamp(); | ||
| 143 | - //--- 判断是等级会员,且在有效期范围内 --- | ||
| 144 | - if (user.card_field && now < end) { | ||
| 145 | - th.setData({ card_field: user.card_field }) | 124 | + wx.showLoading(); |
| 125 | + //-- 读取会员的信息先 --,再app.js中有 | ||
| 126 | + setTimeout(()=> { | ||
| 127 | + ut.fy_back('', 0) | ||
| 128 | + this.setData({paying: 0}); | ||
| 129 | + this.data.ser_paying = 0; | ||
| 130 | + | ||
| 131 | + t_pay.set_fir(); | ||
| 132 | + t.set_fir(); | ||
| 133 | + | ||
| 134 | + var th = this; | ||
| 135 | + | ||
| 136 | + //---查看会员的等级价--- | ||
| 137 | + getApp().getConfig2(function (e) { | ||
| 138 | + | ||
| 139 | + | ||
| 140 | + th.setData({conf: e, sales_rules: e.sales_rules}); | ||
| 141 | + //--- 看后台是不是有开通等级卡 --- | ||
| 142 | + if (e.switch_list) { | ||
| 143 | + var s_list = JSON.parse(e.switch_list); | ||
| 144 | + th.setData({appoint_pick_keyid: s_list.appoint_pick_keyid}) | ||
| 145 | + | ||
| 146 | + var user = getApp().globalData.userInfo; | ||
| 147 | + var is_open_offline = s_list.is_pricing_open; | ||
| 148 | + //-- 如果后台有开启等级价的功能 -- | ||
| 149 | + if (parseInt(s_list.rank_switch) == 2 && user && user['card_expiredate']) { | ||
| 150 | + var str = user['card_expiredate'].replace(/-/g, '/'); | ||
| 151 | + var end = new Date(str); | ||
| 152 | + end = Date.parse(end) / 1000; | ||
| 153 | + var now = ut.gettimestamp(); | ||
| 154 | + //--- 判断是等级会员,且在有效期范围内 --- | ||
| 155 | + if (user.card_field && now < end) { | ||
| 156 | + th.setData({card_field: user.card_field}) | ||
| 157 | + } | ||
| 146 | } | 158 | } |
| 147 | - } | ||
| 148 | - //-- 判断有没有过期 -- | ||
| 149 | - getApp().request.promiseGet("/store/storemoduleendtime/page?store_id=" + os.stoid + "&type=6", {}).then(res => { | ||
| 150 | - //未购买 | ||
| 151 | - if (res.data.code != 0 || !res.data.data || !res.data.data.pageData || !res.data.data.pageData.length) { | ||
| 152 | - is_open_offline = 0; | ||
| 153 | - } else { | ||
| 154 | - //已经过期 | ||
| 155 | - var item = res.data.data.pageData[0]; | ||
| 156 | - if (item.end_time < ut.gettimestamp()) { | 159 | + |
| 160 | + //-- 判断有没有过期 -- | ||
| 161 | + getApp().request.promiseGet("/store/storemoduleendtime/page?store_id=" + os.stoid + "&type=6", {}).then(res => { | ||
| 162 | + //未购买 | ||
| 163 | + if (res.data.code != 0 || !res.data.data || !res.data.data.pageData || !res.data.data.pageData.length) { | ||
| 157 | is_open_offline = 0; | 164 | is_open_offline = 0; |
| 165 | + } else { | ||
| 166 | + //已经过期 | ||
| 167 | + var item = res.data.data.pageData[0]; | ||
| 168 | + if (item.end_time < ut.gettimestamp()) { | ||
| 169 | + is_open_offline = 0; | ||
| 170 | + } | ||
| 158 | } | 171 | } |
| 159 | - } | ||
| 160 | 172 | ||
| 161 | - th.data.is_open_offline = is_open_offline; | ||
| 162 | - }) | ||
| 163 | - } | ||
| 164 | - }, 1) | 173 | + th.data.is_open_offline = is_open_offline; |
| 174 | + }) | ||
| 175 | + } | ||
| 176 | + }, 1) | ||
| 177 | + | ||
| 178 | + this.resetData(), this.requestOrderList(this.data.activeCategoryId); | ||
| 165 | 179 | ||
| 166 | - this.resetData(), this.requestOrderList(this.data.activeCategoryId); | ||
| 167 | - this.clickTab(); | 180 | + this.clickTab(); |
| 181 | + },1500); | ||
| 168 | }, | 182 | }, |
| 169 | changeTab: function (t) { | 183 | changeTab: function (t) { |
| 170 | if (this.data.activeCategoryId == t.currentTarget.id) return false; | 184 | if (this.data.activeCategoryId == t.currentTarget.id) return false; |
| @@ -372,6 +386,8 @@ Page({ | @@ -372,6 +386,8 @@ Page({ | ||
| 372 | 386 | ||
| 373 | th.setData({ orderList: data, }); | 387 | th.setData({ orderList: data, }); |
| 374 | 388 | ||
| 389 | + wx.hideLoading(); | ||
| 390 | + | ||
| 375 | }); | 391 | }); |
| 376 | 392 | ||
| 377 | 393 |