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
<template>
  <el-dialog
    title="提前结清试算"
    :visible.sync="dialogVisible"
    width="1250px"
    :before-close="handleClose"
  >
    <el-form
      ref="inputForm"
      :model="form"
      :rules="rules"
      :inline="true"
      label-width="120px"
    >
      <el-row>
        <el-form-item label="和解日期" prop="reconcileDate">
          <el-date-picker
            disabled
            :value="form.reconcileDate"
            @input="reconcileDateHandle($event)"
            :placeholder="'请选择'"
            type="date"
            format="yyyy/MM/dd"
            value-format="yyyy/MM/dd"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="结清日期" prop="finishDate">
          <el-date-picker
            :value="form.finishDate"
            @input="finishDateHandle($event)"
            :placeholder="'请选择'"
            type="date"
            format="yyyy/MM/dd"
            value-format="yyyy/MM/dd"
            :picker-options="finishDatePickerOptions"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="执行利率" prop="businessRate">
          <el-input
            disabled
            v-model="form.businessRate"
            placeholder="请填写"
            style="width: 208px"
          ></el-input>
          <span style="margin-left: 8px; color: #606266">%</span>
        </el-form-item>
      </el-row>
      <el-row>
        <el-form-item label="结清需还款本金" prop="totalFirstPrincipalAmt">
          <el-input
            disabled
            v-model="form.totalFirstPrincipalAmt"
            style="width: 208px"
          ></el-input>
        </el-form-item>
        <el-form-item label="结清需还款利息" prop="totalFirstInterestAmt">
          <el-input
            disabled
            v-model="form.totalFirstInterestAmt"
            style="width: 208px"
          ></el-input>
        </el-form-item>
        <el-form-item label="结清需还款总额" prop="totalFirstAmt">
          <el-input
            disabled
            v-model="form.totalFirstAmt"
            style="width: 208px"
          ></el-input>
        </el-form-item>
      </el-row>
    </el-form>
    <TableList
      :pageInfo="pageInfo"
      @handleCurrentChange="handleCurrentChange"
      @handleSizeChange="handleSizeChange"
      :isAutoIndex="true"
      :isPaddingRight="false"
      ref="tableRef"
      :list="records"
      :header="tableHeader"
      :height="tableHeight"
    ></TableList>
 
    <div slot="footer" class="dialog-footer">
      <el-button size="mini" @click="handleClose">关 闭</el-button>
    </div>
  </el-dialog>
