Blame view

src/views/fee/applyRoomDiscountManageList.vue 10.7 KB
43eaaadb   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
  <template>
    <div class="apply-room-discount-container">
      <!-- 查询条件 -->
      <el-card class="search-wrapper">
        <div slot="header" class="flex justify-between">
          <span>{{ $t('applyRoomDiscount.search.title') }}</span>
        </div>
        <el-row :gutter="20">
          <el-col :span="6">
            <el-input v-model.trim="searchForm.roomName" :placeholder="$t('applyRoomDiscount.search.roomName')"
              clearable />
          </el-col>
          <el-col :span="6">
            <el-select v-model="searchForm.applyType" :placeholder="$t('applyRoomDiscount.search.applyType')"
              style="width:100%">
              <el-option v-for="item in applyTypes" :key="item.applyType" :label="item.typeName"
                :value="item.applyType" />
            </el-select>
          </el-col>
          <el-col :span="6">
            <el-select v-model="searchForm.state" :placeholder="$t('applyRoomDiscount.search.state')" style="width:100%">
              <el-option v-for="item in states" :key="item.statusCd" :label="item.name" :value="item.statusCd" />
            </el-select>
          </el-col>
          <el-col :span="6">
            <el-button type="primary" @click="handleSearch">
              {{ $t('common.search') }}
            </el-button>
            <el-button @click="handleReset">
              {{ $t('common.reset') }}
            </el-button>
          </el-col>
        </el-row>
      </el-card>
  
      <!-- 列表 -->
      <el-card class="list-wrapper">
        <div slot="header" class="flex justify-between">
          <span>{{ $t('applyRoomDiscount.list.title') }}</span>
          <div style="float: right;">
            <el-button type="primary" size="small" @click="handleOpenDiscountType">
              {{ $t('applyRoomDiscount.button.discountType') }}
            </el-button>
            <el-button type="primary" size="small" @click="handleOpenAddApply">
              <i class="el-icon-plus"></i>
              {{ $t('applyRoomDiscount.button.phoneApply') }}
            </el-button>
            <el-button type="primary" size="small" @click="handleExport">
              <i class="el-icon-download"></i>
              {{ $t('applyRoomDiscount.button.export') }}
            </el-button>
          </div>
        </div>
  
        <el-table v-loading="loading" :data="tableData" border style="width: 100%">
          <el-table-column prop="roomName" :label="$t('applyRoomDiscount.table.roomName')" align="center" />
          <el-table-column prop="discountId" :label="$t('applyRoomDiscount.table.discountId')" align="center" />
          <el-table-column prop="discountName" :label="$t('applyRoomDiscount.table.discountName')" align="center" />
          <el-table-column prop="applyTypeName" :label="$t('applyRoomDiscount.table.applyType')" align="center" />
          <el-table-column prop="createUserName" :label="$t('applyRoomDiscount.table.createUser')" align="center" />
          <el-table-column prop="createUserTel" :label="$t('applyRoomDiscount.table.createUserTel')" align="center" />
          <el-table-column prop="startTime" :label="$t('applyRoomDiscount.table.startTime')" align="center" />
          <el-table-column prop="endTime" :label="$t('applyRoomDiscount.table.endTime')" align="center" />
          <el-table-column prop="stateName" :label="$t('applyRoomDiscount.table.state')" align="center" />
          <el-table-column prop="createTime" :label="$t('applyRoomDiscount.table.createTime')" align="center" />
          <el-table-column :label="$t('applyRoomDiscount.table.inUse')" align="center">
            <template slot-scope="scope">
              {{ scope.row.inUse === '0' ? $t('applyRoomDiscount.status.notUsed') : $t('applyRoomDiscount.status.used') }}
            </template>
          </el-table-column>
          <el-table-column :label="$t('applyRoomDiscount.table.returnType')" align="center">
            <template slot-scope="scope">
              {{ scope.row.discountId ? (scope.row.returnWay === '1002' ? $t('applyRoomDiscount.returnType.account') :
                $t('applyRoomDiscount.returnType.discount')) : '-' }}
            </template>
          </el-table-column>
          <el-table-column :label="$t('applyRoomDiscount.table.returnAmount')" align="center">
            <template slot-scope="scope">
              {{ scope.row.returnAmount ? scope.row.returnAmount : '-' }}
            </template>
          </el-table-column>
          <el-table-column :label="$t('common.operation')" align="center" width="300" fixed="right">
            <template slot-scope="scope">
              <el-button v-if="scope.row.state === '1' && hasPrivilege('502021010723590006')" size="mini"
                @click="handleOpenCheck(scope.row)">
                {{ $t('applyRoomDiscount.button.check') }}
              </el-button>
              <el-button size="mini" @click="handleOpenRecord(scope.row)">
                {{ $t('applyRoomDiscount.button.record') }}
              </el-button>
              <el-button v-if="scope.row.state === '2' && hasPrivilege('502021010761730007')" size="mini"
                @click="handleOpenReview(scope.row)">
                {{ $t('applyRoomDiscount.button.review') }}
              </el-button>
              <el-button size="mini" @click="handleOpenEdit(scope.row)">
                {{ $t('common.edit') }}
              </el-button>
              <el-button size="mini" type="danger" @click="handleOpenDelete(scope.row)">
                {{ $t('common.delete') }}
              </el-button>
            </template>
          </el-table-column>
        </el-table>
  
        <el-pagination :current-page.sync="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-card>
  
      <!-- 子组件 -->
      <add-apply-room-discount ref="addApplyRoomDiscount" @success="handleSuccess" />
      <edit-apply-room-discount ref="editApplyRoomDiscount" @success="handleSuccess" />
      <edit-apply-room-discount-record ref="editApplyRoomDiscountRecord" @success="handleSuccess" />
      <review-apply-room-discount ref="reviewApplyRoomDiscount" @success="handleSuccess" />
      <delete-apply-room-discount ref="deleteApplyRoomDiscount" @success="handleSuccess" />
      <view-image ref="viewImage" />
    </div>
  </template>
  
  <script>
