customerType.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <template>
  2. <div>
  3. <uni-table style="margin-top:40px;" ref="table" :loading="loading" border stripe type="" emptyText="暂无更多数据" @selection-change="selectionChange">
  4. <uni-tr>
  5. <uni-th width="60" align="center">客户类型</uni-th>
  6. <uni-th width="60" align="center">间夜数/间</uni-th>
  7. <uni-th width="60" align="center">数量占比</uni-th>
  8. <uni-th width="60" align="center">房费收入/元</uni-th>
  9. <uni-th width="60" align="center">非房费收入/元</uni-th>
  10. <uni-th width="60" align="center">收入小计</uni-th>
  11. <uni-th width="60" align="center">收入占比</uni-th>
  12. <uni-th width="60" align="center">平均客单价/元</uni-th>
  13. </uni-tr>
  14. <uni-tr v-for="(item, index) in tableData" :key="index">
  15. <uni-td align="center">
  16. <view class="name">{{ item.name }}</view>
  17. </uni-td>
  18. <uni-td align="center">{{ item.rz_count }}</uni-td>
  19. <uni-td align="center">{{ item.address }}</uni-td>
  20. <uni-td align="center">{{ item.room_money }}</uni-td>
  21. <uni-td align="center">{{ item.other_money }}</uni-td>
  22. <uni-td align="center">{{ item.sum_money }}</uni-td>
  23. <uni-td align="center">{{ item.date }}</uni-td>
  24. <uni-td align="center">{{ item.room_average_price }}</uni-td>
  25. </uni-tr>
  26. </uni-table>
  27. <div style="margin-top:20px;">
  28. <ucharts :chartData="chartsData" :type="'column'"></ucharts>
  29. </div>
  30. <div style="margin-top:20px;">
  31. <pieCharts :chartData="chartsPieDatas" ></pieCharts>
  32. </div>
  33. <div style="margin-top:20px;">
  34. <pieCharts :chartData="chartsPieData" ></pieCharts>
  35. </div>
  36. </div>
  37. </template>
  38. <script>
  39. import ucharts from '../echarts/line.vue'
  40. import pieCharts from '../echarts/pie.vue'
  41. export default {
  42. components: {
  43. ucharts,
  44. pieCharts
  45. },
  46. props:{
  47. tableData:{
  48. type:Array,
  49. default(){
  50. return []
  51. }
  52. }
  53. },
  54. computed: {
  55. chartsData() {
  56. let categories = [];
  57. let series = [];
  58. let obj = {
  59. name: '收入',
  60. data: []
  61. }
  62. console.log(this.tableData);
  63. if (!this.tableData || this.tableData.length === 0) {
  64. return {
  65. categories,
  66. series
  67. }
  68. } else {
  69. this.tableData.forEach(ele => {
  70. categories.push(ele.name)
  71. obj.data.push(ele.sum_money)
  72. })
  73. series = [obj]
  74. return {
  75. categories,
  76. series
  77. }
  78. }
  79. },
  80. chartsPieData() {
  81. console.log('111111111', this.tableData);
  82. let series = []
  83. this.tableData.forEach(ele => {
  84. series.push({
  85. name: ele.name,
  86. value: ele.sum_money
  87. })
  88. })
  89. console.log('222222222222', series);
  90. return series
  91. },
  92. chartsPieDatas() {
  93. console.log('111111111', this.tableData);
  94. let series = []
  95. this.tableData.forEach(ele => {
  96. series.push({
  97. name: ele.name,
  98. value: ele.rz_count
  99. })
  100. })
  101. console.log('222222222222', series);
  102. return series
  103. },
  104. },
  105. data() {
  106. return {
  107. loading:false,
  108. }
  109. }
  110. }
  111. </script>
  112. <style lang="scss">
  113. /deep/.uni-table {
  114. min-width: 100vw !important;
  115. }
  116. /deep/.uni-table-th {
  117. font-size: 12px !important;
  118. }
  119. </style>