| | |
| | | <div class="flex justify-between"> |
| | | <div></div> |
| | | <div> |
| | | <el-button type="primary" @click="openForm" style="margin-bottom: 8px"> |
| | | <el-button |
| | | type="primary" |
| | | @click="openForm" |
| | | style="margin-bottom: 8px" |
| | | :disabled="!canInvoice" |
| | | > |
| | | 开票登记 |
| | | </el-button> |
| | | </div> |
| | |
| | | /> |
| | | <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 |
| | | :step="0.1" |
| | | :min="0" |
| | | style="width: 100%" |
| | | :precision="2" |
| | | v-model="scope.row.currentInvoiceNum" |
| | | @change="invoiceNumBlur(scope.row)" |
| | | :disabled="isProductInvoiceDisabled(scope.row)" |
| | | ></el-input-number> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | width="180" |
| | | > |
| | | <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 |
| | | :step="0.01" |
| | | :min="0" |
| | | style="width: 100%" |
| | | :precision="2" |
| | | v-model="scope.row.currentInvoiceAmount" |
| | | @change="invoiceAmountBlur(scope.row)" |
| | | :disabled="isProductInvoiceDisabled(scope.row)" |
| | | ></el-input-number> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | <script setup> |
| | | import pagination from "@/components/PIMTable/Pagination.vue"; |
| | | import FormDialog from '@/components/Dialog/FormDialog.vue'; |
| | | import { onMounted, ref } from "vue"; |
| | | import { onMounted, ref, computed } from "vue"; |
| | | import { Search } from "@element-plus/icons-vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | // import {userListNoPage} from "@/api/system/user.js"; |
| | |
| | | |
| | | const formattedInputNumber = (value) => { |
| | | return value ? parseFloat(value).toFixed(2) : 0; |
| | | }; |
| | | |
| | | // 判断是否可以开票(基于选中的台账数据) |
| | | const canInvoice = computed(() => { |
| | | if (selectedRows.value.length === 0) { |
| | | return false; |
| | | } |
| | | // 检查所有选中的台账,只要有一个未开票金额大于0,就可以开票 |
| | | return selectedRows.value.some(row => { |
| | | const noInvoiceAmount = parseFloat(row.noInvoiceAmountTotal || 0); |
| | | return noInvoiceAmount > 0; |
| | | }); |
| | | }); |
| | | |
| | | // 判断单个产品是否可以开票 |
| | | const isProductInvoiceDisabled = (row) => { |
| | | // 检查未开票金额和未开票数,如果都为0或小于等于0,则禁用 |
| | | // 优先使用 tempnoInvoiceAmount 和 tempNoInvoiceNum(初始值),如果没有则使用 noInvoiceAmount 和 originalNoInvoiceNum |
| | | const noInvoiceAmount = parseFloat(row.tempnoInvoiceAmount || row.noInvoiceAmount || 0); |
| | | const noInvoiceNum = parseFloat(row.tempNoInvoiceNum || row.originalNoInvoiceNum || row.noInvoiceNum || 0); |
| | | return noInvoiceAmount <= 0 || noInvoiceNum <= 0; |
| | | }; |
| | | |
| | | // 查询列表 |
| | |
| | | |
| | | productData.value = allProductData; |
| | | |
| | | // 对于不能开票的产品,将开票数和开票金额设置为0 |
| | | productData.value.forEach(item => { |
| | | if (isProductInvoiceDisabled(item)) { |
| | | item.currentInvoiceNum = 0; |
| | | item.currentInvoiceAmount = 0; |
| | | } |
| | | }); |
| | | |
| | | dialogFormVisible.value = true; |
| | | console.log("productData.value ", productData.value); |
| | | }); |