Skouter mortgage estimates. Web application with view written in PHP and Vue, but controller and models in Go.
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 
 

50 linhas
1.2 KiB

  1. <template>
  2. <div>
  3. <section class="form inputs">
  4. <h3>Monthly Payment - ${{totalMonthly}}</h3>
  5. <label>Loan payment: ${{loanPayment}}</label>
  6. <label>Mortgage insurance: $0</label>
  7. <label>Property taxes: ${{loan.tax}}</label>
  8. </section>
  9. <section class="form inputs">
  10. <h3>Cash to Close - ${{totalMonthly}}</h3>
  11. <label>Closing costs: ${{fees}}</label>
  12. <label>Credits: ${{credits}}</label>
  13. <label>Downpayment: ${{downpayment}}</label>
  14. </section>
  15. <section class="form inputs">
  16. <button>Save Estimate</button>
  17. <button>Generage PDF</button>
  18. </section>
  19. </div>
  20. </template>
  21. <script setup>
  22. import { ref } from 'vue'
  23. const props = defineProps(['estimate', 'loans', 'sel'])
  24. const loan = props.loans[props.sel]
  25. const rate = loan.interest / 100 / 12
  26. const term = loan.term*12
  27. const loanPayment = loan.amount *
  28. rate*(1+rate)**(term) /
  29. ((1+rate)**(term) - 1)
  30. const totalMonthly = (loanPayment + loan.tax + loan.hoa + loan.hazard).toFixed(2)
  31. // Closing costs
  32. const downpayment = (props.estimate.price - loan.amount).toFixed(2)
  33. const fees = loan.fees.reduce((total, x) => {
  34. return x.amount > 0 ? total + x.amount : 0
  35. }, 0
  36. ).toFixed(2)
  37. const credits = loan.fees.reduce((total, x) => {
  38. return x.amount < 0 ? total + x.amount : 0
  39. }, 0
  40. ).toFixed(2)
  41. </script>