Commit 4439edb0439ab918102da26220d74b39f641b9d8

Authored by liuqimichale
1 parent f0fb6d92

收入概览

src/components/incomeOverview/index.vue
@@ -42,9 +42,16 @@ @@ -42,9 +42,16 @@
42 orgIds: [10003,10005] 42 orgIds: [10003,10005]
43 }).then((response)=>{ 43 }).then((response)=>{
44 let data = response.data.data 44 let data = response.data.data
45 - console.log(data.totalPay)  
46 - this.incomeTotal = 0 45 + this.incomeTotal = data.totalPay
47 this.incomeTotal = common.formatNumToStr(this.incomeTotal) 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 }).catch((response)=>{ 55 }).catch((response)=>{
49 console.log(response); 56 console.log(response);
50 }) 57 })
@@ -54,10 +61,7 @@ @@ -54,10 +61,7 @@
54 //总收入 61 //总收入
55 this.incomeTotal=this.formatNumToStr(); 62 this.incomeTotal=this.formatNumToStr();
56 //收入Bar 63 //收入Bar
57 - this.barChart=this.createBar();  
58 - window.addEventListener('resize', function() {  
59 - this.barChart.resize()  
60 - }.bind(this)); 64 +
61 }, 65 },
62 methods: { 66 methods: {
63 /* 67 /*
@@ -69,8 +73,9 @@ @@ -69,8 +73,9 @@
69 /* 73 /*
70 * 创建收入Bar 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 let barChart = echarts.init(document.querySelector('.app-incomeBox .incomeBar')); 79 let barChart = echarts.init(document.querySelector('.app-incomeBox .incomeBar'));
75 const rightYdata=this._formatterValue(root.barColor); 80 const rightYdata=this._formatterValue(root.barColor);
76 const seriesData=this._seriesData(root.barColor); 81 const seriesData=this._seriesData(root.barColor);