58 lines
1.3 KiB
Vue
58 lines
1.3 KiB
Vue
<template>
|
|
<b-tab-item label="Carritos">
|
|
<TablaCarritos
|
|
:carritos="carritos"
|
|
:isLoadingTable="isLoadingTable"
|
|
:onPageChange="onPageChange"
|
|
:page="page"
|
|
:total="total"
|
|
:operador="admin"
|
|
/>
|
|
</b-tab-item>
|
|
</template>
|
|
|
|
<script>
|
|
import axios from 'axios'
|
|
import TablaCarritos from '@/components/tablas/TablaCarritos'
|
|
|
|
export default {
|
|
components: { TablaCarritos },
|
|
props: {
|
|
admin: { type: Object, required: true, default: () => ({}) },
|
|
modulo: { type: Object, required: true, default: () => ({}) },
|
|
},
|
|
data() {
|
|
return { carritos: [], isLoadingTable: false, page: 1, total: 0 }
|
|
},
|
|
methods: {
|
|
obtenerCarritos() {
|
|
this.isLoadingTable = true
|
|
return axios
|
|
.get(
|
|
`${process.env.api}/carrito/carritos?pagina=1&id_institucion=${this.admin.institucion.id_institucion}&id_modulo=${this.modulo.id_modulo}`,
|
|
this.$getToken.token()
|
|
)
|
|
.then((res) => {
|
|
this.carritos = res.data[0]
|
|
this.total = res.data[1]
|
|
this.isLoadingTable = false
|
|
})
|
|
.catch((err) => {
|
|
this.isLoadingTable = false
|
|
})
|
|
},
|
|
onPageChange(page) {
|
|
this.page = page
|
|
this.obtenerCarritos()
|
|
},
|
|
},
|
|
watch: {
|
|
modulo() {
|
|
this.obtenerCarritos()
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style></style>
|