overview.vue
6.49 KB
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
<template>
<div class="overview-container" v-if="flag">
<div class="overview-wrap m-b-16">
<div class="title-info">客户招揽概况</div>
<div class="overview-content">
<template v-if="chart.pieData.length > 0">
<pieChart :color="chart.pieColor" id="overviewRef" :list="chart.pieData" :centerData="chart.centerData" :specialData="chart.specialData"></pieChart>
</template>
<template v-else>
<empty></empty>
</template>
</div>
</div>
<div class="overview-wrap m-b-16">
<div class="title-info">客户分群</div>
<div class="overview-group">
<template v-if="chart.barData.length > 0">
<barChart :color="chart.barColor" :tickCount="7" id="groupingRef" :list="chart.barData"></barChart>
</template>
<template v-else>
<empty></empty>
</template>
</div>
</div>
<div class="overview-wrap m-b-16">
<div class="title-info">工作简报</div>
<div class="bulletin flex">
<template v-for="(item, index) in bulletinList">
<div class="bulletin-single flex-top m-b-16" :key="index">
<div :class="['logo', 'sprite-icon', item.icon]"></div>
<div class="bulletin-info">
<div class="color-2f font-12">{{ item.todayText }}</div>
<div class="number color-3 font-24 fw7">{{ item.todayValue(overviewInfo) }}</div>
<div class="color-2f font-12 m-t-8">
{{ item.currentMonth }}
<span class="font-14 color-3 fw5">{{ item.currentValue(overviewInfo) }}</span>
</div>
</div>
</div>
</template>
</div>
</div>
</div>
</template>
<script>
import pieChart from '../solicit/components/pie.vue'
import barChart from '../solicit/components/bar.vue'
import { solicitApi } from '@/api'
import { mapState, mapActions } from 'vuex'
import { util } from '../../utils'
import { Notify } from 'vant'
export default {
components: {
pieChart,
barChart
},
data() {
return {
flag: true,
bulletinList: [],
activityId: '',
chart: {
pieColor: ['#3975C6', '#E6E7EB'],
pieData: [],
specialData:[],
centerData: {},
barData: [],
barColor: '#3975C6'
},
overviewInfo: {
followedUpCount: 0,
notFollowedUpCount: 0,
followedUpPercent: '',
customerGroupList: [],
workBriefingFollowUpTodayCount: 0,
workBriefingFollowUpMonthCount: 0,
workBriefingAddedTodayCount: 0,
workBriefingAddedMonthCount: 0,
workBriefingAppointmentTodayCount: 0,
workBriefingAppointmentMonthCount: 0,
workBriefingReturnFactoryTodayCount: 0,
workBriefingReturnFactoryMonthCount: 0
}
}
},
created() {
this.bulletinList = this.$constants.BULLETINLIST
let { taskId } = this.getQuery()
if (taskId) {
this.findActivityIdByUUID({
uuid: taskId,
success: res => {
this.activityId = res
this.getStaffId({
success: res => {
this.getTaskOverviewData()
}
})
},
fail: () => {
this.hideLoading()
this.reLogin()
}
})
} else {
this.activityId = window.localStorage.getItem('dj_scrm_activityId') ? JSON.parse(window.localStorage.getItem('dj_scrm_activityId')) : ''
this.getStaffId({
success: res => {
this.getTaskOverviewData()
}
})
}
},
computed: {
...mapState({
staffId: state => state.solicit.staffId
})
},
methods: {
...mapActions({
getStaffId: 'solicit/getStaffId',
findActivityIdByUUID: 'solicit/findActivityIdByUUID',
navigation: 'navigation'
}),
//重新登录
reLogin() {
/**登录过期 重新登录 */
util.clearSessionId()
this.navigation()
},
getTaskOverviewData() {
let params = {
activityId: this.activityId,
staffId: this.staffId
}
this.showLoading()
solicitApi.taskOverviewData(params).then(({ code, data, message }) => {
this.hideLoading()
if (code == '0') {
this.overviewInfo = data
this.$emit('getCountInfo', {
tabPageFollowUpCount: data.tabPageFollowUpCount,
tabPageResultCount: data.tabPageResultCount
})
this.initChartData()
} else {
Notify(message)
}
this.flag = true
})
},
initChartData() {
let { overviewInfo } = this
// legendData
if (overviewInfo.followedUpCount != 0 || overviewInfo.notFollowedUpCount != 0) {
this.chart.pieData = [
{
const: 'const',
text: ' 已跟进 (人)',
value: overviewInfo.followedUpCount
},
{
const: 'const',
text: '本月指标 (人)',
value: overviewInfo.notFollowedUpCount
}
]
this.chart.specialData = [
{
const: 'const',
text: ' 已跟进 (人)',
value: overviewInfo.followedUpCount
},
{
const: 'const',
text: '未跟进',
value: parseInt(overviewInfo.notFollowedUpCount-overviewInfo.followedUpCount)
}
]
this.chart.centerData = {
text: '达成率',
rate: overviewInfo.followedUpPercent ? parseInt(overviewInfo.followedUpPercent * 100) + '%' : 0
}
overviewInfo.customerGroupList.length > 0 &&
overviewInfo.customerGroupList.forEach(item => {
this.chart.barData.push({
text: item.groupName.slice(0, 10),
value: item.groupCount
})
})
}
}
}
}
</script>
<style lang="scss" scoped>
.overview-container {
.overview-wrap {
background: #fff;
box-shadow: 0px 3px 10px 0px rgba(223, 228, 234, 0.81);
border-radius: 4px;
.overview-content {
height: 160px;
box-sizing: border-box;
}
.overview-group {
box-sizing: border-box;
}
.bulletin {
height: 236px;
padding: 16px 0;
box-sizing: border-box;
flex-wrap: wrap;
&-single {
width: 50%;
height: 98px;
padding-left: 16px;
box-sizing: border-box;
.bulletin-info {
margin-left: 12px;
}
.number {
height: 36px;
line-height: 36px;
}
}
}
}
}
</style>