consume_stat.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <view class="">
  3. <view class="tabs page-box-bg-fff r-30 m-t30" :style="[{position:is_fixed?'absolute':''}]"
  4. style="height: 100rpx;">
  5. <z-tabs ref="tabs" :list="tabsList" :active-style="{color:'#10B261',fontWeight:'bold',fontSize:'30rpx'}"
  6. :bar-style="{background:'#10B261'}" :inactive-style="{fontWeight:'bold',fontSize:'28rpx'}"
  7. :current="current" :bar-animate-mode="'worm'" @change="tabsChange" />
  8. </view>
  9. <!-- 顶部单行统计 -->
  10. <StatSingleData :genre="dateTypeObj.censusUserType" :type="current+1" :total-money="moneyData.loanMoney"
  11. :total-num="moneyData.loanNum"></StatSingleData>
  12. <StatLoanChart ref="outObj" :genre="3" :leftText="'消金汇总占比'"></StatLoanChart>
  13. <!-- <StatRanking :genre="3" :leftText="'消金汇总明细'"></StatRanking>-->
  14. <!-- <StatRanking ref="rankingObj" :genre="3" :is_type='2' :leftText="'个人业绩排行'"></StatRanking>-->
  15. <stat_gather is_group :leftText="'汇总明细'" :out-list="outList"></stat_gather>
  16. <StatRanking ref="rankingObj" :is_type="2" :leftText="'个人业绩排行'" :data-list="userList"></StatRanking>
  17. <StatSituation ref="situationObj" :date-type-obj="selectTypeObj" :type="1"></StatSituation>
  18. </view>
  19. </template>
  20. <script>
  21. import StatLoanChart from "../module/stat_loan_chart.vue"
  22. import StatSingleData from "../module/stat_single_data.vue"
  23. import md5 from "js-md5";
  24. import {
  25. getConsumeMoney,
  26. getRanking
  27. } from "@/api/statistics";
  28. import Stat_gather from "@/pages/statistics/module/stat_gather.vue";
  29. import StatRanking from "@/pages/statistics/module/stat_ranking.vue";
  30. import StatSituation from "@/pages/statistics/module/stat_situation.vue";
  31. export default {
  32. props: {
  33. 'dateTypeObj': {
  34. default: () => {
  35. return {
  36. dateType: 4,
  37. selectDate: '2023-02-25',
  38. money_type: 1,
  39. censusUserType: 0,
  40. product_id: 5,
  41. }
  42. }
  43. }
  44. },
  45. components: {
  46. Stat_gather,
  47. StatSingleData,
  48. StatLoanChart,
  49. StatRanking,
  50. StatSituation,
  51. },
  52. data() {
  53. return {
  54. selectTypeObj: {
  55. dateType: 4,
  56. selectDate: '2023-02-25',
  57. money_type: 1,
  58. censusUserType: 0,
  59. product_id: 5,
  60. },
  61. tabsList: [{
  62. name: '未出款',
  63. dot_color: 'red',
  64. disabled: false
  65. }, {
  66. name: '签约',
  67. dot_color: 'yellow',
  68. disabled: false
  69. }, {
  70. name: '出款',
  71. dot_color: 'yellow',
  72. disabled: false
  73. }],
  74. current: 0,
  75. moneyData: {
  76. loanMoney: 0,
  77. loanNum: 0
  78. },
  79. outList: [],
  80. userList: [],
  81. }
  82. },
  83. watch: {
  84. 'dateTypeObj': function() {
  85. this.initData()
  86. }
  87. },
  88. mounted() {
  89. this.initData()
  90. },
  91. methods: {
  92. tabsChange(e) {
  93. if (e !== this.current) {
  94. this.current = e
  95. this.selectTypeObj.money_type = this.current + 1
  96. this.startData()
  97. }
  98. },
  99. setSendMd5() {
  100. let str = JSON.stringify(this.dateTypeObj)
  101. return md5(str)
  102. },
  103. initData() {
  104. if (this.dateTypeObj.censusUserType > 0) {
  105. this.selectTypeObj = this.dateTypeObj
  106. this.selectTypeObj.money_type = 1
  107. let sendMd5 = this.setSendMd5()
  108. if (sendMd5 !== this.sendMd5) {
  109. this.sendMd5 = sendMd5
  110. this.startData()
  111. }
  112. }
  113. },
  114. startData() {
  115. this.getConsumeMoney()
  116. this.setUserRanking()
  117. },
  118. getConsumeMoney() {
  119. getConsumeMoney(this.selectTypeObj).then((res) => {
  120. if (res.code === 1) {
  121. this.moneyData.loanMoney = res.data.moneyData.loanMoney
  122. this.moneyData.loanNum = res.data.moneyData.loanNum
  123. this.outList = res.data.items
  124. this.$refs.outObj.setPeakChartData(this.outList)
  125. }
  126. })
  127. },
  128. setUserRanking() {
  129. let fromData = this.selectTypeObj
  130. fromData.pageNum = 5
  131. getRanking(fromData).then((res) => {
  132. if (res.code === 1) {
  133. this.userList = res.data.items
  134. this.$refs.rankingObj.setDataList(this.userList)
  135. } else {
  136. this.userList = []
  137. }
  138. })
  139. },
  140. },
  141. }
  142. </script>
  143. <style>
  144. </style>