PaymentMethod.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template lang="pug">
  2. .pos-step
  3. ticket(:customerName='selectedCustomer && selectedCustomer.name' :companyName='user && user.company.name' :total='cartTotal' :items='cartItems' :defaultCurrency='selectedCurrency')
  4. form.payment-method
  5. .form-separator
  6. h3 Detalles del Cliente
  7. hr
  8. .form-item
  9. label.form-label Cliente
  10. input.form-input(:value='selectedCustomer && selectedCustomer.name' readonly)
  11. transition(name='fade')
  12. .form-item(v-if="payment === 'credit'")
  13. label.form-label Crédito
  14. input.form-input(:value='customerCredit' readonly)
  15. .form-separator
  16. h3 Detalles del Pago
  17. hr
  18. .form-item
  19. label.form-label Forma de Pago
  20. .form-item-option
  21. input.form-input(type='radio' id='cash' value='cash' v-model='payment')
  22. label(for='cash') Contado
  23. .form-item-option
  24. input.form-input(type='radio' id='credit' value='credit' v-model='payment')
  25. label(for='credit') Crédito
  26. transition(name='fade')
  27. .form-item(v-if="payment === 'credit'")
  28. select.form-input.input-only(v-model='paymentTermId')
  29. option(v-for='term in paymentTerms' :value='term.id' v-if="term.lines.length > 0 && (term.lines[0].days !== 0 || term.lines[0].value !== 'balance')") {{ term.displayName }}
  30. .form-item(v-else)
  31. label.form-label Método de Pago
  32. select.form-input(v-model='journalId')
  33. option(v-for='journal in journals' :value='journal.id') {{ journal.displayName }}
  34. payment-bank-modal(:show='!!showBankPaymentModal' :banks='banks' :paymentTypes='bankPaymentTypes' @onSubmit='submitBankPayment')
  35. </template>
  36. <script>
  37. import { mapGetters, mapActions } from 'vuex'
  38. import Ticket from '@@/common/Ticket'
  39. import PaymentBankModal from '@@/modals/PaymentBankModal'
  40. export default {
  41. components: {
  42. Ticket,
  43. PaymentBankModal
  44. },
  45. computed: {
  46. paymentTermId: {
  47. get() {
  48. return (this.selectedPaymentTerm && this.selectedPaymentTerm.id) || -1
  49. },
  50. set(value) {
  51. this.selectPaymentTerm(value)
  52. }
  53. },
  54. journalId: {
  55. get() {
  56. return (this.selectedJournal && this.selectedJournal.id) || -1
  57. },
  58. set(value) {
  59. this.selectJournal(value)
  60. }
  61. },
  62. payment: {
  63. get() {
  64. return this.paymentType
  65. },
  66. set(value) {
  67. this.changePaymentType(value)
  68. if (value == 'credit') {
  69. this.computePaymentLines()
  70. }
  71. }
  72. },
  73. ...mapGetters([
  74. 'user',
  75. 'selectedCustomer',
  76. 'cartItems',
  77. 'cartTotal',
  78. 'customerCredit',
  79. 'paymentTerms',
  80. 'paymentType',
  81. 'selectedPaymentTerm',
  82. 'journals',
  83. 'selectedCurrency',
  84. 'selectedJournal',
  85. 'showBankPaymentModal',
  86. 'banks',
  87. 'bankPaymentTypes'
  88. ])
  89. },
  90. methods: mapActions([
  91. 'changePaymentType',
  92. 'selectJournal',
  93. 'selectPaymentTerm',
  94. 'computePaymentLines',
  95. 'submitBankPayment'
  96. ])
  97. }
  98. </script>
  99. <style lang="sass">
  100. @import '../../assets/variables'
  101. .pos-step
  102. width: 100%
  103. height: calc(100% - 50px)
  104. padding-bottom: 50px
  105. display: flex
  106. .payment-method
  107. width: calc(100% - 450px)
  108. height: 100%
  109. margin-right: 50px
  110. padding: 35px
  111. background: $app-light-color
  112. .form-separator
  113. h3
  114. color: $app-separator-color
  115. font-size: 8pt
  116. margin: 0
  117. hr
  118. margin-top: 15px
  119. .form-item
  120. width: 100%px
  121. height: 45px
  122. margin-bottom: 15px
  123. .form-label
  124. width: 250px
  125. height: 45px
  126. font-size: 14pt
  127. .form-input
  128. width: 350px
  129. height: 45px
  130. font-size: 14pt
  131. border-radius: 0
  132. &.input-only
  133. margin-left: 250px
  134. margin-bottom: 15px
  135. .form-item-option
  136. display: inline-block
  137. input
  138. width: 20px
  139. height: 20px
  140. label
  141. font-size: 12pt
  142. margin: 0 45px 15px 5px
  143. </style>