| | |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="发票金额(元):" prop="invoiceAmount"> |
| | | <el-input |
| | | type="number" |
| | | :step="0.01" |
| | | :min="0" |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" |
| | | v-model="form.invoiceAmount" |
| | | placeholder="自动填充" |
| | | clearable |
| | | :disabled="true" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="录入日期:" prop="enterDate"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="form.enterDate" |
| | | type="date" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-form-item label="产品信息:" prop="entryDate"> </el-form-item> |
| | | <el-form-item label="产品信息:"> </el-form-item> |
| | | <PIMTable |
| | | 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"; |
| | |
| | | import { getPurchaseById } from "@/api/procurementManagement/procurementLedger.js"; |
| | | import { getToken } from "@/utils/auth"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | import dayjs from "dayjs"; |
| | | |
| | | defineOptions({ |
| | | name: "来票登记模态框", |
| | |
| | | issUer: userStore.nickName, // 录入人 |
| | | entryDate: undefined, // 开票日期 |
| | | salesContractNoId: undefined, // 开票日期 |
| | | enterDate: dayjs().format("YYYY-MM-DD"), |
| | | productData: [], // 表格 |
| | | tempFileIds: [], // 文件 |
| | | }); |
| | |
| | | invoiceAmount: [ |
| | | { required: true, message: "请输入发票金额", trigger: "blur" }, |
| | | ], |
| | | entryDate: [{ required: true, message: "请选择开票日期", trigger: "change" }], |
| | | enterDate: [{ required: true, message: "请选择录入日期", trigger: "change" }], |
| | | }); |
| | | |
| | | const { |
| | |
| | | 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); |
| | |
| | | form.tempFileIds = form.tempFileIds.filter((item) => item !== tempId); |
| | | }; |
| | | |
| | | const closeAndRefresh = () => { |
| | | closeModal(); |
| | | emit('refreshList'); |
| | | }; |
| | | |
| | | const submitForm = () => { |
| | | formRef.value.validate(async (valid, fields) => { |
| | | if (valid) { |
| | |
| | | salesContractNoId: form.salesContractNoId, |
| | | supplierName: form.supplierName, |
| | | tempFileIds: form.tempFileIds, |
| | | enterDate: form.enterDate, |
| | | type: 4, |
| | | }); |
| | | modalLoading.value = false; |
| | | if (code == 200) { |
| | | closeModal(); |
| | | closeAndRefresh(); |
| | | } |
| | | } else { |
| | | modalLoading.value = false; |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | defineExpose({ |
| | | open, |
| | | closeAndRefresh, |
| | | }); |
| | | </script> |
| | | |