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
<template>
  <div class="product">
    <div v-for="(item,index) in merchantInterestArr" :key="index">
      <el-form
        :model="merchantInterestForm[index]"
        :rules="rules"
        ref="merchantInterestForm"
        label-width="165px"
        size="small"
        inline
      >
        <div class="_block">
          <p class="title">
            <span></span>
            商户补贴方案
          </p>
          <div class="form">
            <el-form-item
              label="贴息类型"
              prop="discountCase.isAllPostedInterest"
              v-if="item.discountCase.isAllPostedInterest.visible"
            >
              <el-select
                v-model="merchantInterestForm[index].discountCase.isAllPostedInterest"
                :disabled="!item.discountCase.isAllPostedInterest.writeAble"
                clearable
                filterable
                placeholder="请选择"
              >
                <el-option
                  v-for="(item,index) in isAllPostedInterests"
                  :key="index"
                  :label="item.itemname"
                  :value="item.itemno"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item
              label="贴手续费类型"
              prop="discountCase.isAllPostedPoundage"
              v-if="item.discountCase.isAllPostedPoundage.visible"
            >
              <el-select
                v-model="merchantInterestForm[index].discountCase.isAllPostedPoundage"
                :disabled="!item.discountCase.isAllPostedPoundage.writeAble"
                clearable
                filterable
                placeholder="请选择"
              >
                <el-option
                  v-for="(item,index) in isAllPostedInterests"
                  :key="index"
                  :label="item.itemname"
                  :value="item.itemno"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item
              label="贴担保费类型"
              prop="discountCase.isAllPostedGuaranty"
              v-if="item.discountCase.isAllPostedGuaranty.visible"
            >
              <el-select
                v-model="merchantInterestForm[index].discountCase.isAllPostedGuaranty"
                :disabled="!item.discountCase.isAllPostedGuaranty.writeAble"
                clearable
                filterable
                placeholder="请选择"
              >
                <el-option
                  v-for="(item,index) in isAllPostedInterests"
                  :key="index"
                  :label="item.itemname"
                  :value="item.itemno"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item
              label="贴平台服务费类型"
              prop="discountCase.isAllPostedService"
              v-if="item.discountCase.isAllPostedService.visible"
            >
              <el-select
                v-model="merchantInterestForm[index].discountCase.isAllPostedService"
                :disabled="!item.discountCase.isAllPostedService.writeAble"
                clearable
                filterable
                placeholder="请选择"
              >
                <el-option
                  v-for="(item,index) in isAllPostedInterests"
                  :key="index"
                  :label="item.itemname"
                  :value="item.itemno"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item
              label="贴息期数"
              prop="discountCase.discountTerm"
              v-if="item.discountCase.discountTerm.visible"
            >
              <el-input
                v-model="merchantInterestForm[index].discountCase.discountTerm"
                :disabled="!item.discountCase.discountTerm.writeAble"
              ></el-input>
            </el-form-item>
            <el-form-item
              label="贴息固额"
              prop="discountCase.discountSum"
              v-if="item.discountCase.discountSum.visible"
            >
              <el-input
                v-model="merchantInterestForm[index].discountCase.discountSum"
                :disabled="!item.discountCase.discountSum.writeAble"
              ></el-input>
            </el-form-item>
            <el-form-item
              label="贴息月利率(%)"
              prop="discountCase.discountRate"
              v-if="item.discountCase.discountRate.visible"
            >
              <el-input
                v-model="merchantInterestForm[index].discountCase.discountRate"
                :disabled="!item.discountCase.discountRate.writeAble"
              ></el-input>
            </el-form-item>
            <el-form-item
              label="贴手续费固额"
              prop="discountCase.poundageSum"
              v-if="item.discountCase.poundageSum.visible"
            >
              <el-input
                v-model="merchantInterestForm[index].discountCase.poundageSum"
                :disabled="!item.discountCase.poundageSum.writeAble"
              ></el-input>
            </el-form-item>
            <el-form-item
              label="贴手续费费率(%)"
              prop="discountCase.poundageRate"
              v-if="item.discountCase.poundageRate.visible"
            >
              <el-input
                v-model="merchantInterestForm[index].discountCase.poundageRate"
                :disabled="!item.discountCase.poundageRate.writeAble"
              ></el-input>
            </el-form-item>
            <el-form-item
              label="贴担保费固额"
              prop="discountCase.guarantySum"
              v-if="item.discountCase.guarantySum.visible"
            >
              <el-input
                v-model="merchantInterestForm[index].discountCase.guarantySum"
                :disabled="!item.discountCase.guarantySum.writeAble"
              ></el-input>
            </el-form-item>
            <el-form-item
              label="贴担保费费率(%)"
              prop="discountCase.guarantyRate"
              v-if="item.discountCase.guarantyRate.visible"
            >
              <el-input
                v-model="merchantInterestForm[index].discountCase.guarantyRate"
                :disabled="!item.discountCase.guarantyRate.writeAble"
              ></el-input>
            </el-form-item>
            <el-form-item
              label="贴平台服务费固额"
              prop="discountCase.serviceSum"
              v-if="item.discountCase.serviceSum.visible"
            >
              <el-input
                v-model="merchantInterestForm[index].discountCase.serviceSum"
                :disabled="!item.discountCase.serviceSum.writeAble"
              ></el-input>
            </el-form-item>
            <el-form-item
              label="贴平台服务费费率(%)"
              prop="discountCase.serviceRate"
              v-if="item.discountCase.serviceRate.visible"
            >
              <el-input
                v-model="merchantInterestForm[index].discountCase.serviceRate"
                :disabled="!item.discountCase.serviceRate.writeAble"
              ></el-input>
            </el-form-item>
          </div>
        </div>
        <div class="_block">
          <p class="title">
            <span></span>
            商户补贴信息
          </p>
          <div class="form">
            <el-form-item
              label="收取方式"
              prop="discountInfo.discountCollectionMethod"
              v-if="item.discountInfo.discountCollectionMethod.visible"
            >
              <el-select
                v-model="merchantInterestForm[index].discountInfo.discountCollectionMethod"
                :disabled="!item.discountInfo.discountCollectionMethod.writeAble"
                @change="updateAdvanceFee(merchantInterestForm[index])"
                clearable
                filterable
                placeholder="请选择"
              >
                <el-option
                  v-for="(item,index) in discountCollectionMethods"
                  :key="index"
                  :label="item.itemname"
                  :value="item.itemno"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item
              label="利息补贴金额"
              prop="discountInfo.discountinterestamount"
              v-if="item.discountInfo.discountinterestamount.visible"
            >
              <el-input
                v-model="merchantInterestForm[index].discountInfo.discountinterestamount"
                :disabled="!item.discountInfo.discountinterestamount.writeAble"
              ></el-input>
            </el-form-item>
            <el-form-item
              label="手续费补贴金额"
              prop="discountInfo.discountpoundageamount"
              v-if="item.discountInfo.discountpoundageamount.visible"
            >
              <el-input
                v-model="merchantInterestForm[index].discountInfo.discountpoundageamount"
                :disabled="!item.discountInfo.discountpoundageamount.writeAble"
              ></el-input>
            </el-form-item>
            <el-form-item
              label="担保费补贴金额"
              prop="discountInfo.discountguaranteemount"
              v-if="item.discountInfo.discountguaranteemount.visible"
            >
              <el-input
                v-model="merchantInterestForm[index].discountInfo.discountguaranteemount"
                :disabled="!item.discountInfo.discountguaranteemount.writeAble"
              ></el-input>
            </el-form-item>
            <el-form-item
              label="平台服务费补贴金额"
              prop="discountInfo.discountservicefeeamount"
              v-if="item.discountInfo.discountservicefeeamount.visible"
            >
              <el-input
                v-model="merchantInterestForm[index].discountInfo.discountservicefeeamount"
                :disabled="!item.discountInfo.discountservicefeeamount.writeAble"
              ></el-input>
            </el-form-item>
            <el-form-item
              label="息费补贴总额"
              prop="discountInfo.discountTotalAmount"
              v-if="item.discountInfo.discountTotalAmount.visible"
            >
              <el-input
                v-model="merchantInterestForm[index].discountInfo.discountTotalAmount"
                :disabled="!item.discountInfo.discountTotalAmount.writeAble"
              ></el-input>
            </el-form-item>
            <el-form-item
              label="贴息商户名称"
              prop="discountInfo.enterpriseName"
              v-if="item.discountInfo.enterpriseName.visible"
            >
              <el-input
                v-model="merchantInterestForm[index].discountInfo.enterpriseName"
                :disabled="!item.discountInfo.enterpriseName.writeAble"
              ></el-input>
            </el-form-item>
            <el-form-item
              label="贴息项目名称"
              prop="discountInfo.discountProjectName"
              v-if="item.discountInfo.discountProjectName.visible"
            >
              <el-input
                v-model="merchantInterestForm[index].discountInfo.discountProjectName"
                :disabled="!item.discountInfo.discountProjectName.writeAble"
              ></el-input>
            </el-form-item>
            <el-form-item
              label="鹏友收款对公户开户行"
              prop="discountInfo.settlementBankNameDesc"
              v-if="item.discountInfo.settlementBankNameDesc.visible"
            >
              <el-input
                v-model="merchantInterestForm[index].discountInfo.settlementBankNameDesc"
                :disabled="!item.discountInfo.settlementBankNameDesc.writeAble"
              ></el-input>
            </el-form-item>
            <el-form-item
              label="鹏友收款对公户账号"
              prop="discountInfo.settlementAccountDesc"
              v-if="item.discountInfo.settlementAccountDesc.visible"
            >
              <el-input
                v-model="merchantInterestForm[index].discountInfo.settlementAccountDesc"
                :disabled="!item.discountInfo.settlementAccountDesc.writeAble"
              ></el-input>
            </el-form-item>
            <el-form-item
              label="商户补贴虚拟账号"
              prop="discountInfo.clearingVirtual"
              v-if="item.discountInfo.clearingVirtual.visible"
            >
              <el-input
                v-model="merchantInterestForm[index].discountInfo.clearingVirtual"
                :disabled="!item.discountInfo.clearingVirtual.writeAble"
              ></el-input>
            </el-form-item>
          </div>
        </div>
      </el-form>
      <!-- 待认领资金 -->
      <!-- applyInfo.flowno != 'CreditFlowPublic' &&  测试让改的-->
      <WaitFunds
        v-if="merchantInterestForm[index].discountInfo.isdiscount != '1' &&
        '0205,0208,0190,0180'.indexOf(applyInfo.phaseNo) == -1"
        v-on:sendClaim="sendClaim"
        :collectionMethod='merchantInterestForm[index].discountInfo.discountCollectionMethod'
        :balancefictitiousaccount='merchantInterestForm[index].discountInfo.clearingVirtual'
        operationType='2'
      >
      </WaitFunds>
      <!-- 已认领资金 -->
      <ClaimedFunds
        :claimedFunds="claimedFunds"
        operationType='2'
      ></ClaimedFunds>
    </div>
    <div class="fixedBtn">
      <el-button size="medium" plain @click="prevStep">上一页</el-button>
      <el-button size="medium" type="primary" @click="nextPage()">下一页</el-button>
    </div>
  </div>
