zhaoxiaohai 2 vuotta sitten
vanhempi
commit
514943de37
2 muutettua tiedostoa jossa 62 lisäystä ja 20 poistoa
  1. 59 15
      pages/tabbar/home/index.js
  2. 3 5
      pages/tabbar/home/index.wxml

+ 59 - 15
pages/tabbar/home/index.js

@@ -33,7 +33,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 => {
@@ -74,6 +74,14 @@ Page({
                             apps: v.apps
                         })
                         break;
+                    case "营销物料":
+                        gridList.push({
+                            name: "营销物料",
+                            path: "/pages/tabbar/smartStore/index",
+                            icon: "icon-a-shouyejingangquyingxiaowuliao",
+                            apps: v.apps
+                        })
+                        break;
                     case "销售线索":
                         gridList.push({
                             name: "销售线索",
@@ -84,11 +92,34 @@ 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;
                 };
             });
             /* 首页小组件查询 */
-            let home = getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ['通用'], ['首页'])[0].apps[0].meta.wedgits;
-            if (home.some(v => v.wedgit == 'homedatadisplay')) subassembly.push('homedatadisplay');
+            try {
+                let home = getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ['通用'], ['首页'])[0].apps[0].meta.wedgits;
+                if (home.some(v => v.wedgit == 'homedatadisplay')) subassembly.push('homedatadisplay');
+            } catch (e) {
+                this.setData({
+                    gridList,
+                    subassembly: []
+                })
+            }
             this.setData({
                 gridList,
                 subassembly
@@ -107,7 +138,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",
@@ -116,9 +147,13 @@ 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+';
-            this.data.gridList[index].count = res.data.count;
+            try {
+                this.data.gridList[index].count = res.data.count;
+            } catch (e) {
+
+            }
             this.setData({
                 gridList: this.data.gridList
             })
@@ -196,9 +231,16 @@ Page({
         const {
             item
         } = e.currentTarget.dataset;
-        wx.navigateTo({
-            url: `${item.path}?auth=${JSON.stringify(item.apps)}`,
-        });
+        const url = `${item.path}?auth=${JSON.stringify(item.apps)}`
+        if (item.name == "营销物料") {
+            wx.switchTab({
+                url
+            });
+        } else {
+            wx.navigateTo({
+                url
+            });
+        }
     },
     /* 去消息详情 */
     toMsg(e) {
@@ -221,12 +263,13 @@ Page({
     },
     /* banner */
     bannerClick(e) {
-        const hyperlink = e.currentTarget.dataset.hyperlink.split(":");
-        if (hyperlink[0] == 'path') {
-            wx.navigateTo({
-                url: hyperlink[1]
-            })
-        }
+        const {
+            item
+        } = e.currentTarget.dataset,
+            hyperlink = item.hyperlink.split(":");
+        if (hyperlink[0] == 'path') wx.navigateTo({
+            url: hyperlink[1]
+        })
     },
     onShow() {
         this.getTabBar().init();
@@ -238,4 +281,5 @@ Page({
     onHide() {
         clearInterval(DataCarousel);
     },
+    onShareAppMessage() {}
 })

+ 3 - 5
pages/tabbar/home/index.wxml

@@ -15,7 +15,7 @@
     <view class="banner_oval" />
     <swiper class='banner_content' autoplay circular>
         <swiper-item wx:for="{{bannerList}}" wx:key="index">
-            <image src="{{item.attinfos[0].url}}" mode="aspectFill" data-hyperlink="{{item.hyperlink}}" catchtap="bannerClick" />
+            <image src="{{item.attinfos[0].url}}" mode="aspectFill" data-item="{{item}}" catchtap="bannerClick" />
         </swiper-item>
     </swiper>
 </view>
@@ -34,7 +34,7 @@
         <view wx:if="{{item.count}}" class="badge">{{item.count}}</view>
     </navigator>
 </My_card>
-<!-- 数据概况 -->
+<!-- 数据概况 
 <block wx:if="{{per.query(subassembly,'homedatadisplay')}}">
     <view class="general-situation">
         <view class="title">
@@ -50,7 +50,7 @@
         </view>
     </My_card>
 </block>
-
+-->
 <!-- 通告 -->
 <My_card wx:if="{{annunciateList.length>0 && per.query(subassembly,'homenoticelist')}}" title='最新通告' class="annunciate">
     <view class="unread" slot='title-r' bindtap="toAnnunciate">
@@ -68,7 +68,5 @@
         <view wx:if="{{index!=annunciateList.length-1}}" style="width: 100%; border-top: 1rpx solid #EEEEEE; margin-left: 30rpx;" />
     </block>
 </My_card>
-
 <view style="height: 140rpx;" />
-
 <wxs src='../../../utils/wxmlQueryPer.wxs' module="per" />