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
<template>
  <!-- 认领确认 -->
  <div class="Claim" >
    <el-dialog :visible.sync="claimVisible" title="认领信息确认" :close-on-click-modal='false' @close="closeDialog" center>
      <el-form ref="form" :model="form" :rules="rules" label-width="95px" inline size="small" v-loading='loading'>
        <el-form-item label="回款日期" prop="receivabletime">
          <el-input v-model="receivabletime" disabled></el-input>
        </el-form-item>
        <el-form-item label="回款类型" prop="receivabletype">
          <el-select
            v-if="applyInfo.flowno == 'CreditFlowPublic'"
            v-model="form.receivabletype"
            clearable
            placeholder="请选择"
            @change="selReceivabletype"
          >
            <el-option
              v-for="(item,index) in receivabletypeList"
              :key="index"
              :label="item.receivabletypeDesc"
              :value="item.receivabletype"
            ></el-option>
          </el-select>
          <el-select
            v-else
            v-model="form.receivabletype"
            :disabled="$route.path == '/ZBDCreditFlow/repayment'"
            clearable
            placeholder="请选择"
          >
            <el-option
              v-for="(item,index) in receivabletypeList"
              :key="index"
              :label="item.itemname"
              :value="item.itemno"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="回款金额" prop="receivablesum">
          <el-input 
            v-model="form.receivablesum" 
            @blur="form.receivablesum = formatMoney(form.receivablesum)"
            :disabled="surplusTotalAmt?true:false"
          >
          </el-input>
        </el-form-item>
        <el-form-item label="回款备注">
          <el-input v-model="form.remark"></el-input>
        </el-form-item>
      </el-form>
      <el-table stripe highlight-current-row :data="claim" :header-cell-style="{background:'#f5f5f5',color:'#222222'}" max-height="500">
        <el-table-column label="银行交易流水号" width="176">
          <template slot-scope="{row}">
            <span>{{row.trxnbr?row.trxnbr:'--'}}</span>
          </template>
        </el-table-column>
        <el-table-column label="转账付方银行账号" width="170" v-if="$route.path != '/CreditFlowPublic/moneyBack'">
          <template slot-scope="{row}">
            <span>{{row.rpyacc?row.rpyacc:'--'}}</span>
          </template>
        </el-table-column>
        <el-table-column label="收款日期" width="120">
          <template slot-scope="{row}">
            <span>{{row.etydat?row.etydat:'--'}}</span>
          </template>
        </el-table-column>
        <el-table-column label="转账付方名称" width="120">
          <template slot-scope="{row}">
            <span>{{row.rpynam?row.rpynam:'--'}}</span>
          </template>
        </el-table-column>
        <el-table-column label="绑定客户名称" width="120">
          <template slot-scope="{row}">
            <span>{{row.cltnam?row.cltnam:'--'}}</span>
          </template>
        </el-table-column>
        <el-table-column label="剩余待认领金额" width="130">
          <template slot-scope="{row}">
            <span>{{row.coreBalance?row.coreBalance:'--'}}</span>
          </template>
        </el-table-column>
        <el-table-column label="转账备注" width="200" show-overflow-tooltip>
          <template slot-scope="{row}">
            <span>{{row.trxtxt?row.trxtxt:'--'}}</span>
          </template>
        </el-table-column>
      </el-table>
      <ul v-if="$route.path == '/CreditFlowPublic/moneyBack'">
        <li>
          <span>总笔数:</span>
          <span>{{totalNum}}</span>
        </li>
        <li>
          <span>总金额:</span>
          <span>{{totalSum}}</span>
        </li>
      </ul>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submit(form,'form')" :disabled="loading">确认</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import {
  getDictionaryList,
  receivableClaim,
  calculateLoanMes,
  getRefactorReceivableTypeList
} from "@api/product";
export default {
  props: [
    'claim',
    'visible',
    'loan',
    'surplusTotalAmt'
  ],
  data () {
    return {
      applyInfo:this.$store.state.product.applyInfo,
      form:{
        receivabletime: '',
        receivabletype: '',
        receivablesum: '',
        remark:'',
      },
      receivabletypeList:[],
      receivabletime:'',
      rules:{
        receivabletime:[
          { required: true, message: '请输入回款日期', trigger: 'change' },
        ],
        receivabletype:[
          { required: true, message: '请输入回款类型', trigger: 'change' },
        ],
        receivablesum:[
          { required: true, message: '请输入回款金额', trigger: 'change' },
        ],
      },
      loading:false
    }
  },
  computed: {
    claimVisible:{
      get(){
        return this.visible
      },
      set(){}
    },
    totalNum(){
      return this.claim.length;
    },
    totalSum(){
      let totalSum = 0;
      this.claim.forEach(val => {
        totalSum += parseFloat(val.coreBalance.replace(/,/g,''))
      });
      return totalSum;
    }
  },
  async created () {
    const { applyInfo } = this
    // 回款日期默认填写最晚的收款日期,这里需要做下比较收款日期获取最晚的日期
    this.claim.forEach((val,index) => {
      if(index == 0){
        this.form.receivabletime = val.etydat
      }else{
        if(parseInt(val.etydat)>parseInt(this.form.receivabletime)){
          this.form.receivabletime = val.etydat
        }
      }
    });
 
    const receivabletime = this.form.receivabletime
 
    this.receivabletime = receivabletime.replace(/^(\d{4})(\d{2})(\d{2})$/, "$1/$2/$3") 
 
    // 赎楼本金回款和招标贷还款信息的回款金额需要默认填写
    if(this.$route.path == '/BuildingBusinessFlow/receivable' || this.$route.path == '/ZBDCreditFlow/repayment'){
      this.form.receivablesum = this.formatMoney(this.surplusTotalAmt)
    }
 
    if(this.$route.path == '/BuildingBusinessFlow/receivable'){
      // 赎楼本金回款信息
      this.receivabletypeList = await this.qryDictionaryList('ReceivableType01')
 
    }else if(this.$route.path == '/BuildingBusinessFlow/interestSettle'){
      // 赎楼息费结算
      this.receivabletypeList = await this.qryDictionaryList('ReceivableType02')
 
    }else if(this.$route.path == '/ZBDCreditFlow/repayment'){
      // 招标贷还款信息的回款类型默认选中本息回款并且不可编辑
      this.receivabletypeList = await this.qryDictionaryList('ReceivableType')
      this.form.receivabletype = '10'
 
    }else if(applyInfo.flowno === 'CreditFlowPublic'){
      // 保理
      getRefactorReceivableTypeList({
        applyserialno: applyInfo.serialNo,
        receivabletime: this.receivabletime,
      }).then(res=>{
        this.receivabletypeList = res.result
      })
 
    }else{
      this.receivabletypeList = await this.qryDictionaryList('ReceivableType')
    }
  },
  methods: {
    selReceivabletype(val){
      for (let i = 0; i < this.receivabletypeList.length; i++) {
        if(this.receivabletypeList[i].receivabletype == val){
          this.form.receivablesum = this.receivabletypeList[i].receivablesum
          break;
        }
      }
    },
    submit(form,formName){
      this.$refs[formName].validate((valid) => {
        if (valid) {
          this.loading = true
          form.applyserialno = this.applyInfo.serialNo
          form.bankreceivable = this.claim
          // 招标贷选中流水有值进行赋值
          if(this.loan){
            for (const key in this.loan) {
              form[key] = this.loan[key]
            }
          }
          // 认领成功后通知父组件的父组件刷新已认领资金列表
          receivableClaim(form).then(res=>{
            this.loading = false
            if(res.code == '00'){
              this.$emit('sendClaimResult',true)
              this.$emit('closeClaim',false)
              this.$message.success('回款认领成功')
            }
          }).catch(error => {
            this.loading = false
          })
        } else {
          return false;
        }
      });
    },
    closeDialog(){
      this.$emit('closeClaim',false)
    },
    // 字典接口
    qryDictionaryList(code) {
      return new Promise(resolve => {
        getDictionaryList({
          codeNo: code
        }).then(res => {
          resolve(res.result);
        });
      });
    },
    // 金额格式化
    formatMoney(value) {
      if (value) {
        value =
          parseFloat((value + "").replace(/[^\d\.-]/g, "")).toFixed(2) + "";
        if (value == "NaN") return;
        let l = value
          .split(".")[0]
          .split("")
          .reverse();
        let r = value.split(".")[1];
        let t = "";
        for (let i = 0; i < l.length; i++) {
          t += l[i] + ((i + 1) % 3 === 0 && i + 1 !== l.length ? "," : "");
        }
        return (
          t
            .split("")
            .reverse()
            .join("") +
          "." +
          r
        );
      }
    },
  }
}
</script>
<style lang="stylus">
.Claim
  .el-dialog
    width auto
    max-width calc(100% - 180px)
    min-width 850px
    max-height 100%
    overflow hidden
    margin 0 !important
    position absolute
    left 50%
    top 50%
    transform translate(-50%,-50%)
    .el-dialog__header
      padding 20px 0 0 
    .el-dialog__body
      padding 20px
      .table
        max-height 480px
        overflow auto
      .el-form
        display: flex
        justify-content: flex-start
        flex-wrap: wrap
        .el-form-item
          display: flex
          width:50%
          box-sizing border-box
          padding-right 30px
          margin: 0 0 24px 0
          .el-form-item__label
            color: #888
            line-height 32px
          .el-form-item__content
            flex:1
            .el-date-editor
              width: auto
            .el-select
              display: block
      ul
        li
          text-align right
  .el-dialog__footer
    padding 0 0 20px
    .dialog-footer
      .el-button
        width: 120px
        font-size: 14px
        line-height: 20px
        padding: 5px 0
</style>