formulario de compras
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
<div class="row">
|
||||
<card class="col-8">
|
||||
<card class="col-12">
|
||||
<el-table
|
||||
:data="
|
||||
compras.filter(
|
||||
@@ -63,36 +64,16 @@
|
||||
</el-table>
|
||||
</card>
|
||||
|
||||
<card class="col-4">
|
||||
<base-input
|
||||
label="Fecha"
|
||||
v-model="newCompra.fecha"
|
||||
type="Date"
|
||||
></base-input>
|
||||
<base-input
|
||||
label="Descripcion"
|
||||
v-model="newCompra.detalle"
|
||||
></base-input>
|
||||
<base-input
|
||||
label="Valor"
|
||||
type="Number"
|
||||
v-model="newCompra.valor"
|
||||
></base-input>
|
||||
<base-input label="Metodo de pago">
|
||||
<select class="form-control" v-model="newCompra.metodo_pago">
|
||||
<option v-for="metodo in metodos_pago">{{ metodo.metodo }}</option>
|
||||
</select>
|
||||
</base-input>
|
||||
<base-input label="categoría">
|
||||
<select class="form-control" v-model="newCompra.categoria">
|
||||
<option v-for="categoria in categorias">{{ categoria.ctg }}</option>
|
||||
</select>
|
||||
</base-input>
|
||||
<base-button type="primary" class="mb-3" size="lg" @click="saveCompra()"
|
||||
>Guardar</base-button
|
||||
>
|
||||
</card>
|
||||
|
||||
<Fcompras
|
||||
:categorias="categorias"
|
||||
:metodos_pago="metodos_pago"
|
||||
:newCompra="newCompra"
|
||||
:saveCompra="saveCompra"
|
||||
/>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
@@ -108,7 +89,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
newCompra: {
|
||||
fecha: "",
|
||||
fecha:"",
|
||||
detalle: "",
|
||||
valor: 0,
|
||||
metodo_pago: "",
|
||||
@@ -140,6 +121,9 @@ export default {
|
||||
],
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getDate()
|
||||
},
|
||||
methods: {
|
||||
saveCompra() {
|
||||
var compra = JSON.stringify(this.newCompra);
|
||||
@@ -150,6 +134,15 @@ export default {
|
||||
this.compras.splice(index, 1);
|
||||
//console.log(index)
|
||||
},
|
||||
getDate(){
|
||||
let data = new Date();
|
||||
let year= data.getFullYear();
|
||||
let month = (data.getMonth() + 1)<9?"0"+(data.getMonth() + 1):(data.getMonth() + 1)
|
||||
let day = data.getDate()<9?"0"+data.getDate():data.getDate()
|
||||
let dataF=`${year}-${month}-${day}`
|
||||
this.newCompra.fecha=dataF;
|
||||
}
|
||||
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user