zhaoxiaohai 2 years ago
parent
commit
3e34b9f458

+ 10 - 2
pages/annunciate/details.js

@@ -19,10 +19,18 @@ Page({
      * 生命周期函数--监听页面加载
      */
     onLoad(options) {
+        let dataAuth = '';
+        if (options.auth.includes('团队内部数据分析') && options.auth.includes('经销商数据分析')) {
+            dataAuth = 'all';
+        } else {
+            dataAuth = options.auth.includes('团队内部数据分析') ? '内部' : '经销商'
+        }
         this.setData({
+            viewData: options.auth.includes('团队内部数据分析') || options.auth.includes('经销商数据分析'),
+            dataAuth,
             feedback: options.feedback,
-            viewData: options.viewData
-        })
+            sat_noticeid: options.id
+        });
         /* 详情 */
         _Http.basic({
             "classname": "saletool.notice.notice",

+ 2 - 2
pages/annunciate/details.wxml

@@ -1,5 +1,5 @@
 <!-- swipeable -->
-<van-tabs wx:if="{{viewData!='false'}}" sticky color='var(--assist)' title-active-color='var(--assist)'>
+<van-tabs wx:if="{{viewData}}" sticky color='var(--assist)' title-active-color='var(--assist)'>
     <van-tab title="详情">
         <view class="main">
             <view class="title multi-line">{{detailsData.title}}</view>
@@ -47,7 +47,7 @@
     </van-tab>
 
     <van-tab title="数据">
-        <DispalyData></DispalyData>
+        <DispalyData dataId="{{sat_noticeid}}" dataAuth="{{dataAuth}}" />
     </van-tab>
 </van-tabs>
 

+ 1 - 1
pages/annunciate/index.js

@@ -69,7 +69,7 @@ Page({
         } = e.currentTarget.dataset;
         let authList = this.data.authList;
         wx.navigateTo({
-            url: `./details?id=${item.sat_noticeid}&feedback=${authList.includes('反馈')}&viewData=${authList.includes('查看数据')}`
+            url: `./details?id=${item.sat_noticeid}&feedback=${authList.includes('反馈')}&auth=${authList}`
         })
     },
 

+ 87 - 9
pages/annunciate/modules/displayData.js

@@ -1,26 +1,104 @@
-// pages/annunciate/modules/displayData.js
+const _Http = getApp().globalData.http;
 Component({
     /**
      * 组件的属性列表
      */
     properties: {
-
+        ptype: {
+            type: String,
+            value: "浏览"
+        },
+        dataId: {
+            type: String,
+            value: ''
+        },
+        dataAuth: {
+            type: String,
+            value: '' //all 内部 经销商
+        }
+    },
+    data: {
+        actions: [{
+            name: '',
+            color: '#3874F6'
+        }],
+        actionShow: false,
+        active: "经销商"
+    },
+    lifetimes: {
+        ready() {
+            console.log("id", this.data.dataId)
+            let params = {
+                "classname": "saletool.notice.data", //默认通告
+                "method": "getSaleareaInfo", //默认经销商
+                "content": {
+                    sat_noticeid: this.data.dataId,
+                    "sat_coursewareid": this.data.dataId
+                }
+            };
+            if (this.data.ptype == '学习') params.classname = "saletool.courseware.data";
+            if (this.data.dataAuth != 'all') {
+                params.method = this.data.dataAuth == '内部' ? 'getInternalInfo' : 'getSaleareaInfo'
+                this.setData({
+                    active: this.data.dataAuth
+                })
+            }
+            this.setData({
+                params
+            })
+            this.getData();
+        },
     },
     options: {
         addGlobalClass: true
     },
 
-    /**
-     * 组件的初始数据
-     */
-    data: {
-
-    },
-
     /**
      * 组件的方法列表
      */
     methods: {
+        onChange(e) {
+            let {
+                name
+            } = e.detail;
+            this.setData({
+                active: name,
+                "params.method": name == '内部' ? 'getInternalInfo' : 'getSaleareaInfo'
+            });
+            this.getData();
+        },
+        getData() {
+            _Http.basic(this.data.params).then(res => {
+                console.log("学习数据", res)
+                this.setData({
+                    list: res.data,
+                    tips: res.tips
+                });
+            })
+        },
+        callOut(e) {
+            const {
+                item
+            } = e.currentTarget.dataset;
+            this.setData({
+                'actions[0].name': '呼叫 ' + item.phonenumber,
+                actionShow: true
+            })
 
+        },
+        handleCallOut(e) {
+            let phone = e.detail.name.split(' ')[1];
+            wx.makePhoneCall({
+                phoneNumber: phone,
+                success() {},
+                fail() {}
+            })
+        },
+        onClose() {
+            this.setData({
+                'actions[0].name': '',
+                actionShow: false
+            })
+        },
     }
 })

+ 1 - 27
pages/annunciate/modules/displayData.scss

@@ -5,7 +5,7 @@
     background: none !important;
 
     .box {
-        width: 336rpx;
+        width: 690rpx;
         height: 184rpx;
         background: #ffffff;
         border-radius: 16rpx;
@@ -143,30 +143,4 @@
         }
 
     }
-}
-
-.tab {
-    display: flex;
-    width: 100%;
-
-    &_item {
-        flex: 1;
-        height: 96rpx;
-        background-color: #F8F9FA;
-        border-radius: 16rpx 16rpx 0 0;
-        line-height: 96rpx;
-        text-align: center;
-        font-size: 28rpx;
-        font-family: PingFang SC-Regular, PingFang SC;
-        color: #666666;
-    }
-
-    .active {
-        position: relative;
-        background-color: #ffffff;
-        font-size: 28rpx;
-        font-family: PingFang SC-Bold, PingFang SC;
-        font-weight: bold;
-        color: #3874F6;
-    }
 }

+ 43 - 38
pages/annunciate/modules/displayData.wxml

@@ -2,57 +2,62 @@
 <My_card custom-class='head'>
     <view class="box">
         <view class="title">
-            <text class="iconfont icon-a-tonggaoshujuliulanliang" />浏览量
+            <text class="iconfont {{ptype=='学习'?'icon-a-shangxueyuanxuexi':'icon-a-tonggaoshujuliulanliang'}}" />{{ptype=='学习'?'学习情况':'浏览量'}}
         </view>
         <view class="data">
             <view class="subarea">
-                <view class="nubmer">15</view>
-                <view class="string">已浏览</view>
+                <view class="nubmer">{{tips.unstudy}}</view>
+                <view class="string">已{{ptype}}</view>
             </view>
             <view class="vertical" />
             <view class="subarea">
-                <view class="nubmer">30</view>
-                <view class="string">应浏览</view>
-            </view>
-        </view>
-    </view>
-    <view class="box">
-        <view class="title">
-            <text class="iconfont icon-a-tonggaoshujuxiazailiang" />下载量
-        </view>
-        <view class="data">
-            <view class="subarea">
-                <view class="nubmer">15</view>
-                <view class="string">已下载</view>
-            </view>
-            <view class="vertical" />
-            <view class="subarea">
-                <view class="nubmer">30</view>
-                <view class="string">应下载</view>
+                <view class="nubmer">{{tips.total}}</view>
+                <view class="string">应{{ptype}}</view>
             </view>
         </view>
     </view>
 </My_card>
 <My_card custom-class='data-main'>
-    <view class="tab">
-        <view class="tab_item active">未浏览人员</view>
-        <view class="tab_item">未下载人员</view>
-    </view>
+    <van-tabs wx:if="{{dataAuth=='all'}}" active="{{ active }}" color='#3874F6' title-active-color='#3874F6' bind:change="onChange">
+        <van-tab name='经销商' title="经销商分析" />
+        <van-tab name='内部' title="团队内部分析" />
+    </van-tabs>
     <view class="data-content">
-        <block wx:for="{{5}}">
-            <view class="title">
-                <view class="title_l">负责人:张三</view>
-                <view class="title_r">
-                    应浏览:3人 未浏览:2人
+        <block wx:if="{{active=='经销商'}}">
+            <block wx:for="{{list}}">
+                <view class="title">
+                    <view class="title_l">区域:{{item.areaname}}</view>
+                    <view class="title_r">
+                        未浏览:{{item.unstudy}}人
+                    </view>
                 </view>
-            </view>
-            <view class="user-list">
-                <view class="user" wx:for="{{5}}">
-                    <view class="line-1">江苏省苏州市姑苏区 张三丰</view>
-                    <text class="iconfont icon-shujubodadianhua1" />
+                <view class="user-list">
+                    <view class="user" wx:for="{{item.agent}}" wx:for-item="it" data-item="{{it}}" catchtap="callOut">
+                        <view class="line-1">{{it.province}}{{it.city}}{{it.county}} {{it.contact}}</view>
+                        <text class="iconfont icon-shujubodadianhua1" />
+                    </view>
                 </view>
-            </view>
-            <view class="line-between" />
+                <view class="line-between" />
+            </block>
         </block>
+        <block wx:else>
+            <block wx:for="{{list}}">
+                <view class="title">
+                    <view class="title_l">{{item.depname}}:{{ptype=='学习'?'未学习':'未浏览'}}{{item.unstudy}}人</view>
+                </view>
+                <view class="user-list">
+                    <view class="user" wx:for="{{item.user}}" wx:for-item="it" data-item="{{it}}" catchtap="callOut">
+                        <view class="line-1">{{it.name}}</view>
+                        <text class="iconfont icon-shujubodadianhua1" />
+                    </view>
+                </view>
+                <view class="line-between" />
+            </block>
+        </block>
+        <view wx:if="{{list.length==0}}" style="width: 100%; margin-left:-60rpx;padding-bottom: 150rpx;">
+            <My_empty />
+        </view>
     </view>
-</My_card>
+</My_card>
+
+<van-action-sheet show="{{ actionShow }}" actions="{{ actions }}" cancel-text="取消" bind:close="onClose" bind:cancel='onClose' bind:select='handleCallOut' />

+ 0 - 5
pages/annunciate/modules/list.wxml

@@ -7,11 +7,8 @@
             <van-tag custom-class='tag' plain color='#FA8C16'>{{item.classname}}</van-tag><text class="line-1">{{item.title}}</text>
         </view>
         <view class="explain line-1">{{item.summary}}</view>
-
-
         <view class="incidental">
             <view>{{item.createdate}}</view>
-
             <view class="incidental_r">
                 <view style="margin-right: 30rpx;">
                     <text class="iconfont icon-a-tonggaofujian" />
@@ -22,8 +19,6 @@
                     {{item.readcount}}
                 </view>
             </view>
-
-
         </view>
     </view>
 </view>