Commit c433b6acd6c9cb23f0af52347ebebfffa9eeb951
1 parent
b4faa5d8
首页的修改
Showing
1 changed file
with
41 additions
and
17 deletions
pages/index/index/index.js
... | ... | @@ -52,40 +52,64 @@ Page({ |
52 | 52 | pt_timer:null, |
53 | 53 | pt_timer_active:0, |
54 | 54 | |
55 | + //看下商家是否开通会员权益 | |
56 | + is_boot:0, | |
57 | + gd_category:null, | |
55 | 58 | }, |
59 | + | |
56 | 60 | onLoad: function () { |
57 | 61 | var th = this; |
58 | 62 | n.init(th, "", "recommend"); |
63 | + | |
64 | + //看一下商家是否开通了权益 | |
65 | + //--初始化是否有打勾-- | |
66 | + getApp().request.promiseGet("/api/weshop/users/grade/vip/init/get", { | |
67 | + data: { storeId: os.stoid} | |
68 | + }).then(res => { | |
69 | + if(res.data.data){ | |
70 | + is_init=res.data.data.isBool; | |
71 | + th.setData({is_boot:is_init}); | |
72 | + } | |
73 | + }) | |
74 | + | |
59 | 75 | }, |
60 | 76 | async onShow() { |
61 | 77 | await this.init_load(); |
62 | 78 | //显示的时候要开启计时器 |
63 | - this.data.is_timer=1; | |
79 | + this.data.is_timer = 1; | |
64 | 80 | //如果是自定义模板 |
65 | - if(this.data.isTemplate) { | |
81 | + if (this.data.isTemplate) { | |
66 | 82 | //---先获取会员--- |
67 | - t.getUserFir(function () {}); | |
68 | - }else{ | |
83 | + t.getUserFir(function () { | |
84 | + }); | |
85 | + } else { | |
69 | 86 | await this.init_fir(); |
70 | 87 | } |
71 | 88 | |
72 | 89 | //--正再拼团中的处理-- |
73 | - var url="/api/weshop/order/pageTuan?pt_status=1&is_pt=1&store_id="+os.stoid+"&pageSize=6&page=1" | |
74 | - await getApp().request.promiseGet(url,{}).then(res=>{ | |
75 | - if(res.data.code==0 && res.data.data && res.data.data.pageData){ | |
76 | - th.data.pt_timer_arr=res.data.data.pageData; | |
77 | - } | |
90 | + var url = "/api/weshop/order/pageTuan?pt_status=1&is_pt=1&store_id=" + os.stoid + "&pageSize=6&page=1" | |
91 | + await getApp().request.promiseGet(url, {}).then(res => { | |
92 | + if (res.data.code == 0 && res.data.data && res.data.data.pageData) { | |
93 | + th.data.pt_timer_arr = res.data.data.pageData; | |
94 | + } | |
78 | 95 | }) |
79 | - if(th.data.pt_timer_arr && th.data.pt_timer_arr.length>0){ | |
80 | - for(var i in th.data.pt_timer_arr){ | |
81 | - var p_item=th.data.pt_timer_arr[i]; | |
82 | - await getApp().request.promiseGet("/api/weshop/users/get/"+os.stoid+"/"+p_item.user_id,{1:1}).then(res=>{ | |
83 | - th.data.pt_timer_arr[i].head_pic=res.data.data.head_pic; | |
84 | - }) | |
85 | - } | |
86 | - th.Interval_pt(); | |
96 | + if (th.data.pt_timer_arr && th.data.pt_timer_arr.length > 0) { | |
97 | + for (var i in th.data.pt_timer_arr) { | |
98 | + var p_item = th.data.pt_timer_arr[i]; | |
99 | + await getApp().request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + p_item.user_id, {1: 1}).then(res => { | |
100 | + th.data.pt_timer_arr[i].head_pic = res.data.data.head_pic; | |
101 | + }) | |
102 | + } | |
103 | + th.Interval_pt(); | |
87 | 104 | } |
88 | 105 | |
106 | + //---处理正在6个分类---- | |
107 | + await getApp().request.promiseGet("/api/weshop/goodscategory/page", { | |
108 | + data: {store_id: os.stoid, pageSize: 6} | |
109 | + }).then(res => { | |
110 | + var gd_category=res.data.data.pageData; | |
111 | + th.seData({gd_category:gd_category}); | |
112 | + }) | |
89 | 113 | }, |
90 | 114 | |
91 | 115 | //当隐藏的时候就关闭计时器 | ... | ... |