| | |
| | | </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"> |
| | |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="来票数:"> |
| | | <el-input 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-form-item label="本次来票金额(元):"> |
| | | <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> |
| | |
| | | <script setup> |
| | | import useFormData from "@/hooks/useFormData"; |
| | | import { getProductRecordById } from "@/api/procurementManagement/procurementInvoiceLedger"; |
| | | const { proxy } = getCurrentInstance() |
| | | |
| | | defineOptions({ |
| | | name: "来票台账表单", |
| | |
| | | invoiceNumber: undefined, // 发票号 |
| | | ticketsNum: undefined, // 来票数 |
| | | ticketsAmount: undefined, // 来票金额 |
| | | taxInclusiveTotalPrice: undefined, // 含税总价 |
| | | taxInclusiveUnitPrice: undefined, // 含税单价 |
| | | }); |
| | | |
| | | const load = async (id) => { |
| | |
| | | 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({ |