MerchantsPropotion.vue
3.16 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
<template>
<div class="propotion-box flex">
<div class="propotion-box-left">
<box-title title="商城采购商品占比"></box-title>
<RightViewContent
v-if="shopmallData.length"
class="content-box"
:chart="shopmallChart"
:listData="shopmallData"
:legentList="shopmallLegend"
:legendColors="shopmallChart.colors"
></RightViewContent>
<div v-else class="empty">
<Empty></Empty>
</div>
</div>
<div class="propotion-box-right">
<box-title title="自采商品占比"></box-title>
<RightViewContent
v-if="selfPickData.length"
class="content-box"
:chart="selfPickChart"
:listData="selfPickData"
:legentList="selfPickLegend"
:legendColors="selfPickChart.colors"
></RightViewContent>
<div v-else class="empty">
<Empty></Empty>
</div>
</div>
</div>
</template>
<script>
import RightViewContent from '../solar/RightViewContent.vue'
export default {
name: 'MerchantsPropotion',
components: {
RightViewContent
},
props: {
shopmallData: {
type: Array,
default: () => []
},
selfPickData: {
type: Array,
default: () => []
}
},
data() {
return {
// 商城采购饼图结构
shopmallChart: {
id: 'shopmall',
keys: ['goodsname', 'purchaseamount'],
height: '18vh',
colors: ['#16E193', '#747DFF', '#E588FF', '#34AFFF', '#FFC200', '#EB6001'],
formatter: 'price'
},
shopmallLegend: [
{
name: 'goodsname',
width: '15.28vw'
},
{
name: 'rate',
type: 'decimal',
width: '3vw'
},
// {
// name: 'purchaseamount',
// hasIcon: '¥',
// type: 'number',
// width: '5vw'
// },
// {
// name: 'averprice',
// hasIcon: '均价¥',
// type: 'number',
// width: '5vw'
// }
],
// 自采饼图结构
selfPickChart: {
id: 'selfPick',
keys: ['goodsname', 'purchaseamount'],
height: '18vh',
colors: ['#16E193', '#747DFF', '#E588FF', '#34AFFF', '#FFC200', '#EB6001'],
formatter: 'price'
},
selfPickLegend: [
{
name: 'goodsname',
width: '15.28vw'
},
{
name: 'rate',
type: 'decimal',
width: '3vw'
},
// {
// name: 'purchaseamount',
// hasIcon: '¥',
// type: 'number',
// width: '5vw'
// },
// {
// name: 'averprice',
// hasIcon: '均价¥',
// type: 'number',
// width: '5vw'
// }
]
}
},
mounted() {},
methods: {}
}
</script>
<style lang="scss" scoped>
.propotion-box {
justify-content: space-between;
margin-top: 1.78vh;
&-left,
&-right {
width: 31.46vw;
height: 31.56vh;
box-shadow: inset 0 0 20px 0 #3d57ff69;
}
.content-box {
padding: 3.78vh 1.78vw 4.44vh 1.78vw;
}
.empty {
height: 22vh;
display: flex;
align-items: center;
}
}
</style>