separacion del credito
This commit is contained in:
@@ -35,6 +35,8 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
token: '',
|
||||
|
||||
numeroCuenta: '',
|
||||
credito: '',
|
||||
datos: {},
|
||||
@@ -45,7 +47,8 @@ export default {
|
||||
this.updateIsLoading(true)
|
||||
axios
|
||||
.get(
|
||||
`${process.env.api}/usuario/credito?numeroCuenta=${this.numeroCuenta}`
|
||||
`${process.env.api}/admin/credito?numeroCuenta=${this.numeroCuenta}`,
|
||||
this.token
|
||||
)
|
||||
.then((res) => {
|
||||
this.updateIsLoading(false)
|
||||
@@ -65,7 +68,7 @@ export default {
|
||||
}
|
||||
this.updateIsLoading(true)
|
||||
axios
|
||||
.get(`${process.env.api}/usuario/restar_credito`, data)
|
||||
.get(`${process.env.api}/usuario/restar_credito`, data, this.token)
|
||||
.then((res) => {
|
||||
this.updateIsLoading(false)
|
||||
;(this.datos.nombre = res.data.nombre),
|
||||
@@ -79,6 +82,11 @@ export default {
|
||||
})
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.token = {
|
||||
headers: { token: localStorage.getItem('token') },
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
</div>
|
||||
|
||||
<div class="has-text-centered pb-2 pt-3">
|
||||
<p>Tu crédito es de: $0 pesos</p>
|
||||
<p>Tu crédito es de: ${{ creditoDisponible }} pesos</p>
|
||||
</div>
|
||||
|
||||
<div class="has-text-centered pb-5 pt-3">
|
||||
@@ -75,6 +75,8 @@ export default {
|
||||
monto: '',
|
||||
fechaTicket: null,
|
||||
|
||||
creditoDisponible: 0,
|
||||
|
||||
minDate: this.diaMin(today),
|
||||
maxDate: new Date(),
|
||||
|
||||
@@ -82,6 +84,22 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
traerCredito() {
|
||||
this.updateIsLoading(true)
|
||||
axios
|
||||
.get(
|
||||
`${process.env.api}/usuario/credito?numeroCuenta=${this.numeroCuenta}`,
|
||||
this.token
|
||||
)
|
||||
.then((res) => {
|
||||
this.updateIsLoading(false)
|
||||
this.creditoDisponible = res.data.credito
|
||||
})
|
||||
.catch((err) => {
|
||||
this.updateIsLoading(false)
|
||||
this.imprimirError(err.response.data)
|
||||
})
|
||||
},
|
||||
diaMin(today) {
|
||||
return new Date(
|
||||
today.getFullYear(),
|
||||
@@ -113,5 +131,8 @@ export default {
|
||||
})
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.traerCredito()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user