b9b17c9e   wuxw   v1.9 解决优惠申请导出bug
121
  import { getDict,getCommunityId } from '@/api/community/communityApi'
43eaaadb   wuxw   开发房屋优惠折扣
122
123
124
125
126
127
128
  import { queryApplyRoomDiscount, queryApplyRoomDiscountType } from '@/api/fee/applyRoomDiscountManageApi'
  import AddApplyRoomDiscount from '@/components/fee/addApplyRoomDiscount'
  import EditApplyRoomDiscount from '@/components/fee/editApplyRoomDiscount'
  import EditApplyRoomDiscountRecord from '@/components/fee/editApplyRoomDiscountRecord'
  import ReviewApplyRoomDiscount from '@/components/fee/reviewApplyRoomDiscount'
  import DeleteApplyRoomDiscount from '@/components/fee/deleteApplyRoomDiscount'
  import ViewImage from '@/components/system/viewImage'
2061c5fb   wuxw   v1.9 解决房屋收费页面抄表记录...
129
130
  import {  exportData } from '@/api/report/reportFeeSummaryApi'
  
43eaaadb   wuxw   开发房屋优惠折扣
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
  
  export default {
    name: 'ApplyRoomDiscountManageList',
    components: {
      AddApplyRoomDiscount,
      EditApplyRoomDiscount,
      EditApplyRoomDiscountRecord,
      ReviewApplyRoomDiscount,
      DeleteApplyRoomDiscount,
      ViewImage
    },
    data() {
      return {
        loading: false,
        searchForm: {
          roomName: '',
          applyType: '',
          state: '',
          communityId: ''
        },
        tableData: [],
        applyTypes: [],
        states: [],
        pagination: {
          current: 1,
          size: 10,
          total: 0
        }
      }
    },
    created() {
      this.getList()
      this.getApplyTypes()
      this.getDictData()
b9b17c9e   wuxw   v1.9 解决优惠申请导出bug
165
      this.searchForm.communityId = getCommunityId()
43eaaadb   wuxw   开发房屋优惠折扣
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
    },
    methods: {
      async getList() {
        try {
          this.loading = true
          const params = {
            page: this.pagination.current,
            row: this.pagination.size,
            ...this.searchForm
          }
          const { data, total } = await queryApplyRoomDiscount(params)
          this.tableData = data
          this.pagination.total = total
        } catch (error) {
          this.$message.error(this.$t('applyRoomDiscount.fetchError'))
        } finally {
          this.loading = false
        }
      },
      async getApplyTypes() {
        try {
          const { data } = await queryApplyRoomDiscountType({
            page: 1,
            row: 50,
            communityId: this.searchForm.communityId
          })
          this.applyTypes = data
        } catch (error) {
          console.error('获取申请类型失败:', error)
        }
      },
      async getDictData() {
        try {
          const data = await getDict('apply_room_discount', 'state')
          this.states = data
        } catch (error) {
          console.error('获取字典数据失败:', error)
        }
      },
      handleSearch() {
        this.pagination.current = 1
        this.getList()
      },
      handleReset() {
        this.searchForm = {
          roomName: '',
          applyType: '',
          state: '',
          communityId: ''
        }
        this.handleSearch()
      },
      handleSizeChange(val) {
        this.pagination.size = val
        this.getList()
      },
      handleCurrentChange(val) {
        this.pagination.current = val
        this.getList()
      },
      handleOpenAddApply() {
        this.$refs.addApplyRoomDiscount.open()
      },
      handleOpenEdit(row) {
        this.$refs.editApplyRoomDiscountRecord.open(row)
      },
      handleOpenCheck(row) {
        this.$refs.editApplyRoomDiscount.open(row)
      },
      handleOpenRecord(row) {
        this.$router.push({
f99ceb4f   wuxw   收据优化完成
237
          path: '/views/fee/listApplyRoomDiscountRecord',
43eaaadb   wuxw   开发房屋优惠折扣
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
          query: {
            ardId: row.ardId,
            roomId: row.roomId,
            roomName: row.roomName,
            state: row.state,
            stateName: row.stateName
          }
        })
      },
      handleOpenReview(row) {
        this.$refs.reviewApplyRoomDiscount.open(row)
      },
      handleOpenDelete(row) {
        this.$refs.deleteApplyRoomDiscount.open(row)
      },
      handleOpenDiscountType() {
        this.$router.push('/views/fee/discountType')
      },
b9b17c9e   wuxw   v1.9 解决优惠申请导出bug
256
     async handleExport() {
43eaaadb   wuxw   开发房屋优惠折扣
257
        // 导出逻辑
b9b17c9e   wuxw   v1.9 解决优惠申请导出bug
258
259
260
261
262
263
264
265
266
267
268
269
270
271
        try {
          const params = {
            ...this.searchForm,
            communityId: this.searchForm.communityId,
            pagePath: 'applyRoomDiscount'
          }
  
          await exportData(params)
          this.$message.success(this.$t('reportFeeSummary.exportSuccess'))
          this.$router.push('/pages/property/downloadTempFile?tab=下载中心')
        } catch (error) {
          console.error('Failed to export:', error)
          this.$message.error(this.$t('reportFeeSummary.exportFailed'))
        }
43eaaadb   wuxw   开发房屋优惠折扣
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
      },
      handleSuccess() {
        this.getList()
      },
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .apply-room-discount-container {
    padding: 20px;
  
    .search-wrapper {
      margin-bottom: 20px;
  
      .el-row {
        margin-bottom: -20px;
      }
  
      .el-col {
        margin-bottom: 20px;
      }
    }
  
    .list-wrapper {
      margin-bottom: 20px;
  
      .el-pagination {
        margin-top: 20px;
        text-align: right;
      }
    }
  }
  </style>