arrearsReport.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <!-- 欠费统计 -->
  2. <template>
  3. <view class="container">
  4. <view class="tab">
  5. <u-tabs
  6. :list="tabList"
  7. lineColor="#fff"
  8. :activeStyle="{
  9. color: '#fff',
  10. fontWeight: 'bold',
  11. transform: 'scale(1.05)'
  12. }"
  13. :inactiveStyle="{
  14. color: '#000',
  15. transform: 'scale(1)'
  16. }"
  17. @click="tabClick">
  18. </u-tabs>
  19. </view>
  20. <view class="table">
  21. <view class="table-date" v-if="currentDate">{{ currentDate.join(' 至 ') }}</view>
  22. <view class="table-box">
  23. <TableRanking :loading="loading" :padding="'0'" :tableTh="tableTh" :tableData="tableData"
  24. @pageChange="pageChange" />
  25. </view>
  26. </view>
  27. <view class="total">
  28. <view>
  29. 欠费次数<text>{{ totalData.oweCount || 0 }}</text>次,欠费金额<text>{{ totalData.amtOwe || 0 }}</text>元
  30. </view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. import TableRanking from '@/components/tableRanking.vue'
  36. export default {
  37. components: {
  38. TableRanking
  39. },
  40. props: {
  41. tableTh: {
  42. type: Array,
  43. default: () => {
  44. return [
  45. { field: '车牌号', key: 'vehicleNo', width: 100 },
  46. { field: '车主姓名', key: 'name', width: 100 },
  47. { field: '联系方式', key: 'mobile', width: 100 },
  48. { field: '欠费次数(次)', width: 80, key: 'oweCount' },
  49. { field: '欠费金额(元)', width: 80, key: 'amtOwe' }
  50. ]
  51. }
  52. }
  53. },
  54. data() {
  55. return {
  56. loading: false,
  57. totalData: {},
  58. tableData: {
  59. current: 1,
  60. total: 0,
  61. list: []
  62. },
  63. tabCurName: 'road',
  64. currentDate: [],
  65. beginTime: undefined,
  66. endTime: undefined,
  67. tabList: [
  68. { name: '路段', value: 'road' },
  69. { name: '停车场', value: 'parking' }
  70. ]
  71. }
  72. },
  73. methods: {
  74. tabClick(item) {
  75. this.tabCurName = item.value
  76. this.tableData.current = 1
  77. if (this.tabCurName === 'road') {
  78. this.getArreasReportTotal()
  79. this.getArreasReportList()
  80. } else {
  81. this.getParkingArreasReportTotal()
  82. this.getParkingArreasReportList()
  83. }
  84. },
  85. getData(data) {
  86. if (data.length) {
  87. this.beginTime = data[0]
  88. this.endTime = data[1]
  89. }
  90. this.currentDate = data
  91. this.tableData.current = 1
  92. if (this.tabCurName === 'road') {
  93. this.getArreasReportTotal()
  94. this.getArreasReportList()
  95. } else {
  96. this.getParkingArreasReportTotal()
  97. this.getParkingArreasReportList()
  98. }
  99. },
  100. getArreasReportTotal() {
  101. uni.$u.api.statisticalReportApi.getArrearsReportTotalApi({
  102. beginTime: this.beginTime,
  103. endTime: this.endTime
  104. }).then(res => {
  105. if (res.code === 200) {
  106. this.totalData = res.data
  107. }
  108. })
  109. },
  110. getParkingArreasReportTotal() {
  111. uni.$u.api.statisticalReportApi.getParkingArrearsReportTotalApi({
  112. beginTime: this.beginTime,
  113. endTime: this.endTime
  114. }).then(res => {
  115. if (res.code === 200) {
  116. this.totalData = res.data
  117. }
  118. })
  119. },
  120. getArreasReportList() {
  121. this.loading = true
  122. uni.$u.api.statisticalReportApi.getArrearsReportListApi({
  123. beginTime: this.beginTime,
  124. endTime: this.endTime,
  125. pageNum: this.tableData.current,
  126. pageSize: 10
  127. }).then(res => {
  128. if (res.code === 200) {
  129. this.tableData.list = res.rows
  130. this.tableData.total = res.total
  131. }
  132. this.loading = false
  133. })
  134. },
  135. getParkingArreasReportList() {
  136. this.loading = true
  137. uni.$u.api.statisticalReportApi.getParkingArrearsReportListApi({
  138. beginTime: this.beginTime,
  139. endTime: this.endTime,
  140. pageNum: this.tableData.current,
  141. pageSize: 10
  142. }).then(res => {
  143. if (res.code === 200) {
  144. this.tableData.list = res.rows
  145. this.tableData.total = res.total
  146. }
  147. this.loading = false
  148. })
  149. },
  150. pageChange(cur) {
  151. this.tableData.current = cur
  152. if (this.tabCurName === 'road') {
  153. this.getArreasReportList()
  154. } else {
  155. this.getParkingArreasReportList()
  156. }
  157. }
  158. }
  159. }
  160. </script>
  161. <style lang="scss" scoped>
  162. @import './report.scss';
  163. .tab {
  164. margin-bottom: 10px;
  165. }
  166. </style>