Blame view

src/components/owner/ownerOweFees.vue 2.95 KB
af1bcbd6   wuxw   房屋页面开发中
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
  <template>
    <el-dialog
      :visible.sync="visible"
      :title="$t('ownerOweFees.title')"
      width="80%"
      top="5vh"
      custom-class="custom-modal"
      @close="handleClose"
    >
      <el-table
        :data="ownerOweFeesInfo.fees"
        stripe
        border
        style="width: 100%; margin-top: 15px"
      >
        <el-table-column
          prop="payerObjName"
          :label="$t('ownerOweFees.payerObj')"
          align="center"
        />
        <el-table-column
          prop="ownerName"
          :label="$t('ownerOweFees.ownerName')"
          align="center"
        />
        <el-table-column
          prop="ownerTel"
          :label="$t('ownerOweFees.phone')"
          align="center"
        />
        <el-table-column
          prop="endTime"
          :label="$t('ownerOweFees.startTime')"
          align="center"
        />
        <el-table-column
          prop="deadlineTime"
          :label="$t('ownerOweFees.endTime')"
          align="center"
        />
        <el-table-column
          prop="amountOwed"
          :label="`${$t('ownerOweFees.total')} (${$t('ownerOweFees.unit')})`"
          align="center"
        />
        <el-table-column
          prop="updateTime"
          :label="$t('ownerOweFees.updateTime')"
          align="center"
        />
      </el-table>
      
      <el-pagination
        v-if="pagination.total > 0"
        background
        layout="prev, pager, next"
        :total="pagination.total"
        :page-size="pagination.pageSize"
        :current-page="pagination.currentPage"
        @current-change="handlePageChange"
        style="margin-top: 20px; text-align: right"
      />
    </el-dialog>
  </template>
  
  <script>
  import { getOwnerOweFees } from '@/api/room/ownerOweFeesApi'
  
  export default {
    name: 'OwnerOweFees',
    data() {
      return {
        visible: false,
        ownerOweFeesInfo: {
          fees: [],
          ownerId: ''
        },
        pagination: {
          total: 0,
          pageSize: 10,
          currentPage: 1
        }
      }
    },
    methods: {
      open(ownerId) {
        this.ownerOweFeesInfo.ownerId = ownerId
        this.pagination.currentPage = 1
        this.visible = true
        this.loadData()
      },
      handleClose() {
        this.visible = false
      },
      handlePageChange(currentPage) {
        this.pagination.currentPage = currentPage
        this.loadData()
      },
      async loadData() {
        try {
          const params = {
            page: this.pagination.currentPage,
            row: this.pagination.pageSize,
            communityId: this.getCommunityId(),
            ownerId: this.ownerOweFeesInfo.ownerId
          }
          
          const response = await getOwnerOweFees(params)
          this.ownerOweFeesInfo.fees = response.data
          this.pagination.total = response.records
        } catch (error) {
          console.error('加载欠费信息失败:', error)
          this.$message.error(this.$t('common.loadFailed'))
        }
      },
      getCommunityId() {
        return this.$store.state.user.currentCommunity.communityId
      }
    }
  }
  </script>
  
  <style scoped>
  .custom-modal >>> .el-dialog__body {
    padding: 15px 20px;
  }
  </style>