index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <!--
  2. * @Author: WangQiBiao
  3. * @Date: 2019-09-26 10:57:30
  4. * @LastEditors: wjc
  5. * @LastEditTime: 2025-11-18 09:46:07
  6. * @Description: 收入统计
  7. -->
  8. <template>
  9. <div class="income">
  10. <div class="panel b1">
  11. <div class="panel-icon"></div>
  12. <div class="panel-txt">应收</div>
  13. <div class="panel-desc">¥{{billSum.billReceivable | moneyFormat}}</div>
  14. </div>
  15. <div class="panel b2">
  16. <div class="panel-icon"></div>
  17. <div class="panel-txt">实收</div>
  18. <div class="panel-desc">¥{{billSum.billReceived | moneyFormat}}</div>
  19. </div>
  20. <div class="panel b3">
  21. <div class="panel-icon"></div>
  22. <div class="panel-txt">线上</div>
  23. <div class="panel-desc">¥{{billSum.billOnlineSum | moneyFormat}}</div>
  24. </div>
  25. <div class="map" id="mapId"></div>
  26. <div class="progress">
  27. <div class="desc">
  28. <div class="desc-lf">收费率</div>
  29. <div class="desc-lr">{{billSum.billRate}}%</div>
  30. </div>
  31. <el-progress
  32. :percentage="percentage"
  33. :show-text="false"
  34. color="#2FCD76"
  35. :stroke-width="8"
  36. ></el-progress>
  37. </div>
  38. </div>
  39. </template>
  40. <script>
  41. import * as echarts from 'echarts'
  42. import { api } from '@/api'
  43. export default {
  44. data () {
  45. return {
  46. billSum: {
  47. billReceivable: '',
  48. billReceived: '',
  49. billOnline: '',
  50. billUnderline: '',
  51. billRate: ''
  52. },
  53. percentage: 98.4
  54. }
  55. },
  56. mounted () {
  57. api.getBillSum().then(res => {
  58. res.data.data.forEach(item => {
  59. this.billSum[item.type] = item.total
  60. if (item.type === 'billRate') {
  61. this.percentage = JSON.parse(item.total)
  62. }
  63. })
  64. this.createIncomeMap()
  65. })
  66. },
  67. methods: {
  68. /**
  69. * 占比
  70. */
  71. createIncomeMap () {
  72. var myChart = echarts.init(document.getElementById('mapId'))
  73. var option = {
  74. title: [
  75. {
  76. text: '缴费方式',
  77. textStyle: {
  78. fontSize: 10,
  79. color: '#F0F0F0',
  80. fontWeight: 'normal'
  81. },
  82. left: '41%',
  83. top: '45%'
  84. }
  85. ],
  86. series: [
  87. {
  88. // name: '缴费方式',
  89. radius: ['40%', '60%'],
  90. hoverAnimation: false,
  91. type: 'pie',
  92. center: ['50%', '50%'],
  93. label: {
  94. normal: {
  95. formatter: '{b|{b}}\n{per|{d}%}',
  96. fontSize: 10,
  97. lineHeight: 14,
  98. rich: {
  99. b: {
  100. color: '#5774A2',
  101. fontSize: 10
  102. }
  103. }
  104. }
  105. },
  106. data: [
  107. {
  108. value: this.billSum.billOnline,
  109. name: '线上',
  110. label: {
  111. show: true,
  112. color: '#00CCFF'
  113. },
  114. itemStyle: {
  115. color: new echarts.graphic.LinearGradient(
  116. 0, 0, 0, 1,
  117. [
  118. { offset: 0, color: '#2E38EE' },
  119. { offset: 1, color: '#8E44C6' }
  120. ]
  121. )
  122. }
  123. },
  124. {
  125. value: this.billSum.billUnderline,
  126. name: '线下',
  127. label: {
  128. show: true,
  129. color: '#00CCFF'
  130. },
  131. itemStyle: {
  132. color: new echarts.graphic.LinearGradient(
  133. 0, 0, 0, 1,
  134. [
  135. { offset: 0, color: '#1BA71E' },
  136. { offset: 1, color: '#8EBB16' }
  137. ]
  138. )
  139. }
  140. }
  141. ]
  142. }
  143. ]
  144. }
  145. myChart.setOption(option)
  146. }
  147. }
  148. }
  149. </script>
  150. <style lang="scss" scoped>
  151. @import './index.scss';
  152. </style>