incomeMode.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <div :class="valueClass == 1 ? 'modelBlock' : 'modelBlock enlarge'">
  3. <div class="model-title">
  4. <div class="model-title-text">收入方式</div>
  5. <div class="model-title-right">
  6. <el-select
  7. v-model="mixins_query.chargeType"
  8. placeholder="所有费用"
  9. clearable
  10. class="saveColumn-select"
  11. @change="getData"
  12. >
  13. <el-option
  14. :label="item.label"
  15. :value="item.value"
  16. v-for="(item, index) in $publicArray.chargeType()"
  17. :key="index"
  18. ></el-option>
  19. </el-select>
  20. <el-date-picker
  21. value-format="yyyy-MM"
  22. v-model="date"
  23. type="month"
  24. placeholder="选择月"
  25. class="saveColumn-select saveColumn-select-time"
  26. @change="changeTime"
  27. :clearable="false"
  28. >
  29. </el-date-picker>
  30. </div>
  31. </div>
  32. <div class="model-content">
  33. <zz-echart
  34. :option="clientOptions"
  35. class="chart"
  36. ></zz-echart>
  37. </div>
  38. </div>
  39. </template>
  40. <script>
  41. import { GradualChange, ringTypes, ringTypeEnlarges } from './indexOptionChart';
  42. const colors = [
  43. GradualChange('#22D8FF', '#00B2FF'),
  44. GradualChange('#F0646C', '#F4994E'),
  45. GradualChange('#5EEDCC ', '#24C3F1'),
  46. GradualChange('#7178FF', '#D2A4FF'),
  47. GradualChange('#884DD2', '#DF63CC')
  48. ];
  49. import allcommunit from './allcommunit';
  50. export default {
  51. mixins: [allcommunit],
  52. data () {
  53. return {
  54. valueClass: "",
  55. mixins_query: {
  56. communityId: '',
  57. date: '',
  58. chargeType: ''
  59. },
  60. date: '',
  61. total: 0,
  62. clientOptions: ringTypes(
  63. colors,
  64. [
  65. { value: 0, name: '微信' },
  66. { value: 0, name: '支付宝' },
  67. { value: 0, name: '现金' },
  68. { value: 0, name: '预存' },
  69. { value: 0, name: '其他' }
  70. ],
  71. {},
  72. { type: '%', total: 0 },
  73. 30
  74. )
  75. };
  76. },
  77. methods: {
  78. getData () {
  79. this.$http.get('/sc-community/statisticIncomeMethod', this.mixins_query).then(({ data, msg, status }) => {
  80. if (status == 0 && !!data.datas && Object.keys(data.datas).length !== 0) {
  81. // this.clientOptions = ringType(colors, this.eachartObj(data), {}, { type: '%', total: this.total }, 30);
  82. if (window.screen.width == 1920 || window.screen.width < 1920) {
  83. this.clientOptions = ringTypes(colors, this.eachartObj(data), {}, { type: '%', total: this.total });
  84. } else if (window.screen.width == 2560 || window.screen.width > 1920) {
  85. this.clientOptions = ringTypeEnlarges(colors, this.eachartObj(data), {}, { type: '%', total: this.total });
  86. }
  87. }
  88. });
  89. },
  90. changeTime (v) {
  91. this.mixins_query.date = v + '-01';
  92. this.getData();
  93. },
  94. eachartObj (data) {
  95. this.total = data.total || 0;
  96. let typeName = {
  97. 1: '微信在线',
  98. 2: '支付宝',
  99. 3: '现金',
  100. 4: '预存',
  101. 5: '其他',
  102. 6: '刷卡',
  103. 7: '微信扫码'
  104. };
  105. let newData = [];
  106. for (let a in data.datas) {
  107. newData.push({
  108. value: data.datas[a],
  109. name: typeName[a]
  110. });
  111. this.total = this.total + data.datas[a];
  112. }
  113. return newData;
  114. }
  115. },
  116. created () {
  117. if (window.screen.width == 1920 || window.screen.width < 1920) {
  118. this.valueClass = 1;
  119. this.clientOptions = ringTypes(
  120. colors,
  121. [
  122. { value: 0, name: '微信' },
  123. { value: 0, name: '支付宝' },
  124. { value: 0, name: '现金' },
  125. { value: 0, name: '预存' },
  126. { value: 0, name: '其他' }
  127. ],
  128. {},
  129. { type: '%', total: 0 }
  130. );
  131. } else if (window.screen.width == 2560 || window.screen.width > 1920) {
  132. this.valueClass = 2;
  133. this.clientOptions = ringTypeEnlarges(
  134. colors,
  135. [
  136. { value: 0, name: '微信' },
  137. { value: 0, name: '支付宝' },
  138. { value: 0, name: '现金' },
  139. { value: 0, name: '预存' },
  140. { value: 0, name: '其他' }
  141. ],
  142. {},
  143. { type: '%', total: 0 }
  144. );
  145. }
  146. this.mixins_query.date = this.$moment().format('YYYY-MM') + '-01';
  147. this.date = this.$moment().format('YYYY-MM');
  148. }
  149. };
  150. </script>
  151. <style lang="scss" scoped>
  152. @import './style.scss';
  153. @import './stylePc.scss';
  154. </style>