pcpuma_unam_operador/components/operador/Carrito.vue

78 lines
1.7 KiB
Vue
Raw Normal View History

2022-07-05 06:03:20 +00:00
<template>
<section class="mb-5">
<BuscarCarrito
2022-08-05 12:45:31 +00:00
:updateCarrito="updateCarrito"
:updateIsLoading="updateIsLoading"
2022-07-05 06:03:20 +00:00
:operador="operador"
:carrito="carrito"
/>
2022-07-13 05:42:23 +00:00
<TablaEquipos
2022-07-29 20:40:03 +00:00
:equipos="equipos"
:page="page"
2022-07-13 05:42:23 +00:00
:total="total"
2022-07-29 20:40:03 +00:00
:onPageChange="onPageChange"
2022-07-13 05:42:23 +00:00
:isLoadingTable="isLoadingTable"
/>
2022-07-05 06:03:20 +00:00
</section>
</template>
<script>
2022-07-13 05:42:23 +00:00
import axios from 'axios'
2022-07-27 02:33:41 +00:00
import BuscarCarrito from '@/components/buscar/BuscarCarrito'
2022-07-29 20:40:03 +00:00
import TablaEquipos from '@/components/tablas/TablaEquipos'
2022-07-05 06:03:20 +00:00
export default {
2022-07-13 05:42:23 +00:00
components: { BuscarCarrito, TablaEquipos },
2022-08-05 12:45:31 +00:00
props: {
operador: { type: Object, required: true },
updateIsLoading: { type: Function, required: true },
},
2022-07-05 06:03:20 +00:00
data() {
return {
2022-07-22 21:53:27 +00:00
equipos: [],
2022-07-29 20:40:03 +00:00
isLoadingTable: false,
page: 1,
2022-07-13 05:42:23 +00:00
total: 0,
2022-07-05 06:03:20 +00:00
carrito: { modulo: {}, tipoCarrito: {} },
}
},
methods: {
2022-07-29 20:40:03 +00:00
obtenerEquipos() {
2022-07-13 05:42:23 +00:00
axios
.get(
2022-07-29 20:40:03 +00:00
`${process.env.api}/equipo/equipos?pagina=${this.page}&id_carrito=${this.carrito.id_carrito}`,
2022-07-19 16:41:33 +00:00
this.$getToken.token()
2022-07-13 05:42:23 +00:00
)
.then((res) => {
2022-07-22 21:53:27 +00:00
this.equipos = res.data[0]
2022-07-13 05:42:23 +00:00
this.total = res.data[1]
this.isLoadingTable = false
})
.catch((err) => {
this.isLoadingTable = false
2022-08-05 23:41:37 +00:00
this.$alertsGenericos.imprimirError(
this.$buefy,
this.$router,
err.response.data
)
2022-07-13 05:42:23 +00:00
})
},
2022-07-29 20:40:03 +00:00
onPageChange(page) {
this.page = page
this.obtenerEquipos()
},
updateCarrito(valorObject) {
this.carrito = valorObject
},
2022-07-13 05:42:23 +00:00
},
watch: {
carrito() {
2022-07-29 20:40:03 +00:00
this.obtenerEquipos()
2022-07-13 05:42:23 +00:00
},
2022-07-05 06:03:20 +00:00
},
}
</script>
<style></style>