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
<template>
  <div>
    <div class="form-content">
      <FormList
        :info="formInfo"
        :isShowDetail="isShowDetail"
        @handleClick="isShowDetail = !isShowDetail"
        @updateValue="updateValue"
        @onSubmit="onSubmit"
        @setValueInfo="setValueInfo"
        :isChangeArray="false"
      ></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>
    </p>
 
    <div class="list-content">
      <TableList
        :isAutoIndex="false"
        :isPaddingRight="false"
        :list="records"
        :header="tableHeader"
        :height="tableHeight"
        :loading="loading"
        :pageInfo="pageInfo"
        :isMultipleSelect="true"
        @doAction="doAction"
        @handleCurrentChange="handleCurrentChange"
        @handleSizeChange="handleSizeChange"
        @handleSelectionChange="handleSelectionChange"
        :rowKey="'applyserialno'"
        :isReserve="true"
        ref="CommTable"
      ></TableList>
    </div>
    <p class="message">
      提示:超过12个月数据。请输入查询条件:申请编号或姓名。
    </p>
    
  </div>
</template>
<script>
/**
 * 借据查询页面-资方
 */
import FormList from './components/FormList'
import TableList from './components/TableList'
import Download from './components/Download'
import {
  qryProdList,
  qryDimensionList,
  qryFlowPhaseList,
  getAllCityAreaList,
  // qryRepayTypeList,
  qryCustomRepayList,
  loanList,
  getDictionaryList,
  qryFirstInternalOrgInfo,
  createExportLoan,
  applyDownloadCustomerImagesForGM
} from '@comprehensive/serve/public'
import { capitalLoanListHeader } from '@comprehensive/utils/tableHeaders'
import { debitCapitalSearch } from '@comprehensive/utils/formItems'
import { alert } from '@comprehensive/utils/comm'
 
const queryFlag = '02'
 
export default {
  name: 'LoanApply',
  components: {
    FormList,
    TableList,
    Download
  },
  data() {
    return {
      // 是否显示详情页
      isShowList: true,
 
      // 搜索表单字段及描述
      // formInfo: [...debitCapitalSearch],
      formInfo: [],
      // 借据查询过滤字段
      formInfoFilter: [
        'customerid',
        'paymentNameCodes',
        'businesssum',
        'businesstermmonth',
        'businesstermday',
        'extendtimes',
        'changePsLimit',
        'waiveLimit',
        'loanupStatus',
        'discountflag',
        'discounttype',
        'a1FeePayTypeCodes',
        'loanPutoutBTypeCode',
        'rfactorflag'
      ],
      // 表单结果数据
      valueInfo: {},
      records: [],
      selectionRows: [], // 选中行
      tableHeader: [...capitalLoanListHeader],
      pageInfo: {
        currentPage: 1,
        pageSize: 10,
        total: 0
      },
      // 是否显示所有表单项
      isShowDetail: false,
 
      tableHeight: '560px',
      serialNo: '',
      objectType: '',
      customerID: '',
      loading: false
    }
  },
  created() {
    this.init()
  },
  methods: {
    // 页面初始化处理
    init() {
      // 修改借据查询条件过滤
      const { formInfoFilter } = this
      this.formInfo = debitCapitalSearch.filter(
        ({ name }) => !formInfoFilter.includes(name)
      )
      this.qryProdList()
      this.qryDimensionList()
      this.qryFlowPhaseList()
      this.getAllCityAreaList()
      this.loanList()
      this.getDictionaryList()
      this.qryFirstInternalOrgInfo()
      this.qryCustomRepayList()
      this.a1feepaytypeList()
      this.discountTypeList()
      this.loanputoutbtypeCodeList()
      this.discountLoanupStatus()
    },
 
    // 设置表单结果数据
    setValueInfo(info = {}) {
      this.valueInfo = info
    },
 
    // 产品名称下拉列表
    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 })
    },
 
    // 获取当前数据列表
    async loanList() {
      this.loading = true
      let { valueInfo, pageInfo, serialNo } = this
      const res = await loanList({
        ...valueInfo,
        ...pageInfo,
        fundunitNo: 'GMXT'
      })
      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.$refs.CommTable.clearTableSelection()
      this.pageInfo.currentPage = 1
      this.loanList()
    },
 
    // 表单事件回调
    doAction(name, item, index) {
      // 点击申请编号的处理
      if (name === 'applyserialno') {
        const {
          applyserialno,
          flowno,
          objecttype,
          customerid,
          occurType
        } = 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}&source=capital`
        )
 
        // // 案场贷款申请详情
        // 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}`
        // )
      }
    },
 
    // 点击详情页返回的处理
    backList(flg = true) {
      this.isShowList = flg
    },
 
    // 修改翻页条数
    handleSizeChange(val) {
      this.pageInfo.pageSize = val
      this.loanList()
    },
 
    // 修改翻页数
    handleCurrentChange(val) {
      this.pageInfo.currentPage = val
      this.loanList()
    },
 
    handleSelectionChange(rows) {
      let rowIds = []
      rows.map(item => {
        rowIds.push(item.applyserialno)
      })
      this.selectionRows = [...rowIds]
      console.log('rows:', rowIds)
    },
 
    // 导出excle
    async download(values = {}) {
      const res = await createExportLoan({...values, fundunitNo: 'GMXT' })
      if(res.code == '00'){
        alert('提交成功',res.msg,() => {})
      }
    },
    // 导出协议影像信息
    async downloadCustomerImagesForGM() {
      let {selectionRows} = this
      if(!selectionRows.length) {
        this.$message.warning('请至少选择一条要导出的数据!')
        return
      }
      const res = await applyDownloadCustomerImagesForGM({objectnos: [...selectionRows] })
      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>