fix
Helius
2021-02-20 45fb4b11ad51bb38306765b11a6747402e382cee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
<template>
    <!-- 员工业绩报表 -->
    <view class="container">
        <h-tabs
            class="tab"
            :tabData="tabs" 
            @tabClick="tabChange"
            :config="{
                color: '#abb1cc',
                activeColor: '#518EFF',
                underLineColor: '#518EFF',
                underLineHeight: 6,
                fontSize: '28',
                underLineWidth: 60,
            }"
        />
        <view v-if="tabIndex==1 || tabIndex==2">
            <view class="list-item" v-for="item in list">
                <view class="list-header">
                    <text>{{item.time}}</text>
                </view>
                <view class="list-content">
                    <view class="list-row">
                        <text>订单业绩</text>
                        <text>¥{{item.orderAmount | formatNum}}</text>
                    </view>
                    <view class="list-row">
                        <text>现金业绩</text>
                        <text>¥{{item.cashAmount | formatNum}}</text>
                    </view>
                    <view class="list-row">
                        <text>划扣业绩</text>
                        <text>¥{{item.cardUseAmount | formatNum}}</text>
                    </view>
                    <view class="list-row">
                        <text>订单提成</text>
                        <text>¥{{item.goodsAmount | formatNum}}</text>
                    </view>
                    <view class="list-row">
                        <text>本金消耗</text>
                        <text>¥{{item.hisConsume | formatNum}}</text>
                    </view>
                    <view class="list-row">
                        <text>赠送消耗</text>
                        <text>¥{{item.freeConsume | formatNum}}</text>
                    </view>
                    <view class="list-row">
                        <text>服务提成</text>
                        <text>¥{{item.commission | formatNum}}</text>
                    </view>
                    <view class="list-row">
                        <text>人头数</text>
                        <text>{{item.peopleNum}}人</text>
                    </view>
                    <view class="list-row">
                        <text>项目数</text>
                        <text>{{item.projNum}}个</text>
                    </view>
                    <view class="list-row">
                        <text>服务时长</text>
                        <text>{{item.serviceTime}}分钟</text>
                    </view>
                </view>
            </view>
            <view v-if="list.length">
                <uni-load-more :status="loadStatus" color="#a5abaf"></uni-load-more>
            </view>
        </view>
        <view v-else>
            <view class="list-item">
                <view class="list-header">
                    <text class="font-bold">专项数据</text>
                </view>
                <view class="list-content-bordered">
                    <view class="list-row-bordered" @click="toAnalyse('订单业绩', 1)">
                        <text>订单业绩</text>
                        <text class="iconfont iconarrow-backimg"></text>
                    </view>
                    <view class="list-row-bordered" @click="toAnalyse('现金业绩', 2)">
                        <text>现金业绩</text>
                        <text class="iconfont iconarrow-backimg"></text>
                    </view>
                    <view class="list-row-bordered" @click="toAnalyse('划扣业绩', 5)">
                        <text>划扣业绩</text>
                        <text class="iconfont iconarrow-backimg"></text>
                    </view>
                    <view class="list-row-bordered" @click="toAnalyse('订单提成', 3)">
                        <text>订单提成</text>
                        <text class="iconfont iconarrow-backimg"></text>
                    </view>
                    <view class="list-row-bordered" @click="toAnalyse('本金消耗', 6)">
                        <text>本金消耗</text>
                        <text class="iconfont iconarrow-backimg"></text>
                    </view>
                    <view class="list-row-bordered" @click="toAnalyse('赠送消耗', 7)">
                        <text>赠送消耗</text>
                        <text class="iconfont iconarrow-backimg"></text>
                    </view>
                    <view class="list-row-bordered" @click="toAnalyse('服务提成', 8)">
                        <text>服务提成</text>
                        <text class="iconfont iconarrow-backimg"></text>
                    </view>
                    <view class="list-row-bordered" @click="toAnalyse('人头数', 9)">
                        <text>人头数</text>
                        <text class="iconfont iconarrow-backimg"></text>
                    </view>
                    <view class="list-row-bordered" @click="toAnalyse('项目数', 10)">
                        <text>项目数</text>
                        <text class="iconfont iconarrow-backimg"></text>
                    </view>
                    <view class="list-row-bordered" @click="toAnalyse('服务时长', 11)">
                        <text>服务时长</text>
                        <text class="iconfont iconarrow-backimg"></text>
                    </view>
                </view>
            </view>
        </view>
    </view>
</template>
 
