Blame view

src/components/owner/ownerRooms.vue 3.05 KB
af1bcbd6   wuxw   房屋页面开发中
1
  <template>
81955f61   wuxw   优化房屋页面
2
    <el-dialog :title="$t('ownerRooms.title')" :visible.sync="visible" width="70%" :before-close="handleClose">
af1bcbd6   wuxw   房屋页面开发中
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
      <el-table :data="ownerRoomsInfo.rooms" style="width: 100%">
        <el-table-column prop="roomId" :label="$t('ownerRooms.roomId')" align="center" />
        <el-table-column prop="layer" :label="$t('ownerRooms.layer')" align="center" />
        <el-table-column prop="roomSubTypeName" :label="$t('ownerRooms.type')" align="center" />
        <el-table-column :label="$t('ownerRooms.area')" align="center">
          <template slot-scope="scope">
            {{ scope.row.builtUpArea }}/{{ scope.row.roomArea }}
          </template>
        </el-table-column>
        <el-table-column prop="roomRent" :label="$t('ownerRooms.rent')" align="center" />
        <el-table-column prop="stateName" :label="$t('ownerRooms.status')" align="center" />
        <el-table-column :label="$t('ownerRooms.oweFee')" align="center">
          <template slot-scope="scope">
            {{ scope.row.roomOweFee || '0.00' }} ({{ $t('ownerRooms.updateDaily') }})
          </template>
        </el-table-column>
      </el-table>
81955f61   wuxw   优化房屋页面
20
21
  
      <el-row class="mt-3 margin-top">
af1bcbd6   wuxw   房屋页面开发中
22
23
24
25
        <el-col :span="8">
          <span>{{ $t('ownerRooms.subtotal') }}: {{ ownerRoomsInfo.allOweFeeAmount }}</span>
        </el-col>
        <el-col :span="16" class="text-right">
81955f61   wuxw   优化房屋页面
26
27
          <el-pagination :current-page="pagination.currentPage" :page-size="pagination.pageSize" :total="pagination.total"
            layout="prev, pager, next" @current-change="handlePageChange" />
af1bcbd6   wuxw   房屋页面开发中
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
        </el-col>
      </el-row>
    </el-dialog>
  </template>
  
  <script>
  import { queryRoomsByOwner } from '@/api/room/ownerRoomsApi'
  
  export default {
    name: 'OwnerRooms',
    data() {
      return {
        visible: false,
        ownerRoomsInfo: {
          rooms: [],
          ownerId: '',
          allOweFeeAmount: 0
        },
        pagination: {
          currentPage: 1,
          pageSize: 10,
          total: 0
        }
      }
    },
    methods: {
      open(params) {
        this.ownerRoomsInfo.ownerId = params.ownerId
        this.visible = true
        this.loadOwnerRoomInfo()
      },
      handleClose() {
        this.visible = false
      },
      handlePageChange(page) {
        this.pagination.currentPage = page
        this.loadOwnerRoomInfo()
      },
      async loadOwnerRoomInfo() {
        try {
          const params = {
            page: this.pagination.currentPage,
            row: this.pagination.pageSize,
            communityId: this.getCommunityId(),
            ownerId: this.ownerRoomsInfo.ownerId
          }
81955f61   wuxw   优化房屋页面
74
  
af1bcbd6   wuxw   房屋页面开发中
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
          const response = await queryRoomsByOwner(params)
          this.ownerRoomsInfo.rooms = response.rooms
          this.pagination.total = response.total || 0
          this.computeOwnerRoomOweFeeAmount()
        } catch (error) {
          console.error('加载业主房屋信息失败:', error)
        }
      },
      computeOwnerRoomOweFeeAmount() {
        let totalOweFeeAmount = 0
        this.ownerRoomsInfo.rooms.forEach(room => {
          if (room.roomOweFee) {
            totalOweFeeAmount += parseFloat(room.roomOweFee)
          }
        })
        this.ownerRoomsInfo.allOweFeeAmount = totalOweFeeAmount.toFixed(2)
      }
    }
  }
  </script>