ViewEdun.vue
3.35 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
<template>
<div class="edun-box">
<div class="edun-statistic-box">
<div class="patch-title title">按年统计客户销售金额分布的合理性</div>
<inner-tab class="inner-tab" :list="tabList" :width="8.1" :itemPadding="0.5" @changeTab="changeTab"></inner-tab>
<div class="switch-box">
<div class="text">收入占比:{{ ratio }}%</div>
<PriceSwitch :selectList="priceList" @selectPrice="selectPrice"></PriceSwitch>
</div>
<BarChart ref="edunChartRef" domId="edunChart" :label="'statDate'" :height="'24vh'" :colorList="colorList" :barWidth="'50'" valueName="num"></BarChart>
</div>
<div class="income-box">
<div class="patch-title title">月收入趋势</div>
<LineChart ref="edunLineChartRef" domId="edunLineChart" :height="'30vh'" :valName="'num'"></LineChart>
</div>
</div>
</template>
<script>
import BarChart from './BarChart.vue'
import PriceSwitch from './PriceSwitch.vue'
import LineChart from './LineCharts.vue'
import { edunPriceList } from './constant'
export default {
name: 'ViewEdun',
components: {
BarChart,
PriceSwitch,
LineChart
},
data() {
return {
tabList: ['品牌商数', '总金额'],
priceList: edunPriceList,
colorList: ['#22D8FF', '#223FA9', '#061422'],
ratio: 0,
startPrice: '',
endPrice: '',
EDqueryItem: 'brandData',
ESalesAmountRationalitydataList: []
}
},
created() {
// 按年统计客户销售金额的合理性
this.getManageESalesAmountRationality('brandData')
// 月收入趋势
this.getManageETrend()
},
mounted() {
},
methods: {
changeTab(val) {
const queryItems = ['brandData', 'incomeData']
this.EDqueryItem = queryItems[val]
const _dataList = this.ESalesAmountRationalitydataList[this.EDqueryItem].trendData
this.ratio = this.ESalesAmountRationalitydataList[this.EDqueryItem].ratio
this.$refs.edunChartRef.drawBar(_dataList)
},
selectPrice(val) {
if (val.label === '全部') {
this.startPrice = ''
this.endPrice = ''
this.getManageESalesAmountRationality()
return
}
this.startPrice = val.startPrice
this.endPrice = val.endPrice
this.getManageESalesAmountRationality()
},
async getManageESalesAmountRationality(queryItem) {
const params = {
startPrice: this.startPrice,
endPrice: this.endPrice
}
const _data = await this.api.internal.getManageESalesAmountRationality(params)
const _queryItem = queryItem || this.EDqueryItem
this.ESalesAmountRationalitydataList = _data.data.dataList[0]
const _dataList = _data.data.dataList[0][_queryItem].trendData
this.ratio = _data.data.dataList[0][_queryItem].ratio
this.$refs.edunChartRef.drawBar(_dataList)
},
async getManageETrend() {
const _data = await this.api.internal.getManageETrend()
const _dataList = _data.data.dataList
this.$refs.edunLineChartRef.drawLine(_dataList)
}
}
}
</script>
<style lang="scss" scoped>
.edun-box {
.edun-statistic-box {
height: 34vh;
.inner-tab {
margin: 0.92vh 0;
}
.switch-box {
display: flex;
justify-content: space-between;
.text {
font-weight: 600;
font-size: 10px;
color: #ffffff;
}
}
}
.title {
margin-top: 1.78vh;
}
}
</style>