zhaoxiaohai преди 2 години
родител
ревизия
1ac640097a
променени са 1 файла, в които са добавени 31 реда и са изтрити 25 реда
  1. 31 25
      pages/tabbar/home/index.js

+ 31 - 25
pages/tabbar/home/index.js

@@ -6,6 +6,7 @@ Page({
      * 页面的初始数据
      */
     data: {
+        site: getApp().globalData.site,
         bannerList: [], //banner列表
         user: {},
         annunciateList: [], //通告列表
@@ -33,7 +34,7 @@ Page({
         })
         /* 首页宫格授权查询 */
         if (wx.getStorageSync('userauth').length != 0) {
-            let auth = getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ['营销工具'], ['通告', '推广素材', '商学院', '提报', '销售线索', '营销物料']),
+            let auth = getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ['营销工具'], ['通告', '推广素材', '商学院', '提报', '销售线索', '营销物料', '销售预测', '销售目标']),
                 gridList = [],
                 subassembly = [];
             auth.forEach(v => {
@@ -92,27 +93,32 @@ Page({
                         //获取销售线索待办数量
                         setTimeout(this.getCount, 100);
                         break;
+                    case "销售预测":
+                        gridList.push({
+                            name: "销售预测",
+                            path: "/packageA/forecast/index",
+                            icon: "icon-xiaochengxu_xiaoshouyuce",
+                            apps: v.apps
+                        })
+                        break;
+                    case "销售目标":
+                        gridList.push({
+                            name: "销售目标",
+                            path: "/packageA/target/index",
+                            icon: "icon-xiaochengxu_xiaoshoumubiao",
+                            apps: v.apps
+                        })
+                        break;
                 };
             });
-            /* 测试用假数据 */
-            gridList.push({
-                name: "销售预测",
-                path: "/packageA/forecast/index",
-                icon: "icon-xiaochengxu_xiaoshouyuce",
-                apps: {}
-            })
-            gridList.push({
-                name: "销售目标",
-                path: "/packageA/target/index",
-                icon: "icon-xiaochengxu_xiaoshoumubiao",
-                apps: {}
-            })
-            gridList.push({
-                name: "联系人",
-                path: "/packageA/contacts/index",
-                icon: "icon-xiaochengxutongxunlu",
-                apps: {}
-            })
+            if (!['美大'].includes(this.data.site)) {
+                gridList.push({
+                    name: "联系人",
+                    path: "/packageA/contacts/index",
+                    icon: "icon-xiaochengxutongxunlu",
+                    apps: {}
+                })
+            }
             /* 首页小组件查询 */
             try {
                 let home = getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ['通用'], ['首页'])[0].apps[0].meta.wedgits;
@@ -141,7 +147,7 @@ Page({
     /* 销售线索待办 */
     getCount() {
         const index = this.data.gridList.findIndex(v => v.name == '销售线索');
-        if (!index) return;
+        if (index == -1) return;
         _Http.basic({
             "classname": "saletool.orderclue.web.orderclue",
             "method": "getCount",
@@ -150,12 +156,12 @@ Page({
                 "status": "待跟进"
             }
         }, false).then(res => {
-            if (res.data.count == 0) return;
+            if (res.data.count == 0) res.data.count = '';
             if (res.data.count > 99) res.data.count = '99+';
-            try{
+            try {
                 this.data.gridList[index].count = res.data.count;
-            }catch(e){
-                
+            } catch (e) {
+
             }
             this.setData({
                 gridList: this.data.gridList