From c433b6acd6c9cb23f0af52347ebebfffa9eeb951 Mon Sep 17 00:00:00 2001 From: F5VT98DI7XY4X12\Administrator <765199919@qq.com> Date: Mon, 16 Sep 2019 09:42:31 +0800 Subject: [PATCH] 首页的修改 --- pages/index/index/index.js | 58 +++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 41 insertions(+), 17 deletions(-) diff --git a/pages/index/index/index.js b/pages/index/index/index.js index cffefd4..c4d086d 100644 --- a/pages/index/index/index.js +++ b/pages/index/index/index.js @@ -52,40 +52,64 @@ Page({ pt_timer:null, pt_timer_active:0, + //看下商家是否开通会员权益 + is_boot:0, + gd_category:null, }, + onLoad: function () { var th = this; n.init(th, "", "recommend"); + + //看一下商家是否开通了权益 + //--初始化是否有打勾-- + getApp().request.promiseGet("/api/weshop/users/grade/vip/init/get", { + data: { storeId: os.stoid} + }).then(res => { + if(res.data.data){ + is_init=res.data.data.isBool; + th.setData({is_boot:is_init}); + } + }) + }, async onShow() { await this.init_load(); //显示的时候要开启计时器 - this.data.is_timer=1; + this.data.is_timer = 1; //如果是自定义模板 - if(this.data.isTemplate) { + if (this.data.isTemplate) { //---先获取会员--- - t.getUserFir(function () {}); - }else{ + t.getUserFir(function () { + }); + } else { await this.init_fir(); } //--正再拼团中的处理-- - var url="/api/weshop/order/pageTuan?pt_status=1&is_pt=1&store_id="+os.stoid+"&pageSize=6&page=1" - await getApp().request.promiseGet(url,{}).then(res=>{ - if(res.data.code==0 && res.data.data && res.data.data.pageData){ - th.data.pt_timer_arr=res.data.data.pageData; - } + var url = "/api/weshop/order/pageTuan?pt_status=1&is_pt=1&store_id=" + os.stoid + "&pageSize=6&page=1" + await getApp().request.promiseGet(url, {}).then(res => { + if (res.data.code == 0 && res.data.data && res.data.data.pageData) { + th.data.pt_timer_arr = res.data.data.pageData; + } }) - if(th.data.pt_timer_arr && th.data.pt_timer_arr.length>0){ - for(var i in th.data.pt_timer_arr){ - var p_item=th.data.pt_timer_arr[i]; - await getApp().request.promiseGet("/api/weshop/users/get/"+os.stoid+"/"+p_item.user_id,{1:1}).then(res=>{ - th.data.pt_timer_arr[i].head_pic=res.data.data.head_pic; - }) - } - th.Interval_pt(); + if (th.data.pt_timer_arr && th.data.pt_timer_arr.length > 0) { + for (var i in th.data.pt_timer_arr) { + var p_item = th.data.pt_timer_arr[i]; + await getApp().request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + p_item.user_id, {1: 1}).then(res => { + th.data.pt_timer_arr[i].head_pic = res.data.data.head_pic; + }) + } + th.Interval_pt(); } + //---处理正在6个分类---- + await getApp().request.promiseGet("/api/weshop/goodscategory/page", { + data: {store_id: os.stoid, pageSize: 6} + }).then(res => { + var gd_category=res.data.data.pageData; + th.seData({gd_category:gd_category}); + }) }, //当隐藏的时候就关闭计时器 -- libgit2 0.21.4