Arreglo a ProductoCantidad

This commit is contained in:
Rodrigo 2024-09-16 09:25:26 -03:00
parent b845637064
commit a998f76d44
1 changed files with 9 additions and 1 deletions

View File

@ -38,6 +38,10 @@
} }
}, },
mounted() { mounted() {
if (this.producto.pivot !== undefined) {
this.cantidad = this.producto.pivot.cantidad;
this.enChismosa = this.cantidad;
}
Event.$on('sync-subpedido', (cantidad,productoId) => { Event.$on('sync-subpedido', (cantidad,productoId) => {
if (this.producto.id === productoId) if (this.producto.id === productoId)
this.sincronizar(cantidad); this.sincronizar(cantidad);
@ -59,7 +63,11 @@
}, },
sincronizar(cantidad) { sincronizar(cantidad) {
this.cantidad = cantidad; this.cantidad = cantidad;
if (this.producto.pivot != null) {
this.producto.pivot.cantidad = cantidad;
} else {
this.producto.cantidad = cantidad; this.producto.cantidad = cantidad;
}
this.enChismosa = cantidad; this.enChismosa = cantidad;
}, },
hayCambios() { hayCambios() {