Commit 4439edb0439ab918102da26220d74b39f641b9d8
1 parent
f0fb6d92
收入概览
Showing
1 changed file
with
13 additions
and
8 deletions
src/components/incomeOverview/index.vue
... | ... | @@ -42,9 +42,16 @@ |
42 | 42 | orgIds: [10003,10005] |
43 | 43 | }).then((response)=>{ |
44 | 44 | let data = response.data.data |
45 | - console.log(data.totalPay) | |
46 | - this.incomeTotal = 0 | |
45 | + this.incomeTotal = data.totalPay | |
47 | 46 | this.incomeTotal = common.formatNumToStr(this.incomeTotal) |
47 | + this.barChartOption.barColor[0].value = data.aliPay | |
48 | + this.barChartOption.barColor[1].value = data.wxPay | |
49 | + this.barChartOption.barColor[2].value = data.otherPay | |
50 | + let barChartOption = this.barChartOption | |
51 | + this.barChart=this.createBar(barChartOption); | |
52 | + window.addEventListener('resize', function() { | |
53 | + this.barChart.resize() | |
54 | + }.bind(this)); | |
48 | 55 | }).catch((response)=>{ |
49 | 56 | console.log(response); |
50 | 57 | }) |
... | ... | @@ -54,10 +61,7 @@ |
54 | 61 | //总收入 |
55 | 62 | this.incomeTotal=this.formatNumToStr(); |
56 | 63 | //收入Bar |
57 | - this.barChart=this.createBar(); | |
58 | - window.addEventListener('resize', function() { | |
59 | - this.barChart.resize() | |
60 | - }.bind(this)); | |
64 | + | |
61 | 65 | }, |
62 | 66 | methods: { |
63 | 67 | /* |
... | ... | @@ -69,8 +73,9 @@ |
69 | 73 | /* |
70 | 74 | * 创建收入Bar |
71 | 75 | * */ |
72 | - createBar:function(){ | |
73 | - let root=this.$options.data().barChartOption; | |
76 | + createBar:function(barChartOption){ | |
77 | + let root=barChartOption; | |
78 | + console.log(root) | |
74 | 79 | let barChart = echarts.init(document.querySelector('.app-incomeBox .incomeBar')); |
75 | 80 | const rightYdata=this._formatterValue(root.barColor); |
76 | 81 | const seriesData=this._seriesData(root.barColor); | ... | ... |