index.js
3.43 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
// packageCrowdFunding/pages/homePage/index/index.js
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
import api from '~/packageCrowdFunding/api'
import NP from 'number-precision'
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
IMG_URL,
staticDataList: [{
label: '今日营业额',
value: 'todayAmount',
tipsLabel: '今日成交量',
tipsValue: 'todayOrderCount'
}, {
label: '本月营业额',
value: 'monthAmount',
tipsLabel: '本月成交量',
tipsValue: 'monthOrderCount'
}, {
label: '累计营业额',
value: 'totalAmount',
tipsLabel: '累计成交量',
tipsValue: 'totalOrderCount'
}],
itemDataList: [{
label: '当日访客',
value: 'todayfansCount',
icon: 'icon_5'
}, {
label: '当日订单',
value: 'todayOrderCount',
icon: 'icon_4'
}, {
label: '当日产值',
value: 'todayAmount',
icon: 'icon_3'
}, {
label: '累计访客',
value: 'totalfansCount',
icon: 'icon_10'
}, {
label: '累计订单',
value: 'totalOrderCount',
icon: 'icon_9'
}, {
label: '累计产值',
value: 'totalAmount',
icon: 'icon_8'
}],
menuList: [{
menuText: '调查问卷',
icon: 'questionnaire',
path: ''
}, {
menuText: '营销素材',
icon: 'marketing_materials',
path: ''
}, {
menuText: '业务申请',
icon: 'business_application',
path: ''
}, {
menuText: '活动管理',
icon: 'event_management',
path: '',
isTab: true,
tabIndex: 1
},
// {
// menuText: '话术库',
// icon: 'script _library',
// path: ''
// }
],
loginRoleLabel: {
1: '超管',
2: '商户管理员',
3: '区域运营',
4: '驻店负责人',
5: '广联销售',
},
loginRole: '',
userInfo: {},
staticData: {}
},
lifetimes: {
attached() {
let userInfo = wx.$util.getUserInfo()
const loginRole = userInfo.subLoginUser?.loginRole
this.setData({
loginRole,
userInfo
})
this.getData()
}
},
/**
* 组件的方法列表
*/
methods: {
onLoad() {
this.getData()
},
getData() {
const userInfo = wx.$util.getUserInfo()
api.getStaticData({ merchantId: userInfo?.default4SStoreInfo_crowdFunding?.merchantId }).then(res => {
let { code, data, message } = res
if (code == 0) {
// 分转元
if (data?.todayAmount) data.todayAmount = NP.divide(data?.todayAmount, 100)
if (data?.monthAmount) data.monthAmount = NP.divide(data?.monthAmount, 100)
if (data?.totalAmount) data.totalAmount = NP.divide(data?.totalAmount, 100)
if (data?.totalAmount) data.totalAmount = NP.round(data?.totalAmount, 0)
this.setData({
staticData: data || {}
})
} else {
wx.$util.showToast(message)
}
})
},
navGo(e) {
console.log(e)
const thisPage = wx.$router.getPageInstance()
let { item } = e.currentTarget.dataset
if (item.isTab) return thisPage.changeTabBar && thisPage.changeTabBar({ detail: item?.tabIndex })
if (!item.path) wx.$util.showToast('模块暂未开通\r\n敬请期待')
},
}
})