import type { PageParam, PageResult } from '@vben/request';
|
|
import type { ErpPurchaseInvoiceApi } from '#/api/erp/purchase/invoice';
|
|
import { requestClient } from '#/api/request';
|
|
export namespace ErpFinancePaymentApi {
|
/** 付款单信息 */
|
export interface FinancePayment {
|
id?: number; // 付款单编号
|
no: string; // 付款单号
|
supplierId?: number; // 供应商编号
|
supplierName?: string; // 供应商名称
|
invoiceId?: number; // 关联来票编号
|
invoice?: ErpPurchaseInvoiceApi.PurchaseInvoice; // 关联来票信息
|
paymentTime?: Date; // 付款时间
|
totalPrice: number; // 合计金额,单位:元
|
discountPrice: number; // 优惠金额
|
paymentPrice: number; // 实际付款金额
|
status: number; // 状态
|
// ========== 审批信息(轻量级状态机审批) ==========
|
reviewerId?: number; // 审核人编号
|
reviewerName?: string; // 审核人姓名
|
reviewTime?: Date | string; // 审核时间
|
reviewRemark?: string; // 审核意见(不通过时为驳回原因)
|
remark: string; // 备注
|
attachmentList?: { id: number; name?: string; url?: string }[]; // 附件列表
|
accountId?: number; // 付款账户
|
accountName?: string; // 账户名称
|
financeUserId?: number; // 财务人员
|
financeUserName?: string; // 财务人员姓名
|
creator?: string; // 创建人
|
creatorName?: string; // 创建人姓名
|
items?: FinancePaymentItem[]; // 付款明细
|
bizNo?: string; // 业务单号
|
}
|
|
/** 付款单项 */
|
export interface FinancePaymentItem {
|
id?: number;
|
row_id?: number; // 前端使用的临时 ID
|
bizId: number; // 业务ID
|
bizType: number; // 业务类型
|
bizNo: string; // 业务编号
|
totalPrice: number; // 应付金额
|
paidPrice: number; // 已付金额
|
paymentPrice: number; // 本次付款
|
remark?: string; // 备注
|
}
|
}
|
|
/** 查询付款单分页 */
|
export function getFinancePaymentPage(params: PageParam) {
|
return requestClient.get<PageResult<ErpFinancePaymentApi.FinancePayment>>(
|
'/erp/finance-payment/page',
|
{
|
params,
|
},
|
);
|
}
|
|
/** 查询付款单详情 */
|
export function getFinancePayment(id: number) {
|
return requestClient.get<ErpFinancePaymentApi.FinancePayment>(
|
`/erp/finance-payment/get?id=${id}`,
|
);
|
}
|
|
/** 新增付款单 */
|
export function createFinancePayment(
|
data: ErpFinancePaymentApi.FinancePayment,
|
) {
|
return requestClient.post('/erp/finance-payment/create', data);
|
}
|
|
/** 修改付款单 */
|
export function updateFinancePayment(
|
data: ErpFinancePaymentApi.FinancePayment,
|
) {
|
return requestClient.put('/erp/finance-payment/update', data);
|
}
|
|
/**
|
* 提交审批(未审核 → 审批中)
|
*
|
* 审批人由「系统管理 - 审批配置」统一配置,提交时无需指定。
|
*/
|
export function submitFinancePayment(id: number) {
|
return requestClient.put('/erp/finance-payment/submit', null, {
|
params: { id },
|
});
|
}
|
|
/** 获得审批人编号集合,供列表页判断是否展示审核按钮 */
|
export function getFinancePaymentApproverUserIds() {
|
return requestClient.get<number[]>('/erp/finance-payment/approver-ids');
|
}
|
|
/**
|
* 审核(审批中 → 审核通过/审核不通过)
|
*
|
* 仅审批配置中指定的审批人本人可调用;pass=false 时 reviewRemark(不通过原因)必填。
|
*/
|
export function auditFinancePayment(
|
id: number,
|
pass: boolean,
|
reviewRemark?: string,
|
) {
|
return requestClient.put('/erp/finance-payment/audit', {
|
id,
|
pass,
|
reviewRemark,
|
});
|
}
|
|
/** 删除付款单 */
|
export function deleteFinancePayment(ids: number[]) {
|
return requestClient.delete('/erp/finance-payment/delete', {
|
params: {
|
ids: ids.join(','),
|
},
|
});
|
}
|
|
/** 导出付款单 Excel */
|
export function exportFinancePayment(params: any) {
|
return requestClient.download('/erp/finance-payment/export-excel', {
|
params,
|
});
|
}
|