zhaoxiaoqiang1
2026-01-04 f1d30d03186c79ca2cbcfe60d6d2ce7d73fba97b
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
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
360
361
362
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
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
<template>
  <div>
    <div class="form-content">
      <FormList
        :info="formInfo"
        :isShowDetail="isShowDetail"
        @handleClick="isShowDetail = !isShowDetail"
        @updateValue="updateValue"
        @onSubmit="onSubmit"
        @setValueInfo="setValueInfo"
        :isChangeArray="false"
        @resetValue="resetValue"
      ></FormList>
    </div>
 
    <p class="export-excle">
      <Download :type="0" :values="valueInfo" @handleClick="download"></Download>
      <el-button icon="el-icon-download" size="small" type="primary" @click="downloadCustomerImagesForGM">导出影像资料</el-button>
 
      <span v-if="!hideButton">
        <el-button
          size="small"
          style="margin-left:50px"
          plain
          @click="doButtonAction(1)"
          class="el-button-primary"
        >正常入账认领</el-button>
        <el-button
          size="small"
          style="margin-left:20px"
          plain
          @click="doButtonAction(2)"
          class="el-button-primary"
        >提前结清认领</el-button>
        <el-button
          size="small"
          style="margin-left:20px"
          plain
          @click="doButtonAction(7)"
          class="el-button-primary"
        >手工发起扣款</el-button>
        <el-button
          size="small"
          style="margin-left:20px"
          plain
          @click="doButtonAction(3)"
          class="el-button-primary"
        >息费减免</el-button>
        <el-button
          size="small"
          style="margin-left:20px"
          plain
          @click="doButtonAction(4)"
          class="el-button-primary"
        >暂停计息</el-button>
        <el-button
          size="small"
          style="margin-left:20px"
          plain
          @click="doButtonAction(5)"
          class="el-button-primary"
        >提前结清试算</el-button>
        <el-button
          size="small"
          style="margin-left:20px"
          plain
          @click="doButtonAction(6)"
          class="el-button-primary"
        >发送结清证明</el-button>
 
        <el-button
          size="small"
          style="margin-left:20px"
          plain
          @click="showDailog"
          class="el-button-primary"
        >自定义列位置</el-button>
      </span>
    </p>
 
    <div class="list-content">
      <TableList
        :pageInfo="pageInfo"
        @doAction="doAction"
        @handleCurrentChange="handleCurrentChange"
        @handleSizeChange="handleSizeChange"
        @handleSelectionChange="handleSelectionChange"
        :isMultipleSelect="!hideButton"
        :activeIndex="activeIndex"
        :isAutoIndex="true"
        :isPaddingRight="false"
        ref="tableRef"
        :list="records"
        :header="tableHeader"
        :height="tableHeight"
        :loading="loading"
      ></TableList>
    </div>
 
    <p class="message">
      提示:超过12个月数据。请输入查询条件:申请编号或姓名。
    </p>
 
 
    <el-dialog
      width="850px"
      :visible.sync="isShowTrial"
      custom-class="comm-dialog"
      :modal-append-to-body="false"
    >
      <Trial
        :info="tempRecord"
        @handleClick="isShowTrial = false"
        :formList="trialHeader"
        @updateValue="updateTrialValue"
      ></Trial>
    </el-dialog>
    
  </div>
</template>
<script>
/**
 * 借据查询页面
 */
import FormList from './components/FormList'
import TableList from './components/TableList'
import Download from './components/Download'
import Trial from './components/Trial'
import {
  qryProdList,
  qryDimensionList,
  qryFlowPhaseList,
  getAllCityAreaList,
  // qryRepayTypeList,
  qryCustomRepayList,
  loanList,
  getDictionaryList,
  qryFirstInternalOrgInfo,
  createExportLoan,
  applyTransaction,
  malTrial,
  downloadCustomerImagesByLoanList
} from '@comprehensive/serve/public'
import { loanListHeader, trialHeader } from '@comprehensive/utils/tableHeaders'
import { debitSearch } from '@comprehensive/utils/formItems'
import { alert } from '@comprehensive/utils/comm'
 
const queryFlag = '02'
 
