import type { PageParam, PageResult } from '@vben/request';
|
|
import { requestClient } from '#/api/request';
|
|
export namespace CrmInvoiceApi {
|
/** 合同信息 */
|
export interface Contract {
|
id?: number;
|
name?: string;
|
no: string;
|
}
|
|
/** 附件信息 */
|
export interface Attachment {
|
id: number;
|
url?: string;
|
name?: string;
|
}
|
|
/** 开票信息 */
|
export interface Invoice {
|
id?: number;
|
no?: string;
|
contractId?: number;
|
contract?: Contract;
|
customerId?: number;
|
customerName?: string;
|
invoiceType?: number;
|
invoiceNo?: string;
|
invoiceTitle?: string;
|
price?: number;
|
invoiceTime?: string;
|
auditStatus?: number;
|
remark?: string;
|
ownerUserId?: number;
|
ownerUserName?: string;
|
ownerUserDeptName?: string;
|
processInstanceId?: string;
|
attachmentList?: Attachment[];
|
blobIds?: number[];
|
hasAttachment?: boolean;
|
remainingInvoicePrice?: number;
|
creator?: string;
|
creatorName?: string;
|
createTime?: string;
|
updateTime?: string;
|
}
|
|
/** 开票简要信息(用于回款关联选择) */
|
export interface InvoiceSimple {
|
id: number;
|
no: string;
|
invoiceNo?: string;
|
invoiceTitle?: string;
|
price?: number;
|
customerId?: number;
|
contractId?: number;
|
auditStatus?: number;
|
hasAttachment?: boolean;
|
remainingInvoicePrice?: number;
|
}
|
}
|
|
/** 查询开票分页 */
|
export function getInvoicePage(params: PageParam) {
|
return requestClient.get<PageResult<CrmInvoiceApi.Invoice>>(
|
'/crm/invoice/page',
|
{ params },
|
);
|
}
|
|
/** 查询开票分页,基于指定客户 */
|
export function getInvoicePageByCustomer(params: PageParam) {
|
return requestClient.get<PageResult<CrmInvoiceApi.Invoice>>(
|
'/crm/invoice/page-by-customer',
|
{ params },
|
);
|
}
|
|
/** 查询开票详情 */
|
export function getInvoice(id: number) {
|
return requestClient.get<CrmInvoiceApi.Invoice>(
|
`/crm/invoice/get?id=${id}`,
|
);
|
}
|
|
/** 新增开票 */
|
export function createInvoice(data: CrmInvoiceApi.Invoice) {
|
return requestClient.post('/crm/invoice/create', data);
|
}
|
|
/** 修改开票 */
|
export function updateInvoice(data: CrmInvoiceApi.Invoice) {
|
return requestClient.put('/crm/invoice/update', data);
|
}
|
|
/** 删除开票 */
|
export function deleteInvoice(id: number) {
|
return requestClient.delete(`/crm/invoice/delete?id=${id}`);
|
}
|
|
/** 导出开票 */
|
export function exportInvoice(params: Record<string, unknown>) {
|
return requestClient.download('/crm/invoice/export-excel', { params });
|
}
|
|
/** 提交审核 */
|
export function submitInvoice(id: number) {
|
return requestClient.put(`/crm/invoice/submit?id=${id}`);
|
}
|
|
/** 获得待审核开票数量 */
|
export function getAuditInvoiceCount() {
|
return requestClient.get<number>('/crm/invoice/audit-count');
|
}
|
|
/** 查询开票下拉列表(按合同查可选开票) */
|
export function getInvoiceSimpleList(contractId: number) {
|
return requestClient.get<CrmInvoiceApi.InvoiceSimple[]>(
|
`/crm/invoice/simple-list?contractId=${contractId}`,
|
);
|
}
|