- 계좌 관리 대출 폼에 '월 상환금(선택)' 입력(원리금균등) - repayment.js: loanPayment 있으면 이자=잔액×이율, 원금=상환금-이자로 상각 → 남은 개월수 추정 오차(±1회) 없이 은행 조회액과 일치. 미입력 시 기존 추정 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -62,6 +62,7 @@ const form = reactive({
|
||||
loanMethod: '',
|
||||
loanMonths: null,
|
||||
loanStart: '',
|
||||
loanPayment: null,
|
||||
})
|
||||
const submitting = ref(false)
|
||||
const formError = ref(null)
|
||||
@@ -187,6 +188,7 @@ function openCreate() {
|
||||
loanMethod: '',
|
||||
loanMonths: null,
|
||||
loanStart: '',
|
||||
loanPayment: null,
|
||||
})
|
||||
formError.value = null
|
||||
formOpen.value = true
|
||||
@@ -208,6 +210,7 @@ function openEdit(w) {
|
||||
loanMethod: w.loanMethod || '',
|
||||
loanMonths: w.loanMonths ?? null,
|
||||
loanStart: w.loanStart || '',
|
||||
loanPayment: w.loanPayment ?? null,
|
||||
})
|
||||
formError.value = null
|
||||
formOpen.value = true
|
||||
@@ -240,6 +243,7 @@ async function submit() {
|
||||
loanMethod: isLoan && form.loanMethod ? form.loanMethod : null,
|
||||
loanMonths: isLoan && form.loanMonths ? Number(form.loanMonths) : null,
|
||||
loanStart: isLoan && form.loanStart ? form.loanStart : null,
|
||||
loanPayment: isLoan && form.loanPayment ? Number(form.loanPayment) : null,
|
||||
}
|
||||
try {
|
||||
if (editId.value) await accountApi.updateWallet(editId.value, payload)
|
||||
@@ -413,6 +417,13 @@ onBeforeUnmount(destroySortables)
|
||||
<label>대출시작일
|
||||
<input v-model="form.loanStart" type="date" :disabled="submitting" />
|
||||
</label>
|
||||
<label v-if="form.loanMethod === 'EQUAL_PAYMENT' || form.loanMethod === ''">월 상환금(선택)
|
||||
<input v-model.number="form.loanPayment" type="number" min="0"
|
||||
placeholder="은행 조회 고정 월납입금 (예: 697868)" :disabled="submitting" />
|
||||
</label>
|
||||
<p v-if="form.loanMethod === 'EQUAL_PAYMENT' || form.loanMethod === ''" class="form-hint">
|
||||
원리금균등은 <b>월 상환금</b>을 입력하면 상환표의 원금·이자가 은행 조회액과 정확히 일치합니다. (미입력 시 잔액·개월수로 추정)
|
||||
</p>
|
||||
</template>
|
||||
|
||||
<p v-if="formError" class="msg error">{{ formError }}</p>
|
||||
|
||||
Reference in New Issue
Block a user