Commit 403172bd91433ee0bca4d8c97d248179ffecdd85
1 parent
ba6f5a8d
朋友圈打开场景处理首页和组合购首页
Showing
2 changed files
with
60 additions
and
6 deletions
packageB/pages/zuhegou/index/index.js
| @@ -191,11 +191,60 @@ Page({ | @@ -191,11 +191,60 @@ Page({ | ||
| 191 | */ | 191 | */ |
| 192 | onShow: function () { | 192 | onShow: function () { |
| 193 | getApp().check_can_share(); | 193 | getApp().check_can_share(); |
| 194 | + var th = this, | ||
| 195 | + that = this, | ||
| 196 | + ee = this; | ||
| 197 | + | ||
| 198 | + let scene = wx.getLaunchOptionsSync().scene; | ||
| 199 | + //--判断是否是单页面-- | ||
| 200 | + if (scene== 1154) { | ||
| 201 | + var url = "/api/weshop/prom/zhbuy/getone/" + os.stoid + "/" + th.data.id; | ||
| 202 | + getApp().request.get(url, { | ||
| 203 | + success: function (e) { | ||
| 204 | + th.data.is_get_act = 1; | ||
| 205 | + if (e.data.code == 0 && e.data.data) { | ||
| 206 | + self.setData({ | ||
| 207 | + act: e.data.data | ||
| 208 | + }); | ||
| 209 | + if (e.data.data.is_show != 1) { | ||
| 210 | + th.setData({ | ||
| 211 | + error: '活动未开启' | ||
| 212 | + }); | ||
| 213 | + return false; | ||
| 214 | + } | ||
| 215 | + if (ut.gettimestamp() < e.data.data.start_time) { | ||
| 216 | + th.setData({ | ||
| 217 | + error: '活动还未开始' | ||
| 218 | + }); | ||
| 219 | + return false; | ||
| 220 | + } | ||
| 221 | + if (e.data.data.is_end == 0 && ut.gettimestamp() < e.data.data.end_time) { | ||
| 222 | + //判断是否有限制购买次数 | ||
| 223 | + if(e.data.data.buy_limit !=0){ | ||
| 224 | + | ||
| 225 | + } | ||
| 226 | + //-- 获取商品列表 -- | ||
| 227 | + self.get_list(); | ||
| 228 | + self.countDown(); | ||
| 229 | + } else { | ||
| 230 | + th.setData({ | ||
| 231 | + error: '活动已经过期' | ||
| 232 | + }); | ||
| 233 | + return false; | ||
| 234 | + } | ||
| 235 | + } else { | ||
| 236 | + th.data.is_get_act = 0; | ||
| 237 | + th.setData({ | ||
| 238 | + error: e.data.msg | ||
| 239 | + }); | ||
| 240 | + return false; | ||
| 241 | + } | ||
| 242 | + } | ||
| 243 | + }); | ||
| 244 | + } | ||
| 194 | 245 | ||
| 195 | getApp().is_Single_page(this, function () { | 246 | getApp().is_Single_page(this, function () { |
| 196 | - var th = this, | ||
| 197 | - that = this, | ||
| 198 | - ee = this; | 247 | + |
| 199 | this.data.is_timer = 1; | 248 | this.data.is_timer = 1; |
| 200 | if (this.data.act) this.countDown(); | 249 | if (this.data.act) this.countDown(); |
| 201 | //如果有会员的时候 | 250 | //如果有会员的时候 |
| @@ -414,6 +463,9 @@ Page({ | @@ -414,6 +463,9 @@ Page({ | ||
| 414 | return false; | 463 | return false; |
| 415 | } | 464 | } |
| 416 | }) | 465 | }) |
| 466 | + | ||
| 467 | + | ||
| 468 | + | ||
| 417 | }, | 469 | }, |
| 418 | //获取用户参与活动的次数 | 470 | //获取用户参与活动的次数 |
| 419 | getUserBuyPromNum(){ | 471 | getUserBuyPromNum(){ |
pages/index/index/index.js
| @@ -394,9 +394,11 @@ Page({ | @@ -394,9 +394,11 @@ Page({ | ||
| 394 | 394 | ||
| 395 | getApp().check_can_share(); | 395 | getApp().check_can_share(); |
| 396 | 396 | ||
| 397 | - this.getTabBar().setData({ | ||
| 398 | - cartGoodsNum: getApp().globalData.cartGoodsNum | ||
| 399 | - }) | 397 | + if (typeof this.getTabBar === 'function' && this.getTabBar()) { |
| 398 | + this.getTabBar().setData({ | ||
| 399 | + cartGoodsNum: getApp().globalData.cartGoodsNum | ||
| 400 | + }) | ||
| 401 | + } | ||
| 400 | var th = this; | 402 | var th = this; |
| 401 | //-- 登录回来判断弹框 -- | 403 | //-- 登录回来判断弹框 -- |
| 402 | var user_id = getApp().globalData.user_id; | 404 | var user_id = getApp().globalData.user_id; |