ViewClue.vue
7.91 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
<template>
<div class="clue">
<div class="trend-box">
<div class="patch-title">注册门店趋势</div>
<BarChart ref="signChartRef" domId="signChart" :height="chartHeight" valueName="activeNum" :colorList="colorList"></BarChart>
</div>
<div class="trend-box">
<div class="patch-title">活跃门店趋势</div>
<BarChart ref="dynamicChartRef" domId="dynamicChart" :height="chartHeight" valueName="registerNum" :colorList="greenColorList"></BarChart>
</div>
<div class="trend-box">
<div class="patch-title">月收入趋势</div>
<LineChart ref="monthIncomeChartRef" domId="monthIncomeChart" :height="chartHeight" valName="output"></LineChart>
</div>
<div class="trend-box marketing-trend">
<div class="patch-title">销售渠道趋势</div>
<!-- <BarChart ref="saleChartRef" domId="saleChart" :height="chartHeight" :colorList="colorList" valueName="channel"></BarChart> -->
<DoubleBarChart ref="saleChartRef" domId="purchase" :height="chartHeight" :colorList="colorList" valueName="channel"></DoubleBarChart>
<div class="legend">
<div class="legend-item shop">
<span class="legend-even">双</span>
<span class="legend-odd">单</span>
<span>直销</span>
</div>
<div class="legend-item self">
<span class="legend-even">双</span>
<span class="legend-odd">单</span>
渠道
</div>
</div>
</div>
<div class="trend-box">
<div class="patch-title">
按年统计客户销售金额的合理性 -
<PriceSwitch class="rationality" unit="" isObject :selectList="selectList" @selectPrice="selectRationality"></PriceSwitch>
</div>
<div class="rationality-text">
收入占比:{{ ratio }}%
<PriceSwitch style="display: inline-block" :selectList="rationalityPriceList" @selectPrice="selectPrice"></PriceSwitch>
</div>
<BarChart ref="rationalityChartRef" domId="rationalityChart" height="13.99vh" label="statDate" :barWidth="'50'" :colorList="greenColorList" valueName="num"></BarChart>
</div>
<div class="trend-box">
<div class="patch-title">设备订阅数量和线索相关性分析</div>
<div class="correlation"><PriceSwitch style="display: inline-block" unit="" boxWidth="6.94vw" :selectList="serviceList" @selectPrice="selectCorrelation"></PriceSwitch></div>
<LineChart ref="correlationChartRef" domId="correlationChart" height="13.99vh" :tooltipFormatterObj="correlationTooltips" :valName="correlationTooltips.attrName"></LineChart>
</div>
</div>
</template>
<script>
import BarChart from './BarChart.vue'
import LineChart from './LineCharts.vue'
import PriceSwitch from './PriceSwitch.vue'
import DoubleBarChart from './DoubleBarChart.vue'
import { rationalityList, rationalityPriceList, serviceList } from './constant'
export default {
name: 'InternalRight',
components: {
BarChart,
LineChart,
PriceSwitch,
DoubleBarChart
},
data() {
return {
chartHeight: '20vh',
colorList: ['#22D8FF', '#223FA9', '#061422'],
greenColorList: ['#2AD191', '#0E958D', '#063139'],
dataList: [
{
statMonth: '2021',
actiNum: 400
},
{
statMonth: '2022',
actiNum: 600
},
{
statMonth: '2023',
actiNum: 800
}
],
correlationTooltips: {
label: '设备数',
attrName: 'deviceNum'
},
selectList: rationalityList,
rationalityPriceList,
serviceList,
ratio: '',
rationality: rationalityList[0].value,
startPrice: '',
endPrice: '',
manageClueSalesAmountRationalityList: []
}
},
mounted() {
this.init()
},
methods: {
init() {
this.getManageClueTrend()
this.getManageClueSalesAmountRationality('merData')
this.getManageClueAnalysis()
},
async getManageClueTrend() {
const _data = await this.api.internal.getManageClueTrend()
const _dataList = _data.data.dataList
this.$refs.signChartRef.drawBar(_dataList)
this.$refs.dynamicChartRef.drawBar(_dataList)
this.$refs.monthIncomeChartRef.drawLine(_dataList)
this.$refs.saleChartRef.drawBar(_dataList)
},
async getManageClueSalesAmountRationality(queryItem) {
const params = {
startPrice: this.startPrice,
endPrice: this.endPrice
}
const _data = await this.api.internal.getManageClueSalesAmountRationality(params)
const _queryItem = queryItem || this.rationality
this.manageClueSalesAmountRationalityList = _data.data.dataList[0]
const _dataList = _data.data.dataList[0][_queryItem].trendData
this.ratio = _data.data.dataList[0][_queryItem].ratio
this.$refs.rationalityChartRef.drawBar(_dataList)
},
async getManageClueAnalysis() {
const _data = await this.api.internal.getManageClueAnalysis()
const _dataList = _data.data.dataList
this.$refs.correlationChartRef.drawLine(_dataList)
},
selectRationality(val) {
console.log(val)
this.rationality = val.value
const _dataList = this.manageClueSalesAmountRationalityList[val.value].trendData
this.ratio = this.manageClueSalesAmountRationalityList[val.value].ratio
this.$refs.rationalityChartRef.drawBar(_dataList)
},
// 只有当是销售数(output)时才会触发此事件
selectPrice(val) {
if (val.label === '全部') {
this.startPrice = ''
this.endPrice = ''
this.getManageClueSalesAmountRationality()
return
}
this.startPrice = val.startPrice
this.endPrice = val.endPrice
this.getManageClueSalesAmountRationality()
},
selectCorrelation(val) {
this.$set(this.correlationTooltips, 'attrName', val.value)
this.getManageClueAnalysis()
}
}
}
</script>
<style lang="scss" scoped>
.clue {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.marketing-trend {
position: relative;
.legend {
font-size: 10px;
display: flex;
position: absolute;
right: 1.39vw;
top: 2.22vh;
&-item {
display: flex;
align-items: center;
color: #fff;
margin-right: 1.67vw;
&:last-child {
margin-right: 0;
}
img {
width: 1.32vw;
height: 1vh;
margin-right: 0.28vw;
}
.icon-line {
width: 0.98vw;
height: 0.56vh;
}
.legend-even,
.legend-odd {
display: inline-block;
width: 0.83vw;
height: 1.33vh;
line-height: 1.33vh;
margin-right: 0.28vw;
font-size: 8px;
text-align: center;
}
}
.shop {
.legend-even {
background-image: linear-gradient(180deg, #2ad190 1%, #00b7df 100%);
}
.legend-odd {
background-image: linear-gradient(180deg, #22d8ff 0%, #5c56ff 100%);
}
}
.self {
.legend-even {
background-image: linear-gradient(180deg, #145f4e 1%, #035972 100%);
}
.legend-odd {
background-image: linear-gradient(180deg, #11627a 0%, #282f7a 100%);
}
}
}
}
.trend-box {
display: inline-block;
height: 23vh;
width: 50%;
&:nth-child(1),
&:nth-child(2) {
margin-top: 1.78vh;
}
}
.rationality {
display: inline-block;
/deep/ {
.type-plugin {
.trend-type-box {
padding-left: 5px;
}
.text {
font-weight: 400;
font-size: 14px;
}
}
}
&-text {
display: flex;
justify-content: space-between;
font-size: 10px;
font-weight: 600;
color: #fff;
margin-top: 1.33vh;
}
}
.correlation {
display: flex;
flex-direction: row-reverse;
margin-top: 1.33vh;
}
</style>