consume_stat.vue 4.3 KB

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