From 6e3bb34e45df6a2f19f1592fb1b06c574dd026cd Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期六, 12 七月 2025 16:16:55 +0800 Subject: [PATCH] 1.来票台账附件上传接口中未传文件ID --- src/views/procurementManagement/procurementInvoiceLedger/Form/EditForm.vue | 54 +++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 47 insertions(+), 7 deletions(-) diff --git a/src/views/procurementManagement/procurementInvoiceLedger/Form/EditForm.vue b/src/views/procurementManagement/procurementInvoiceLedger/Form/EditForm.vue index 2ce140d..ba4ae28 100644 --- a/src/views/procurementManagement/procurementInvoiceLedger/Form/EditForm.vue +++ b/src/views/procurementManagement/procurementInvoiceLedger/Form/EditForm.vue @@ -12,8 +12,8 @@ </el-form-item> </el-col> <el-col :span="12"> - <el-form-item label="鍚◣鎬讳环(鍏�)锛�"> - <el-text type="primary">{{ form.taxInclusiveTotalPrice }}</el-text> + <el-form-item label="鍚◣鍗曚环(鍏�)锛�"> + <el-text type="primary">{{ form.taxInclusiveUnitPrice }}</el-text> </el-form-item> </el-col> <el-col :span="12"> @@ -28,12 +28,17 @@ </el-col> <el-col :span="12"> <el-form-item label="鏉ョエ鏁帮細"> - <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.ticketsNum" @input="inputTicketsNum" /> + <el-input-number :step="0.1" :min="0" style="width: 100%" v-model="form.ticketsNum" @change="inputTicketsNum" /> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="鏈鏉ョエ閲戦(鍏�)锛�"> - <el-text type="success">{{ form.ticketsAmount }}</el-text> + <el-input-number :step="0.1" :min="0" style="width: 100%" v-model="form.ticketsAmount" @change="inputTicketsAmount" /> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鏈潵绁ㄦ暟锛�"> + <el-text type="success">{{ form.futureTickets }}</el-text> </el-form-item> </el-col> </el-row> @@ -43,6 +48,7 @@ <script setup> import useFormData from "@/hooks/useFormData"; import { getProductRecordById } from "@/api/procurementManagement/procurementInvoiceLedger"; +const { proxy } = getCurrentInstance() defineOptions({ name: "鏉ョエ鍙拌处琛ㄥ崟", @@ -56,7 +62,7 @@ invoiceNumber: undefined, // 鍙戠エ鍙� ticketsNum: undefined, // 鏉ョエ鏁� ticketsAmount: undefined, // 鏉ョエ閲戦 - taxInclusiveTotalPrice: undefined, // 鍚◣鎬讳环 + taxInclusiveUnitPrice: undefined, // 鍚◣鍗曚环 }); const load = async (id) => { @@ -69,12 +75,46 @@ form.invoiceNumber = data.invoiceNumber; form.ticketsNum = data.ticketsNum; form.ticketsAmount = data.ticketsAmount.toFixed(2); - form.taxInclusiveTotalPrice = data.taxInclusiveTotalPrice; + form.taxInclusiveUnitPrice = data.taxInclusiveUnitPrice; + form.futureTickets = data.futureTickets; } }; const inputTicketsNum = (val) => { - form.ticketsAmount = (val * form.taxInclusiveTotalPrice).toFixed(2); + // 纭繚鍚◣鍗曚环瀛樺湪涓斾笉涓洪浂 + if (!form.taxInclusiveUnitPrice || Number(form.taxInclusiveUnitPrice) === 0) { + proxy.$modal.msgWarning("鍚◣鍗曚环涓嶈兘涓洪浂鎴栨湭瀹氫箟"); + return; + } + + if (Number(form.ticketsNum) > Number(form.futureTickets)) { + proxy.$modal.msgWarning("寮�绁ㄦ暟涓嶅緱澶т簬鏈紑绁ㄦ暟"); + form.ticketsNum = form.futureTickets + return; + } + + // 纭繚鎵�鏈夋暟鍊奸兘杞崲涓烘暟瀛楃被鍨嬭繘琛岃绠� + const ticketsAmount = Number(val) * Number(form.taxInclusiveUnitPrice); + form.ticketsAmount = Number(ticketsAmount.toFixed(2)); +}; +const inputTicketsAmount = (val) => { + // 纭繚鍚◣鍗曚环瀛樺湪涓斾笉涓洪浂 + if (!form.taxInclusiveUnitPrice || Number(form.taxInclusiveUnitPrice) === 0) { + proxy.$modal.msgWarning("鍚◣鍗曚环涓嶈兘涓洪浂鎴栨湭瀹氫箟"); + return; + } + + if (Number(val) > Number(form.futureTickets*form.taxInclusiveUnitPrice)) { + proxy.$modal.msgWarning("鏈鏉ョエ閲戦涓嶅緱澶т簬鎬婚噾棰�"); + form.ticketsAmount = (form.futureTickets*form.taxInclusiveUnitPrice).toFixed(2) + const ticketsNum = Number(form.ticketsAmount) / Number(form.taxInclusiveUnitPrice); + form.ticketsNum = Number(ticketsNum.toFixed(2)) + return; + } + + // 纭繚鎵�鏈夋暟鍊奸兘杞崲涓烘暟瀛楃被鍨嬭繘琛岃绠� + const ticketsNum = Number(val) / Number(form.taxInclusiveUnitPrice); + form.ticketsNum = Number(ticketsNum.toFixed(2)); }; defineExpose({ -- Gitblit v1.9.3