index.vue
4.76 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
<template>
<div class="layout-wrap">
<div class="head-bg"></div>
<time-search ref="timeSearch" class="timeSearch"></time-search>
<div class="content">
<statistics></statistics>
<ranking ref="ranking"></ranking>
<!-- 门店周报客户和产值单独提取出来 -->
<template v-if="reportType == 0 && userInfo.accountLevel == 4">
<stores-ranking></stores-ranking>
</template>
<template v-else>
<canvas-tab ref="canvasTab" @change="canvasChange">
<tab-container ref="tabContainer" :tabIndex="tabIndex"></tab-container>
</canvas-tab>
</template>
</div>
<div class="bottom">
<tab :list="['客户统计', '产值统计']" @change="change" :index="tabIndex"></tab>
</div>
</div>
</template>
<script>
import { mapState, mapActions, mapMutations } from 'vuex'
import { util } from '../../utils'
export default {
name: 'report',
data() {
return {
accountLevel: '', //集团 门店(4)
fastData: [],
detail: {},
reportTimeStart: '2021.10.23',
reportTimeEnd: '2021.10.23'
}
},
computed: {
...mapState({
reportData: state => state.report.reportData,
tabIndex: state => state.report.tabIndex,
reportType: state => state.report.reportType,
tabType: state => state.report.tabType,
userInfo: state => state.report.userInfo,
outputData: state => state.report.outputData,
userInfo: state => state.report.userInfo
})
},
mounted() {
this.getData()
},
created() {
let reportType = this.getQuery().reportType ? this.getQuery().reportType : JSON.parse(window.localStorage.getItem('reportType')).reportType
// let reportType =1
if (reportType == 0) {
document.title = '周报'
} else {
document.title = '月报'
}
this.SET_REPORT_TYPE({
reportType: reportType
})
},
methods: {
...mapActions({
getReport: 'report/getReport',
getCumerchantReport: 'report/getCumerchantReport',
getCugroupReport: 'report/getCugroupReport',
navigation: 'navigation'
}),
...mapMutations({
SET_TAB_INDEX: 'report/SET_TAB_INDEX',
SET_TABTYPE_INDEX: 'report/SET_TABTYPE_INDEX',
INIT_DATA: 'report/INIT_DATA',
SET_UESR_INFI: 'report/SET_UESR_INFI', //切换集团门店
SET_REPORT_TYPE: 'report/SET_REPORT_TYPE' //获取周报月报
}),
canvasChange(index) {
this.SET_TABTYPE_INDEX({ index: index })
},
//重新登录
reLogin() {
/**登录过期 重新登录 */
util.clearSessionId()
this.navigation()
},
//底部tab
change(index) {
this.SET_TAB_INDEX({ tabIndex: index })
this.SET_TABTYPE_INDEX({ index: 0 })
this.$refs.timeSearch.showDateSelect = false
// this.$refs.timeSearch.initDate() //切换时间重置不需要
this.toTop()
this.getData()
},
getData() {
this.INIT_DATA()
this.showLoading()
if (this.tabIndex == 1) {
this.getReport({
reportType: this.reportType,
reportTimeStart: this.outputData.reportTimeStart,
success: res => {
this.hideLoading()
this.$refs.ranking.initFastData()
},
fail: () => {
this.hideLoading()
this.reLogin()
}
})
} else if (this.tabIndex == 0 && this.userInfo.accountLevel == 4) {
/**获取当前门店周报月报客户统计 */
this.getCumerchantReport({
startDate: this.outputData.reportTimeStart,
reportType: this.reportType,
success: res => {
this.hideLoading()
// this.INIT_DATA()
this.$refs.ranking.initFastData()
},
fail: () => {
this.hideLoading()
this.reLogin()
}
})
} else {
/**获取当前集团周报月报客户统计 */
this.getCugroupReport({
startDate: this.outputData.reportTimeStart,
reportType: this.reportType,
success: res => {
this.hideLoading()
this.$refs.ranking.initFastData()
},
fail: () => {
this.reLogin()
this.hideLoading()
}
})
}
}
}
}
</script>
<style lang="scss" scoped>
.layout-wrap {
width: 100%;
height: 100%;
position: relative;
color: #333333;
font-size: 14px;
box-sizing: border-box;
overflow: scroll;
.timeSearch {
position: absolute;
top: 0;
left: 15px;
right: 15px;
z-index: 100;
}
.content {
position: absolute;
top: 67px;
left: 15px;
right: 15px;
z-index: 9;
}
}
.bottom {
position: fixed;
bottom: 0;
left: 0;
background: #ffffff;
z-index: 90;
width: 100%;
right: 0;
}
</style>