export default {
  name: 'LoanApply',
  components: {
    FormList,
    TableList,
    Download,
    Trial,
  },
  computed: {
    activeIndex(){
      const arr = []
      this.records.forEach((item,i) => {
        this.checkInfoList.forEach(val => {
          if(item.applyserialno == val.applyserialno){
            arr.push(i)
          }
        });
      });
      return arr
    }
  },
  data() {
    return {
      // 是否显示详情页
      isShowList: true,
 
      // 搜索表单字段及描述
      // formInfo: [...debitSearch],
      formInfo: [],
      trialHeader: [],
      tempRecord: {},
      // 借据查询过滤字段
      formInfoFilter: [
        'customerid',
        // 'paymentNameCodes',
        'businesssum',
        'businesstermmonth',
        'businesstermday',
        'extendtimes',
        'changePsLimit',
        'waiveLimit',
        'loanupStatus',
        'discountflag',
        'discounttype',
        'a1FeePayTypeCodes',
        'loanPutoutBTypeCode',
        'rfactorflag',
        // 'businesstermmonthlist',
        // 'businesstermdaylist',
        // 'businesssumlist'
      ],
      // 表单结果数据
      valueInfo: {},
      records: [],
      tableHeader: [...loanListHeader],
      pageInfo: {
        currentPage: 1,
        pageSize: 10,
        total: 0
      },
      // 是否显示所有表单项
      isShowDetail: false,
      checkInfoList: [],
      tableHeight: '560px',
      serialNo: '',
      objectType: '',
      customerID: '',
      loading: false,
      hideButton: true,
      isShowTrial: false,
    }
  },
  created() {
    if(this.$route.name == 'comprehensive') {
      this.hideButton = false
    }
    this.init()
  },
  methods: {
    showDailog(){
      this.$refs.tableRef.openDialog()
    },
    // 页面初始化处理
    init() {
      // 修改借据查询条件过滤
      const { formInfoFilter } = this
      this.formInfo = debitSearch.filter(
        ({ name }) => !formInfoFilter.includes(name)
      )
      this.qryPaymentName()
      this.qryProdList()
      this.qryDimensionList()
      this.qryFlowPhaseList()
      this.getAllCityAreaList()
      if(window.location.href.indexOf('loanDetail') < 0){
        this.loanList()
      }
      this.getDictionaryList()
      this.qryFirstInternalOrgInfo()
      // this.qryCustomRepayList()
      this.a1feepaytypeList()
      this.discountTypeList()
      this.loanputoutbtypeCodeList()
      this.discountLoanupStatus()
    },
 
    resetValue() {
      this.pageInfo.currentPage = 1
      this.loanList()
    },
 
    // 设置表单结果数据
    setValueInfo(info = {}) {
      this.valueInfo = info
    },
  // 导出协议影像信息
    async downloadCustomerImagesForGM() {
      const res = await downloadCustomerImagesByLoanList({
        ...this.valueInfo,
        ...this.pageInfo })
      if(res.code == '00'){
        alert('提交成功',res.msg,() => {})
      }
    },
// 还款方式
    async qryPaymentName() {
      const res = await getDictionaryList({ codeNo: 'PaymentName' })
      const { result } = res
      this.setOrGetFormInfo('paymentNameCodes', { options: result })
    },
 
    // 产品名称下拉列表
    async qryProdList() {
      const res = await qryProdList({ productTypeNo: '' })
      const { result } = res
      this.setOrGetFormInfo('productids', { options: result })
    },
 
    // 贴息类型
    async discountTypeList() {
      const res = await getDictionaryList({ codeNo: 'DiscountType' })
      const { result } = res
      this.setOrGetFormInfo('discounttype', { options: result })
    },
 
    // 借据状态
    async getDictionaryList() {
      const res = await getDictionaryList({ codeNo: 'LoanStatus' })
      const { result } = res
      this.setOrGetFormInfo('loanStatuses', { options: result })
    },
 
    // 手续费收取方式
    async a1feepaytypeList() {
      const res = await getDictionaryList({ codeNo: 'PoundageCharge' })
      const { result } = res
      this.setOrGetFormInfo('a1FeePayTypeCodes', { options: result })
    },
 
    // 贷款发放商家标志
    async loanputoutbtypeCodeList() {
      const res = await getDictionaryList({ codeNo: 'YesNo' })
      const { result } = res
      this.setOrGetFormInfo('loanPutoutBTypeCode', { options: result })
    },
 
    // 挂起状态
    async discountLoanupStatus() {
      const res = await getDictionaryList({ codeNo: 'YesNo' })
      const { result } = res
      this.setOrGetFormInfo('loanupStatus', { options: result })
    },
 
    // 产品维度下拉列表
    async qryDimensionList() {
      const { valueInfo } = this
      let { productid = '' } = valueInfo
      const res = await qryDimensionList({ productid })
      const { result } = res
      this.setOrGetFormInfo('dimensions', { options: result })
    },
 
    // 当前流程阶段下拉列表
    async qryFlowPhaseList() {
      const res = await qryFlowPhaseList({})
      const { result } = res
      this.setOrGetFormInfo('phaseNo', { options: result })
    },
 
    // 业务城市下拉列表
    async getAllCityAreaList() {
      const res = await getAllCityAreaList({ queryFlag })
      const { result } = res
      this.setOrGetFormInfo('businesscities', { options: result })
    },
 
    // 查询一级内部机构列表
    async qryFirstInternalOrgInfo() {
      const res = await qryFirstInternalOrgInfo({})
      const { result } = res
      this.setOrGetFormInfo('refereebllevel1iorg', { options: result })
      this.setOrGetFormInfo('formbllevel1iorg', { options: result })
    },
 
    // // 获取还款方式列表
    // async qryRepayTypeList() {
    //   const res = await qryRepayTypeList({
    //     // 贷款期限
    //     creditTerm: '',
 
    //     // 产品维度编号
    //     dimensionCode: '',
 
    //     // 产品编号
    //     productCode: '',
 
    //     // 还款方式 字典:PaymentName
    //     repaymentType: '',
 
    //     // 期限单位 M:月,D:日
    //     termUnit: ''
    //   })
    //   const { result } = res
    //   this.setOrGetFormInfo('paymentNameCodes', { options: result })
    // },
 
    // // 获取自定义还款方式列表
    // async qryCustomRepayList() {
    //   const res = await qryCustomRepayList({})
    //   const { result } = res
    //   this.setOrGetFormInfo('paymentNameCodes', { options: result })
    // },
 
    updateTrialValue(index, info) {
      const { value } = info
      const dateFormate = 'YYYY/MM/DD'
      if (value === null) {
        return false
      }
      let item  = this.checkInfoList[0]
      this.toTrial(item, {
        trialDate: this.dayjs(value).format(dateFormate)
      })
    },
 
    // 获取当前数据列表
    async loanList() {
      this.loading = true
      let { valueInfo, pageInfo, serialNo } = this
      const res = await loanList({
        ...valueInfo,
        ...pageInfo
      })
      const { records = [], total, pages } = res.result
      this.loading = false
      this.records = records.reduce((pre, curr) => {
        // 贷款期限处理
        const { termUnit, businessTermMonth, businessTermDay } = curr
        let businessTerm = ''
        if (termUnit === 'M' && businessTermMonth) {
          businessTerm = `${businessTermMonth}月`
        }
        if (termUnit === 'D' && businessTermDay) {
          businessTerm = `${businessTermDay}天`
        }
        pre.push({
          ...curr,
          businessTerm
        })
        return pre
      }, [])
 
      this.pageInfo = {
        ...pageInfo,
        total
      }
    },
 
    // 更新表单数据或查找某项数据
    setOrGetFormInfo(nameKey, newInfo) {
      let { formInfo } = this
      let index = formInfo.findIndex(({ name }) => name === nameKey)
      let result = {}
      if (!isNaN(index)) {
        this.$set(this.formInfo, index, { ...formInfo[index], ...newInfo })
        result = this.formInfo[index]
      }
      if (typeof newInfo === 'undefined') {
        return result
      }
    },
 
    // 更新数据
    updateValue(value, item) {
      let { name } = item
      this.setOrGetFormInfo(name, { value })
      if (name === 'productid') {
        this.qryDimensionList()
      }
    },
 
    // 查询操作
    onSubmit() {
      // let { valueInfo } = this
      this.pageInfo.currentPage = 1
      this.loanList()
    },
 
    // 表单事件回调
    doAction(name, item, index) {
      // 点击申请编号的处理
      if (name === 'applyserialno') {
        const {
          applyserialno,
          flowno,
          objecttype,
          customerid,
          occurType,
          productID
        } = item
        // flowno objecttype 两个字段接口暂时缺失
        this.serialNo = applyserialno
        this.customerID = customerid
 
        // 注意objecttype非驼峰命名,跟接口一致
        this.objectType = objecttype
 
        this.isShowList = false
        this.$router.push(
          `/comprehensiveTransaction/loanDetail/${applyserialno}?occurType=${occurType}&flowno=${flowno}&objectType=${objecttype}&customerID=${customerid}&productID=${productID}`
        )
 
        // // 案场贷款申请详情
        // if (flowno === 'CreditFlowCase') {
        //   this.isShowList = false
        //   this.$router.push(
        //     `/comprehensiveTransaction/loanDetail/${applyserialno}?flowno=${flowno}&objectType=${objecttype}&customerID=${customerid}`
        //   )
        // } else {
        //   this.$message('目前仅完成案场功能!')
        // }
 
        // // 非案场贷款申请详情
        // if (flowno === 'CreditFlowCommon') {
        // }
 
        // // 易贷贷款申请详情
        // if (flowno === 'MortgageFlow') {
        // }
 
        // // 快贷贷款申请详情
        // if (flowno === 'BuildingBusinessFlow') {
        // }
        // console.log(
        //   `name: ${name}, flowno: ${flowno}, serialNo: ${applyserialno}`
        // )
      }
    },
 
    // 财务放款阶段需要获取列表选中的数据
    handleSelectionChange(array) {
      this.checkInfoList = array;
    },
 
    async doButtonAction(val) {
      if (!this.checkInfoList.length) {
        this.$message.warning("请选择需要处理的数据");
        return;
      }
      if (this.checkInfoList.length !== 1) {
        this.$message.warning("只可选择一条数据");
        return;
      }
      
      // const origin = 'http://10.1.1.163'// location.origin
      const origin =  location.origin
      let item  = this.checkInfoList[0]
      if(val == 1) {
        location.href = origin + `/rlc-mal-web/#/comm/apply?pageId=41&serialNo=${item.loanserialno}&transCode=T1004&isApplyPhase=2&isHiddenAppoveOpinion=1&phaseNo=0010&applyType=01`
      }
      if(val == 2) {
        location.href = origin + `/rlc-mal-web/#/comm/apply?pageId=41&serialNo=${item.loanserialno}&transCode=T1004&isApplyPhase=2&isHiddenAppoveOpinion=1&phaseNo=0010&applyType=03`
      }
      if(val == 3) {
        let {result}  = await applyTransaction({ transCode: "5001", loanSerialno: item.loanserialno})
        location.href = origin + `/rlc-mal-web/#/comm/apply?serialNo=&transCode=5001&pageId=37&transLogSerialno=${result.transLogSerialno}&objectType=TransactionApply&tabName=%E7%94%B3%E8%AF%B7%E4%BF%A1%E6%81%AF&phaseNo=0000&isApplyPhase=1&isHiddenAppoveOpinion=2`
      }
      if(val == 4) {
        location.href = origin + `/rlc-mal-web/#/comm/apply?pageId=41&serialNo=${item.loanserialno}&transCode=T1004&isApplyPhase=2&isHiddenAppoveOpinion=1&phaseNo=0010&applyType=01`
      }
      if(val == 5) {
        this.toTrial(item)
        // let { transLogSerialno } = await applyTransaction({ transCode: "2000", loanSerialno: item.loanserialno})
        // location.href = origin + `/rlc-mal-web/#/comm/apply?objectType=TransactionApply&applySerialno=${item.applyserialno}&transCode=2000&codeNo=&phaseNo=0030&pageId=&loanSerialno=${item.loanserialno}&withholdStatus=&transLogSerialno=${transLogSerialno}&tabName=%E7%94%B3%E8%AF%B7%E4%BF%A1%E6%81%AF&isApplyPhase=1&isHiddenAppoveOpinion=2`
      }
      if(val == 6) {
        if(item.loanstatus == 2 || item.loanstatus == 3 || item.loanstatus == 4) {
          location.href = origin + `/rlc-mal-web/#/comm/apply?pageId=&serialNo=${item.loanserialno}&applySerialno=&phaseNo=&objectType=TransactionApply&transCode=T1009&isApplyPhase=1&isHiddenAppoveOpinion=1&objectNo=${item.applyserialno}&parameterMap=%7B%22ObjectNo%22%3A%22${item.applyserialno}%22%7D`
        } else {
          this.$message.warning("该单据未结清,不支持结清证明发送");
        }
      }
      if(val == 7) {
        let { result } = await applyTransaction({ transCode: "2001", loanSerialno: item.loanserialno})
        location.href = origin +`/rlc-mal-web/#/comm/apply?objectType=TransactionApply&applySerialno=${item.applyserialno}&transCode=2001&codeNo=&phaseNo=&pageId=&loanSerialno=${item.loanserialno}&withholdStatus=&transLogSerialno=${result.transLogSerialno}&tabName=%E7%94%B3%E8%AF%B7%E4%BF%A1%E6%81%AF&isApplyPhase=1&isHiddenAppoveOpinion=2`
      }
    },
 
    async toTrial(item,info) {
      const {result} = await malTrial({
        loanSerialno: item.loanserialno,
        ...info
      })
      const detail = result
      // 逾期部分应还总金额 = 逾期应还本金+逾期应还罚息+逾期应还利息+逾期应还手续费+逾期应还平台服务费+逾期应还担保费+逾期应还展期费+逾期应还还款计划变更手续费
      detail.overdueAllBalance =  (parseFloat(detail.overduePrincipalBalance) + 
                                 parseFloat(detail.overduePalpenaltyBalance) +
                                 parseFloat(detail.overdueInterestBalance) +
                                 parseFloat(detail.overdueInterestBalanceA1) + 
                                 parseFloat(detail.overdueInterestBalanceA2) + 
                                 parseFloat(detail.overdueInterestBalanceA3) + 
                                 parseFloat(detail.overdueInterestBalanceA6) + 
                                 parseFloat(detail.overdueInterestBalanceA8)).toFixed(2)
      // 提前结清部分应还总金额 = 提前还本金+提前还罚息+提前还利息+提前还手续费+提前还平台服务费+提前还担保费+提前还展期费+归还提前还款违约金金额+提前还展期费+提前还还款计划变更手续费
      // detail.repayBalance =  (parseFloat(detail.prePrincipalBalance) + 
      //                       parseFloat(detail.prePalpenaltyBalance) +
      //                       parseFloat(detail.preInterestBalance) +
      //                       parseFloat(detail.preInterestBalanceA1) + 
      //                       parseFloat(detail.preInterestBalanceA2) + 
      //                       parseFloat(detail.preInterestBalanceA3) + 
      //                       parseFloat(detail.interestBalanceA5) + 
      //                       parseFloat(detail.preInterestBalanceA6) + 
      //                       parseFloat(detail.preInterestBalanceA8)).toFixed(2)
      
      
      this.isShowTrial = true
      this.trialHeader = this.getFormList(detail)
      this.tempRecord = detail
      if (Object.keys(info).length > 0) {
        this.$message.success('数据已更新!')
      }
    },
 
 
  getFormList(initValues = {}, list) {
    const formList = trialHeader
    if (typeof list === 'undefined') {
      list = [...formList]
    }
    const keys = Object.keys(initValues)
    if (keys.length > 0) {
      return list.reduce((pre, curr) => {
        let { value, name, descName, descValue, children } = curr
        if (typeof value === 'undefined' && Array.isArray(children)) {
          // has children
          pre.push({
            ...curr,
            children: this.getFormList(initValues, children)
          })
        } else {
          let result = { ...curr }
          result.value =
            typeof initValues[name] === 'undefined' ? value : initValues[name]
          if (typeof descValue === 'undefined' && descName) {
            const dValue = initValues[descName]
            result.descValue = typeof dValue === 'undefined' ? '' : dValue
          }
          pre.push(result)
        }
        return pre
      }, [])
    }
    return [...list]
  },
    // 点击详情页返回的处理
    backList(flg = true) {
      this.isShowList = flg
    },
 
    // 修改翻页条数
    handleSizeChange(val) {
      this.pageInfo.pageSize = val
      this.loanList()
    },
 
    // 修改翻页数
    handleCurrentChange(val) {
      this.pageInfo.currentPage = val
      this.loanList()
    },
 
    // 导出excle
    async download(values = {}) {
      const res = await createExportLoan(values)
      if(res.code == '00'){
        alert('提交成功',res.msg,() => {})
      }
    }
  }
}
</script>
<style lang="postcss" scoped>
.list-content {
  font-size: 14px;
}
.export-excle {
  margin: 0 0 20px 0;
}
.message{
  font-size: 12px;
  color: #666666;
  padding: 10px 20px;
  background-color: #FAFAFA;
}
</style>