App.vue 5.2 KB

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