sectionBerth.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <!-- 路段泊位统计 -->
  2. <template>
  3. <view class="container">
  4. <view class="table">
  5. <!-- <view class="table-date" v-if="currentDate">{{ currentDate.join(' 至 ') }}</view> -->
  6. <view class="table-box">
  7. <TableRanking :loading="loading" :tableTh="tableTh" :tableData="tableData"
  8. @pageChange="pageChange" />
  9. </view>
  10. </view>
  11. <view class="total">
  12. <view>
  13. 停车数量<text>{{ totalData.vehicleCount || 0 }}</text>辆,实收金额<text>{{ totalData.realAmount || 0 }}</text>元
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. import TableRanking from '@/components/tableRanking.vue'
  20. export default {
  21. components: {
  22. TableRanking
  23. },
  24. props: {
  25. tableTh: {
  26. type: Array,
  27. default: () => {
  28. return [{
  29. field: '路段名称',
  30. key: 'roadName'
  31. },
  32. {
  33. field: '所属泊位',
  34. key: 'spaceName'
  35. },
  36. {
  37. field: '停车数量(次)',
  38. width: 80,
  39. key: 'vehicleCount'
  40. },
  41. {
  42. field: '实收金额(元)',
  43. width: 80,
  44. key: 'realAmount'
  45. }
  46. ]
  47. }
  48. }
  49. },
  50. data() {
  51. return {
  52. beginTime: '',
  53. endTime: '',
  54. totalData: {},
  55. tableData: {
  56. current: 1,
  57. total: 0,
  58. list: []
  59. },
  60. currentDate: [],
  61. loading: false
  62. }
  63. },
  64. methods: {
  65. getData(data) {
  66. if (data.length) {
  67. this.beginTime = data[0]
  68. this.endTime = data[1]
  69. } else {
  70. this.beginTime = undefined
  71. this.endTime = undefined
  72. }
  73. this.currentDate = data
  74. this.tableData.current = 1
  75. this.getRoadSpaceTotal()
  76. this.getRoadSpaceList()
  77. },
  78. getRoadSpaceTotal() {
  79. uni.$u.api.statisticalReportApi.getRoadSpaceTotalApi({
  80. beginTime: this.beginTime,
  81. endTime: this.endTime
  82. }).then(res => {
  83. if (res.code === 200) {
  84. this.totalData = res.data
  85. }
  86. })
  87. },
  88. getRoadSpaceList() {
  89. this.loading = true
  90. uni.$u.api.statisticalReportApi.getRoadSpaceListApi({
  91. beginTime: this.beginTime,
  92. endTime: this.endTime,
  93. pageNum: this.tableData.current,
  94. pageSize: 10
  95. }).then(res => {
  96. if (res.code === 200) {
  97. this.tableData.list = res.rows;
  98. this.tableData.total = res.total
  99. }
  100. this.loading = false
  101. })
  102. },
  103. /**
  104. * 分页切换
  105. * @param { Number } cur
  106. */
  107. pageChange(cur) {
  108. this.tableData.current = cur
  109. this.getRoadSpaceList()
  110. }
  111. }
  112. }
  113. </script>
  114. <style lang="scss" scoped>
  115. @import './../../styles/report.scss';
  116. </style>