| | |
| | | @change="handleQuery" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="不显示待回款"> |
| | | <el-form-item> |
| | | <el-checkbox |
| | | v-model="searchForm.status" |
| | | :label="0" |
| | | label="不显示待付款为0" |
| | | @change="handleQuery" |
| | | /> |
| | | </el-form-item> |
| | |
| | | <el-button type="primary" @click="openForm('add')"> |
| | | 新增付款 |
| | | </el-button> |
| | | <el-button type="danger" plain @click="handleDelete"> |
| | | 删除 |
| | | </el-button> |
| | | <el-button @click="handleExport" style="margin-right: 10px">导出</el-button> |
| | | <!-- <el-button type="danger" plain @click="handleDelete">--> |
| | | <!-- 删除--> |
| | | <!-- </el-button>--> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <!-- <div> |
| | | <span class="search_title">供应商名称/合同号:</span> |
| | | <el-input |
| | | v-model="searchForm.supplierNameOrContractNo" |
| | | style="width: 240px" |
| | | placeholder="输入供应商名称/合同号搜索" |
| | | @change="handleQuery" |
| | | clearable |
| | | :prefix-icon="Search" |
| | | /> |
| | | <el-button |
| | | type="primary" |
| | | @click="handleQuery" |
| | | style="margin-left: 10px" |
| | | > |
| | | 搜索 |
| | | </el-button> |
| | | </div> |
| | | <div> |
| | | <el-button type="primary" @click="openForm('add')">新增付款</el-button> |
| | | <el-button type="danger" plain @click="handleDelete">删除</el-button> |
| | | </div> --> |
| | | </div> |
| | | <div class="table_list"> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :expandRowKeys="expandedRowKeys" |
| | | :isSelection="true" |
| | | :isShowSummary="isShowSummarySon" |
| | | :summaryMethod="summarizeMainTable1" |
| | | :handleSelectionChange="handleSelectionChange" |
| | | @selection-change="handleSelectionChange" |
| | | @expand-change="expandChange" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination" |
| | | :total="total" |
| | | ></PIMTable> |
| | | </div> |
| | | <el-dialog |
| | | v-model="dialogFormVisible" |
| | | :title="operationType === 'add' ? '新增付款登记' : '编辑付款登记'" |
| | | width="60%" |
| | | @close="closeDia" |
| | | > |
| | | <el-form |
| | | :model="form" |
| | | label-width="140px" |
| | | label-position="top" |
| | | :rules="rules" |
| | | ref="formRef" |
| | | :total="page.total" |
| | | > |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="采购合同号:" prop="purchaseContractNumber"> |
| | | <el-input |
| | | v-model="form.purchaseContractNumber" |
| | | placeholder="自动填充" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="销售合同号:" prop="salesContractNo"> |
| | | <el-input |
| | | v-model="form.salesContractNo" |
| | | placeholder="自动填充" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="供应商名称:" prop="supplierName"> |
| | | <el-input |
| | | v-model="form.supplierName" |
| | | placeholder="自动填充" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="发票号:" prop="invoiceNumber"> |
| | | <el-input |
| | | v-model="form.invoiceNumber" |
| | | placeholder="自动填充" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="发票金额(元):" prop="invoiceAmount"> |
| | | <el-input |
| | | type="number" |
| | | :step="0.01" |
| | | v-model="form.invoiceAmount" |
| | | placeholder="自动填充" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="本次付款金额:" prop="currentPaymentAmount"> |
| | | <el-input |
| | | type="number" |
| | | :step="0.01" |
| | | v-model="form.currentPaymentAmount" |
| | | placeholder="请输入" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="付款方式:" prop="paymentMethod"> |
| | | <el-select |
| | | v-model="form.paymentMethod" |
| | | placeholder="请选择" |
| | | clearable |
| | | > |
| | | <el-option label="电汇" value="电汇" /> |
| | | <el-option label="承兑" value="承兑" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="登记人:" prop="registrant"> |
| | | <el-input |
| | | v-model="form.registrant" |
| | | placeholder="请输入" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="付款日期:" prop="paymentDate"> |
| | | <el-date-picker |
| | | disabled |
| | | style="width: 100%" |
| | | v-model="form.paymentDate" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | type="date" |
| | | placeholder="请选择" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="登记日期:" prop="registrationtDate"> |
| | | <el-input |
| | | v-model="form.registrationtDate" |
| | | placeholder="请输入" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">确认</el-button> |
| | | <el-button @click="closeDia">取消</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | <template #expand="{ row }"> |
| | | <el-table |
| | | :data="expandData" |
| | | border |
| | | show-summary |
| | | v-loading="childrenLoading" |
| | | :summary-method="summarizeMainTable2" |
| | | > |
| | | <el-table-column |
| | | align="center" |
| | | label="序号" |
| | | type="index" |
| | | width="60" |
| | | /> |
| | | <el-table-column label="付款日期" prop="paymentDate" /> |
| | | <el-table-column label="付款金额" prop="currentPaymentAmount"> |
| | | <template #default="scope"> |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" |
| | | v-model="scope.row.currentPaymentAmount" |
| | | :disabled="!scope.row.editType" |
| | | :precision="2" |
| | | placeholder="请输入" |
| | | clearable |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="付款方式" prop="paymentMethod"> |
| | | <template #default="scope"> |
| | | <el-select |
| | | :disabled="!scope.row.editType" |
| | | v-model="scope.row.paymentMethod" |
| | | placeholder="请选择" |
| | | clearable |
| | | > |
| | | <el-option label="电汇" value="电汇" /> |
| | | <el-option label="承兑" value="承兑" /> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="登记人" prop="registrant" /> |
| | | <el-table-column label="登记日期" prop="registrationtDate" /> |
| | | <el-table-column label="操作" width="150"> |
| | | <template #default="scope"> |
| | | <el-button |
| | | link |
| | | type="primary" |
| | | size="small" |
| | | @click="changeEditType(scope.row)" |
| | | v-if="!scope.row.editType" |
| | | >编辑</el-button |
| | | > |
| | | <el-button |
| | | link |
| | | type="primary" |
| | | size="small" |
| | | @click="saveReceiptPayment(scope.row)" |
| | | v-if="scope.row.editType" |
| | | >保存</el-button |
| | | > |
| | | <el-button |
| | | link |
| | | type="primary" |
| | | size="small" |
| | | @click="handleDelete(scope.row)" |
| | | >删除</el-button |
| | | > |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </template> |
| | | </PIMTable> |
| | | </div> |
| | | <FormDialog |
| | | v-model="dialogFormVisible" |
| | | title="新增付款页面" |
| | | :width="'90%'" |
| | | @close="closeDia" |
| | | @confirm="submitForm" |
| | | @cancel="closeDia" |
| | | > |
| | | <el-table |
| | | v-if="forms.length" |
| | | :data="forms" |
| | | border |
| | | style="width: 100%" |
| | | size="small" |
| | | > |
| | | <el-table-column type="index" label="序号" width="50" align="center"/> |
| | | <el-table-column label="采购合同号" prop="purchaseContractNumber" show-overflow-tooltip /> |
| | | <el-table-column label="销售合同号" prop="salesContractNo" show-overflow-tooltip /> |
| | | <el-table-column label="供应商名称" prop="supplierName" show-overflow-tooltip /> |
| | | <el-table-column |
| | | label="产品大类" |
| | | prop="productCategory" |
| | | show-overflow-tooltip |
| | | width="100" |
| | | /> |
| | | <el-table-column |
| | | label="规格型号" |
| | | prop="specificationModel" |
| | | show-overflow-tooltip |
| | | width="150" |
| | | /> |
| | | <el-table-column |
| | | label="待付款金额(元)" |
| | | prop="pendingTicketsTotal" |
| | | show-overflow-tooltip |
| | | width="170" |
| | | > |
| | | <template #default="{ row, column }"> |
| | | <el-text type="danger"> |
| | | {{ formattedNumber(row, column, row.pendingTicketsTotal) }} |
| | | </el-text> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="本次付款金额(元)" width="180"> |
| | | <template #default="{ row }"> |
| | | <el-input-number |
| | | v-model="row.currentPaymentAmount" |
| | | :step="0.01" |
| | | :min="0" |
| | | :max="Number(row.pendingTicketsTotal || 0)" |
| | | :precision="2" |
| | | style="width: 100%" |
| | | placeholder="请输入" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="付款方式" width="160"> |
| | | <template #default="{ row }"> |
| | | <el-select v-model="row.paymentMethod" placeholder="请选择" clearable> |
| | | <el-option label="电汇" value="电汇" /> |
| | | <el-option label="承兑" value="承兑" /> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="付款日期" width="170"> |
| | | <template #default="{ row }"> |
| | | <el-date-picker |
| | | v-model="row.paymentDate" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | type="date" |
| | | placeholder="请选择" |
| | | style="width: 100%" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="登记人" width="140"> |
| | | <template #default="{ row }"> |
| | | <el-input v-model="row.registrant" disabled /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="登记日期" width="170"> |
| | | <template #default="{ row }"> |
| | | <el-input v-model="row.registrationtDate" /> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <div v-else class="empty-tip">请选择需要付款的记录</div> |
| | | </FormDialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref } from "vue"; |
| | | import FormDialog from '@/components/Dialog/FormDialog.vue'; |
| | | import { ref, reactive, toRefs, getCurrentInstance, nextTick, onMounted } from "vue"; |
| | | import { Search } from "@element-plus/icons-vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import useUserStore from "@/store/modules/user.js"; |
| | |
| | | paymentRegistrationEdit, |
| | | getTicketNo, |
| | | } from "@/api/procurementManagement/paymentEntry.js"; |
| | | import { invoiceListPage } from "@/api/procurementManagement/procurementInvoiceLedger.js"; |
| | | import { |
| | | delPaymentRegistration, |
| | | invoiceListPage, |
| | | registrationListPageGetById, |
| | | updatePaymentRegistration |
| | | } from "@/api/procurementManagement/procurementInvoiceLedger.js"; |
| | | import useFormData from "@/hooks/useFormData"; |
| | | import { getCurrentDate } from "@/utils/index.js"; |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | const tableColumn = ref([ |
| | | { |
| | | type: "expand", |
| | | dataType: "slot", |
| | | slot: "expand", |
| | | }, |
| | | { |
| | | label: "采购合同号", |
| | | prop: "purchaseContractNumber", |
| | | width:160 |
| | | }, |
| | | { |
| | | label: "销售合同号", |
| | | prop: "salesContractNo", |
| | | width:160 |
| | | }, |
| | | { |
| | | label: "供应商名称", |
| | | prop: "supplierName", |
| | | width:240 |
| | | }, |
| | | { |
| | | label: "发票号", |
| | | prop: "invoiceNumber", |
| | | }, |
| | | { |
| | | label: "发票金额(元)", |
| | | prop: "invoiceAmount", |
| | | formatData: (params) => { |
| | | return parseFloat(params).toFixed(2); |
| | | }, |
| | | }, |
| | | { |
| | | label: "付款状态", |
| | | prop: "statusName", |
| | | width:110, |
| | | dataType: "tag", |
| | | formatType: (params) => { |
| | | if (params == '未完成付款') { |
| | | return "danger"; |
| | | } else if (params == '已完成付款') { |
| | | return "success"; |
| | | } else { |
| | | return null; |
| | | } |
| | | }, |
| | | }, |
| | | { |
| | | label: "产品大类", |
| | | prop: "productCategory", |
| | | showOverflowTooltip: true, |
| | | width: 100 |
| | | }, |
| | | { |
| | | label: "规格型号", |
| | | prop: "specificationModel", |
| | | showOverflowTooltip: true, |
| | | width: 150 |
| | | }, |
| | | { |
| | | label: "已付款金额(元)", |
| | | prop: "paymentAmountTotal", |
| | | prop: "ticketsTotal", |
| | | width: 120, |
| | | formatData: (params) => { |
| | | return parseFloat(params).toFixed(2); |
| | | return params ? parseFloat(params).toFixed(2) : 0; |
| | | }, |
| | | }, |
| | | { |
| | | label: "待付款金额(元)", |
| | | prop: "unPaymentAmountTotal", |
| | | prop: "pendingTicketsTotal", |
| | | width: 120, |
| | | formatData: (params) => { |
| | | return parseFloat(params).toFixed(2); |
| | | return params ? parseFloat(params).toFixed(2) : 0; |
| | | }, |
| | | }, |
| | | ]); |
| | | const tableData = ref([]); |
| | | const expandData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const tableLoading = ref(false); |
| | | const invoiceNumberList = ref([]); |
| | | const childrenLoading = ref(false); |
| | | const forms = ref([]); |
| | | const userStore = useUserStore(); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | total: 0, |
| | | }); |
| | | const total = ref(0); |
| | | |
| | | // 用户信息表单弹框数据 |
| | | const operationType = ref(""); |
| | |
| | | purchaseLedgerId: "", |
| | | salesContractNo: "", |
| | | supplierName: "", |
| | | invoiceNumber: "", |
| | | invoiceAmount: "", |
| | | taxRate: "", |
| | | currentPaymentAmount: "", |
| | | paymentMethod: "", |
| | |
| | | { required: true, message: "请输入", trigger: "blur" }, |
| | | ], |
| | | paymentMethod: [{ required: true, message: "请选择", trigger: "change" }], |
| | | invoiceNumber: [ |
| | | { required: true, message: "请选择采购合同号", trigger: "change" }, |
| | | ], |
| | | }, |
| | | }); |
| | | const { form, rules } = toRefs(data); |
| | | const { form: searchForm, resetForm } = useFormData(data.searchForm); |
| | | const isShowSummarySon = ref(true); |
| | | const expandedRowKeys = ref([]); |
| | | |
| | | const getStatusTagType = (statusName = '') => { |
| | | const normalized = statusName.trim(); |
| | | if (!normalized) return 'info'; |
| | | return normalized === '未完成付款' ? 'danger' : 'success'; |
| | | }; |
| | | |
| | | const formattedNumber = (row, column, cellValue) => { |
| | | const val = Number(cellValue ?? 0); |
| | | return Number.isFinite(val) ? val.toFixed(2) : "0.00"; |
| | | }; |
| | | // 子表合计方法 |
| | | const summarizeMainTable1 = (param) => { |
| | | return proxy.summarizeTable( |
| | | param, |
| | | ["invoiceAmount", "paymentAmountTotal", "unPaymentAmountTotal"], |
| | | ["ticketsTotal", "pendingTicketsTotal"], |
| | | { |
| | | ticketsNum: { noDecimal: true }, // 不保留小数 |
| | | futureTickets: { noDecimal: true }, // 不保留小数 |
| | | } |
| | | ); |
| | | }; |
| | | // 子表合计方法 |
| | | const summarizeMainTable2 = (param) => { |
| | | return proxy.summarizeTable(param, ["currentPaymentAmount"], { |
| | | ticketsNum: { noDecimal: true }, // 不保留小数 |
| | | futureTickets: { noDecimal: true }, // 不保留小数 |
| | | }); |
| | | }; |
| | | // 查询列表 |
| | | /** 搜索按钮操作 */ |
| | |
| | | tableLoading.value = true; |
| | | invoiceListPage({ ...searchForm, ...page }).then((res) => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.records; |
| | | total.value = res.total; |
| | | tableData.value = res.data.records; |
| | | page.total = res.data.total; |
| | | if (expandedRowKeys.value.length > 0) { |
| | | const arr = [] |
| | | const index = tableData.value.findIndex(item => item.id === expandedRowKeys.value[0]); |
| | | if (index > -1) { |
| | | arr.push(tableData.value[index]); |
| | | expandChange(tableData.value[index], arr) |
| | | } |
| | | } |
| | | }); |
| | | }; |
| | | // 展开行 |
| | | const expandChange = (row, expandedRows) => { |
| | | if (expandedRows.length > 0) { |
| | | nextTick(() => { |
| | | expandedRowKeys.value = []; |
| | | try { |
| | | childrenLoading.value = true; |
| | | registrationListPageGetById({ id: row.id }).then((res) => { |
| | | childrenLoading.value = false; |
| | | const index = tableData.value.findIndex((item) => item.id === row.id); |
| | | if (index > -1) { |
| | | expandData.value = res; |
| | | } |
| | | expandedRowKeys.value.push(row.id); |
| | | }); |
| | | } catch (error) { |
| | | childrenLoading.value = false; |
| | | console.log(error); |
| | | } |
| | | }) |
| | | } else { |
| | | expandedRowKeys.value = []; |
| | | } |
| | | }; |
| | | // 编辑修改状态 |
| | | const changeEditType = (row) => { |
| | | row.editType = !row.editType; |
| | | }; |
| | | // 保存回款记录 |
| | | const saveReceiptPayment = (row) => { |
| | | let updateData = { |
| | | id: row.id, |
| | | currentPaymentAmount: row.currentPaymentAmount, |
| | | paymentMethod: row.paymentMethod, |
| | | }; |
| | | updatePaymentRegistration(updateData).then((res) => { |
| | | row.editType = !row.editType; |
| | | getList(); |
| | | proxy.$modal.msgSuccess("提交成功"); |
| | | }); |
| | | }; |
| | | // 表格选择数据 |
| | | const handleSelectionChange = (selection) => { |
| | |
| | | }; |
| | | // 打开弹框 |
| | | const openForm = (type, row) => { |
| | | if (selectedRows.value.length !== 1) { |
| | | proxy.$message.error("请选择一条发票数据"); |
| | | if (selectedRows.value.length === 0) { |
| | | proxy.$modal.msgError("请选择至少一条数据"); |
| | | return; |
| | | } |
| | | operationType.value = type; |
| | | form.value = {}; |
| | | form.value = { ...selectedRows.value[0] }; |
| | | form.value.ticketRegistrationId = selectedRows.value[0].id; |
| | | form.value.id = null; |
| | | // 查询采购合同号 |
| | | form.value.registrationtDate = getCurrentDate(); |
| | | form.value.paymentDate = getCurrentDate(); |
| | | form.value.registrant = userStore.name; |
| | | const validRows = selectedRows.value.filter((item) => Number(item.pendingTicketsTotal || 0) !== 0); |
| | | if (validRows.length === 0) { |
| | | proxy.$modal.msgWarning("所选记录均无需付款"); |
| | | return; |
| | | } |
| | | forms.value = validRows.map((row) => ({ |
| | | purchaseContractNumber: row.purchaseContractNumber || "", |
| | | salesContractNo: row.salesContractNo || "", |
| | | supplierName: row.supplierName || "", |
| | | supplierId: row.supplierId, |
| | | productCategory: row.productCategory || "", |
| | | specificationModel: row.specificationModel || "", |
| | | pendingTicketsTotal: Number(row.pendingTicketsTotal || 0), |
| | | currentPaymentAmount: "", |
| | | paymentMethod: "", |
| | | paymentDate: "", |
| | | registrant: userStore.nickName, |
| | | registrationtDate: getCurrentDate(), |
| | | ticketRegistrationId: row.id, |
| | | purchaseLedgerId: row.salesLedgerId, |
| | | salesLedgerProductId: row.id, |
| | | })); |
| | | dialogFormVisible.value = true; |
| | | }; |
| | | // 选择发票号以后给发票金额赋值 |
| | | const setInvoiceAmount = (value) => { |
| | | if (value) { |
| | | invoiceNumberList.value.forEach((item) => { |
| | | if (item.invoiceNumber === value) { |
| | | form.value.invoiceAmount = item.invoiceAmount; |
| | | form.value.ticketRegistrationId = item.id; |
| | | } |
| | | }); |
| | | } else { |
| | | form.value.invoiceAmount = ""; |
| | | } |
| | | }; |
| | | // 选择采购合同号赋值 |
| | | const setInfo = (value) => { |
| | | getTicketNo({ id: value }).then((res) => { |
| | | invoiceNumberList.value = res.data; |
| | | }); |
| | | if (value) { |
| | | byPurchaseId(value).then((res) => { |
| | | form.value.salesContractNo = res.data.salesContractNo; |
| | | form.value.supplierName = res.data.supplierName; |
| | | form.value.taxRate = res.data.taxRate; |
| | | form.value.supplierId = res.data.supplierId; |
| | | }); |
| | | } else { |
| | | form.value.salesContractNo = ""; |
| | | form.value.supplierName = ""; |
| | | form.value.taxRate = ""; |
| | | form.value.supplierId = ""; |
| | | } |
| | | }; |
| | | // 提交表单 |
| | | const submitForm = () => { |
| | | proxy.$refs["formRef"].validate((valid) => { |
| | | if (valid) { |
| | | if (operationType.value === "edit") { |
| | | submitEdit(); |
| | | } else { |
| | | submitAdd(); |
| | | } |
| | | if (forms.value.length === 0) { |
| | | proxy.$modal.msgError("请选择付款记录"); |
| | | return; |
| | | } |
| | | for (let i = 0; i < forms.value.length; i++) { |
| | | const item = forms.value[i]; |
| | | const pendingAmount = Number(item.pendingTicketsTotal || 0); |
| | | const currentAmount = Number(item.currentPaymentAmount); |
| | | if (!item.currentPaymentAmount && item.currentPaymentAmount !== 0) { |
| | | proxy.$modal.msgError(`第 ${i + 1} 条:请填写付款金额`); |
| | | return; |
| | | } |
| | | }); |
| | | }; |
| | | // 提交新增 |
| | | const submitAdd = () => { |
| | | paymentRegistrationAdd(form.value).then((res) => { |
| | | proxy.$modal.msgSuccess("提交成功"); |
| | | closeDia(); |
| | | getList(); |
| | | }); |
| | | }; |
| | | // 提交修改 |
| | | const submitEdit = () => { |
| | | paymentRegistrationEdit(form.value).then((res) => { |
| | | if (currentAmount > pendingAmount) { |
| | | proxy.$modal.msgError( |
| | | `第 ${i + 1} 条:付款金额不能超过待付款金额(待付款:${pendingAmount.toFixed( |
| | | 2 |
| | | )})` |
| | | ); |
| | | return; |
| | | } |
| | | if (!item.paymentMethod) { |
| | | proxy.$modal.msgError(`第 ${i + 1} 条:请选择付款方式`); |
| | | return; |
| | | } |
| | | if (!item.paymentDate) { |
| | | proxy.$modal.msgError(`第 ${i + 1} 条:请选择付款日期`); |
| | | return; |
| | | } |
| | | } |
| | | paymentRegistrationAdd(forms.value).then(() => { |
| | | proxy.$modal.msgSuccess("提交成功"); |
| | | closeDia(); |
| | | getList(); |
| | |
| | | }; |
| | | // 关闭弹框 |
| | | const closeDia = () => { |
| | | proxy.resetForm("formRef"); |
| | | forms.value = []; |
| | | dialogFormVisible.value = false; |
| | | }; |
| | | // 删除 |
| | | const handleDelete = () => { |
| | | let ids = []; |
| | | if (selectedRows.value.length > 0) { |
| | | ids = selectedRows.value.map((item) => item.id); |
| | | } else { |
| | | proxy.$modal.msgWarning("请选择数据"); |
| | | return; |
| | | } |
| | | const handleDelete = (row) => { |
| | | ElMessageBox.confirm("选中的内容将被删除,是否确认删除?", "删除提示", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "取消", |
| | |
| | | }) |
| | | .then(() => { |
| | | tableLoading.value = true; |
| | | paymentRegistrationDel(ids) |
| | | delPaymentRegistration(row.id) |
| | | .then((res) => { |
| | | proxy.$modal.msgSuccess("删除成功"); |
| | | getList(); |
| | |
| | | proxy.$modal.msg("已取消"); |
| | | }); |
| | | }; |
| | | // 获取当前日期并格式化为 YYYY-MM-DD |
| | | function getCurrentDate() { |
| | | const today = new Date(); |
| | | const year = today.getFullYear(); |
| | | const month = String(today.getMonth() + 1).padStart(2, "0"); // 月份从0开始 |
| | | const day = String(today.getDate()).padStart(2, "0"); |
| | | return `${year}-${month}-${day}`; |
| | | } |
| | | getList(); |
| | | // 导出 |
| | | const handleExport = () => { |
| | | ElMessageBox.confirm("选中的内容将被导出,是否确认导出?", "导出", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download("/purchase/registration/exportOne", { ...searchForm, ...page }, "付款登记.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已取消"); |
| | | }); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .table_list { |
| | | margin-top: unset; |
| | | } |
| | | ::v-deep(.el-checkbox__label) { |
| | | font-weight: bold; |
| | | } |
| | | .empty-tip { |
| | | text-align: center; |
| | | padding: 20px 0; |
| | | color: #909399; |
| | | } |
| | | </style> |