revenueRanking.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <!-- 路段/停车场营收排行 -->
  2. <template>
  3. <view class="ranking">
  4. <TableRanking :loading="loading" :title="title" :tableTh="tableTh" :tableData="tableData" @pageChange="pageChange"/>
  5. </view>
  6. </template>
  7. <script>
  8. import TableRanking from '@/components/tableRanking.vue'
  9. export default {
  10. components: {
  11. TableRanking
  12. },
  13. props: {
  14. title: {
  15. type: String,
  16. default: ''
  17. },
  18. tableTh: {
  19. type: Array,
  20. default: () => [
  21. { field: '路段编号', key: 'roadNo' },
  22. { field: '路段名称', key: 'roadName' },
  23. { field: '收益(元)', key: 'amt' }
  24. ]
  25. }
  26. },
  27. data() {
  28. return {
  29. tableData: {
  30. current: 1,
  31. total: 0,
  32. list: []
  33. },
  34. reportType: '',
  35. queryDate: '',
  36. loading: false
  37. }
  38. },
  39. methods: {
  40. getData({ reportType, queryDate }) {
  41. this.reportType = reportType
  42. this.queryDate = queryDate
  43. this.tableData.current = 1
  44. this.getList()
  45. },
  46. getList() {
  47. this.loading = true
  48. uni.$u.api.operationalAnalysisApi.getParkingLotRevenueDataApi({
  49. pageNum: this.tableData.current,
  50. pageSize: 10,
  51. reportType: this.reportType,
  52. queryDate: this.queryDate
  53. }).then(res => {
  54. if (res.code === 200) {
  55. this.tableData.list = res.rows
  56. this.tableData.total = res.total
  57. }
  58. this.loading = false
  59. }).catch(() => {
  60. this.loading = false
  61. })
  62. },
  63. pageChange(current) {
  64. this.tableData.current = current
  65. this.getList()
  66. }
  67. }
  68. }
  69. </script>
  70. <style lang="scss" scoped>
  71. .ranking-title {
  72. text-align: center;
  73. margin-bottom: 10px;
  74. }
  75. </style>