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
<template>
  <div>
    <template v-if="productId != 'CFD_ESCKRD'">
      <template v-if="productId == 'OFF_CDZY'">
        <FormInfo
          :info="info"
          :keys="creditorLineArr"
          title="授信额度信息"
          :loading="loading"
        ></FormInfo>
      </template>
      <template v-else>
        <FormInfo
          :info="info"
          :keys="headerKeyArr"
          title="应收账款汇总"
          :loading="loading"
        ></FormInfo>
        <KeysTable
          :list="creditorBills"
          :header="creditorBillsTableHeader"
          :isShowPages="false"
          title="应收账款明细"
          listItemType="string"
        ></KeysTable>
        <FormInfo
          :info="info"
          :keys="creditorLineArr"
          title="授信额度信息"
          :loading="loading"
        ></FormInfo>
      </template>
    </template>
    <template v-if="productId == 'CFD_ESCKRD'">
      <FormInfo
        :info="info"
        :keys="esckrdHeaderKeyArr"
        title="授信额度有效期"
        :loading="loading"
      ></FormInfo>
      <FormInfo
        :info="info"
        :keys="esckrdCreditorLineArr"
        title="授信额度信息"
        :loading="loading"
      ></FormInfo>
    </template>
  </div>
</template>
 
<script>
// 授信额度信息
import {
  qryCreditorInfo, //查询应收账款数据
  getDictionaryList, //请求字段选择项
  queryCustomerQuotaInfoMap,
} from "@/api/product";
import FormInfo from "../FormInfo";
import KeysTable from "../KeysTable";
import {
  creditLineFormHeader,
  esckrdHeaderKeyArr,
} from "@comprehensive/utils/formHeaders";
 
import { flownos } from "@comprehensive/utils/comm";
 
export default {
  props: {
    // 申请编号
    serialNo: {
      type: String,
      required: true,
    },
    objectType: {
      type: String,
      default: "",
    },
    customerID: {
      type: String,
      default: "",
    },
    flowno: {
      type: String,
 
      // 默认为案场
      default: "CreditFlowPublic",
    },
  },
  components: {
    FormInfo,
    KeysTable,
  },
  data() {
    return {
      info: {}, //接口获取到的参数为值
      loading: false, //是否loading
      headerKeyArr: [], //定义key,在FormInfo中决定有哪些key。
      creditorLineArr: [], //定义key,授信额度信息key
      creditorBills: [], //应收账款明细
      billtypeArr: [], //应收账款凭证类型
      creditorBillsTableHeader: [
        {
          prop: "contractname",
          width: "auto",
          label: "基础合同名称",
        },
        {
          prop: "billname",
          width: "auto",
          label: "应收账款名称",
        },
        {
          prop: "billtypeDesc",
          width: "auto",
          label: "应收账款凭证类型",
        },
        {
          prop: "billno",
          width: "auto",
          label: "应收账款凭证编号",
        },
        {
          prop: "billsum",
          width: "auto",
          label: "应收账款金额",
          isMoney: true,
        },
        {
          prop: "pjpamentendday",
          width: "auto",
          label: "应收账款到期日",
        },
      ],
      // 应收账款汇总需要字段
      accountsAmtFilter: [
        "accountsAmt", //应收账款汇总
      ],
      //授信额度需要字段
      creditorLineInfoFilter: [
        "addcreditamtlimit", // 新增授信额度
        "remanentAmt", //剩余额度
        "useSumNum",
        "creditbaseamt",
      ],
      productId: "",
      esckrdHeaderKeyArr: [
        {
          label: "授信有效期起",
          field: "creditEffectiveDate",
        },
        {
          label: "授信有效期止",
          field: "creditDiseffectiveDate",
        },
      ],
      esckrdCreditorLineArr: [
        {
          label: "授信剩余可用额度",
          field: "creditbaseamt",
        },
      ],
    };
  },
 
  created() {
    this.init();
  },
 
  methods: {
    init() {
      this.productId = this.$route.query.productID;
      const { flowno, accountsAmtFilter, creditorLineInfoFilter } = this;
      const {
        //佣金贷(保理)
        CreditFlowPublic,
      } = flownos;
      let header = [];
      let creditorHeader = [];
      //佣金贷
      if (flowno === CreditFlowPublic) {
        header = creditLineFormHeader.filter(({ field }) =>
          accountsAmtFilter.includes(field)
        );
        creditorHeader = creditLineFormHeader.filter(({ field }) =>
          creditorLineInfoFilter.includes(field)
        );
        if (this.productId == "OFF_CDZY") {
          this.requestQueryCustomerQuotaInfo();
        } else {
          this.getCreditorInfo();
          this.headerKeyArr = header;
          this.creditorLineArr = creditorHeader;
        }
      }
    },
    //获取仓单质押授信额度信息
    async requestQueryCustomerQuotaInfo() {
      const { serialNo } = this;
      const resp = await queryCustomerQuotaInfoMap({
        applyserialno: serialNo,
      });
      if (resp.code == "00") {
        const { result } = resp;
        this.info = result;
        let tempArr = [];
        for (const key in this.info) {
          let obj = {
            field: this.info[key].name,
            label: this.info[key].filedDescription,
            isMoney: true,
            orders: this.info[key].orders,
          };
          tempArr.push(obj);
        }
        //按字段进行排序
        tempArr.sort(function (a, b) {
          let orderA = parseInt(a.orders);
          let orderB = parseInt(b.orders);
          return orderA - orderB;
        });
        this.creditorLineArr = tempArr;
      }
    },
    //获取授信额度信息
    async getCreditorInfo() {
      this.loading = true;
      const { serialNo } = this;
      const res = await qryCreditorInfo({
        applySerialNo: serialNo,
      });
      this.billtypeArr = await this.qryDictionaryList("AccountsCertType");
      this.loading = false;
 
      const { result } = res;
      const { creditorBills, ...other } = result;
      this.info = other;
      this.productId = result.productId.value;
      let tempBills = creditorBills;
      tempBills.forEach((item) => {
        //金额格式化
        // item.billsum = this.formatMoney(item.billsum);
        //对应收账款凭证类型转译
        this.billtypeArr.map((typeItem) => {
          if (item.billtype == typeItem.itemno) {
            item.billtypeDesc = typeItem.itemname;
          }
        });
      });
      this.creditorBills = tempBills;
    },
    //请求字典项,应收账款类型
    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;
      }
    },
  },
  watch: {
    serialNo() {
      this.init();
    },
  },
};
</script>
 
<style lang="postcss" scoped>
.apply {
  & >>> .el-dialog__body {
    padding-top: 10px;
  }
  & >>> .comm-dialog {
    width: 1200px;
  }
  & >>> .hint-remark .input {
    color: #f40;
    font-weight: bold;
  }
}
</style>