123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- <!--
- * @Author: WangQiBiao
- * @Date: 2019-09-26 10:57:30
- * @LastEditors: mozhuangru
- * @LastEditTime: 2019-10-13 16:02:12
- * @Description: 收入统计
- -->
- <template>
- <div class="income">
- <div class="panel b1">
- <div class="panel-icon"></div>
- <div class="panel-txt">应收</div>
- <div class="panel-desc">¥{{billSum.billReceivable | moneyFormat}}</div>
- </div>
- <div class="panel b2">
- <div class="panel-icon"></div>
- <div class="panel-txt">实收</div>
- <div class="panel-desc">¥{{billSum.billReceived | moneyFormat}}</div>
- </div>
- <div class="map" id="mapId"></div>
- <div class="progress">
- <div class="desc">
- <div class="desc-lf">收费率</div>
- <div class="desc-lr">{{billSum.billRate}}%</div>
- </div>
- <el-progress
- :percentage="percentage"
- :show-text="false"
- color="#2FCD76"
- :stroke-width="8"
- ></el-progress>
- </div>
- </div>
- </template>
- <script>
- import echarts from 'echarts'
- import { api } from '@/api'
- export default {
- data () {
- return {
- billSum: {
- billReceivable: '',
- billReceived: '',
- billOnline: '',
- billUnderline: '',
- billRate: ''
- },
- percentage: 98.4
- }
- },
- mounted () {
- api.getBillSum().then(res => {
- res.data.data.forEach(item => {
- this.billSum[item.type] = item.total
- if (item.type === 'billRate') {
- this.percentage = JSON.parse(item.total)
- }
- })
- this.createIncomeMap()
- })
- },
- methods: {
- /**
- * 占比
- */
- createIncomeMap () {
- var myChart = echarts.init(document.getElementById('mapId'))
- var option = {
- // backgroundColor: '#2c343c',
- series: [
- {
- radius: ['40%', '60%'],
- hoverAnimation: false,
- type: 'pie',
- center: ['50%', '50%'],
- label: {
- normal: {
- // formatter: '{b|{b}}\n{c}',
- formatter: '{b|{b}}\n{per|{d}%}',
- fontSize: 10,
- lineHeight: 14,
- rich: {
- b: {
- color: '#fff',
- fontSize: 10
- }
- }
- }
- },
- data: [
- {
- value: this.billSum.billOnline,
- name: '线上',
- label: {
- show: true,
- color: '#FF9933'
- },
- itemStyle: {
- color: new echarts.graphic.LinearGradient(
- 0, 0, 0, 1,
- [
- { offset: 0, color: '#FCC204' },
- { offset: 1, color: '#EF6E18' }
- ]
- )
- }
- },
- {
- value: this.billSum.billUnderline,
- name: '线下',
- label: {
- show: true,
- color: '#00CCFF'
- },
- itemStyle: {
- color: new echarts.graphic.LinearGradient(
- 0, 0, 0, 1,
- [
- { offset: 0, color: '#01B4FF' },
- { offset: 1, color: '#0336FF' }
- ]
- )
- }
- }
- ]
- }
- ]
- }
- myChart.setOption(option)
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- @import './index.scss';
- </style>
|