<script>
    import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
    import HTabs from "@/components/liuyuno-tabs/liuyuno-tabs.vue";
    export default {
        components: {
            HTabs,
            uniLoadMore
        },
        data() {
          return {
            tabIndex: 1,
            tabs:[
                {
                    state: 1,
                    name: '每日'
                },
                {
                    state: 2,
                    name: '每月'
                },
                {
                    state: 3,
                    name: '专项'
                }
            ],
            list: [],
            staffId: '',
            loadStatus: 'more',
            pageNum: 1
          }  
        },
        onLoad(options) {
            this.initTitle();
            this.loadEmloyeeList();
            this.loadList()
        },
        onPullDownRefresh(){
            this.reloadData();
            let timer = setTimeout(function () {
                uni.stopPullDownRefresh();
                clearTimeout(timer);
                timer = null;
            }, 800);
        },
        onReachBottom(){
            this.loadList()
        },
        onNavigationBarButtonTap(e){
            if(e.index==0){
                uni.navigateTo({
                    url:"./hint?type=2"
                })
            }
            if(e.width && e.index==1){
                uni.navigateTo({
                    url: './selectEmployee?selectId='+this.staffId
                })
            }
        },
        methods:{
            reloadData(){
                this.list = [];
                this.pageNum = 1;
                this.loadStatus = 'more';
                this.loadList();
            },
            initTitle(){
                let roleInfo = this.$httpUtils.getRoleInfo();
                if(roleInfo){
                    this.staffId = roleInfo.id;
                    uni.setNavigationBarTitle({
                        title: roleInfo.name+'的业绩报表'
                    })
                }
            },
            tabChange(index){
                let val = index + 1;
                if(val == this.tabIndex){
                    return
                }
                this.tabIndex = val;
                if(val != 3){
                    this.reloadData()
                }
            },
            toAnalyse(title, type){
                uni.navigateTo({
                    url: './analyse/index?staffId='+this.staffId+'&title='+title+'&type='+type+'&page=2'
                })
            },
            loadEmloyeeList(){
                this.$httpUtils.request('/api/user/findAllUsers', {}, 'POST').then((res) => {
                    if(res.status == 200){
                        let result = res.rows;
                        if(!result.length){
                            // #ifdef APP-PLUS
                            let webView = this.$mp.page.$getAppWebview();
                            webView.setTitleNViewButtonStyle(1, {
                                width: 0,  
                            });
                            // #endif
                        }
                    }
                })
            },
            loadList(){
                if(this.loadStatus!=='more'){
                    return;
                }
                this.$httpUtils.request('/api/statistics/findVipAchieve', {
                    "pageNum": this.pageNum,
                    "pageSize": 10,
                    "staffId": this.staffId,
                    "type": this.tabIndex
                }, 'POST').then((res) => {
                    if(res.status == 200){
                        let result = res.rows;
                        if(result.length < 10){
                            this.loadStatus = 'noMore';
                        } else {
                            this.pageNum ++ ;
                            this.loadStatus = 'more';
                        }
                        this.list = this.list.concat(result);
                    }
                })
            },
            setData(selectItem){
                let item = selectItem[0];
                this.staffId = item.id;
                this.reloadData();
                setTimeout(() => {
                    uni.setNavigationBarTitle({
                        title: item.name+'的业绩报表'
                    });
                }, 500)
            }
        }
    }
</script>
 
<style>
    page{
        background: #F6F6F8;
        height: 100%;
    }
    .container{
        min-height: 100%;
    }
    .tab{
        background: #FFFFFF;
        border-bottom: #EDEAF4;
        border-bottom-left-radius: 4px;
        border-bottom-right-radius: 4px;
        box-shadow:0 6px 6px rgba(237,234,244,0.5);
    }
    .list-item{
        margin: 10px 10px 0;
        padding: 0 10px;
        background: #FFFFFF;
        border: 1px solid #EDEAF4;
        border-radius: 4px;
    }
    .list-header{
        border-bottom: 1px solid #EDEAF4;
        padding: 12px 5px;
        font-size: 14px;
    }
    .list-content{
        padding: 8px 5px;
        font-size: 13px;
        color: #333;
    }
    .list-row{
        display: flex;
        justify-content: space-between;
        line-height: 30px;
    }
    .list-row text:nth-last-of-type(1){
        color: #666
    }
    .list-content-bordered{
        padding: 0 5px;
        font-size: 13px;
    }
    .list-row-bordered{
        display: flex;
        justify-content: space-between;
        line-height: 40px;
        border-bottom: 1px solid #EDEAF4;
    }
    .list-row-bordered:nth-last-of-type(1){
        border-bottom: 0;
    }
    .list-row-bordered text:nth-last-of-type(1){
        color: #a5abaf
    }
    .drop-down{
        height: 200px;
        width: 60px;
        background: #FFFFFF;
        border: 1px solid #EDEAF4;
        border-radius: 4px;
        padding: 0 10px;
        position: fixed;
        right: 35px;
        top: 0;
        z-index: 99;
        color: #a5abaf;
        font-size: 12px;
    }
    .drop-down-row{
        border-bottom: 1px solid #EDEAF4;
        padding: 5px 0;
        text-align: center;
    }
    .drop-down-row:nth-last-child(1){
        border: 0;
    }
</style>