"use strict";(globalThis.webpackChunkinfinity_hitab_client=globalThis.webpackChunkinfinity_hitab_client||[]).push([[4060,9042],{79042:(t,e,a)=>{a.r(e),a.d(e,{useCalcHomeLoanStore:()=>n});const n=(0,a(10435).Q_)("calc-components-homeloan",{state:()=>({activeIndex:0,loanType:"1",step:1,businessFormData:{amount:100,years:30,rate:4.9},fundFormData:{amount:60,years:20,rate:3.25},groupFormData:{years:30,bus_amount:50,bus_rate:4.9,fund_amount:50,fund_rate:3.25}}),getters:{getSelectData(){switch(this.activeIndex){case 0:default:return this.businessFormData;case 1:return this.fundFormData;case 2:return this.groupFormData}},getActiveIndex(){return this.activeIndex}},actions:{changeActive(t){this.activeIndex=t},changeStep(t){this.step=t}}})},94060:(t,e,a)=>{a.r(e),a.d(e,{useHomeLoanPanel:()=>u});var n=a(10435),o=a(79042);function s(t){return Number(t.toFixed(2))}const r=(t,e,a)=>{const n=t*e*Math.pow(1+e,a)/(Math.pow(1+e,a)-1),o=n*a,r=[];for(let o=1;o<=a;o++){const l=t*e*Math.pow(1+e,o-1)/(Math.pow(1+e,a)-1),i={index:`第${o}期`,monthlyPay:s(n),monthlyBase:s(l),monthlyInterest:s(n-l)};r.push(i)}return{base:t,monthlyPay:s(n),payedTotal:s(n*a),interestTotal:s(o-t),payList:r}},l=(t,e,a)=>{let n=0,o=0,r=0;const l=[];for(let i=0;i<a;i++){n+=(t-t/a*i)*e;const u=t/a+(t-t/a*i)*e;0===i&&(o=u),i===a-1&&(r=u);const y={index:`第${i+1}期`,monthlyPay:s(u),monthlyBase:s(t/a),monthlyInterest:s(u-t/a)};l.push(y)}const i=t/a+n/a,u=(o-r)/a;return{base:t,monthlyPay:s(o),payedTotal:s(i*a),interestTotal:s(n),delta:s(u),payList:l}},i=(t,e,a,n,o,i)=>{const u=12*o,y=1e4*t,c=e/100/12,h=1e4*a,m=n/100/12,p="1"===i?r(y,c,u):l(y,c,u),d="1"===i?r(h,m,u):l(h,m,u),b=[];for(let t=0;t<p.payList.length;t++){const e=p.payList[t],a=d.payList[t];b.push({index:e.index,monthlyPay:s(e.monthlyPay+a.monthlyPay),monthlyBase:s(e.monthlyBase+a.monthlyBase),monthlyInterest:s(e.monthlyInterest+a.monthlyInterest)})}return{base:p.base+d.base,monthlyPay:s(p.monthlyPay+d.monthlyPay),payedTotal:s(p.payedTotal+d.payedTotal),interestTotal:s(p.interestTotal+d.interestTotal),payList:b}},u=()=>{const t=(0,o.useCalcHomeLoanStore)(),e=(0,n.Jk)(t);return{changeActive:e=>{t.changeActive(e)},calcResultHandle:()=>{if(0===t.getActiveIndex||1===t.getActiveIndex){const a=0===t.getActiveIndex?e.businessFormData.value:e.fundFormData.value,n=1e4*a.amount,o=a.rate/100/12,s=12*a.years;return{..."1"===e.loanType.value?r(n,o,s):l(n,o,s),...a}}if(2===t.getActiveIndex){const t=e.groupFormData.value;return{...t,...i(t.bus_amount,t.bus_rate,t.fund_amount,t.fund_rate,t.years,e.loanType.value)}}},resetStep:e=>{t.changeStep(e)},step:e.step,loanType:e.loanType,activeIndex:e.activeIndex,businessFormData:e.businessFormData,fundFormData:e.fundFormData,groupFormData:e.groupFormData}}}}]);