crew.js
9.72 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
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
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
// pages/tab/crew/crew.js
import dayjs from 'dayjs'
import api from '~/api/crew/index'
import indexApi from '~/api/index/index'
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/supervisor-miniprogram/'
Page({
/**
* 页面的初始数据
*/
data: {
IMG_URL,
tabIndex: 0,
tabList: [{
text: '业绩',
value: 'performance'
}, {
text: '行为',
value: 'behavior'
}, {
text: '培训',
value: 'training'
}],
sceneTabIndex: 0,
sceneTabList: [{
text: '全部',
icon: 'all-icon',
value: ''
}, {
text: '延保',
icon: 'yanbao-icon',
value: '1'
}, {
text: '权益',
icon: 'quanyi-icon',
value: '2'
}, {
text: '轻改',
icon: 'qinggai-icon',
value: '3'
}],
staticList: [{
label: '驻店人员',
width: '208',
key: 'staffCount',
background: 'linear-gradient(90deg, #42CCCF 0%, #36D9A5 100%)'
}, {
label: '门店数量',
width: '192',
key: 'shopCount',
background: 'linear-gradient(90deg, #5E69FF 0%, #4079FF 100%)'
}, {
label: '总产值',
key: 'totalValue',
background: 'linear-gradient(90deg, #3D76FC 0%, #4DA6FF 100%)'
}],
AIContent: '',
staticData: {},
employeeList: [{
staffName: '邹家平',
staffPhone: '18971083546',
chengjiao: 3,
zhanbai: 8,
luyin: 15,
queshilv: 34.54,
xuexi: 3,
wancheng: 7,
daijiao: 15,
chanzhi: 43545600.45,
kedan: 45600.45,
zhuanhua: 34.54
}, {
staffName: '邹家平',
staffPhone: '18971083546',
chengjiao: 3,
zhanbai: 8,
luyin: 15,
queshilv: 34.54,
xuexi: 3,
wancheng: 7,
daijiao: 15,
chanzhi: 43545600.45,
kedan: 45600.45,
zhuanhua: 34.54
}, {
staffName: '邹家平',
staffPhone: '18971083546',
chengjiao: 3,
zhanbai: 8,
luyin: 15,
queshilv: 34.54,
xuexi: 3,
wancheng: 7,
daijiao: 15,
chanzhi: 43545600.45,
kedan: 45600.45,
zhuanhua: 34.54
}, {
staffName: '邹家平',
staffPhone: '18971083546',
chengjiao: 3,
zhanbai: 8,
luyin: 15,
queshilv: 34.54,
xuexi: 3,
wancheng: 7,
daijiao: 15,
chanzhi: 43545600.45,
kedan: 45600.45,
zhuanhua: 34.54
}]
},
onTabItemTap(e) {
// 点击埋点
// wx.$track.setTrackData(0, 'supervisor_crew_page', {}, '')
},
navbarReady(e) {
let navBarHeight = e.detail.height
this.setData({
navBarHeight
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getStaticsData()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
search() {
},
formatThousands (v) {
const s = String(v)
if (!s) return s
const isNeg = s[0] === '-'
const raw = isNeg ? s.slice(1) : s
const [intPart, decPart] = raw.split('.')
const intFmt = String(intPart || '0').replace(/\B(?=(\d{3})+(?!\d))/g, ',')
const res = decPart ? `${intFmt}.${decPart}` : intFmt
return isNeg ? `-${res}` : res
},
getStaticsData() {
// 假数据
let data = {
staffCount: 56,
shopCount: 12,
totalValue: 68954782.23
}
data.staffCount = this.formatThousands(data.staffCount)
data.shopCount = this.formatThousands(data.shopCount)
data.totalValue = this.formatThousands(data.totalValue)
this.setData({staticData: data})
// indexApi.getSupervisorStaticData({}).then(res => {
// let { code, data, message } = res
// if (code == 0) {
// this.setData({staticData: data})
// } else {
// wx.$util.showToast(message)
// }
// })
},
// 切换类型
changeTab(e) {
let { target } = e.currentTarget.dataset
let { tabList } = this.data
let eventCode = ['supervisor_performance_tab', 'supervisor_behavior_tab', 'supervisor_training_tab']
const index = tabList?.findIndex(val => val.value == target.value)
// wx.$track.setTrackData(0, eventCode[index], {}, '')
this.setData({
tabIndex: index,
mode: target.value,
sceneTabIndex: 0,
sortField: 1,
sortOrder: 1
}, () => {
const comp = this.selectComponent('#date')
if (comp) comp.initLoad('date')
})
},
// 切换业务
changeSceneTab(e) {
let { target } = e.currentTarget.dataset
let { sceneTabList } = this.data
const index = sceneTabList?.findIndex(val => val.value == target.value)
let eventCode = ['supervisor_warranty_tab', 'supervisor_benefits_tab', 'supervisor_lightMod_tab']
// wx.$track.setTrackData(0, eventCode[index], {}, '')
this.setData({
sceneTabIndex: index
}, () => {
const comp = this.selectComponent('#date')
if (comp) comp.initLoad('date')
})
},
// 排序变化
onEmployeeSortChange(e) {
const { rankfield, rankType } = e.detail
// wx.$track.setTrackData(0, `supervisor_${rankfield}_${rankType}`, {}, '')
this.setData({
sortField: rankfield,
sortOrder: rankType == 'desc' ? 1 : 0
})
this.getEmployeeRank()
},
search(e) {
this.setData({
startStr: e.detail.startDay?.replace(/\//g, '-'),
endStr: e.detail.endDay?.replace(/\//g, '-'),
timeDimension: e.detail.timeDimension + 1
})
this.getAIAnalyse()
this.getEmployeeRank()
},
getAIAnalyse() {
let { startStr, endStr, timeDimension, tabIndex } = this.data
// 假数据
let data = {
aiGenerateResult: '团队培训数据显示表面学习投入尚可,但知识体系构建严重不均,部分老顾问仅完成基础课程,在新产品与金融方案上存在明显知识断层,且带教记录空白,表明技能固化缺乏更新。与此同时,新人虽接受带教较多,但与其高战败率关联看,带教内容可能未精准击中其销售流程中的薄弱环节(如需求挖掘)。当前培训陷入“学用脱节”与“辅导泛化”的困境。建议立即进行针对性调整:第一,实施“短板课程强推计划”,根据上月战败主因(如竞品对比失利),强制相关顾问在3日内完成对应专题课程学习并通关测试;第二,改革带教模式,推行“数据驱动的精准带教”,督导需提前查阅带教对象的近期战败录音或低分项,带着具体问题(如“如何应对XX竞品的空间质疑”)进行陪访或演练,确保每次带教解决一个实际问题。通过“缺什么补什么”和“练什么考什么”,快速将培训转化为实战能力。团队培训数据显示表面学习投入尚可,但知识体系构建严重不均,部分老顾问仅完成基础课程,在新产品与金融方案上存在明显知识断层,且带教记录空白,表明技能固化缺乏更新。将“现状分析”与“建议”两部分自然融合为一段连贯文字,避免使用标题。整段文字需严格控制在500字以内,语言简洁、务实、指向明确。'
}
this.setData({
AIContent: data?.aiGenerateResult
})
// api.getAIAnslyseData({
// type: tabIndex + 1,
// timeDimension: timeDimension,
// startDate: startStr,
// endDate: endStr
// }).then(res => {
// let { code, data, message } = res
// if (code == 0) {
// this.setData({
// AIContent: data?.aiGenerateResult || ''
// })
// } else {
// wx.$util.showToast(message)
// }
// })
},
// 获取员工排名数据
getEmployeeRank() {
let { tabIndex, sceneTabIndex, startStr, endStr, sortField, sortOrder, timeDimension } = this.data
const event = ['getDashboardData', 'getDashboardBehavior', 'getTrainingStaffList']
let params = tabIndex == 2 ? {
businessType: sceneTabIndex > 0 ? sceneTabIndex : '',
startDate: startStr,
endDate: endStr,
sortField,
sortOrder
} : {
bizs: sceneTabIndex > 0 ? sceneTabIndex : '',
dateType: timeDimension,
startDate: startStr,
endDate: endStr
}
wx.$util.showLoading()
setTimeout(() => {
wx.$util.hideLoading()
// 假数据
let data
if (tabIndex == 0 || tabIndex == 1) {
data = {
employeeList: [{
employeePhone: 15626599738,
personalOutput: 43545600.53,
personalUnitPrice: 15623.23,
personalConversion: 56.23,
employeeName: '张三',
dealCount: 56,
defeatCount: 80,
recordingCount: 156,
missingRate: 59,
employeeId: 123
}, {
employeePhone: 15626599738,
personalOutput: 43545600.53,
personalUnitPrice: 15623.23,
personalConversion: 56.23,
employeeName: '张三',
dealCount: 56,
defeatCount: 80,
recordingCount: 156,
missingRate: 59,
employeeId: 123
}]
}
} else {
data = [{
employeeName: '张胜男',
phone: 15623568956,
studyHours: 15,
completedCourses: 5,
coachingTimes: 20
}, {
employeeName: '张胜男',
phone: 15623568956,
studyHours: 15,
completedCourses: 5,
coachingTimes: 20
}, {
employeeName: '张胜男',
phone: 15623568956,
studyHours: 15,
completedCourses: 5,
coachingTimes: 20
}, {
employeeName: '张胜男',
phone: 15623568956,
studyHours: 15,
completedCourses: 5,
coachingTimes: 20
}]
}
this.setData({employeeList: data.employeeList || data})
}, 300)
console.log(params)
api[event[tabIndex]](params).then(res => {
})
},
// 跳转员工个人看板
onEmployeeTap(e) {
const employee = e.detail.employee
// wx.$track.setTrackData(0, 'supervisor_staffDetail', {}, '')
wx.navigateTo({
url: `/packageCrew/pages/peopleOverview/peopleOverview?emloyeeId=${employee.employeeId}&scene=${this.data.sceneTabIndex}`,
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})