123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310 |
- <template lang="pug">
- .pos-step
- ticket(
- :companyName='companyName'
- :items='cartItems'
- :total='amountToPay'
- :defaultCurrency='selectedCurrency'
- :customerName='selectedCustomerName'
- )
- form
- //- input para forma de pago
- .form-item
- label.form-label Forma de Pago
- switch-button-input.form-input(
- primary-value='Contado'
- secondary-value='Crédito'
- :selected-value="paymentType === 'cash' ? 'Contado' : 'Crédito'"
- @onChange="changePaymentType($event ? 'cash' : 'credit')"
- )
- //- input para condiciones de pago en caso de pago a crédito
- .form-item(v-show="paymentType === 'credit'")
- select.form-input.input-only(v-model='paymentTermId')
- option(
- :value='term.id'
- v-for='term in paymentTerms'
- v-if="term.lines.length > 0 && (term.lines[0].days !== 0 || term.lines[0].value !== 'balance')"
- ) {{ term.name }}
- //- input para monto de pago
- .form-item
- label.form-label Monto a Pagar
- input-dropdown.form-input(
- format='number'
- :value='amountToPay'
- :editable='false'
- :suffix='currencySymbol'
- :options='currencySymbols'
- @onChangeValue='onChangeValue'
- @onClickOption='changeCurrency'
- )
- .other_exchanges(v-if='settings.viewExchanges')
- h2 En otras monedas
- ul
- li(v-for='value in amountToPayInOtherCurrencies') {{ value.amount | currency(value.currency) }}
- //- input para el monto recibido
- .form-item
- label.form-label Monto Recibido
- input-dropdown.form-input(
- ref='initialAmount'
- format='number'
- :value='initialPayment'
- :suffix='paymentMethod'
- :options='paymentMethods'
- :focus='true'
- @onClickOption='changePaymentMethod'
- @onChangeValue='changeAmountReceived($event)'
- )
- //- input para el vuelto del pago en caso de pago en efectivo
- div(v-show="paymentType === 'cash'")
- hr
- .form-item
- label.form-label Vuelto
- input-dropdown.form-input(
- format='number'
- :value='amountResidual'
- :editable='false'
- )
- //- input para el monto de cuotas calculadas en caso de pago a crédito
- .form-item-table(v-show="paymentType === 'credit'")
- table
- thead
- tr
- th Monto a Pagar
- th Fecha de Pago
- tbody
- tr(v-for='line in paymentLines')
- td {{ line.total | currency(...selectedCurrency) }}
- td {{ line.date }}
- bank-payment-modal(
- :initialAmount='amountToPay'
- :journals='bankJournals'
- :hasSelectedJournal='hasBankJournalSelected'
- :banks='banks'
- :bankPaymentTypes='bankPaymentTypes'
- :selectedBankPaymentType='selectedBankPaymentType'
- :chequeTypes='chequeTypes'
- :selectedChequeType='selectedChequeType'
- :show='showBankPayment'
- @onNotify='notify'
- @onChangeBankJournal='changeBankJournal'
- @onChangeBankPaymentType='changeBankPaymentType'
- @onChangeChequeType='changeChequeType'
- @onSelectBank='changeBank'
- @onDone='endBankPayment'
- @onCancel='cancelBankPayment'
- )
- </template>
- <script>
- import { mapGetters, mapActions } from 'vuex'
- import { Ticket, SwitchButtonInput, InputDropdown } from '../common'
- import BankPaymentModal from '../modals/BankPaymentModal'
- export default {
- components: {
- Ticket,
- SwitchButtonInput,
- InputDropdown,
- BankPaymentModal
- },
- computed: {
- paymentTermId: {
- get() {
- return (this.paymentTerm && this.paymentTerm.id) || -1
- },
- set(value) {
- this.selectPaymentTerm(value)
- if (this.paymentType === 'credit') {
- this.computePaymentLines()
- }
- }
- },
- ...mapGetters([
- 'companyName',
- 'amountToPay',
- 'amountToPayInOtherCurrencies',
- 'initialPayment',
- 'amountResidual',
- 'paymentLines',
- 'cartItems',
- 'paymentType',
- 'paymentTerm',
- 'paymentMethod',
- 'currencySymbol',
- 'showBankPayment',
- 'hasBankJournalSelected',
- 'selectedCustomerName',
- 'selectedCurrency',
- 'selectedJournal',
- 'selectedBankPaymentType',
- 'selectedChequeType',
- 'currencies',
- 'currencySymbols',
- 'journals',
- 'bankJournals',
- 'paymentTerms',
- 'paymentMethods',
- 'banks',
- 'bankPaymentTypes',
- 'chequeTypes',
- 'settings'
- ])
- },
- watch: {
- paymentType() {
- this.focusInitialPayment()
- },
- paymentTerm() {
- this.focusInitialPayment()
- },
- selectedCurrency() {
- this.focusInitialPayment()
- }
- },
- methods: {
- focusInitialPayment() {
- this.$nextTick(() => this.$refs.initialAmount.$el.children[0].children[0].focus())
- },
- endBankPayment(data) {
- this.changeBankPaymentData(data)
- this.toggleBankPayment()
- },
- changeBankJournal(journalId) {
- this.selectJournal(journalId)
- this.changeBankPaymentType()
- },
- cancelBankPayment() {
- this.toggleBankPayment()
- this.changePaymentMethod('Efectivo')
- this.autoSelectJournal()
- },
- changeAmountReceived(amount) {
- this.changeInitialPayment(amount)
- },
- ...mapActions([
- 'autoSelectJournal',
- 'changeCurrency',
- 'selectPaymentTerm',
- 'selectJournal',
- 'changePaymentType',
- 'changePaymentMethod',
- 'changeBankPaymentType',
- 'changeChequeType',
- 'changeBank',
- 'changeInitialPayment',
- 'changeBankPaymentData',
- 'computePaymentLines',
- 'toggleBankPayment',
- 'notify'
- ])
- }
- }
- </script>
- <style lang="sass">
- @import '../../assets/variables'
- .pos-step
- width: 100%
- height: calc(100% - 50px)
- padding-bottom: 50px
- display: flex
- form
- width: calc(100% - 450px)
- height: 100%
- margin-right: 50px
- padding: 25px
- background: $app-bg-color
- .form-item
- width: 100%
- height: 35px
- margin-bottom: 15px
- & > .form-label, > .form-input
- display: inline-block
- vertical-align: top
- .form-label
- width: 200px
- height: 35px
- font-size: 12pt
- line-height: 30px
- color: $app-dark-color
- .form-input
- width: 400px
- height: 35px
- font-size: 12pt
- border-radius: 0
- &.input-only
- margin-left: 200px
- margin-bottom: 15px
- .form-item-option
- display: inline-block
- input
- width: 20px
- height: 20px
- label
- font-size: 12pt
- margin: 0 35px 15px 5px
- .other_exchanges
- width: 145px
- height: 150px
- border: 1px solid #e0e0e0
- display: inline-block
- position: relative
- bottom: calc(50% + 40px)
- margin-left: 25px
- &:after
- content: ''
- position: absolute
- left: 0
- top: 50%
- width: 0
- height: 0
- border: 16px solid transparent
- border-right-color: #e0e0e0
- border-left: 0
- margin-top: -16px
- margin-left: -16px
- h2
- font-size: 8pt
- margin: 10px 0 0
- color: #d3d3d3
- text-align: center
- ul
- list-style: none
- margin: 0
- padding: 10px
- font-size: 12pt
- text-align: center
- li
- margin-bottom: 10px
- border-bottom: 1px solid #eeeeee
- .form-item-table
- width: 100%
- height: 200px
- border: 1px solid #e0e0e0
- overflow-y: auto
- table
- width: 100%
- thead
- background-color: #7c7bad
- color: #fff
- th
- line-height: 35px
- padding-left: 10px
- th:nth-child(1)
- width: 200px
- th:nth-child(2)
- width: 200px
- tbody
- td
- height: 35px
- padding-left: 10px
- line-height: 30px
- font-size: 11pt
- td:nth-child(1)
- width: 200px
- td:nth-child(2)
- width: 200px
- </style>
|