Blame view

src/components/fee/simplifyFeeReceipt.vue 13.8 KB
24d3590f   wuxw   房屋收费页面开发完成
1
2
  <template>
    <div>
6f916870   wuxw   优化甘肃客户反馈bug
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
      <div class="margin-top-lg flex justify-between">
        <div class="flex justify-start">
          <div :span="3" class="padding-right-xs padding-left-xl">
            <el-select v-model="simplifyFeeReceiptInfo.objType" size="small" @change="_changeSimplifyFeeReceiptFeeTypeCd"
              :placeholder="$t('simplifyFeeReceipt.selectFeeType')">
              <el-option v-for="(item, index) in simplifyFeeReceiptInfo.objTypes" :key="index" :label="item.name"
                :value="item.statusCd"></el-option>
            </el-select>
          </div>
          <div :span="3" class="padding-right-xs padding-left-xl" v-if="simplifyFeeReceiptInfo.objType == '6666'">
            <el-select v-model="simplifyFeeReceiptInfo.carId" size="small" @change="changeSimplifyFeeReceiptCar"
              :placeholder="$t('simplifyFeeReceipt.selectCar')">
              <el-option v-for="(item, index) in simplifyFeeReceiptInfo.ownerCars" :key="index" :label="item.carNum"
                :value="item.carId"></el-option>
            </el-select>
          </div>
          <div :span="3" class="padding-right-xs padding-left-xl" v-else-if="simplifyFeeReceiptInfo.objType == '7777'">
            <el-select v-model="simplifyFeeReceiptInfo.contractId" size="small" @change="changeSimplifyFeeReceiptCar"
              :placeholder="$t('simplifyFeeReceipt.selectContract')">
              <el-option v-for="(item, index) in simplifyFeeReceiptInfo.ownerContracts" :key="index"
                :label="item.contractCode" :value="item.contractId"></el-option>
            </el-select>
          </div>
          <div :span="3" class="padding-right-xs padding-left-xl" v-if="simplifyFeeReceiptInfo.objType != '7777'">
            <el-select v-model="simplifyFeeReceiptInfo.ownerFlag" size="small" @change="_queryFeeReceiptMethod">
              <el-option
                :label="$t('simplifyFeeReceipt.current') + (simplifyFeeReceiptInfo.objType == '6666' ? $t('simplifyFeeReceipt.car') : $t('simplifyFeeReceipt.room'))"
                value="F"></el-option>
              <el-option
                :label="$t('simplifyFeeReceipt.all') + (simplifyFeeReceiptInfo.objType == '6666' ? $t('simplifyFeeReceipt.car') : $t('simplifyFeeReceipt.room'))"
                value="T"></el-option>
            </el-select>
          </div>
          <div :span="3" class="padding-right-xs padding-left-xl">
            <el-input v-model="simplifyFeeReceiptInfo.receiptCode" size="small"
              :placeholder="$t('simplifyFeeReceipt.receiptCode')"></el-input>
          </div>
          <div :span="2" class="padding-right-xs padding-left-xl">
            <el-button type="primary" size="small" @click="_queryFeeReceiptMethod">
              {{ $t('simplifyFeeReceipt.query') }}
            </el-button>
          </div>
        </div>
        <div :span="8" class="text-right padding-right-lg">
24d3590f   wuxw   房屋收费页面开发完成
47
48
49
50
51
52
53
54
55
56
57
58
          <el-button type="primary" size="small" @click="_printFeeReceipt('OFF')">
            {{ $t('simplifyFeeReceipt.print') }}
          </el-button>
          <el-button type="primary" size="small" @click="_printFeeReceipt('ON')">
            {{ $t('simplifyFeeReceipt.mergePrint') }}
          </el-button>
          <el-button type="primary" size="small" @click="_printFeeSmallReceipt">
            {{ $t('simplifyFeeReceipt.printSmall') }}
          </el-button>
          <el-button type="primary" size="small" @click="_printApplyFeeReceipt">
            {{ $t('simplifyFeeReceipt.apply') }}
          </el-button>
6f916870   wuxw   优化甘肃客户反馈bug
59
60
        </div>
      </div>
24d3590f   wuxw   房屋收费页面开发完成
61
      <div class="margin-top">
