| | |
| | | }; |
| | | |
| | | //本次开票失焦操作 |
| | | const getInvoiceCalcUnitPrice = (row) => { |
| | | const baseNoInvoiceNum = parseFloat( |
| | | row.tempNoInvoiceNum ?? row.originalNoInvoiceNum ?? row.noInvoiceNum ?? 0 |
| | | ); |
| | | const baseNoInvoiceAmount = parseFloat( |
| | | row.tempnoInvoiceAmount ?? row.noInvoiceAmount ?? row.taxInclusiveTotalPrice ?? 0 |
| | | ); |
| | | if (!baseNoInvoiceNum) { |
| | | return 0; |
| | | } |
| | | return baseNoInvoiceAmount / baseNoInvoiceNum; |
| | | }; |
| | | |
| | | const invoiceNumBlur = (row) => { |
| | | if (!row.currentInvoiceNum) { |
| | | row.currentInvoiceNum = 0; |
| | | } |
| | | if (row.currentInvoiceNum > row.tempNoInvoiceNum) { |
| | | const baseNoInvoiceNum = parseFloat( |
| | | row.tempNoInvoiceNum ?? row.originalNoInvoiceNum ?? row.noInvoiceNum ?? 0 |
| | | ); |
| | | const baseNoInvoiceAmount = parseFloat( |
| | | row.tempnoInvoiceAmount ?? row.noInvoiceAmount ?? row.taxInclusiveTotalPrice ?? 0 |
| | | ); |
| | | const unitPrice = getInvoiceCalcUnitPrice(row); |
| | | if (!unitPrice) { |
| | | row.currentInvoiceAmount = 0; |
| | | row.noInvoiceNum = Number(baseNoInvoiceNum).toFixed(2); |
| | | row.noInvoiceAmount = Number(baseNoInvoiceAmount).toFixed(2); |
| | | return; |
| | | } |
| | | if (row.currentInvoiceNum > baseNoInvoiceNum) { |
| | | proxy.$modal.msgWarning("本次开票数不得大于未开票数"); |
| | | row.currentInvoiceNum = 0; |
| | | } |
| | | // 计算本次开票金额 |
| | | row.currentInvoiceAmount = ( |
| | | row.currentInvoiceNum * row.taxInclusiveUnitPrice |
| | | ).toFixed(2); |
| | | row.currentInvoiceAmount = (row.currentInvoiceNum * unitPrice).toFixed(2); |
| | | // 计算未开票数 |
| | | row.noInvoiceNum = (row.originalNoInvoiceNum - row.currentInvoiceNum).toFixed( |
| | | 2 |
| | | ); |
| | | row.noInvoiceNum = (baseNoInvoiceNum - row.currentInvoiceNum).toFixed(2); |
| | | // 计算未开票金额 |
| | | row.noInvoiceAmount = ( |
| | | row.tempnoInvoiceAmount - row.currentInvoiceAmount |
| | | ).toFixed(2); |
| | | row.noInvoiceAmount = (row.noInvoiceNum * unitPrice).toFixed(2); |
| | | }; |
| | | // 本次开票金额失焦操作 |
| | | const invoiceAmountBlur = (row) => { |
| | | if (!row.currentInvoiceAmount) { |
| | | row.currentInvoiceAmount = 0; |
| | | } |
| | | const baseNoInvoiceNum = parseFloat( |
| | | row.tempNoInvoiceNum ?? row.originalNoInvoiceNum ?? row.noInvoiceNum ?? 0 |
| | | ); |
| | | const baseNoInvoiceAmount = parseFloat( |
| | | row.tempnoInvoiceAmount ?? row.noInvoiceAmount ?? row.taxInclusiveTotalPrice ?? 0 |
| | | ); |
| | | const unitPrice = getInvoiceCalcUnitPrice(row); |
| | | if (!unitPrice) { |
| | | row.currentInvoiceNum = 0; |
| | | row.noInvoiceNum = Number(baseNoInvoiceNum).toFixed(2); |
| | | row.noInvoiceAmount = Number(baseNoInvoiceAmount).toFixed(2); |
| | | return; |
| | | } |
| | | // 计算是否超过开票总金额 |
| | | if (row.currentInvoiceAmount > row.tempnoInvoiceAmount) { |
| | | if (row.currentInvoiceAmount > baseNoInvoiceAmount) { |
| | | proxy.$modal.msgWarning("本次开票金额不得大于未开票金额"); |
| | | row.currentInvoiceAmount = 0; |
| | | } |
| | | // 计算本次开票数 |
| | | row.currentInvoiceNum = ( |
| | | row.currentInvoiceAmount / row.taxInclusiveUnitPrice |
| | | ).toFixed(2); |
| | | row.currentInvoiceNum = (row.currentInvoiceAmount / unitPrice).toFixed(2); |
| | | console.log("row.currentInvoiceNum ", row.currentInvoiceNum); |
| | | console.log(" row.originalNoInvoiceNum ", row.originalNoInvoiceNum); |
| | | // 计算未开票数 |
| | | row.noInvoiceNum = (row.originalNoInvoiceNum - row.currentInvoiceNum).toFixed( |
| | | 2 |
| | | ); |
| | | row.noInvoiceNum = (baseNoInvoiceNum - row.currentInvoiceNum).toFixed(2); |
| | | // 计算未开票金额 |
| | | row.noInvoiceAmount = ( |
| | | row.tempnoInvoiceAmount - row.currentInvoiceAmount |
| | | ).toFixed(2); |
| | | row.noInvoiceAmount = (row.noInvoiceNum * unitPrice).toFixed(2); |
| | | }; |
| | | |
| | | onMounted(() => { |