App.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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="Agregue productos al carrito" :before-change="checkCart")
  5. .products
  6. .products-container
  7. products-searcher
  8. products-grid(:symbol="currency.symbol")
  9. .cart-container
  10. cart-total(:total="total" :symbol="currency.symbol")
  11. cart-items(:symbol="currency.symbol")
  12. tab-content(title="Seleccione un cliente" :before-change="checkCustomer")
  13. customer-searcher
  14. customers-grid
  15. tab-content(title="Vea un resumen de su operación")
  16. payment
  17. loader
  18. </template>
  19. <script>
  20. import { FormWizard, TabContent } from 'vue-form-wizard'
  21. import 'vue-form-wizard/dist/vue-form-wizard.min.css'
  22. import Loader from '@/components/Loader'
  23. import ProductsSearcher from '@/components/ProductsSearcher'
  24. import ProductsGrid from '@/components/ProductsGrid'
  25. import CartTotal from '@/components/CartTotal'
  26. import CartItems from '@/components/CartItems'
  27. import CartItem from '@/components/CartItem'
  28. import CustomerSearcher from '@/components/CustomerSearcher'
  29. import CustomersGrid from '@/components/CustomersGrid'
  30. import Payment from '@/components/Payment'
  31. import { mapActions, mapGetters } from 'vuex'
  32. import Vuex from 'vuex'
  33. export default {
  34. components: {
  35. 'form-wizard': FormWizard,
  36. 'tab-content': TabContent,
  37. 'loader': Loader,
  38. 'products-searcher': ProductsSearcher,
  39. 'products-grid': ProductsGrid,
  40. 'cart-total': CartTotal,
  41. 'cart-items': CartItems,
  42. 'cart-item': CartItem,
  43. 'customer-searcher': CustomerSearcher,
  44. 'customers-grid': CustomersGrid,
  45. 'payment': Payment
  46. },
  47. computed: mapGetters({
  48. total: 'getTotal',
  49. currency: 'getCurrency',
  50. cartIsEmpty: 'cartIsEmpty',
  51. hasSelectedCustomer: 'hasSelectedCustomer'
  52. }),
  53. methods: {
  54. checkCart() {
  55. if (!this.cartIsEmpty) {
  56. this.notify('Necesitas agregar productos al carrito para continuar')
  57. }
  58. return this.cartIsEmpty
  59. },
  60. checkCustomer() {
  61. if (!this.hasSelectedCustomer) {
  62. this.notify('Necesitas seleccionar un cliente para continuar')
  63. }
  64. return this.hasSelectedCustomer
  65. },
  66. ...mapActions([
  67. 'initSale',
  68. 'notify',
  69. 'completeSale'
  70. ])
  71. },
  72. mounted() {
  73. this.initSale(this.$root.pos_instance)
  74. }
  75. }
  76. </script>
  77. <style lang="sass">
  78. .pos
  79. width: 100%
  80. height: 100%
  81. position: absolute
  82. .vue-form-wizard
  83. width: 100%
  84. height: 100%
  85. padding-bottom: 0
  86. .wizard-header
  87. display: none
  88. .wizard-navigation
  89. width: 100%
  90. height: 100%
  91. .wizard-progress-with-circle
  92. top: 35px
  93. .wizard-icon-circle
  94. width: 60px
  95. height: 60px
  96. .wizard-tab-content
  97. width: 100%
  98. height: calc(100% - 82px)
  99. padding: 0
  100. overflow: hidden
  101. .wizard-tab-container
  102. width: calc(100% - 20px)
  103. height: calc(100% - 20px)
  104. margin: 10px
  105. .products
  106. width: 100%
  107. height: 100%
  108. display: block
  109. background: #fff
  110. .products-container
  111. width: calc(100% - 300px)
  112. height: 100%
  113. padding-right: 5px
  114. display: inline-block
  115. .cart-container
  116. width: 300px
  117. height: 100%
  118. border-left: 1px solid #d3d3d3
  119. padding-left: 10px
  120. display: inline-block
  121. vertical-align: top
  122. .wizard-card-footer
  123. width: 100%
  124. height: 50px
  125. position: absolute
  126. bottom: 0
  127. .wizard-btn
  128. width: 160px
  129. height: 40px
  130. border-radius: 0
  131. box-shadow: none
  132. border: none
  133. &:hover, &:focus
  134. background: #7c7bad
  135. </style>