Blame view

src/views/fee/adminOweFeeDetailList.vue 8.64 KB
10d3499d   wuxw   开发完成 admin 台账功能
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
  <template>
    <div class="admin-owe-fee-detail-container animated fadeInRight">
      <el-row :gutter="20" class="flex justify-start">
        <el-col :span="4" class="room-floor-unit-tree">
          <community-floor-tree ref="communityFloorTree" @chooseFloor="handleChooseFloor" />
        </el-col>
        <el-col :span="20" class="margin-top-xs">
          <el-card class="box-card">
            <div slot="header" class="clearfix text-left">
              <span>{{ $t('adminOweFeeDetail.search.title') }}</span>
            </div>
            <el-row :gutter="20">
              <el-col :span="4">
                <el-select v-model="searchForm.feeTypeCd" :placeholder="$t('adminOweFeeDetail.search.feeTypeCd')" clearable
                  class="w-full">
                  <el-option v-for="item in feeTypeCds" :key="item.statusCd" :label="item.name" :value="item.statusCd" />
                </el-select>
              </el-col>
              <el-col :span="4">
                <el-input v-model="searchForm.objNameLike" :placeholder="$t('adminOweFeeDetail.search.objNameLike')"
                  clearable />
              </el-col>
              <el-col :span="4">
                <el-date-picker v-model="searchForm.startTime" type="date"
                  :placeholder="$t('adminOweFeeDetail.search.startTime')" class="w-full" />
              </el-col>
              <el-col :span="4">
                <el-date-picker v-model="searchForm.endTime" type="date"
                  :placeholder="$t('adminOweFeeDetail.search.endTime')" class="w-full" />
              </el-col>
              <el-col :span="4">
                <el-input v-model="searchForm.ownerNameLike" :placeholder="$t('adminOweFeeDetail.search.ownerNameLike')"
                  clearable />
              </el-col>
              <el-col :span="4">
                <el-button type="primary" @click="handleSearch">
                  {{ $t('common.search') }}
                </el-button>
                <el-button @click="handleReset" style="margin-left: 10px;">
                  {{ $t('common.reset') }}
                </el-button>
              </el-col>
            </el-row>
          </el-card>
  
          <el-card class="box-card margin-top">
            <div slot="header" class="clearfix  text-left" >
              <span>{{ $t('adminOweFeeDetail.list.title') }}</span>
            </div>
            <el-table :data="tableData" border style="width: 100%" v-loading="loading">
              <el-table-column prop="index" :label="$t('adminOweFeeDetail.table.index')" width="80" align="center" />
              <el-table-column prop="communityName" :label="$t('adminOweFeeDetail.table.communityName')" align="center" />
              <el-table-column prop="objName" :label="$t('adminOweFeeDetail.table.objName')" align="center" />
              <el-table-column prop="ownerName" :label="$t('adminOweFeeDetail.table.ownerName')" align="center" />
              <el-table-column prop="ownerTel" :label="$t('adminOweFeeDetail.table.ownerTel')" align="center" />
              <el-table-column prop="builtUpArea" :label="$t('adminOweFeeDetail.table.builtUpArea')" align="center" />
              <el-table-column prop="feeName" :label="$t('adminOweFeeDetail.table.feeName')" align="center" />
              <el-table-column prop="startTime" :label="$t('adminOweFeeDetail.table.startTime')" align="center" />
              <el-table-column prop="endTime" :label="$t('adminOweFeeDetail.table.endTime')" align="center" />
              <el-table-column prop="oweDay" :label="$t('adminOweFeeDetail.table.oweDay')" align="center" />
              <el-table-column prop="oweAmount" :label="$t('adminOweFeeDetail.table.oweAmount')" align="center" />
            </el-table>
  
            <el-row class="margin-top  text-left">
              <el-col :span="24">
                <div>
                  <span class="font-bold">{{ $t('adminOweFeeDetail.summary.subtotal') }}</span>
                  <span class="margin-left">
                    {{ $t('adminOweFeeDetail.summary.owe') }}: {{ totalPreferentialAmount }}
                    {{ $t('adminOweFeeDetail.summary.yuan') }}
                  </span>
                </div>
                <div>
                  <span class="font-bold">{{ $t('adminOweFeeDetail.summary.total') }}</span>
                  <span class="margin-left">
                    {{ $t('adminOweFeeDetail.summary.owe') }}: {{ allOweAmount }}
                    {{ $t('adminOweFeeDetail.summary.yuan') }}
                  </span>
                </div>
              </el-col>
            </el-row>
  
            <el-row class="margin-top  text-left">
              <el-col :span="12">
                <div>{{ $t('adminOweFeeDetail.tips.startTime') }}</div>
                <div>{{ $t('adminOweFeeDetail.tips.oweDayDeposit') }}</div>
                <div>{{ $t('adminOweFeeDetail.tips.oweDayOther') }}</div>
                <div>{{ $t('adminOweFeeDetail.tips.oweAmount') }}</div>
              </el-col>
              <el-col :span="12" class="text-right">
                <el-pagination :current-page="pagination.current" :page-sizes="[10, 20, 30, 50]"
                  :page-size="pagination.size" :total="pagination.total" layout="total, sizes, prev, pager, next, jumper"
                  @size-change="handleSizeChange" @current-change="handleCurrentChange" />
              </el-col>
            </el-row>
          </el-card>
        </el-col>
      </el-row>
    </div>
  </template>
  
  <script>
  import { queryAdminOweFeeDetail } from '@/api/fee/adminOweFeeDetailApi'
  import CommunityFloorTree from '@/components/fee/communityFloorTree'
  
  export default {
    name: 'AdminOweFeeDetailList',
    components: {
      CommunityFloorTree
    },
    data() {
      return {
        loading: false,
        searchForm: {
          floorId: '',
          floorName: '',
          roomNum: '',
          objNameLike: '',
          feeTypeCd: '',
          startTime: '',
          endTime: '',
          communityId: '',
          ownerNameLike: ''
        },
        feeTypeCds: [],
        tableData: [],
        totalPreferentialAmount: 0,
        allOweAmount: 0,
        pagination: {
          current: 1,
          size: 10,
          total: 0
        }
      }
    },
    created() {
      this.initData()
    },
    methods: {
      async initData() {
        try {
          this.loading = true
          await this.getFeeTypeCds()
          await this.getList()
        } catch (error) {
          console.error(error)
        } finally {
          this.loading = false
        }
      },
      async getFeeTypeCds() {
        // 这里应该是获取费用类型的字典数据
        // 假设从字典接口获取数据
        this.feeTypeCds = [
          { statusCd: '1', name: this.$t('adminOweFeeDetail.feeType.property') },
          { statusCd: '2', name: this.$t('adminOweFeeDetail.feeType.parking') }
        ]
      },
      async getList() {
        try {
          this.loading = true
          const params = {
            ...this.searchForm,
            page: this.pagination.current,
            row: this.pagination.size
          }
          const { data, total } = await queryAdminOweFeeDetail(params)
          this.tableData = data.map((item, index) => ({
            ...item,
            index: index + 1
          }))
          this.pagination.total = total
  
          // 计算小计
          let _totalPreferentialAmount = 0.0
          data.forEach(item => {
            _totalPreferentialAmount += parseFloat(item.oweAmount)
          })
          this.totalPreferentialAmount = _totalPreferentialAmount.toFixed(2)
  
          if (data.length > 0) {
            this.allOweAmount = data[0].allOweAmount || 0.0.toFixed(2)
          } else {
            this.allOweAmount = 0.0.toFixed(2)
          }
        } catch (error) {
          console.error(error)
          this.$message.error(this.$t('adminOweFeeDetail.fetchError'))
        } finally {
          this.loading = false
        }
      },
      handleSearch() {
        this.pagination.current = 1
        this.getList()
      },
      handleReset() {
        this.searchForm = {
          floorId: '',
          floorName: '',
          roomNum: '',
          objNameLike: '',
          feeTypeCd: '',
          startTime: '',
          endTime: '',
          communityId: '',
          ownerNameLike: ''
        }
        this.handleSearch()
      },
      handleSizeChange(val) {
        this.pagination.size = val
        this.getList()
      },
      handleCurrentChange(val) {
        this.pagination.current = val
        this.getList()
      },
      handleChooseFloor(floor) {
        this.searchForm.floorId = floor.floorId
        this.searchForm.floorName = floor.floorNum
        this.searchForm.communityId = floor.communityId
        this.searchForm.communityName = floor.communityName
        this.handleSearch()
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .admin-owe-fee-detail-container {
    padding: 20px;
  
    .margin-top {
      margin-top: 20px;
    }
  
    .margin-left {
      margin-left: 10px;
    }
  
    .font-bold {
      font-weight: bold;
    }
  
    .text-right {
      text-align: right;
    }
  
    .room-floor-unit-tree {
      padding-right: 0;
    }
  }
  </style>