Untitled
unknown
javascript
a year ago
3.0 kB
6
Indexable
<template> <div> <v-dialog v-model="status" @keydown.esc="status = false" persistent max-width="600px"> <v-form ref="form" v-model="valid" lazy-validation> <v-card> <v-card-text> <v-container grid-list-md> <v-layout wrap> <v-select :items="receipt_type_other" item-value="text" item-text="name" label="Seleccionar documento" v-model="data.serie" /> <v-flex xs12> <v-text-field label="Número correlativo" v-model="data.correlative" required /> </v-flex> </v-layout> </v-container> </v-card-text> <v-card-actions class="pb-3"> <v-btn color="blue darken-1" @click="closeModal">Cancelar</v-btn> <v-spacer/> <v-btn color="primary" dark @click="saveRegister">REGISTRAR</v-btn> </v-card-actions> </v-card> </v-form> </v-dialog> </div> </template> <script> import Invoice from "../../mixins/InvoiceMixins"; import axios from "axios"; export default { name: "RegisterInvoice.vue", props: { data: Object, status: Boolean, }, mixins: [Invoice], data() { return { dialogCreate: true, valid: false, modal: false, countries_id: 1, } }, methods: { async saveRegister() { let flag = ['B001', 'EB01']; this.data.document_type_id = flag.indexOf(this.data.serie) > -1 ? 1 : 2; this.data.document_type = flag.indexOf(this.data.serie) > -1 ? 'saleTicket' : 'invoice' this.data.correlative = +this.data.correlative; await axios.post('/charges/receips/store', this.data) .then(() => { this.closeModal() }) .catch(error => { console.log(error) }); }, clearData() { this.data = { serie: '', correlative: null, membership_charge_id: null, document_type_id: null, document_type: null } }, closeModal() { this.clearData() this.$emit('close') }, } } </script> <style scoped> </style>
Editor is loading...
Leave a Comment