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
<template>
  <div class="search-form">
    <CommForm
      :inline="true"
      :list="formList"
      @updateValue="updateValue"
      @buttonAction="buttonAction"
      ref="form"
      :formValues="formValues"
      :buttons="formButtons"
      :isShowAll="isShowAll"
      title="交易信息"
    ></CommForm>
 
    <CommTable
      :pageInfo="pageInfo"
      :total="total"
      @doAction="doAction"
      @handleCurrentChange="handleCurrentChange"
      @handleSizeChange="handleSizeChange"
      :loading="loading"
      :list="records"
      :header="tableHeader"
      v-bind="$attrs"
    ></CommTable>
 
    <el-dialog
      :visible.sync="dialogEditClaim"
      custom-class="comm-dialog"
      :modal-append-to-body="false"
    >
      <EditClaim
        :info="tempRecord"
        @close="dialogEditClaim = false"
        :isShow="dialogEditClaim"
        :detail="tempInfo"
        :trxnBr="trxnBr"
        :buttonProp="buttonProp"
        :isEdit="false"
      ></EditClaim>
    </el-dialog>
 
    <el-dialog
      :visible.sync="dialogRefundTransInfo"
      custom-class="comm-dialog"
      :modal-append-to-body="false"
      width="940px"
    >
      <RefundTransInfo :info="tempRecord"></RefundTransInfo>
    </el-dialog>
  </div>
</template>
<script>
// 交易信息
import CommForm from '@/components/CommForm'
import CommTable from '@/components/CommTable'
import EditClaim from '@/components/EditClaim'
import RefundTransInfo from '@/components/RefundTransInfo'
import claimRefundTransList from '@/controller/claimRefundTransList'
import queryCodeValueList from '@/controller/queryCodeValueList'
import claimRefundInfo from '@/controller/claimRefundInfo'
import transDataAuthority from '@/controller/transDataAuthority'
 
const recordButtons = [
  {
    text: '详情',
    prop: 'detailsButton'
  },
  {
    text: '交易入账明细',
    prop: 'transButton'
  }
]
 
