| | |
| | | <el-form-item> |
| | | <el-button type="primary" @click="handleQuery"> 搜索 </el-button> |
| | | <el-button @click="resetForm"> 重置 </el-button> |
| | | <el-button @click="handleExport" style="margin-right: 10px">导出</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <div class="table_list"> |
| | | <div class="flex justify-between"> |
| | | <div></div> |
| | | <div> |
| | | <el-button type="primary" @click="openForm" style="margin-bottom: 8px"> |
| | | 新增登记 |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | | <el-table |
| | | :data="tableData" |
| | |
| | | <el-table-column label="本次开票数" prop="currentInvoiceNum" width="180"> |
| | | <template #default="scope"> |
| | | <el-input-number :step="0.1" :min="0" style="width: 100%" |
| | | :precision="2" |
| | | v-model="scope.row.currentInvoiceNum" |
| | | @change="invoiceNumBlur(scope.row)" |
| | | ></el-input-number> |
| | |
| | | > |
| | | <template #default="scope"> |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" |
| | | :precision="2" |
| | | v-model="scope.row.currentInvoiceAmount" |
| | | @change="invoiceAmountBlur(scope.row)" |
| | | ></el-input-number> |
| | |
| | | |
| | | const formattedNumber = (row, column, cellValue) => { |
| | | if (cellValue == 0) { |
| | | return parseFloat(cellValue).toFixed(2); |
| | | return parseFloat(cellValue).toFixed(5); |
| | | } |
| | | if (cellValue) { |
| | | return parseFloat(cellValue).toFixed(2); |
| | | return parseFloat(cellValue).toFixed(5); |
| | | } else { |
| | | return cellValue; |
| | | } |
| | | }; |
| | | |
| | | const formattedInputNumber = (value) => { |
| | | return value ? parseFloat(value).toFixed(2) : 0; |
| | | return value ? parseFloat(value).toFixed(5) : 0; |
| | | }; |
| | | |
| | | // 查询列表 |
| | |
| | | }); |
| | | }; |
| | | |
| | | // 导出销售台账 |
| | | const handleExport = () => { |
| | | ElMessageBox.confirm("选中的内容将被导出,是否确认导出?", "导出", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download("/sales/ledger/exportOne", { ...searchForm, ...page }, "开票登记.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已取消"); |
| | | }); |
| | | }; |
| | | |
| | | //本次开票失焦操作 |
| | | const invoiceNumBlur = (row) => { |
| | | if (!row.currentInvoiceNum) { |
| | | row.currentInvoiceNum = 0; |
| | | } |
| | | row.currentInvoiceNum = row.currentInvoiceNum.toFixed(5); |
| | | if (row.currentInvoiceNum > row.tempNoInvoiceNum) { |
| | | proxy.$modal.msgWarning("本次开票数不得大于未开票数"); |
| | | row.currentInvoiceNum = 0; |
| | |
| | | // 计算本次开票金额 |
| | | row.currentInvoiceAmount = ( |
| | | row.currentInvoiceNum * row.taxInclusiveUnitPrice |
| | | ).toFixed(2); |
| | | ).toFixed(5); |
| | | // 计算未开票数 |
| | | row.noInvoiceNum = (row.originalNoInvoiceNum - row.currentInvoiceNum).toFixed( |
| | | 2 |
| | | 5 |
| | | ); |
| | | // 计算未开票金额 |
| | | row.noInvoiceAmount = ( |
| | | row.tempnoInvoiceAmount - row.currentInvoiceAmount |
| | | ).toFixed(2); |
| | | ).toFixed(5); |
| | | }; |
| | | // 本次开票金额失焦操作 |
| | | const invoiceAmountBlur = (row) => { |
| | | if (!row.currentInvoiceAmount) { |
| | | row.currentInvoiceAmount = 0; |
| | | } |
| | | row.currentInvoiceAmount = row.currentInvoiceAmount.toFixed(5); |
| | | // 计算是否超过开票总金额 |
| | | if (row.currentInvoiceAmount > row.tempnoInvoiceAmount) { |
| | | proxy.$modal.msgWarning("本次开票金额不得大于未开票金额"); |
| | |
| | | // 计算本次开票数 |
| | | row.currentInvoiceNum = ( |
| | | row.currentInvoiceAmount / row.taxInclusiveUnitPrice |
| | | ).toFixed(2); |
| | | ).toFixed(5); |
| | | console.log("row.currentInvoiceNum ", row.currentInvoiceNum); |
| | | console.log(" row.originalNoInvoiceNum ", row.originalNoInvoiceNum); |
| | | // 计算未开票数 |
| | | row.noInvoiceNum = (row.originalNoInvoiceNum - row.currentInvoiceNum).toFixed( |
| | | 2 |
| | | 5 |
| | | ); |
| | | // 计算未开票金额 |
| | | row.noInvoiceAmount = ( |
| | | row.tempnoInvoiceAmount - row.currentInvoiceAmount |
| | | ).toFixed(2); |
| | | ).toFixed(5); |
| | | }; |
| | | |
| | | onMounted(() => { |