workspace.js
5.01 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
// pages/tab/workspace/workspace.js
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/regional-assistant/'
import {
getWaitAuditCountAPI,
waitstaffstateAPI
} from '~/api/api'
Page({
/**
* 页面的初始数据
*/
data: {
IMG_URL,
navBarHeight: 0,
showBanner: true,
approvalMenus: [{
name: '退款审批',
icon: 'refund-review',
url: 'packageWorkspace.refundOperationList',
trackingCode: 'regional-assistant-refund-approval'
}],
storeManagementMenus: [{
name: "驻店管理",
url: "packageWorkspace.residentManage",
icon: "resident-manage",
trackingCode: 'regional-assistant-resident-manage'
}, {
name: "轻改区域日报",
url: "packageWorkspace.supervisorDaily",
icon: "modifications-supervisor-daily",
params: {
templateCode: 'qinggai-temp-001'
},
trackingCode: 'regional-modifications-supervisor-daily'
}, {
name: "延保区域日报",
url: "packageWorkspace.supervisorDaily",
icon: "warranty-supervisor-daily",
trackingCode: 'regional-warranty-supervisor-daily'
}],
staffDevelopmentMenus: [{
name: "招聘管理",
url: "packageWorkspace.recruitManage",
icon: "recruit-manage",
tipsNum: 0,
trackingCode: 'regional-assistant-recruit-manage'
}, {
name: "人才分析",
url: "packageWorkspace.talentAnalysis",
icon: "talent-analysis",
trackingCode: 'regional-assistant-talent-analysis'
}]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
navbarReady(e) {
let navBarHeight = e.detail.height;
this.setData({
navBarHeight,
});
},
closeBannaer() {
this.setData({
showBanner: false
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
let userInfo = wx.$util.getUserInfo()
let { approvalMenus, storeManagementMenus } = this.data
if (userInfo.sceneType == 0) {
if (storeManagementMenus.every(item => item.name != '接待记录')) {
storeManagementMenus.push({
name: "接待记录",
icon: "reception-record",
url: "packageWorkspace.receptionRecords",
trackingCode: 'regional-assistant-reception-records'
})
}
// if (storeManagementMenus.every(item => item.name != '违规录音处理')) {
// storeManagementMenus.push({
// name: "违规录音处理",
// icon: "reception-records",
// url: 'packageWorkspace.receptionRecords',
// query: true,
// trackingCode: 'regional-assistant-improper-record'
// })
// }
}
this.setData({
approvalMenus,
storeManagementMenus
}, () => {
// 获取退款待审批数量
this.getWaitAuditCount(userInfo)
// 获取招聘管理待处理数量
this.getWaitStaff()
})
},
getWaitAuditCount(userInfo) {
let { approvalMenus } = this.data
let index = approvalMenus.findIndex(e => e.name == '退款审批')
getWaitAuditCountAPI({
sceneType: userInfo?.sceneType
}).then(res => {
let {
code,
data
} = res
if (code == 0) {
this.setData({
[`approvalMenus[${index}].tipsNum`]: data.waiteForAuditNum > 99 ? '99+' : data.waiteForAuditNum
})
}
})
},
getWaitStaff() {
let { staffDevelopmentMenus } = this.data
let index = staffDevelopmentMenus.findIndex(e => e.name == '招聘管理')
waitstaffstateAPI()
.then(result => {
let {
code,
data
} = result
if (code == 0) {
console.log("调统计招聘",data);
this.setData({
[`staffDevelopmentMenus[${index}].tipsNum`]: data.waitProcessCount
})
}
})
.catch(err => { })
},
jump(e) {
// 创建节流函数,1500ms 内只能触发一次
if (!this.throttledJump) {
this.throttledJump = wx.$util.throttle((event) => this.jumpTo(event), 1500);
}
this.throttledJump(e); // 调用节流后的函数
},
jumpTo(e) {
let { url, query, trackingCode, params } = e.currentTarget.dataset.target
let userInfo = wx.$util.getUserInfo()
// 埋点
wx.$track.setTrackData(0, trackingCode, {}, '', userInfo?.sceneType)
if (url == 'packageWorkspace.receptionRecords' && query) {
return wx.navigateTo({
url: '/packageWorkspace/pages/receptionRecords/receptionRecords?hideScore=1',
})
}
wx.$router.go(url, {
params: params || {},
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})