PurchasePropertion.vue
2.26 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
<template>
<div class="purchase-propertion-box">
<box-title title="商城采购额商品占比"></box-title>
<RightViewContent v-if="propertionData.length" class="content-box" :chart="propertionChart" :listData="propertionData" :legentList="propertionLegend" :legendColors="propertionChart.colors"></RightViewContent>
<div v-else class="empty">
<Empty></Empty>
</div>
</div>
</template>
<script>
import RightViewContent from './RightViewContent.vue'
import { changeMixin } from '@/mixins'
export default {
name: 'PurchasePropertion',
mixins: [changeMixin],
components: {
RightViewContent
},
data() {
return {
// 采购占比饼图结构
propertionChart: {
id: 'propertion',
keys: ['goodsname', 'purchaseamount'],
height: '17.34vh',
colors: ['#16E193', '#747DFF', '#E588FF', '#34AFFF', '#FFC200', '#EB6001'],
formatter: 'price'
},
// 采购占比数据
propertionData: [],
propertionLegend: [
{
name: 'goodsname',
width: '11.11vw'
},
{
name: 'rate',
type: 'decimal',
width: '3.2vw'
},
// {
// name: 'purchaseamount',
// hasIcon: '¥',
// type: 'number',
// width: '4.06vw'
// },
// {
// name: 'averprice',
// hasIcon: '均价¥',
// type: 'number',
// width: '6.24vw'
// }
]
}
},
mounted() {},
methods: {
init() {
this.getAllGoodsRatio()
},
// 获取商品采购占比
getAllGoodsRatio() {
this.api.solar.getAllGoodsRatio({ year: this.$store.state.app.solarYear }).then(res => {
if (!res.code === '0') {
this.openMessage('获取商品采购占比失败')
return
}
this.propertionData = res.data.dataList[0].shopgoodsRatioList.slice(0, 6) || []
})
}
}
}
</script>
<style lang="scss" scoped>
.purchase-propertion-box {
width: 100%;
background: #061422;
box-shadow: inset 0 0 20px 0 #3d57ff69;
height: 25vh;
.content-box {
// padding: 2.78vh 1.39vw 2.78vh 0;
height: 21.67vh;
}
.empty {
height: 21.67vh;
display: flex;
align-items: center;
}
}
</style>