import { request } from '@eciol/request'; import { replaceVariables } from '@eciol/shared'; import { useUserStoreWithOut } from '@/store/modules/user'; import type { InvoiceAdvanceService } from './typing'; enum Api { GetInvoiceAdvanceList = '/api/ReceiveAdvance/QueryPage', GetInvoiceReceiveList = '/api/ReceiveAdvance/GetReceiveBill/{org}/{clientId}', SaveInvoiceReceive = '/api/ReceiveAdvance/Save', GetAdvanceClientList = '/api/Advance/QueryPage', } /** * 预收款发票列表 * @param data */ function getInvoiceAdvanceList(data: InvoiceAdvanceService.GetInvoiceAdvanceListParams) { const { getCompanyId } = useUserStoreWithOut(); return request.post( { url: Api.GetInvoiceAdvanceList, data: { ...data, orgId: getCompanyId }, }, { showLoading: true, }, ); } /** * 收款单列表 * @param clientId */ function getInvoiceReceiveList(clientId: number) { const { getCompanyId } = useUserStoreWithOut(); return request.get( { url: replaceVariables(Api.GetInvoiceReceiveList, { clientId, org: getCompanyId }), }, { showLoading: true, }, ); } /** * 保存 * @param data */ function saveInvoiceReceive(data: InvoiceAdvanceService.SaveReceiveParams) { return request.post( { url: Api.SaveInvoiceReceive, data, }, { showLoading: true, loadingTip: 'EMPTY', successMessage: '关联成功', successMessageMode: 'message', }, ); } /** * 预收款客户余额列表 * @param data */ function getInvoiceAdvanceClientList(data: InvoiceAdvanceService.GetInvoiceAdvanceListParams) { const { getCompanyId } = useUserStoreWithOut(); return request.post( { url: Api.GetAdvanceClientList, data: { ...data, orgId: getCompanyId }, }, { showLoading: true, }, ); } export { getInvoiceAdvanceClientList, getInvoiceAdvanceList, getInvoiceReceiveList, saveInvoiceReceive, }; export type { InvoiceAdvanceService } from './typing';