</template>
<script>
import { qryPreMerchantInterestInfo, getDictionaryList, updateAdvanceFee } from "@api/product";
import common from "@/utils/common";
import ClaimedFunds from "../../components/ClaimedFunds";
import WaitFunds from "../../components/WaitFunds";
export default {
  data() {
    return {
      applyInfo: this.$store.state.product.applyInfo,
      applyMenu: this.$store.state.product.applyMenu,
      merchantInterestForm: [],
      merchantInterestArr: [],
      isAllPostedInterests: [],
      isAllPostedPoundages: [],
      discountCollectionMethods: [],
      claimedFunds: [],
      rules: {}
    };
  },
  async created() {
    this.$parent._data.loading = true;
    const result = await this.qryPreMerchantInterestInfo();
    this.qryPreMerchantInterestData(result);
    this.isAllPostedInterests = await this.qryDictionaryList("DiscountType01");
    this.discountCollectionMethods = await this.qryDictionaryList(
      "CollectionMethod"
    );
    this.$parent._data.loading = false;
  },
  components: {
    WaitFunds,
    ClaimedFunds
  },
  methods: {
    // 字典
    qryDictionaryList(code) {
      return new Promise(resolve => {
        getDictionaryList({
          codeNo: code
        }).then(res => {
          resolve(res.result);
        });
      });
    },
    // 查询预收商户贴息详情
    qryPreMerchantInterestInfo() {
      return new Promise(resolve => {
        qryPreMerchantInterestInfo({ serialNo: this.applyInfo.serialNo }).then(
          res => {
            resolve(res.result);
          }
        );
      });
    },
    // 对数据进行重新排列
    qryPreMerchantInterestData(result) {
      this.merchantInterestArr = [result];
      this.merchantInterestForm = [];
      this.merchantInterestArr.forEach((val, index) => {
        if (index == 0) {
          for (const key in val) {
            if (key == "discountCase") {
              for (const child in val[key]) {
                // 格式化金额
                if (
                  child == "discountSum" ||
                  child == "poundageSum" ||
                  child == "serviceSum" ||
                  child == "guarantySum"
                ) {
                  val[key][child].value = this.formatMoney(
                    val[key][child].value
                  );
                }
                this.rules["discountCase." + child] = [];
                if (val[key][child].required) {
                  this.rules["discountCase." + child].push({
                    required: true,
                    message: `请输入${val[key][child].filedDescription}`,
                    trigger: "blur"
                  });
                }
              }
            } else if (key == "discountInfo") {
              for (const child in val[key]) {
                // 格式化金额
                if (
                  child == "discountinterestamount" ||
                  child == "discountguaranteemount" ||
                  child == "discountservicefeeamount" ||
                  child == "discountTotalAmount" ||
                  child == 'discountpoundageamount'
                ) {
                  val[key][child].value = this.formatMoney(
                    val[key][child].value
                  );
                }
                this.rules["discountInfo." + child] = [];
                if (val[key][child].required) {
                  this.rules["discountInfo." + child].push({
                    required: true,
                    message: `请输入${val[key][child].filedDescription}`,
                    trigger: "blur"
                  });
                }
              }
            }
          }
        }
        // 将数据重新排列
        let obj = {};
        for (const key in val) {
          if (key == "acctBankRecord") {
            this.qryClaimedFunds(val[key])
          } else if (key == "discountCase") {
            obj["discountCase"] = {};
            for (const child in val[key]) {
              obj["discountCase"][child] = val[key][child].value;
            }
          } else if (key == "discountInfo") {
            obj["discountInfo"] = {};
            for (const child in val[key]) {
              obj["discountInfo"][child] = val[key][child].value;
            }
          }
        }
        this.merchantInterestForm.push(obj);
      });
    },
    // 对已认领资金数据进行处理
    qryClaimedFunds(array){
      this.claimedFunds = []
      array.forEach(val => {
        const obj = {}
        for (const key in val) {
          obj[key] = val[key].value
        }
        this.claimedFunds.push(obj)
      });
    },
    // 接受子组件传值并更新已认领资金列表
    async sendClaim(data){
      const collectionMethod = this.merchantInterestForm[0].collectionMethod
      const result = await this.qryPreMerchantInterestInfo()
      this.qryPreMerchantInterestData(result)
      // 重新查询这两个值要附上,因为接口数据没有返回
      this.customerInterestForm[0].collectionMethod = collectionMethod
    },
    // 更新预收息费
    updateAdvanceFee(form){
      const collectionMethod = form.discountInfo.discountCollectionMethod
      this.$parent._data.loading = true;
      updateAdvanceFee({
        applySerialno:this.applyInfo.serialNo,
        collectionMethod:form.discountInfo.discountCollectionMethod
      }).then(async res=>{
        this.$parent._data.loading = false;
        if(res.code=='00'){
          // 成功后重新查询
          const result = await this.qryPreMerchantInterestInfo();
          this.qryPreMerchantInterestData(result);
          // 重新查询这两个值要附上,因为接口数据没有返回
          this.merchantInterestForm[0].discountInfo.discountCollectionMethod = collectionMethod
        }
      })
    },
    // 金额格式化
    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
        );
      }
    },
    // 上一页
    prevStep() {
      this.applyMenu.forEach((val, index) => {
        if (val.tabname == "预收商户贴息") {
          common.tabInfo(
            this.applyMenu[index - 1].tabname,
            this.applyInfo.flowno,
            this
          );
        }
      });
    },
    // 下一页
    nextPage() {
      this.applyMenu.forEach((val, index) => {
        if (val.tabname == "预收商户贴息") {
          common.tabInfo(
            this.applyMenu[index + 1].tabname,
            this.applyInfo.flowno,
            this
          );
        }
      });
    }
  }
};
</script>