diff --git a/pages/cart/cart/cart.js b/pages/cart/cart/cart.js index 8e8311c..73558ab 100644 --- a/pages/cart/cart/cart.js +++ b/pages/cart/cart/cart.js @@ -492,6 +492,21 @@ Page({ } }); + if(!app.globalData.user_id){ + + th.setData({ + requestData: [], + all_num: 0, + is_load: 1, + is_edit: 0, + checkAllToggle:0 + }),wx.stopPullDownRefresh(); + + wx.hideLoading(); + + return false; + } + getApp().request.get("/api/weshop/cart/listNew1", { data: { user_id: app.globalData.user_id, @@ -503,8 +518,11 @@ Page({ success: async function (su) { console.log(su, 10000); //按门店分类的数组 - var arr = new Array(), - carr = su.data.data.pageData; + var arr = new Array(); + var carr=[]; + + if(ut.ajax_ok(su)) + carr = su.data.data.pageData; var all_num = 0; if (carr && carr.length > 0) { diff --git a/pages/user/index/index.js b/pages/user/index/index.js index 2c195e9..6485176 100644 --- a/pages/user/index/index.js +++ b/pages/user/index/index.js @@ -546,22 +546,25 @@ Page({ }) //th.requestRecommend(); - //自定义组件一定要等到页面加载完了,才来调用selectComponnent - setTimeout(function () { - th.setData({ is_show_recommend:true }) - if (getApp().globalData.user_id) getApp().requestCardNum(th); - var goods_list = th.selectComponent("#goods_recommend"); //组件的id - if(goods_list){ - goods_list.init(); - goods_list.get_list(); - } + } + } + + //自定义组件一定要等到页面加载完了,才来调用selectComponnent + setTimeout(function () { - }, 1200) + th.setData({ is_show_recommend:true }) + if (getApp().globalData.user_id) getApp().requestCardNum(th); + var goods_list = th.selectComponent("#goods_recommend"); //组件的id + if(goods_list){ + goods_list.init(); + goods_list.get_list(); } - } + + }, 1200) + setTimeout(()=>{ th.setData({ pshow:1 }) @@ -630,14 +633,14 @@ Page({ */ onReachBottom: function () { //!this.nomore && this.requestRecommend(); - var e = getApp().globalData.userInfo; - if (e != undefined && e != null && e.mobile) { + //var e = getApp().globalData.userInfo; + //if (e != undefined && e != null && e.mobile) { var goods_list = this.selectComponent("#goods_recommend"); //组件的id goods_list.init(); setTimeout(function () { goods_list.get_list(); }, 300) - } + //} }, /**