| | |
| | | rowKey="id" |
| | | :column="columns" |
| | | :tableData="form.productData" |
| | | :summaryMethod="summarizeChildrenTable" |
| | | :isShowSummary="true" |
| | | height="auto" |
| | | > |
| | | <template #ticketsNumRef="{ row }"> |
| | | <el-input-number |
| | | v-model="row.ticketsNum" |
| | | placeholder="请选择" |
| | | placeholder="请输入" |
| | | :min="0" |
| | | :step="0.1" |
| | | clearable |
| | |
| | | <template #ticketsAmountRef="{ row }"> |
| | | <el-input-number |
| | | v-model="row.ticketsAmount" |
| | | placeholder="请选择" |
| | | placeholder="请输入" |
| | | :min="0" |
| | | :step="0.1" |
| | | clearable |
| | |
| | | |
| | | <script setup> |
| | | import { ref, getCurrentInstance } from "vue"; |
| | | import { defineEmits } from 'vue'; |
| | | import { useModal } from "@/hooks/useModal"; |
| | | import useFormData from "@/hooks/useFormData"; |
| | | import FileUpload from "@/components/Upload/FileUpload.vue"; |
| | |
| | | title: "来票登记", |
| | | }); |
| | | |
| | | const emit = defineEmits(['refreshList']); |
| | | |
| | | const columns = [ |
| | | { |
| | | label: "产品大类", |
| | | prop: "productCategory", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "规格型号", |
| | | prop: "specificationModel", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "单位", |
| | |
| | | { |
| | | label: "未来票数", |
| | | prop: "futureTickets", |
| | | width: 100, |
| | | }, |
| | | { |
| | | label: "未来票金额(元)", |
| | | prop: "futureTicketsAmount", |
| | | width: 200, |
| | | }, |
| | | ]; |
| | | |
| | |
| | | form.productData = data.productData; |
| | | } |
| | | }; |
| | | |
| | | // 子表合计方法 |
| | | const summarizeChildrenTable = (param) => { |
| | | return proxy.summarizeTable(param, [ |
| | | "taxInclusiveUnitPrice", |
| | | "taxInclusiveTotalPrice", |
| | | "taxExclusiveTotalPrice", |
| | | "ticketsNum", |
| | | "ticketsAmount", |
| | | "ticketsAmountRef", |
| | | "futureTickets", |
| | | "futureTicketsAmount", |
| | | ]); |
| | | }; |
| | | //本次来票数失焦操作 |
| | | const invoiceNumBlur = (row) => { |
| | | if (!row.ticketsNum || row.ticketsNum === "") { |
| | |
| | | return; |
| | | } |
| | | // 计算本次来票金额 |
| | | row.ticketsAmount = row.ticketsNum * row.taxInclusiveUnitPrice; |
| | | row.ticketsAmount = (row.ticketsNum * row.taxInclusiveUnitPrice).toFixed(2) |
| | | // 计算未来票数 |
| | | row.futureTickets = row.tempFutureTickets - row.ticketsNum; |
| | | row.futureTickets = (row.tempFutureTickets - row.ticketsNum).toFixed(2) |
| | | // 计算未来票金额 |
| | | row.futureTicketsAmount = row.tempFutureTicketsAmount - row.ticketsAmount; |
| | | row.futureTicketsAmount = (row.tempFutureTicketsAmount - row.ticketsAmount).toFixed(2) |
| | | calculateinvoiceAmount(); |
| | | }; |
| | | |
| | |
| | | (row.ticketsAmount / row.taxInclusiveUnitPrice).toFixed(2) |
| | | ); |
| | | // 计算未来票数 |
| | | row.futureTickets = row.tempFutureTickets - row.ticketsNum; |
| | | row.futureTickets = (row.tempFutureTickets - row.ticketsNum).toFixed(2) |
| | | // 计算未来票金额 |
| | | row.futureTicketsAmount = row.tempFutureTicketsAmount - row.ticketsAmount; |
| | | row.futureTicketsAmount = (row.tempFutureTicketsAmount - row.ticketsAmount).toFixed(2) |
| | | calculateinvoiceAmount(); |
| | | }; |
| | | |
| | |
| | | let invoiceAmountTotal = 0; |
| | | form.productData.forEach((item) => { |
| | | if (item.ticketsAmount) { |
| | | invoiceAmountTotal += item.ticketsAmount; |
| | | invoiceAmountTotal += Number(item.ticketsAmount); |
| | | } |
| | | }); |
| | | form.invoiceAmount = invoiceAmountTotal.toFixed(2); |
| | |
| | | const removeFile = (file) => { |
| | | const { tempId } = file.response.data; |
| | | form.tempFileIds = form.tempFileIds.filter((item) => item !== tempId); |
| | | }; |
| | | |
| | | const closeAndRefresh = () => { |
| | | closeModal(); |
| | | emit('refreshList'); |
| | | }; |
| | | |
| | | const submitForm = () => { |
| | |
| | | }); |
| | | modalLoading.value = false; |
| | | if (code == 200) { |
| | | closeModal(); |
| | | closeAndRefresh(); |
| | | } |
| | | } else { |
| | | modalLoading.value = false; |
| | |
| | | |
| | | defineExpose({ |
| | | open, |
| | | closeAndRefresh, |
| | | }); |
| | | </script> |
| | | |