e5f65d68   wuxw   测试补打收据
62
        <el-table :data="simplifyFeeReceiptInfo.feeReceipts" @selection-change="handleSelectionChange" border stripe>
6f916870   wuxw   优化甘肃客户反馈bug
63
          <el-table-column type="selection" width="55" align="center"></el-table-column>
24d3590f   wuxw   房屋收费页面开发完成
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
          <el-table-column prop="receiptCode" :label="$t('simplifyFeeReceipt.receiptCode')"
            align="center"></el-table-column>
          <el-table-column :label="$t('simplifyFeeReceipt.feeType')" align="center">
            <template slot-scope="scope">
              {{ _getFeeObjName(scope.row.objType) }}{{ $t('simplifyFeeReceipt.fee') }}
            </template>
          </el-table-column>
          <el-table-column prop="objName" :label="_getFeeObjName(simplifyFeeReceiptInfo.objType)"
            align="center"></el-table-column>
          <el-table-column prop="payObjName" :label="$t('simplifyFeeReceipt.owner')" align="center"></el-table-column>
          <el-table-column prop="feeName" :label="$t('simplifyFeeReceipt.feeItem')" align="center"></el-table-column>
          <el-table-column :label="$t('simplifyFeeReceipt.timePeriod')" align="center">
            <template slot-scope="scope">
              {{ dateFormat(scope.row.startTime) }}~<br>
              <span v-if="scope.row.startTime >= scope.row.endTime">
                {{ dateFormat(scope.row.endTime) }}
              </span>
              <span v-else>
                {{ dateFormat(scope.row.endTime) }}
              </span>
            </template>
          </el-table-column>
          <el-table-column prop="amount" :label="$t('simplifyFeeReceipt.totalAmount')" align="center">
            <template slot-scope="scope">
              {{ scope.row.amount }}{{ $t('simplifyFeeReceipt.yuan') }}
            </template>
          </el-table-column>
          <el-table-column prop="createTime" :label="$t('simplifyFeeReceipt.payTime')" align="center"></el-table-column>
          <el-table-column prop="receiptId" :label="$t('simplifyFeeReceipt.receiptId')" align="center"></el-table-column>
        </el-table>
        <el-pagination @current-change="handleCurrentChange" :current-page="currentPage" :page-size="pageSize"
          layout="total, prev, pager, next" :total="total">
        </el-pagination>
      </div>
    </div>
  </template>
  
  <script>
  import { getCommunityId, getDict } from '@/api/community/communityApi'
  import { queryFeeReceipt, listFeePrintPage } from '@/api/fee/simplifyFeeReceiptApi'
  import { queryOwnerCars } from '@/api/room/ownerCarsApi'
  import { queryContract } from '@/api/contract/contractChangeDetailApi'
  import { dateFormat } from '@/utils/dateUtil'
  
  export default {
    name: 'SimplifyFeeReceipt',
    data() {
      return {
        DEFAULT_PAGE: 1,
        DEFAULT_ROWS: 50,
        simplifyFeeReceiptInfo: {
          feeReceipts: [],
          objType: '3333',
          objId: '',
          payObjId: '',
          roomId: '',
          carId: '',
          receiptCode: '',
          total: '',
          records: '',
          ownerId: '',
          objTypes: [],
          ownerCars: [],
          ownerContracts: [],
          selectReceipts: [],
          ownerFlag: 'F',
          contractId: '',
          quan: false,
f5128dde   wuxw   优化打印404 问题
132
          printUrl: '/#/pages/property/printPayFee'
24d3590f   wuxw   房屋收费页面开发完成
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
        },
        currentPage: 1,
        pageSize: 10,
        total: 0
      }
    },
    watch: {
      'simplifyFeeReceiptInfo.selectReceipts': {
        handler(newVal) {
          this.simplifyFeeReceiptInfo.quan = newVal.length === this.simplifyFeeReceiptInfo.feeReceipts.length
        },
        deep: true
      }
    },
    created() {
24d3590f   wuxw   房屋收费页面开发完成
148
149
150
151
    },
    methods: {
      handleSwitch(param) {
        if (param.roomId === '') return
6f916870   wuxw   优化甘肃客户反馈bug
152
  
24d3590f   wuxw   房屋收费页面开发完成
153
        this.clearSimplifyFeeReceiptInfo()
6f916870   wuxw   优化甘肃客户反馈bug
154
155
        this._loadDictData()
  
24d3590f   wuxw   房屋收费页面开发完成
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
        this._listFeePrintPages()
        Object.assign(this.simplifyFeeReceiptInfo, param)
        this.simplifyFeeReceiptInfo.objId = param.roomId
        this.simplifyFeeReceiptInfo.payObjId = param.ownerId
        this._listSimplifyFeeReceipt(this.DEFAULT_PAGE, this.DEFAULT_ROWS)
      },
      handleCurrentChange(val) {
        this._listSimplifyFeeReceipt(val, this.DEFAULT_ROWS)
      },
      async _loadDictData() {
        try {
          const data = await getDict('fee_receipt', 'obj_type')
          this.simplifyFeeReceiptInfo.objTypes = data
        } catch (error) {
          console.error('Failed to load dict data:', error)
        }
      },
      async _listSimplifyFeeReceipt(page, rows) {
        this.simplifyFeeReceiptInfo.selectReceipts = []
        this.simplifyFeeReceiptInfo.quan = false
        let objId = ''
        if (this.simplifyFeeReceiptInfo.objType === '3333') {
          objId = this.simplifyFeeReceiptInfo.roomId
        } else if (this.simplifyFeeReceiptInfo.objType === '6666') {
          objId = this.simplifyFeeReceiptInfo.carId
        } else {
          objId = this.simplifyFeeReceiptInfo.contractId
        }
  
        const params = {
          page,
          row: rows,
          objType: this.simplifyFeeReceiptInfo.objType,
          objId,
          receiptCode: this.simplifyFeeReceiptInfo.receiptCode,
          communityId: getCommunityId()
        }
  
        if (this.simplifyFeeReceiptInfo.ownerFlag === 'T') {
          params.objId = ''
          params.payObjId = this.simplifyFeeReceiptInfo.payObjId
        }
  
        try {
          const res = await queryFeeReceipt(params)
          this.simplifyFeeReceiptInfo.total = res.total
          this.simplifyFeeReceiptInfo.records = res.records
          this.simplifyFeeReceiptInfo.feeReceipts = res.data
          this.total = res.records
        } catch (error) {
          console.error('Request failed:', error)
        }
      },
      _queryFeeReceiptMethod() {
        this._listSimplifyFeeReceipt(this.DEFAULT_PAGE, this.DEFAULT_ROWS)
      },
      _printFeeReceipt(merge) {
        if (this.simplifyFeeReceiptInfo.selectReceipts.length < 1) {
          this.$message.warning(this.$t('simplifyFeeReceipt.selectReceipt'))
          return
        }
        const receiptids = this.simplifyFeeReceiptInfo.selectReceipts.join(',')
        window.open(`${this.simplifyFeeReceiptInfo.printUrl}?receiptIds=${receiptids}&apply=N&merge=${merge}`)
      },
      _printApplyFeeReceipt() {
        if (this.simplifyFeeReceiptInfo.selectReceipts.length < 1) {
          this.$message.warning(this.$t('simplifyFeeReceipt.selectReceipt'))
          return
        }
        const receiptids = this.simplifyFeeReceiptInfo.selectReceipts.join(',')
f5128dde   wuxw   优化打印404 问题
226
        window.open(`/#/pages/property/printPayFee?receiptIds=${receiptids}&apply=Y`)
24d3590f   wuxw   房屋收费页面开发完成
227
228
229
230
231
232
233
      },
      _printFeeSmallReceipt() {
        if (this.simplifyFeeReceiptInfo.selectReceipts.length < 1) {
          this.$message.warning(this.$t('simplifyFeeReceipt.selectReceipt'))
          return
        }
        const receiptids = this.simplifyFeeReceiptInfo.selectReceipts.join(',')
f5128dde   wuxw   优化打印404 问题
234
        window.open(`/#/pages/property/printSmallPayFee?receiptIds=${receiptids}`)
24d3590f   wuxw   房屋收费页面开发完成
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
      },
      clearSimplifyFeeReceiptInfo() {
        this.simplifyFeeReceiptInfo = {
          feeReceipts: [],
          objType: '3333',
          objId: '',
          roomId: '',
          carId: '',
          receiptCode: '',
          total: '',
          records: '',
          ownerId: '',
          objTypes: [],
          ownerCars: [],
          ownerContracts: [],
          selectReceipts: [],
          ownerFlag: 'F',
          contractId: '',
          quan: false,
f5128dde   wuxw   优化打印404 问题
254
          printUrl: '/#/pages/property/printPayFee'
24d3590f   wuxw   房屋收费页面开发完成
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
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
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
        }
      },
      async _changeSimplifyFeeReceiptFeeTypeCd(objType) {
        if (objType === '3333') {
          this.$emit('notify', {})
        } else if (objType === '6666') {
          try {
            await this._listSimplifyFeeReceiptOwnerCar()
            this.$emit('notify', {})
          } catch (error) {
            console.error(error)
          }
        } else {
          try {
            await this._listSimplifyFeeReceiptOwnerContract()
            this.$emit('notify', {})
          } catch (error) {
            console.error(error)
          }
        }
      },
      changeSimplifyFeeReceiptCar() {
        this._changeSimplifyFeeReceiptFeeTypeCd(this.simplifyFeeReceiptInfo.objType)
      },
      async _listSimplifyFeeReceiptOwnerCar() {
        try {
          const res = await queryOwnerCars({
            page: 1,
            row: 50,
            ownerId: this.simplifyFeeReceiptInfo.ownerId,
            carTypeCd: '1001',
            communityId: getCommunityId()
          })
          this.simplifyFeeReceiptInfo.ownerCars = res.data
          if (res.data.length > 0) {
            this.simplifyFeeReceiptInfo.carId = res.data[0].carId
            return res.data
          }
          throw new Error(this.$t('simplifyFeeReceipt.noCar'))
        } catch (error) {
          console.error('Request failed:', error)
          throw error
        }
      },
      async _listSimplifyFeeReceiptOwnerContract() {
        try {
          const res = await queryContract({
            page: 1,
            row: 50,
            objId: this.simplifyFeeReceiptInfo.ownerId,
            communityId: getCommunityId()
          })
          this.simplifyFeeReceiptInfo.ownerContracts = res.data
          if (res.data.length > 0) {
            this.simplifyFeeReceiptInfo.contractId = res.data[0].contractId
            return res.data
          }
          throw new Error(this.$t('simplifyFeeReceipt.noContract'))
        } catch (error) {
          console.error('Request failed:', error)
          throw error
        }
      },
      checkAllReceipt(e) {
        const checkObj = document.querySelectorAll('.checReceiptItem')
        if (e.target.checked) {
          checkObj.forEach(item => {
            if (!item.checked) {
              this.simplifyFeeReceiptInfo.selectReceipts.push(item.value)
            }
          })
        } else {
          this.simplifyFeeReceiptInfo.selectReceipts = []
        }
      },
      _getFeeObjName(feeTypeCd) {
        if (feeTypeCd === '3333') {
          return this.$t('simplifyFeeReceipt.room')
        } else if (feeTypeCd === '6666') {
          return this.$t('simplifyFeeReceipt.car')
        } else {
          return this.$t('simplifyFeeReceipt.contract')
        }
      },
      async _listFeePrintPages() {
        try {
          const res = await listFeePrintPage({
            page: 1,
            row: 1,
            state: 'T',
            communityId: getCommunityId()
          })
          const feePrintPages = res.data
          if (feePrintPages && feePrintPages.length > 0) {
            this.simplifyFeeReceiptInfo.printUrl = feePrintPages[0].url
          }
        } catch (error) {
          console.error('Request failed:', error)
        }
      },
      open(params) {
        this.handleSwitch(params)
      },
      dateFormat(date) {
        return dateFormat(date)
e5f65d68   wuxw   测试补打收据
360
361
362
      },
      handleSelectionChange(val) {
        this.simplifyFeeReceiptInfo.selectReceipts = val.map(item => item.receiptId)
24d3590f   wuxw   房屋收费页面开发完成
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
      }
    }
  }
  </script>
  
  <style scoped>
  .margin-top-lg {
    margin-top: 20px;
  }
  
  .padding-right-xs {
    padding-right: 5px;
  }
  
  .padding-left-xl {
    padding-left: 20px;
  }
  
  .text-right {
    text-align: right;
  }
  
  .padding-right-lg {
    padding-right: 20px;
  }
  </style>