App.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template lang="pug">
  2. .pos
  3. form-wizard(title="" subtitle="" finishButtonText="Finalizar" color="#7c7bad" nextButtonText="Continuar" backButtonText="Volver" @on-complete="completeSale()")
  4. tab-content(title="Qué productos necesita?" :before-change="checkCart")
  5. cart-step
  6. tab-content(title="Quién es el cliente?" :before-change="checkCustomer")
  7. customer-step
  8. tab-content(title="Cómo quieres pagar?")
  9. payment-method-step
  10. tab-content(v-if="payment === 'cash'" title="Qué monto quieres pagar?")
  11. payment-cash-step
  12. tab-content(v-else title="Quieres hacer alguna entrega?")
  13. payment-credit-step
  14. loader
  15. </template>
  16. <script>
  17. import { FormWizard, TabContent } from 'vue-form-wizard'
  18. import 'vue-form-wizard/dist/vue-form-wizard.min.css'
  19. import CartStep from '@/components/cart/CartStep'
  20. import CustomerStep from '@/components/customer/CustomerStep'
  21. import PaymentMethodStep from '@/components/payment/method/PaymentMethodStep'
  22. import PaymentCashStep from '@/components/payment/cash/PaymentCashStep'
  23. import PaymentCreditStep from '@/components/payment/credit/PaymentCreditStep'
  24. import Loader from '@/components/Loader'
  25. import { mapActions, mapGetters } from 'vuex'
  26. import Vuex from 'vuex'
  27. export default {
  28. components: {
  29. TabContent,
  30. FormWizard,
  31. CartStep,
  32. CustomerStep,
  33. PaymentMethodStep,
  34. PaymentCashStep,
  35. PaymentCreditStep,
  36. Loader,
  37. },
  38. computed: mapGetters([
  39. 'cartIsEmpty',
  40. 'hasSelectedCustomer',
  41. 'payment'
  42. ]),
  43. methods: {
  44. checkCart() {
  45. if (!this.cartIsEmpty) {
  46. this.notify('Necesitas agregar productos al carrito para continuar')
  47. }
  48. return this.cartIsEmpty
  49. },
  50. checkCustomer() {
  51. if (!this.hasSelectedCustomer) {
  52. this.notify('Necesitas seleccionar un cliente para continuar')
  53. }
  54. return this.hasSelectedCustomer
  55. },
  56. ...mapActions([
  57. 'initSale',
  58. 'notify',
  59. 'completeSale'
  60. ])
  61. },
  62. mounted() {
  63. this.initSale(this.$root.pos_instance)
  64. }
  65. }
  66. </script>
  67. <style lang="sass">
  68. .pos
  69. width: 100%
  70. height: 100%
  71. position: absolute
  72. .vue-form-wizard
  73. width: 100%
  74. height: 100%
  75. padding-bottom: 0
  76. .wizard-header
  77. display: none
  78. .wizard-navigation
  79. width: 100%
  80. height: 100%
  81. .wizard-progress-with-circle
  82. top: 35px
  83. .wizard-icon-circle
  84. width: 60px
  85. height: 60px
  86. .wizard-tab-content
  87. width: 100%
  88. height: calc(100% - 82px)
  89. padding: 0
  90. overflow: hidden
  91. .wizard-tab-container
  92. width: calc(100% - 20px)
  93. height: calc(100% - 20px)
  94. margin: 10px
  95. .pos-step
  96. width: 100%
  97. height: 100%
  98. background: #fff
  99. .wizard-card-footer
  100. width: 100%
  101. height: 50px
  102. position: absolute
  103. bottom: 0
  104. .wizard-btn
  105. width: 160px
  106. height: 40px
  107. border-radius: 0
  108. box-shadow: none
  109. border: none
  110. &:hover, &:focus
  111. background: #7c7bad
  112. </style>