Commit d8b16fd2c6bba5406a1b3cb07ad3776432804007

Authored by yvan.ni
1 parent bca55194

1、购物车空会员的时候

2、会员中心  空会员显示推荐商品
pages/cart/cart/cart.js
... ... @@ -492,6 +492,21 @@ Page({
492 492 }
493 493 });
494 494  
  495 + if(!app.globalData.user_id){
  496 +
  497 + th.setData({
  498 + requestData: [],
  499 + all_num: 0,
  500 + is_load: 1,
  501 + is_edit: 0,
  502 + checkAllToggle:0
  503 + }),wx.stopPullDownRefresh();
  504 +
  505 + wx.hideLoading();
  506 +
  507 + return false;
  508 + }
  509 +
495 510 getApp().request.get("/api/weshop/cart/listNew1", {
496 511 data: {
497 512 user_id: app.globalData.user_id,
... ... @@ -503,8 +518,11 @@ Page({
503 518 success: async function (su) {
504 519 console.log(su, 10000);
505 520 //按门店分类的数组
506   - var arr = new Array(),
507   - carr = su.data.data.pageData;
  521 + var arr = new Array();
  522 + var carr=[];
  523 +
  524 + if(ut.ajax_ok(su))
  525 + carr = su.data.data.pageData;
508 526 var all_num = 0;
509 527  
510 528 if (carr && carr.length > 0) {
... ...
pages/user/index/index.js
... ... @@ -546,22 +546,25 @@ Page({
546 546 })
547 547 //th.requestRecommend();
548 548  
549   - //自定义组件一定要等到页面加载完了,才来调用selectComponnent
550   - setTimeout(function () {
551 549  
552   - th.setData({ is_show_recommend:true })
553   - if (getApp().globalData.user_id) getApp().requestCardNum(th);
554   - var goods_list = th.selectComponent("#goods_recommend"); //组件的id
555 550  
556   - if(goods_list){
557   - goods_list.init();
558   - goods_list.get_list();
559   - }
  551 + }
  552 + }
  553 +
  554 + //自定义组件一定要等到页面加载完了,才来调用selectComponnent
  555 + setTimeout(function () {
560 556  
561   - }, 1200)
  557 + th.setData({ is_show_recommend:true })
  558 + if (getApp().globalData.user_id) getApp().requestCardNum(th);
  559 + var goods_list = th.selectComponent("#goods_recommend"); //组件的id
562 560  
  561 + if(goods_list){
  562 + goods_list.init();
  563 + goods_list.get_list();
563 564 }
564   - }
  565 +
  566 + }, 1200)
  567 +
565 568  
566 569 setTimeout(()=>{
567 570 th.setData({ pshow:1 })
... ... @@ -630,14 +633,14 @@ Page({
630 633 */
631 634 onReachBottom: function () {
632 635 //!this.nomore && this.requestRecommend();
633   - var e = getApp().globalData.userInfo;
634   - if (e != undefined && e != null && e.mobile) {
  636 + //var e = getApp().globalData.userInfo;
  637 + //if (e != undefined && e != null && e.mobile) {
635 638 var goods_list = this.selectComponent("#goods_recommend"); //组件的id
636 639 goods_list.init();
637 640 setTimeout(function () {
638 641 goods_list.get_list();
639 642 }, 300)
640   - }
  643 + //}
641 644 },
642 645  
643 646 /**
... ...