From fcd3f23a3247d4c37276aa00795945cb5f0e2c4c Mon Sep 17 00:00:00 2001 From: ByungCheol Date: Tue, 7 Jul 2026 22:24:34 +0900 Subject: [PATCH] =?UTF-8?q?fix(loan):=20=EC=9B=90=EB=A6=AC=EA=B8=88?= =?UTF-8?q?=EA=B7=A0=EB=93=B1=20PMT=20=EC=9E=90=EB=8F=99=EA=B3=84=EC=82=B0?= =?UTF-8?q?=20=E2=80=94=20=EB=82=A9=EC=9E=85=EA=B8=88=EC=95=A1=20=EC=88=98?= =?UTF-8?q?=EB=8F=99=EC=9E=85=EB=A0=A5=20=EB=B6=88=ED=95=84=EC=9A=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- src/views/account/AccountView.vue | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/views/account/AccountView.vue b/src/views/account/AccountView.vue index 122be5f..137574c 100644 --- a/src/views/account/AccountView.vue +++ b/src/views/account/AccountView.vue @@ -161,7 +161,7 @@ function monthlyInterestOf(loan) { return Math.round(Math.abs(loan.balance || 0) * (Number(loan.loanRate) / 100 / 12)) } -// 상환방식별 자동계산: 원금균등·만기일시는 납입금액 입력 불필요 +// 상환방식별 자동계산: 원금균등·만기일시·원리금균등(PMT) 모두 자동, 나머지만 수동 const loanAutoResult = computed(() => { const loan = repayTargetLoanWallet.value if (!loan) return null @@ -173,6 +173,14 @@ const loanAutoResult = computed(() => { const principal = Math.round(Number(loan.loanAmount) / loan.loanMonths) return { interest, principal, total: principal + interest, needsInput: false } } + if (loan.loanMethod === 'EQUAL_PAYMENT' && loan.loanAmount && loan.loanMonths && loan.loanRate) { + // PMT 공식: M = P × r(1+r)^n / ((1+r)^n − 1) + const r = Number(loan.loanRate) / 100 / 12 + const n = loan.loanMonths + const M = Math.round(Number(loan.loanAmount) * r * Math.pow(1 + r, n) / (Math.pow(1 + r, n) - 1)) + const principal = Math.max(0, M - interest) + return { interest, principal, total: M, needsInput: false } + } return { interest: null, principal: null, total: null, needsInput: true } })