export default {
  components: {
    CommForm,
    CommTable,
    EditClaim,
    RefundTransInfo
  },
  data() {
    return {
      loading: false,
      isShowAll: false,
      dialogEditClaim: false,
      dialogRefundTransInfo: false,
      query: {},
      trxnBr: '',
      buttonProp: '',
      tempInfo: {},
      model: null,
      detailModel: null,
      claimRefundModel: null,
      formList: [],
      tableHeader: [],
      formButtons: [
        { text: '重置', type: 'default' },
        { text: '搜索' },
        { text: '展开', type: 'fold' }
      ],
      pageInfo: {
        currentPage: 1,
        pageSize: 10
      },
      total: 0,
      records: [],
      tempRecord: {}
    }
  },
  created() {
    this.init()
  },
  methods: {
    init() {
      const { query } = this.$route
      const { trxnBr } = query
      this.query = query
      this.trxnBr = trxnBr
      const model = claimRefundTransList()
      this.formList = model.getFormList()
      this.tableHeader = model.getTableList()
      this.model = model
      this.codeNameModel = queryCodeValueList()
      this.claimRefundModel = claimRefundInfo('remark')
      this.detailModel = transDataAuthority()
 
      model.computedItem = item => {
        return {
          ...item,
          action: {
            buttons: recordButtons.filter(
              button => Number(item[button.prop]) === 1
            )
          }
        }
      }
 
      this.setSelectOptions()
      this.getList()
    },
 
    // 设置表单下拉菜单
    setSelectOptions() {
      const { formList } = this
      formList.forEach(({ name }) => {
        if (name === 'transTypeArray') {
          this.queryCodeValueList(name)
        }
        if (name === 'status') {
          this.claimRefundTransList(name, { codeNo: 'ClaimStatus' })
        }
      })
    },
 
    // 获取列表
    async getList() {
      this.loading = true
      let { pageInfo, formValues, model, trxnBr } = this
      // 自动扣款挂起管理新增查询条件字段loanUpStatus
      if (formValues.loanUpStatusArray) {
        formValues.loanUpStatus = formValues.loanUpStatusArray
      }
      const res = await model.request({
        trxnBr,
        ...pageInfo,
        ...formValues
      })
      this.loading = false
      const { list = [], total } = res
      this.records = list
      this.total = parseInt(total)
    },
 
    // 更新表单数据
    updateValue(index, info) {
      const { formList } = this
      if (isNaN(index)) {
        index = formList.findIndex(({ name }) => name === index)
      }
      if (!isNaN(index) && index > -1) {
        const preInfo = formList[index]
        this.$set(formList, index, { ...preInfo, ...info })
        if (preInfo.name === 'productid') {
          this.qryDimensionList()
        }
      }
    },
 
    // 贷后交易名称下拉列表
    async queryCodeValueList(name) {
      // const codeNameModel = queryTransCodeNameList()
      const codeNameModel = queryCodeValueList()
      const { list } = await codeNameModel.request({ codeNo: 'TransCodeEnum' })
      this.updateValue(name, { options: list })
    },
 
    // 获取select中options数据
    async claimRefundTransList(name, info = {}) {
      const tempModel = claimRefundTransList()
      const { list } = await tempModel.request(info)
      this.updateValue(name, { options: list })
    },
 
    // 修改翻页条数
    handleSizeChange(val) {
      this.pageInfo.pageSize = val
      this.getList()
    },
 
    // 修改翻页数
    handleCurrentChange(val) {
      this.pageInfo.currentPage = val
      this.getList()
    },
 
    // 表单按钮事件处理
    buttonAction(id) {
      if (id === 0) {
        this.resetForm()
      }
      if (id === 1) {
        this.resetList()
      }
      if (id === 2) {
        const { isShowAll } = this
        this.isShowAll = !isShowAll
      }
    },
 
    // 表格按钮事件处理
    doAction(item, record) {
      const { prop } = item
      this.tempRecord = { ...record }
      if (prop === 'transButton') {
        this.dialogRefundTransInfo = true
      } else {
        this.doDetail()
      }
    },
 
    // 表格按钮事件处理
    doDetail() {
      const { tempRecord } = this
      const { transType } = tempRecord
 
      // 按钮部分待完善
      // 点击打开对应申请-查询详情
      // 当为“预收息费认领”时暂不需支持显示详情页,详情按钮灰显示
      // 当为“还款认领”时,显示“转账还款认领-处理&查询详情”内容
      // 当为“虚拟认领”时,显示“虚拟认领确认”弹窗内容,无提交按钮。
      // 当为“虚拟认领撤销”时,显示“虚拟认领撤销确认”弹窗字段,无提交按钮。
      // 当为“贴息结算认领”时,显示“贴息结算-详情”内容
      // 当为“预收息费认领撤销”、“贴息结算认领撤销”、“还款认领撤销”时,显示“转账认领撤销申请-处理&查询详情”内容
 
      // transType
      // 交易编号6001打开转账退款审批阶段一详情
      // 交易编号6002打开显示“虚拟认领确认”弹窗内容
      // 交易编号6003打开虚拟认领撤销显示“虚拟认领撤销确认”弹窗字段
      // 交易编号2004, 2021打开转账还款认领详情
      // 交易编号5004打开贴息结算详情
      // 交易编号4002 ,5006,4004打开认领撤销详情
 
      // 打开转账退款审批阶段一详情
      if (['6001'].includes(transType)) {
        this.toDetail({
          isApplyPhase: 2,
          isHiddenAppoveOpinion: 1,
          phaseNo: '0010', // 该参数可能有问题
          transCode: 'T1007',
          objectType: 'TransferRefundApply',
          pageId: '30',
          withholdStatus: ''
        })
      }
 
      // 显示“虚拟认领确认/虚拟认领撤销确认”弹窗内容
      if (['6002', '6003'].includes(transType)) {
        this.buttonProp =
          transType === '6003' ? 'virtualClaimUndoButton' : 'virtualClaimButton'
        this.showClaim()
      }
 
      // 转账还款认领详情(applyType可能需要)
      if (['2004', '2021'].includes(transType)) {
        this.toDetail({
          isApplyPhase: 2,
          isHiddenAppoveOpinion: 1,
          phaseNo: '0010',
          transCode: 'T1005'
          // applyType: ''
        })
      }
 
      // 贴息详情
      if (['5004'].includes(transType)) {
        this.toDetail({
          isApplyPhase: 2,
          isHiddenAppoveOpinion: 1,
          phaseNo: '0010',
          transCode: 'T1002'
        })
      }
 
      // 认领撤销详情
      if (['4002', '5006', '4004'].includes(transType)) {
        this.toDetail({
          pageId: '30',
          isApplyPhase: 2,
          isHiddenAppoveOpinion: 1,
          transCode: 'TCR1001'
        })
      }
    },
 
    async showClaim() {
      const { claimRefundModel, trxnBr } = this
      const res = await claimRefundModel.request({
        trxnBr
      })
      this.tempInfo = res
      this.dialogEditClaim = true
    },
 
    // async toCtsDetail() {
    //   const { loanDetailModel, tempRecord } = this
    //   const { applySerialno } = tempRecord
    //   const res = await loanDetailModel.request({
    //     applySerialno
    //   })
    //   this.$goDetail(res)
    // },
 
    async toDetail(info) {
      const { detailModel, tempRecord, trxnBr } = this
      const { transSerialNo = '', transType } = tempRecord
      const {
        objectNo = '',
        objectType = '',
        serialNo = '',
        productId = '',
        productDimension = '',
        transSerialNoHis = '',
        transCodeHis = '',
        applyType = '',
        transLogSerialno = ''
      } = await detailModel.request({
        transSerialNo,
        transType,
        trxnBr
      })
      this.toEdit({
        objectNo,
        objectType,
        serialNo: serialNo || transSerialNoHis,
        productId,
        trxnBr,
        productDimension,
        transCodeOne: transCodeHis,
        transSerialNo: transSerialNo || serialNo,
        applyType,
        transLogSerialno,
        ...info
      })
    },
 
    toEdit(info = {}) {
      const { tempRecord, transCode, codeNo, pageId } = this
      const {
        applySerialno = '',
        phaseNo = '',
        transCode: tempTransCode,
        withholdStatus = '',
        loanSerialno = ''
      } = tempRecord
 
      const baseQuery = {
        applySerialno,
        transCode: tempTransCode || transCode,
        codeNo,
        phaseNo,
        pageId,
        loanSerialno,
        withholdStatus
      }
 
      // 贷后变更记录(入口在贷前详情)
      // isApplyPhase=2   isHiddenAppoveOpinion=2
 
      // 复核 “继续处理” 和“立即处理” 的时候 isApplyPhase=2 isHiddenAppoveOpinion=2
      // 非复核 “继续处理” 和“立即处理” 的时候 isApplyPhase=2 isHiddenAppoveOpinion=2
      // 所有 “详情” isApplyPhase=2   isHiddenAppoveOpinion=1
      // 所有 “申请” isApplyPhase=1   isHiddenAppoveOpinion=2
 
      this.$router.push({
        path: '/comm/apply',
        query: {
          ...baseQuery,
          ...info
        }
      })
    },
 
    resetList() {
      this.pageInfo.currentPage = 1
      this.getList()
    },
 
    resetForm() {
      const { model } = this
      this.formList = model.getFormList()
      this.setSelectOptions()
    }
  },
  computed: {
    // 表单值信息
    formValues() {
      const { model, formList } = this
      return model.getFormValues(formList)
    }
  }
}
</script>
<style lang="postcss" scoped>
</style>