diff --git a/src/api/settlement/formalSettlement.js b/src/api/settlement/formalSettlement.js index 2d980d4..032e253 100644 --- a/src/api/settlement/formalSettlement.js +++ b/src/api/settlement/formalSettlement.js @@ -58,5 +58,13 @@ export const applyPayments = data => request({ url: `${baseUrl}/apply-payments`, method: 'post', data }); export const claimInvoices = data => request({ url: `${baseUrl}/claim-invoices`, method: 'post', data }); +// 先票后款:发票登记确认推送(认领收票单逐单 A302-6 指定应付),涉及多次金蝶远程调用,覆盖全局超时 +export const invoiceAssignKingdee = id => + request({ + url: `${baseUrl}/invoice-assign-kingdee`, + method: 'post', + timeout: 30000, + params: { id }, + }); export const queryInvoicePool = params => request({ url: `${baseUrl}/invoice-pool`, method: 'get', params }); diff --git a/src/views/settlement/components/formal-settlement-editor.vue b/src/views/settlement/components/formal-settlement-editor.vue index 7455abb..2589487 100644 --- a/src/views/settlement/components/formal-settlement-editor.vue +++ b/src/views/settlement/components/formal-settlement-editor.vue @@ -440,8 +440,15 @@ /> -
- 认领查询 +
+ + 选择收票单 + 认领查询
@@ -452,11 +459,6 @@ - - - + + + + + + + {{ invoiceRegisterDialog.row.formalSettlementNo || '-' }} + + + {{ formatMoney(invoiceRegisterDialog.row.settlementAmount, invoiceRegisterDialog.row.currency) }} + + + {{ formatMoney(invoiceRegisterDialog.row.invoiceAmount, invoiceRegisterDialog.row.currency) }} + + + {{ kingdeeSyncName(invoiceRegisterDialog.row.kingdeeSyncStatus) }} + + + + + 选择收票单 + + + + + + + + + + + + + + + + + + + + + @@ -113,16 +186,17 @@ import { isAdministrator } from '@/utils/auth'; import { downloadFile } from '@/utils/util'; import * as api from '@/api/settlement/formalSettlement'; import * as paymentApi from '@/api/payment/paymentApplication'; -import { formalSettlementOption } from '@/option/settlement/formalSettlement'; +import { formalSettlementOption, kingdeeSyncName } from '@/option/settlement/formalSettlement'; import organizationSearch from '@/mixins/organization-search'; import FormalSettlementEditor from './components/formal-settlement-editor.vue'; import FormalSettlementTablePanel from './components/formal-settlement-table-panel.vue'; +import InvoiceReceiptCandidatesDialog from './components/invoice-receipt-candidates-dialog.vue'; import { submitMkApprovalFlow, loadMkEnabled } from '@/utils/mk-approval'; import { getMKApprovalUrl } from '@/api/system/business-process'; export default { name: 'FormalSettlement', - components: { FormalSettlementEditor, FormalSettlementTablePanel }, + components: { FormalSettlementEditor, FormalSettlementTablePanel, InvoiceReceiptCandidatesDialog }, mixins: [organizationSearch], props: { /** 菜单拆分后锁定结算类型:payable=付款结算单,receivable=收款结算单 */ @@ -151,6 +225,16 @@ export default { rows: [], form: { appliedAmount: 0, remark: '' }, }, + // 先票后款路径B:发票登记(关联收票单 + 确认推送指定应付) + invoiceRegisterDialog: { + visible: false, + saving: false, + row: {}, + candidates: [], + }, + candidatesDialog: { + visible: false, + }, mkEnabled: false, // keep-alive 多标签下仅激活实例响应 detailNo,避免缓存页重复弹窗 isPageActive: true, @@ -297,6 +381,7 @@ export default { return: () => this.handleReturn(row), void: () => this.handleVoid(row), print: () => this.handlePrint(row), + invoiceRegister: () => this.openInvoiceRegisterDialog(row), }; (handlers[type] || (() => {}))(); }, @@ -596,6 +681,58 @@ export default { this.paymentDialog.loading = false; } }, + // 先票后款路径B:发票登记——认领收票单(claim-invoices 走增量认领并同步收票侧关系) + openInvoiceRegisterDialog(row) { + this.invoiceRegisterDialog.row = row || {}; + this.invoiceRegisterDialog.candidates = []; + this.invoiceRegisterDialog.visible = true; + }, + addInvoiceRegisterCandidates(rows) { + const existing = new Set( + this.invoiceRegisterDialog.candidates.map(item => String(item.invoiceNo)) + ); + const added = rows.filter(row => !existing.has(String(row.invoiceNo))); + if (!added.length) { + this.$message.warning('所选收票单均已登记'); + return; + } + // 全额认领:匹配金额固定=发票金额 + this.invoiceRegisterDialog.candidates.push( + ...added.map(row => ({ ...row, matchedAmount: Number(row.invoiceAmount || 0) })) + ); + }, + async submitInvoiceRegister() { + const settlement = this.invoiceRegisterDialog.row; + const invoices = this.invoiceRegisterDialog.candidates.map(row => ({ + ...row, + attachmentJson: row.attachmentJson || row.attachmentsJson, + invoiceType: row.invoiceType || '', + taxRate: row.taxRate ?? null, + availableInvoiceAmount: Number(row.invoiceAmount || 0), + matchedAmount: Number(row.invoiceAmount || 0), + })); + this.invoiceRegisterDialog.saving = true; + try { + await api.claimInvoices({ formalSettlementId: settlement.id, invoices }); + this.invoiceRegisterDialog.visible = false; + this.onLoad(this.page); + try { + await this.$confirm('是否将发票匹配数据推送金蝶?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + }); + } catch { + this.$message.info('已保存认领,未推送金蝶'); + return; + } + const data = this.unwrapData(await api.invoiceAssignKingdee(settlement.id)); + this.$message.success(data || '发票登记推送金蝶成功'); + this.onLoad(this.page); + } finally { + this.invoiceRegisterDialog.saving = false; + } + }, handlePrint(row) { if (!row) { row = this.selectedOne('打印');