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
<template>
  <div class="product">
    <div v-for="(item,index) in customerInterestArr" :key="index">
      <div class="_block">
        <p class="title">
          <span></span>
          客户息费信息
        </p>
        <el-form :model="customerInterestForm[index]" :rules="rules" ref="customerInterestForm" label-width="165px" size="small" inline>
          <div class="form">
            <el-form-item label="收取方式" prop="collectionMethod" v-if="item.collectionMethod.visible">
              <el-select
                v-model="customerInterestForm[index].collectionMethod"
                :disabled="!item.collectionMethod.writeAble"
                @change="updateAdvanceFee(customerInterestForm[index])"
                clearable
                filterable
                placeholder="请选择"
              >
                <el-option
                  v-for="(item,index) in collectionMethods"
                  :key="index"
                  :label="item.itemname"
                  :value="item.itemno"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="预计放款日" prop="projectedLendersDay" v-if="item.projectedLendersDay.visible">
              <el-date-picker
                v-model="customerInterestForm[index].projectedLendersDay"
                type="date"
                format="yyyy/MM/dd"
                value-format="yyyy/MM/dd"
                size="small"
                placeholder="选择日期"
                :picker-options="pickerOptions"
                :disabled="!item.projectedLendersDay.writeAble"
                @change="updateAdvanceFee(customerInterestForm[index])"
              ></el-date-picker>
            </el-form-item>
          </div>
          <div class="form">
            <el-form-item label="预收利息金额" prop="advaninterest" v-if="item.advaninterest.visible">
              <el-input
                v-model="customerInterestForm[index].advaninterest"
                :disabled="!item.advaninterest.writeAble"
              >
              </el-input>
            </el-form-item>
            <el-form-item label="预收手续费金额" prop="advancecharge" v-if="item.advancecharge.visible">
              <el-input
                v-model="customerInterestForm[index].advancecharge"
                :disabled="!item.advancecharge.writeAble"
              >
              </el-input>
            </el-form-item>
            <el-form-item label="预收担保费金额" prop="advanceguarantee" v-if="item.advanceguarantee.visible">
              <el-input
                v-model="customerInterestForm[index].advanceguarantee"
                :disabled="!item.advanceguarantee.writeAble"
              >
              </el-input>
            </el-form-item>
            <el-form-item label="预收平台服务费金额" prop="advanceservicefee" v-if="item.advanceservicefee.visible">
              <el-input
                v-model="customerInterestForm[index].advanceservicefee"
                :disabled="!item.advanceservicefee.writeAble"
              >
              </el-input>
            </el-form-item>
            <el-form-item label="预收总金额" prop="advanceTotal" v-if="item.advanceTotal.visible">
              <el-input
                v-model="customerInterestForm[index].advanceTotal"
                :disabled="!item.advanceTotal.writeAble"
              >
              </el-input>
            </el-form-item>
          </div>
          <div class="form">
            <el-form-item label="自动扣款支付流水号" prop="transno" v-if="item.transno.visible">
              <el-input v-model="customerInterestForm[index].transno" :disabled="!item.transno.writeAble"></el-input>
            </el-form-item>
            <el-form-item label="自动扣款状态" prop="ischarge" v-if="item.ischarge.visible">
              <el-select
                v-model="customerInterestForm[index].ischarge"
                :disabled="!item.ischarge.writeAble"
                clearable
                filterable
                placeholder="请选择"
              >
                <el-option
                  v-for="(item,index) in ischarges"
                  :key="index"
                  :label="item.itemname"
                  :value="item.itemno"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="自动扣款失败原因" prop="transresult" v-if="item.transresult.visible">
              <el-input v-model="customerInterestForm[index].transresult" :disabled="!item.transresult.writeAble"></el-input>
            </el-form-item>
          </div>
          <div class="form">
            <el-form-item label="绿信收款对公户开户行" prop="balanceBankNo" v-if="item.balanceBankNo.visible">
              <el-input v-model="customerInterestForm[index].balanceBankNo" :disabled="!item.balanceBankNo.writeAble"></el-input>
            </el-form-item>
            <el-form-item label="绿信收款对公户账号" prop="balanceaccount" v-if="item.balanceaccount.visible">
              <el-input v-model="customerInterestForm[index].balanceaccount" :disabled="!item.balanceaccount.writeAble"></el-input>
            </el-form-item>
            <el-form-item
              :label="applyInfo.flowno == 'BuildingBusinessFlow' ? '渠道结算虚拟账号' : '客户还款虚拟账号'"
              prop="balancefictitiousaccount"
              v-if="item.balancefictitiousaccount.visible"
            >
              <el-input v-model="customerInterestForm[index].balancefictitiousaccount" :disabled="!item.balancefictitiousaccount.writeAble"></el-input>
            </el-form-item>
          </div>
        </el-form>
      </div>
      <!-- 待认领资金 -->
      <WaitFunds
        v-if="customerInterestForm[index].collectionMethod != '01' && customerInterestForm[index].ischarge != '1'"
        v-on:sendClaim="sendClaim"
        :balancefictitiousaccount='customerInterestForm[index].balancefictitiousaccount'
        :collectionMethod='customerInterestForm[index].collectionMethod'
        :projectedLendersDay='customerInterestForm[index].projectedLendersDay'
        operationType='1'
      ></WaitFunds>
      <!-- 已认领资金 -->
      <ClaimedFunds
        v-if="customerInterestForm[index].collectionMethod != '01'"
        :claimedFunds="claimedFunds"
        operationType='1'
      ></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 {
  qryPreCustomerInterestInfo,
  updateAdvanceFee,
  getDictionaryList
} 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,
      customerInterestForm:[],
      customerInterestArr:[],
      collectionMethods:[],
      claimedFunds:[],
      ischarges:[],
      rules:{},
      pickerOptions: { // 限制收货时间不让选择今天以前的
      disabledDate(time) {
      return time.getTime() < Date.now() - 24 * 60 * 60 * 1000
      }
      }
    }
  },
  async created () {
    this.$parent._data.loading = true;
    const result = await this.qryPreCustomerInterestInfo()
    this.qryPreCustomerInterestData(result)
    this.collectionMethods = await this.qryDictionaryList('CollectionMethod')
    // 预收息费阶段——收取方式去掉自动扣款和无需收取
    this.collectionMethods.forEach((val,index) => {
      if(val.itemno == '01' || val.itemno == '03'){
        this.collectionMethods.splice(index,1)
      }
    });
    this.ischarges = await this.qryDictionaryList('IsCharge')
    this.$parent._data.loading = false;
  },
  components: {
    ClaimedFunds,
    WaitFunds
  },
  methods: {
    // 字典
    qryDictionaryList(code) {
      return new Promise(resolve => {
        getDictionaryList({
          codeNo: code
        }).then(res => {
          resolve(res.result);
        });
      });
    },
    // 对已认领资金数据进行处理
    qryClaimedFunds(array){
      this.claimedFunds = []
      array.forEach(val => {
        const obj = {}
        for (const key in val) {
          obj[key] = val[key].value
        }
        this.claimedFunds.push(obj)
      });
    },
    // 查询预收客户息费详情
    qryPreCustomerInterestInfo(){
      return new Promise(resolve=>{
        qryPreCustomerInterestInfo({serialNo:this.applyInfo.serialNo}).then(res=>{
          resolve(res.result)
        })
      })
    },
    // 接受子组件传值并更新已认领资金列表
    async sendClaim(data){
      const projectedLendersDay = this.customerInterestForm[0].projectedLendersDay
      const collectionMethod = this.customerInterestForm[0].collectionMethod
      const result = await this.qryPreCustomerInterestInfo()
      this.qryPreCustomerInterestData(result)
      // 重新查询这两个值要附上,因为接口数据没有返回
      this.customerInterestForm[0].projectedLendersDay = projectedLendersDay
      this.customerInterestForm[0].collectionMethod = collectionMethod
    },
    // 对数据进行重新排列
    qryPreCustomerInterestData(result){
      this.customerInterestArr = [result]
      this.customerInterestForm = []
      this.customerInterestArr.forEach((val,index) => {
        if (index == 0) {
          for (const key in val) {
            // 格式化金额
            if (
              key == "advaninterest" ||
              key == "advanceguarantee" ||
              key == "advanceservicefee" ||
              key == "advanceTotal" ||
              key == "advancecharge"
            ) {
              val[key].value = this.formatMoney(val[key].value);
            }
            this.rules[key] = [];
            if (val[key].required) {
              this.rules[key].push({
                required: true,
                message: `请输入${val[key].filedDescription}`,
                trigger: "blur"
              });
            }
          }
        }
        // 将数据重新排列
        let obj = {};
        for (const key in val) {
          if (key != "acctBankRecord") {
            obj[key] = val[key].value;
          } else {
            this.qryClaimedFunds(val[key])
          }
        }
        this.customerInterestForm.push(obj);
      });
    },
    // 更新预收息费
    updateAdvanceFee(form){
      if(form.projectedLendersDay&&form.collectionMethod){
        const projectedLendersDay = form.projectedLendersDay
        const collectionMethod = form.collectionMethod
        this.$parent._data.loading = true;
        updateAdvanceFee({
          applySerialno:this.applyInfo.serialNo,
          projectedLendersDay:form.projectedLendersDay,
          collectionMethod:form.collectionMethod
        }).then(async res=>{
          this.$parent._data.loading = false;
          if(res.code=='00'){
            // 成功后重新查询
            const result = await this.qryPreCustomerInterestInfo()
            this.qryPreCustomerInterestData(result)
            // 重新查询这两个值要附上,因为接口数据没有返回
            this.customerInterestForm[0].projectedLendersDay = projectedLendersDay
            this.customerInterestForm[0].collectionMethod = 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>