index.js
27.1 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
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
// tabIndex/pages/index/index.js
import mixins from './index_mixins'
import api from '../../api.js'
import NP from 'number-precision'
import {
getYQInfo,
get4SStoreList,
getBusinessSchoolScene
} from '~/store/index'
import { env } from '~/config'
import { checkDailyReport } from '~/store/ModalToQueueControl'
const IMG_URL =
'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
const app = getApp()
let time = null
let modalQueue = []
import commonApi from '~/api/api'
Page({
/**
* 页面的初始数据
*/
data: {
IMG_URL,
...mixins.data,
navStyle: 'background-color: rgba(0,0,0,0);box-shadow:none;',
navBarHeight: 0,
delayShow: false,
showRemark: false,
isStaff: false,
showOrderpop: false,
shopSideSelectPopup: false,
flag: true,
dateObj: {
beginDateStr: ''
},
showPicker: false,
// showPicker: true
storeRange: [],
changeSelectIndex: 0, // 个人产值过滤筛选
taskInfo: {},
background: ['demo-text-1', 'demo-text-2', 'demo-text-3'],
todoList: [],
stodoList: [],
selectType: 1,
isPad: false
},
checkStaffOrderStatus() {
// 开单预警弹框
return new Promise(resolve => {
let dateStaffPop = wx.$storage.get('dateStaffPop')
let userInfo = wx.$util.getUserInfo()
let nowDate = new Date().format('yyyy-MM-dd')
let { sceneType, shopMerchantId: merchantId } = userInfo
let dayBoolean = dateStaffPop?.date && nowDate == dateStaffPop?.date
let flag = dateStaffPop?.[sceneType]?.[merchantId]
// console.log(
// flag,
// "flag",
// dateStaffPop?.[sceneType],
// dateStaffPop?.[sceneType]?.[merchantId]
// );
if (dayBoolean && flag) {
resolve()
return
}
api
.orderStaffValid({
sceneType: userInfo.sceneType
})
.then(result => {
console.log(result)
if (result.data) {
if (
wx.__HAS_NOTLOGIN_MODAL ||
userInfo?.isSuper ||
userInfo?.loginRole == 3 ||
userInfo.loginRole == 5
)
return false
this.addModalToQueue(
'开单预警',
'您已超过三天未开单',
'确定',
false,
1,
() => { }
)
}
wx.$storage.set('dateStaffPop', {
date: new Date().format('yyyy-MM-dd'),
1: {
[userInfo.shopMerchantId]: true,
...dateStaffPop[1]
}
})
resolve()
})
.catch(err => {
resolve()
})
})
},
changeSwiper(e) {
this.setData({
changeSelectIndex: e.detail.current
})
},
tipsEvent() {
this.setData({
showOrderpop: true
})
},
closeSwitchPopup() {
this.setData({
showOrderpop: false
})
},
async navigator(e) {
// 校验是否填写昨日日报
let staffCheck = await checkDailyReport()
if (staffCheck) return false
let { outTradeNo } = e.detail
this.closeSwitchPopup()
wx.$storage.set('outTradeNo', outTradeNo)
outTradeNo &&
// wx.$router.go("tabWorkOrder.additionRecordOrder", {
wx.$router.go('tabWorkOrder.createOrder', {
...e.detail,
orderCreateType: 'additionRecordOrder'
})
},
navbarReady(e) {
let navBarHeight = e.detail.height
this.setData({
navBarHeight
})
},
back() {
wx.$router.go('pages.sceneIndex')
console.log('🚀')
},
showMenuPopup() {
this.setData({
shopSideSelectPopup: true
})
},
tapPicker() {
this.setData({
moveArrow: !this.data.moveArrow
})
},
// 获取4s店数据
get4SStoreList() {
let userInfo = wx.$util.getUserInfo()
const loginRole = userInfo.subLoginUser?.loginRole
// if (userInfo?.isSuper) return;
let params = {
merchantId:
userInfo?.isSuper || loginRole == 3 || loginRole == 5
? ''
: userInfo?.merchantId,
staffUUID:
userInfo?.isSuper || loginRole == 3 || loginRole == 5
? ''
: userInfo?.uuid,
scene: 1
}
get4SStoreList(
params,
userInfo?.isSuper || userInfo?.loginRole == 3 || userInfo.loginRole == 5
).then(result => {
if (!userInfo?.isSuper) {
if (!result?.length) {
// 缓存记录登录信息 但关联未4s
userInfo.shopMerchantId = null
userInfo.shopMerchantName = null
userInfo.sceneType = null
wx.$util.setUserInfo(userInfo)
return wx.$router.reLaunch('pages.accountItems')
}
}
if (userInfo?.isSuper || loginRole == 3 || loginRole == 5) {
// 超管或区域督导
if (result[0]?.merchantName !== '全部' && result[0]?.merchantId) {
result.unshift({
merchantName: '全部'
})
}
}
this.setData({
storeRange: result || []
})
})
},
// 超管获取园区店数据
getStoreList(e) {
let { value } = e.detail
getYQInfo(this.data.userInfo)
.then(result => {
let { merchantRange } = result
if (value) {
merchantRange = merchantRange.filter(item =>
item.merchantName.includes(value)
)
}
this.setData({
merchantRange
})
})
.catch(err => { })
},
changePicker(e, value) {
let { merchantId } = e
// 修改对应下标显示
app.globalData.yqdInfo.subIndex = value
let obj = {}
if (merchantId) obj.merchantId = merchantId
api.swtichSubLoginInfo(obj).then(res => {
console.log(res)
let { code, data, message } = res
if (code == 0) {
let userInfo = wx.$util.getUserInfo()
userInfo.subLoginUser = data.subLoginUser
wx.$util.setUserInfo(userInfo)
this.initData(data)
} else {
this.showToast(message)
}
})
this.tapPicker()
},
navTabPage(e) {
let { item, type } = e.currentTarget.dataset
if ('activeIndex' in item) {
wx.$util.refreshPageData()
item.url = type ? item.waiturl : item.url
item.activeIndex = type ? item.activeWIndex : item.activeIndex
item.url &&
wx.$router.go(item.url, {
activeIndex: item.activeIndex
})
} else {
item.url && wx.$router.go(item.url)
}
},
jumpDebounce(e) {
console.log('jumpDebounce');
// debugger
// wx.$util.debounce(this.jump(e), 5000)
const debouncedJump = wx.$util.debounce((event) => this.jump(event), 1000, true);
debouncedJump(e); // 调用防抖后的函数
},
async jump(e) {
console.log('jump');
let { item, type } = e.currentTarget.dataset
let { userInfo, taskId } = this.data
// 工资绩效
if (item.name == '工资绩效') {
return wx.$router.go('packageEquity.collegeScene', {
reLaunchPath: 'packageEquity.equityPage',
tabIndex: 0
})
}
if (item.name == '驻店目标') {
return wx.$router.go(item.url, {
id: taskId
})
}
if (item.name == '营销素材') {
return wx.switchTab({
url: item.url
})
}
if (item.name == '生意助手') {
wx.navigateToMiniProgram({
appId: 'wx2c28337db96364d2',
path: `pages/tab/index/index`,
envVersion: 'trial',
success(res) {
// 打开成功
}
})
}
// 判断是不是门店员工
if (userInfo?.merchantType && !userInfo.isSuper && type == 2) {
wx.$util.pointRecord(item.recordId)
if (item.type == 'scanCode') {
let that = this
// 校验是否填写昨日日报
let staffCheck = await checkDailyReport()
if (staffCheck) return false
wx.scanCode({
success(res) {
let { result } = res
console.log(result, 'result')
that.showSelectType({ scene: result })
// wx.$router.go("tabWorkOrder.createOrder", {
// scene: result,
// });
}
})
} else if (item.type == 'mini') {
wx.navigateToMiniProgram({
appId: 'wx2c28337db96364d2',
path: `pages/tab/index/index`,
envVersion: 'trial',
success(res) {
// 打开成功
}
})
} else {
console.log(item)
// 客户线索和培训资料无需校验
if (!item.noCheckdailyReport) {
// 校验是否填写昨日日报
let staffCheck = await checkDailyReport()
console.log(staffCheck, 'staffCheck')
if (staffCheck) return false
}
console.log(item.url, 'item.url')
wx.$router.go(item.url)
}
} else {
if (
![
'tabWorkOrder.createOrder',
'tabWorkOrder.createArchives',
'tabWorkOrder.defeatOrder'
].includes(item.url)
) {
wx.$util.pointRecord(item.recordId)
return wx.$router.go(item.url, {
scene: 1
})
} else {
wx.$util.showNoAccess()
}
}
},
// 确定是否要显示
showSelectType({ scene = '', item = {} }) {
wx.$modal(
this,
{
show: true,
title: '请选择录单入口',
tabTitleShow: false,
success: res => {
// 跳转新增订单页面 并带特定参数
let { selectType } = this.data
if (selectType == 1) {
wx.$router.go('tabWorkOrder.createOrder', {
scene,
...item
})
} else {
wx.$router.go('tabWorkOrder.defeatOrder', {
scene,
...item
})
}
},
error: () => { }
},
'#modal2'
)
},
selectType(e) {
let { type } = e.currentTarget.dataset
console.log(e, e.currentTarget.dataset, type)
this.setData({
selectType: type
})
},
// 10s轮询一次待补录
checkShowOrderPop(options) {
let userInfo = wx.$util.getStorageSync('dj_boutique_user_info')
if (userInfo?.subLoginUser?.merchantId == options.merchantId) {
if (options.merchantId) {
this.setData({
showOrderpop: true
})
}
}
},
getUserStat(userInfo) {
api
.userStat({
// merchantId: userInfo?.isSuper ? undefined : userInfo?.shopMerchantId,
merchantId: userInfo?.shopMerchantId || undefined
})
.then(result => {
let { code, data } = result
if (code == 0) {
this.data.changeBtnData.forEach(changeData => {
if (data[changeData.valueObj].totalOrderMoney > 10000000) {
data[changeData.valueObj].totalOrderMoney = parseInt(
data[changeData.valueObj].totalOrderMoney
)
}
if (data[changeData.valueFn].totalOrderMoney > 10000000) {
data[changeData.valueFn].totalOrderMoney = parseInt(
data[changeData.valueFn].totalOrderMoney
)
}
})
this.setData({
userStat: data
})
}
})
.catch(err => { })
},
totalListSet() {
let { userInfo } = this.data
if (
userInfo.subLoginUser?.loginRole == 3 ||
userInfo.subLoginUser?.loginRole == 5 ||
userInfo.isSuper
) {
this.setData({
totalList: [
{
name: '转化订单',
itemName: 'totalUpgrade',
index: 4,
icon: 'icon_17'
},
{
name: '战败订单',
itemName: 'totalNotUpgrade',
index: 5,
icon: 'icon_16'
},
{
name: '客单价',
itemName: 'customerUnitPrice',
unit: '¥',
index: 6,
icon: 'icon_7'
}
]
})
}
},
initTime() {
let data = new Date()
// 选择 本月
const year = data.getFullYear()
const month = data.getMonth()
const dataMonth = new Date(year, month + 1, 0).format('yyyy-MM')
this.setData({
dateObj: {
dataMonth,
pointUnit: 1, // 1日,2月,默认日
type: 'month',
label: month + 1 + '月份'
}
})
},
initData(userInfo) {
console.log('切换门店')
userInfo = userInfo ? userInfo : wx.$util.getUserInfo()
getYQInfo(userInfo).then(result => {
wx.$util.hideLoading()
this.totalListSet()
this.initTime()
this.getUserStat(userInfo)
this.setData({
...result
})
})
// 切换门店 获取驻店员工目标
if (app.globalData.isStaff) this.getStaffTargetTask()
// 产品需求:强制填写(04-17版本)
this.checkDailyRecport()
},
checkShowOrderPop(options) {
let userInfo = wx.$util.getStorageSync('dj_boutique_user_info')
if (userInfo?.subLoginUser?.merchantId == options.merchantId) {
if (options.merchantId) {
this.setData({
showOrderpop: true
})
}
}
},
async checkDailyRecport() {
// let { tabIndex } = this.data
let userInfo = wx.$util.getUserInfo()
const isStaff = app.globalData.isStaff
let eventRequest = [this.checkStaffOrderStatus()]
if (!userInfo?.isSuper && userInfo?.loginRole != 3)
eventRequest.push(this.checkAgreeClient(wx.$util.getUserInfo()))
// 如果是员工 判读是否要填写日报
// isStaff && eventRequest.push(this.staffDailyReport(wx.$util.getUserInfo()));
return new Promise(resolve => {
Promise.all(eventRequest).then(() => {
this.showNextModal()
})
})
},
// 检测一下是否能微信端小程序登录
checkAgreeClient(loginUserObj) {
return new Promise((resolve, reject) => {
let sysInfo = wx.getSystemInfoSync()
// let { environment } = sysInfo
// 1企业微信 0微信
let envName = sysInfo.environment ? 1 : 0
let { merchantId: yqMerchantId } = loginUserObj
commonApi
.getYqStoreConfig({
yqMerchantId
})
.then(res => {
let { code, data } = res
if (code == '0') {
// const loginControlList = []
// const loginControlList = [0, 1]
let loginControlList = data?.loginControlList || []
if (
loginControlList.includes(envName) ||
!loginControlList.length
) {
resolve(true)
} else {
wx.hideLoading()
this.addModalToQueue(
'温馨提示',
`请在${envName == 0 ? '企业微信' : '微信'}中打开`,
'知道了',
false,
3,
res => {
if (res.confirm) {
wx.$router.go('pages.accountItems')
}
}
)
resolve(false)
}
}
})
})
},
addModalToQueue(
title,
content,
confirmText,
showCancel,
priority,
eventCallback
) {
if (modalQueue.findIndex(val => val.content == content) < 0)
modalQueue.push({
title,
content,
confirmText,
showCancel,
priority,
eventCallback
})
modalQueue.sort((a, b) => a.priority - b.priority)
},
showNextModal() {
let _this = this
if (modalQueue.length > 0) {
const modalInfo = modalQueue.pop()
if (wx.__HAS_SHOW_MODAL) return
wx.__HAS_SHOW_MODAL = true
wx.showModal({
title: modalInfo.title,
content: modalInfo.content,
showCancel: modalInfo.showCancel,
cancelColor: '#292D33',
confirmText: modalInfo.confirmText,
confirmColor: '#347BFF',
success: function (res) {
wx.__HAS_SHOW_MODAL = false
if (res.cancel) _this.showNextModal()
modalInfo.eventCallback(res)
}
})
}
},
/**获取园区配置 */
async getYqStoreConfig() {
const { merchantId: yqMerchantId } = wx.$util.getUserInfo(),
{ menu } = this.data,
{ data } = await commonApi.getYqStoreConfig({
yqMerchantId
})
//是否配置园区店面档案互通 Y / N
// if (data) {
// const culeIndex = menu.findIndex(e => e.name == '客户线索')
// if (data.customerExchangeFlag == 'Y') {
// if (culeIndex == -1)
// menu.push({
// name: '客户线索',
// url: 'packageEquity.clueList',
// recordId: 11,
// icon: 'customer_clue',
// tipsNum: 0,
// noCheckdailyReport: true
// })
// this.getCustomerClueRemind()
// }
// if (data.customerExchangeFlag == 'N' && culeIndex != -1)
// menu.splice(culeIndex, 1)
// }
this.setData({
menu
})
},
/**客户线索新增客户提醒 */
// async getCustomerClueRemind() {
// const { sceneType, shopMerchantId: merchantId } = wx.$util.getUserInfo(),
// { menu } = this.data,
// { data, code } = await commonApi.getCustomerClueRemind({
// sceneType,
// merchantId: [merchantId]
// })
// if (code == 0) {
// const index = menu.findIndex(e => e.name == '客户线索')
// this.setData({
// [`menu[${index}].tipsNum`]: data
// })
// }
// },
checkIsPadOrNot() {
wx.getRendererUserAgent({
success(res) {
let isPad = /iPad|Android.*Tablet|Kindle|Silk/i.test(res.userAgent)
_this.setData({
isPad
})
}
})
},
getStaffTargetTask() {
let userInfo = wx.$util.getUserInfo()
let { menu } = this.data
if (
userInfo?.isSuper ||
userInfo?.loginRole == 3 ||
userInfo.loginRole == 5
)
return
userInfo?.default4SStoreInfo?.merchantId &&
commonApi
.getStaffTargetTaskApi({
sceneType: 1,
merchantId: userInfo?.default4SStoreInfo?.merchantId
})
.then(res => {
let { code, data, message } = res
if (code == 0) {
// 切换门店 需删除入口 重新请求判断显示入口
let index = menu.findIndex(v => v.name == '驻店目标')
if (index > -1) menu.splice(index, 1)
if (data?.length && menu.every(item => item.name != '驻店目标')) {
menu.push({
name: '驻店目标',
url: 'packageEquity.residentTarget',
icon: 'resident_target',
noRead: data[0]?.readFlag == 'N'
})
}
this.setData({
taskId: data[0]?.id,
menu
})
// 当前周期未弹起过查看任务明细提示弹窗
if (data[0]?.promptFlag == 'N') {
this.setData({
showTaskDialog: true,
taskInfo: data[0]
})
// 将当前周期的员工目标任务弹窗标记为已弹起
commonApi
.setTaskDialog({
id: data[0]?.id
})
.then(() => { })
}
} else {
wx.$util.showToast(message)
}
})
},
getIsBusinessSchoolEnableCurrentUser() {
let { menu } = this.data
let userInfo = wx.$util.getUserInfo()
if (userInfo?.isSuper && menu.every(item => item.name != '工资绩效')) {
menu.push({
name: '工资绩效',
icon: 'businessschoo',
path: ''
})
this.setData({
menu
})
console.log(
menu,
userInfo?.isSuper && menu.every(item => item.name != '工资绩效'),
'userInfo?.isSuper'
)
} else {
getBusinessSchoolScene({}).then(res => {
if (res && menu.every(item => item.name != '工资绩效')) {
menu.push({
name: '工资绩效',
icon: 'businessschoo',
path: ''
})
this.setData({
menu
})
}
})
}
},
customerOnReady() {
let checklist = []
switch (env) {
case 'develop':
checklist = []
break
case 'trial':
checklist = ['15398879285']
break
case 'release':
checklist = ['18123663366', '19557403672']
break
default:
checklist = ['18123663366', '19557403672']
break
}
// 判断是不是特殊账号
let { menu, newMenu } = this.data
let userInfo = wx.$util.getUserInfo()
const isNoStaff = userInfo?.loginRole != 4 && userInfo?.loginRole != null
// 不是员工类型
// if (isNoStaff) {
// menu = [
// {
// name: '预约管理',
// url: 'pages.tabDateIndex',
// recordId: 8,
// icon: 'booking_management'
// }
// ]
// }
//超管、督导驻店日报、BI报表、生意助手
if (userInfo?.loginRole === 3 || userInfo?.loginRole === 5 || userInfo?.isSuper) {
menu = []
}
if (
(app.globalData.isStaff ||
userInfo?.isSuper ||
userInfo?.loginRole === 3 || userInfo?.loginRole === 5) &&
menu.every(item => item.name != '驻店日报')
) {
menu.push({
name: '驻店日报',
url: 'tabWorkOrder.upgradeStaffDaily',
recordId: 13,
icon: 'staffreport',
noCheckdailyReport: true
})
}
// if (
// (userInfo?.isSuper || userInfo?.loginRole === 3 || userInfo?.loginRole === 5) &&
// menu.every(item => item.name != 'BI报表')
// ) {
// menu.push({
// name: 'BI报表',
// url: 'tabOperating.index',
// recordId: 11,
// icon: 'business_data'
// })
// }
//区域督导和超管角色
// if (
// (userInfo?.isSuper || userInfo?.loginRole === 3 || userInfo?.loginRole === 5) &&
// menu.every(item => item.name != '生意助手')
// ) {
// menu.push({
// name: '生意助手',
// type: 'mini',
// recordId: 12,
// icon: 'boutique-syzs'
// })
// }
// if ((userInfo?.loginRole == 3 || userInfo.loginRole == 5) && menu.every((item) => item.name != '积分审批')) {
// menu.push({
// name: '积分审批',
// url: 'pages.pointsReview',
// icon: 'points_review'
// })
// }
// 督导和销售
// if ((userInfo?.loginRole == 3 || userInfo?.loginRole == 5) && menu.every((item) => item.name != '工作日报')) {
// menu.push({
// name: "工作日报",
// url: "tabWorkOrder.supervisorDaily",
// icon: "supervisorDaily",
// })
// }
// if (checklist.includes(userInfo?.accountName)) {
// menu = menu.filter(e => e.name != '预约管理')
// }
// 新加培训资料
// if (newMenu.every(item => item.name != '培训资料')) {
// newMenu.push({
// name: '培训资料',
// url: 'packageEquity.trainingMaterials',
// recordId: 14,
// icon: 'peixun_icon',
// noCheckdailyReport: true
// })
// }
// if (userInfo?.isSuper && menu.every(item => item.name != '工资绩效')) {
// newMenu.push({
// name: '工资绩效',
// icon: 'businessschoo',
// path: ''
// })
// }
// if (
// (userInfo?.isSuper ||
// userInfo?.loginRole == 3 ||
// userInfo.loginRole == 5) &&
// menu.every((item) => item.name != "驻店管理")
// ) {
// menu.push({
// name: "驻店管理",
// url: "tabWorkOrder.residentManage",
// recordId: 13,
// icon: "residentManage",
// noCheckdailyReport: true,
// });
// }
this.setData({
menu,
isNoStaff,
newMenu
})
this.getIsBusinessSchoolEnableCurrentUser()
},
onRoute(options) {
options && this.checkShowOrderPop(options)
wx.__HAS_SHOW_MODAL = false
// options && options.resetStoreList && this.get4SStoreList()
// 跳转工单/预约详情
// listStatus 0 待跟进 1已升级 2战败 3待支付
if (options?.isGoPage) {
// status 1待跟进(有inviteRecordId跳转预约详情无跳转待跟进工单页面 微信支付跳转工单确认页面)3待支付(跳转工单确认页面)constructionFlag(已施工页面)
let pageName =
options?.status == 1 && options?.pageParams?.id
? 'tabDate.detail'
: options.status == 3 ||
(options.status == 1 && options.selectPayType == 1)
? 'tabWorkOrder.confirmOrder'
: options.constructionFlag == 'Y' && options.status != 10
? 'tabWorkOrder.constructionOrderDetail'
: 'tabWorkOrder.orderDetail'
wx.$router.go(
`${pageName}?id=${options?.pageParams?.id}&orderCode=${options?.pageParams?.orderCode}`,
{
...options?.pageParams
}
)
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
options && this.checkShowOrderPop(options)
let today = new Date()
let startDate = today.format('yyyy-MM-dd')
let endDate = today.format('yyyy-MM-dd')
let userInfo = wx.$util.getUserInfo()
this.setData(
{
maxDate: new Date().format('yyyy-MM-dd'),
startDate,
endDate,
isStaff: app.globalData.isStaff,
isWait: !(
userInfo?.isSuper ||
userInfo?.loginRole == 3 ||
userInfo.loginRole == 5
)
}
)
this.checkIsPadOrNot()
if (!userInfo?.isSuper && userInfo?.loginRole != 3) this.get4SStoreList()
// 获取驻店员工目标
if (app.globalData.isStaff) this.getStaffTargetTask()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
this.customerOnReady()
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function (options) {
let userInfo = wx.$util.getUserInfo()
this.customerOnReady()
setTimeout(() => {
this.setData({
delayShow: true
})
}, 1000)
this.setData(
{
isStaff: app.globalData.isStaff,
isWait: !(
userInfo?.isSuper ||
userInfo?.loginRole == 3 ||
userInfo.loginRole == 5
)
},
() => {
if (this.data.isWait) {
this.getYqStoreConfig()
}
}
)
console.log(this.data.isWait, 'isWait')
if (userInfo) {
if (userInfo.merchantAccountList && userInfo.merchantAccountList.length) {
try {
userInfo.merchantAccountList.map(e => {
if (e == 6 || e == 8) throw true
})
} catch (error) {
userInfo.merchantType = error
}
}
}
if (userInfo) {
this.initData(userInfo)
this.setData({
userInfo
})
} else {
getApp().login(true)
}
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
time && clearTimeout(time)
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
time && clearTimeout(time)
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () { },
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () { },
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () { }
})