</template>
<script>
import {
  trialFinishRate,
  trialFinishPayment,
  queryReconcileInfo,
} from "@comprehensive/serve/public";
import { trialFinishPaymentHeader } from "@comprehensive/utils/tableHeaders";
import TableList from "./TableList.vue";
export default {
  components: {
    TableList,
  },
  props: {
    dialogVisible: {
      type: Boolean,
      default: false,
    },
    // 申请编号
    batchNoArr: {
      type: Array,
      required: false,
    },
  },
  data() {
    return {
      //页码
      pageInfo: {
        currentPage: 1,
        pageSize: 10,
        total: 0,
      },
      records: [],
      tableHeader: [...trialFinishPaymentHeader],
      tableHeaderFilter: [],
      tableHeight: "560px",
      form: {
        batchNo: "",
        orgName: "",
        reconcileDate: "",
        finishDate: "",
      },
      finishDatePickerOptions: {
        disabledDate: (date) => {
          // 如果和解日期未选择,则结清日期不可选
          if (!this.form.reconcileDate) return true;
          // 结清日期必须早于或等于和解日期
          return date < new Date(this.form.reconcileDate);
        },
      },
      rules: {
        reconcileDate: [
          { required: false, message: "请选择和解日期", trigger: "change" },
        ],
        finishDate: [
          { required: false, message: "请选择结清日期", trigger: "change" },
        ],
      },
      submitLoading: false,
    };
  },
  mounted() {},
  created() {
    this.init();
  },
  watch: {
    batchNoArr: {
      immediate: false,
      handler(newVal) {
        if (this.batchNoArr.length == 1) {
          this.requestQueryReconcileInfo();
        }
      },
    },
  },
  methods: {
    init() {
      const { tableHeaderFilter } = this;
      this.tableHeader = trialFinishPaymentHeader.filter(
        ({ prop }) => !tableHeaderFilter.includes(prop)
      );
    },
 
    // 修改翻页数
    handleCurrentChange(val) {
      this.pageInfo.currentPage = val;
    },
    // 修改翻页条数
    handleSizeChange(val) {
      this.pageInfo.pageSize = val;
    },
    //重置数据
    resetForm(formName) {
      this.$refs[formName].resetFields();
    },
    //关闭窗口
    handleClose(done) {
      console.log("关闭窗口");
      this.resetForm("inputForm");
      this.$emit("close");
      this.records = [];
      this.pageInfo.total = 0;
    },
    //查询和解信息,获取和解日期
    async requestQueryReconcileInfo() {
      const resp = await queryReconcileInfo({
        applySerialNo: this.batchNoArr[0].serialNo,
      });
      if (resp.code == "00") {
        this.$set(this.form, "reconcileDate", resp.result.reconcileSignDate);
      }
    },
    //请求执行利率
    async requestTrialFinishRate() {
      if (this.form.reconcileDate && this.form.finishDate) {
        const res = await trialFinishRate({
          applySerialNo: this.batchNoArr[0].serialNo,
          reconcileDate: this.form.reconcileDate,
          finishDate: this.form.finishDate,
        });
        if (res.code == "00") {
          this.$set(this.form, "businessRate", res.result);
          this.requestTrialFinishPayment();
        }
      }
    },
    //请求还款试算
    async requestTrialFinishPayment() {
      console.log("requestTrialFinishPayment", this.batchNoArr[0]);
      const resp = await trialFinishPayment({
        // businessRate: this.form.businessRate,
        // creditCustomerId: this.batchNoArr[0].customerid,
        // firstPayDate: this.form.finishDate,
        applySerialNo: this.batchNoArr[0].serialNo,
        finishRate: this.form.businessRate,
        finishDate: this.form.finishDate,
      });
      if (resp.code == "00") {
        // this.records = resp.result.resultList;
        this.records = resp.result.resultList.map((item) => ({
          ...item,
          compromisepayamt:
            (Number(item.compromisepayamt) || 0) +
            (Number(item.latestpayamt) || 0),
        }));
        this.pageInfo.total = resp.result.resultList.length;
        this.$set(
          this.form,
          "totalFirstPrincipalAmt",
          resp.result.totalFirstPrincipalAmt
        );
        this.$set(
          this.form,
          "totalFirstInterestAmt",
          resp.result.totalFirstInterestAmt
        );
        this.$set(this.form, "totalFirstAmt", resp.result.totalFirstAmt);
      }
    },
    //和解日期
    async reconcileDateHandle(val) {
      this.form.reconcileDate = val;
      // 如果结清日期早于新的和解日期,则清空结清日期
      if (
        this.form.finishDate &&
        new Date(this.form.finishDate) < new Date(val)
      ) {
        this.form.finishDate = "";
      }
      this.requestTrialFinishRate();
    },
    //结清日期
    async finishDateHandle(val) {
      this.form.finishDate = val;
      this.requestTrialFinishRate();
    },
  },
};
</script>
<style lang="stylus" scoped>
.submit-form {
  margin-top: 20px;
  padding-top: 40px;
  border-top: 1px solid #eee;
 
  .content-input /deep/ .el-form-item__content {
    width: calc(100% - 120px);
  }
 
  /deep/.el-input input {
    padding: 4px 15px;
    height: auto;
  }
}
 
.dialog-footer {
  margin-top: 60px;
  display: block;
  width: 100%;
  text-align: center;
}
</style>