staff.js
1.99 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
// pages/tab/output/components/staff/staff.js
import { IMG_URL } from '~/utils/constantData'
import outputApi from '~/api/outputApi/index'
Component({
/**
* 组件的属性列表
*/
properties: {},
/**
* 组件的初始数据
*/
data: {
IMG_URL,
bgUrl: `${IMG_URL}/personal/empty_tran.png`,
formData: {
// 0:全部-1;2:精品升级SC002;1:会员权益/升级SC001
busiIdx: 0,
sceneCode: '-1',
yqMerchantName: '服务中心',
timeIdx: 0
},
},
lifetimes: {
attached() {
this.getStaff()
}
},
/**
* 组件的方法列表
*/
methods: {
// tab-业务经营切换
handleSearch(e) {
this.getStaff(true, true)
},
getStaff(isReset = false) {
let staffSortModule = this.selectComponent('#staffSort')
let staffSearchData = staffSortModule ? staffSortModule.dealParams() : {}
this.setData({
formData: JSON.parse(JSON.stringify(staffSortModule.data.formData))
})
let { userInfo } = wx.$storage.get()
let params = {
...staffSearchData,
partnerMerchantId: userInfo.subLoginUser.merchantId
// partnerMerchantId: 44209468
}
outputApi.getStaffList(params).then(res => {
if (isReset) {
this.setData({
busiScrollTop: 0
})
}
this.setData({
triggered: false
})
let _list = []
// 1-会员权益/升级;2-精品升级
let attrToNum = {
'': 'totalStat',
'1': 'vdStat',
'2': 'boutiqueStat',
'3': 'carTransformStat'
}
_list = res[attrToNum[staffSearchData.sceneType || '']] || []
if (staffSearchData.sceneType == '3') {
_list.forEach(item => {
item.list?.forEach(k => {
k.totalOutputValue = (k.totalOutputValue / 100).toFixed(2)
})
})
}
this.setData({
staffList: _list
})
})
},
}
})