Commit 7f2b4dfc authored by 14699's avatar 14699

融资试算公式调整

parent 172f19b0
...@@ -157,12 +157,24 @@ const getResult = (formValueObj) => { ...@@ -157,12 +157,24 @@ const getResult = (formValueObj) => {
let monthRate = contractRate / 12; let monthRate = contractRate / 12;
let temp = (1 + monthRate); let temp = (1 + monthRate);
let cashflow = [] let cashflow = []
let outstandingPrincipal = financeAmount; // 剩余本金
for (let i = 1; i <= term; i++) { for (let i = 1; i <= term; i++) {
// 每月应还利息,每月应还本金,月供, 还款日 // 每月应还利息,每月应还本金,月供, 还款日
let interest = (financeAmount * monthRate * (temp ** term - temp ** (i - 1)) / (temp ** term - 1)).toFixed(2) // let interest = (financeAmount * monthRate * (temp ** term - temp ** (i - 1)) / (temp ** term - 1)).toFixed(2)
let principal = (financeAmount * monthRate * temp ** (i - 1) / (temp ** term - 1)).toFixed(2) // let principal = (financeAmount * monthRate * temp ** (i - 1) / (temp ** term - 1)).toFixed(2)
let dueAmount = (financeAmount * monthRate * temp ** term / (temp ** term - 1)).toFixed(2) // let dueAmount = (financeAmount * monthRate * temp ** term / (temp ** term - 1)).toFixed(2)
let interest = (outstandingPrincipal * monthRate).toFixed(2)
if(i == 1){
interest = 0;
}
let dueAmount = (financeAmount * monthRate * temp ** (term -1 ) / (temp ** term - 1)).toFixed(2)
let principal = dueAmount - interest
if(i == term){
principal = outstandingPrincipal
interest = dueAmount - principal
}
outstandingPrincipal = outstandingPrincipal - principal
let chargeDueDate = moment(firstRentDay).add(i-1, 'month').format('YYYY-MM-DD') let chargeDueDate = moment(firstRentDay).add(i-1, 'month').format('YYYY-MM-DD')
cashflow.push({ interest, principal, dueAmount, times: i + "", chargeDueDate }) cashflow.push({ interest, principal, dueAmount, times: i + "", chargeDueDate })
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment