5 天以前 91c82965b2d987452ca276e3a03b48c8dcda2ae9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
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}`,
  );
}