费用管理内容优化-初步

This commit is contained in:
Cheng Zhou
2026-01-13 16:49:55 +08:00
parent 0c7c03069a
commit 1db36f40b0
43 changed files with 5229 additions and 26 deletions
+32
View File
@@ -0,0 +1,32 @@
import { apiDelete, apiGet, apiPost } from "./axios";
import type { FeeApiResponse } from "../types/api";
export const listFeeAttachments = (entityType: string, entityId: string) =>
apiGet<FeeApiResponse<any[]>>("/api/v1/fees/attachments", { params: { entity_type: entityType, entity_id: entityId } });
export const uploadFeeAttachment = (
entityType: string,
entityId: string,
fileType: string,
file: File,
options?: Record<string, any>
) => {
const formData = new FormData();
formData.append("file", file);
formData.append("entity_type", entityType);
formData.append("entity_id", entityId);
formData.append("file_type", fileType);
return apiPost<FeeApiResponse<any>>("/api/v1/fees/attachments", formData, {
headers: { "Content-Type": "multipart/form-data" },
...options,
});
};
export const deleteFeeAttachment = (attachmentId: string) => apiDelete(`/api/v1/fees/attachments/${attachmentId}`);
export const getFeeAttachmentDownloadUrl = (attachmentId: string) => {
const token = localStorage.getItem("ctms_token");
return token
? `/api/v1/fees/attachments/${attachmentId}/download?token=${token}`
: `/api/v1/fees/attachments/${attachmentId}/download`;
};
+50
View File
@@ -0,0 +1,50 @@
import { apiDelete, apiGet, apiPatch, apiPost } from "./axios";
import type { FeeApiResponse } from "../types/api";
export interface ContractFeePayload {
project_id: string;
center_id: string;
contract_amount: number;
contract_cases: number;
actual_cases?: number | null;
settlement_amount?: number | null;
final_payment_amount?: number | null;
}
export interface ContractFeeUpdatePayload {
contract_amount?: number;
contract_cases?: number;
actual_cases?: number | null;
settlement_amount?: number | null;
final_payment_amount?: number | null;
}
export interface ContractPaymentPayload {
amount: number;
paid_date?: string | null;
verified_date?: string | null;
is_paid?: boolean;
is_verified?: boolean;
remark?: string | null;
}
export const listContractFees = (params: { projectId: string; centerId?: string; q?: string }) =>
apiGet<FeeApiResponse<any[]>>("/api/v1/fees/contracts", { params });
export const getContractFee = (contractId: string) => apiGet<FeeApiResponse<any>>(`/api/v1/fees/contracts/${contractId}`);
export const createContractFee = (payload: ContractFeePayload) =>
apiPost<FeeApiResponse<any>>("/api/v1/fees/contracts", payload);
export const updateContractFee = (contractId: string, payload: ContractFeeUpdatePayload) =>
apiPatch<FeeApiResponse<any>>(`/api/v1/fees/contracts/${contractId}`, payload);
export const deleteContractFee = (contractId: string) => apiDelete(`/api/v1/fees/contracts/${contractId}`);
export const createContractPayment = (contractId: string, payload: ContractPaymentPayload) =>
apiPost<FeeApiResponse<any>>(`/api/v1/fees/contracts/${contractId}/payments`, payload);
export const updateContractPayment = (paymentId: string, payload: ContractPaymentPayload) =>
apiPatch<FeeApiResponse<any>>(`/api/v1/fees/payments/${paymentId}`, payload);
export const deleteContractPayment = (paymentId: string) => apiDelete(`/api/v1/fees/payments/${paymentId}`);
+45
View File
@@ -0,0 +1,45 @@
import { apiDelete, apiGet, apiPatch, apiPost } from "./axios";
import type { FeeApiResponse } from "../types/api";
export interface SpecialExpensePayload {
project_id: string;
center_id?: string | null;
category: string;
amount: number;
happen_date?: string | null;
description?: string | null;
is_paid?: boolean;
paid_date?: string | null;
is_verified?: boolean;
verified_date?: string | null;
}
export interface SpecialExpenseUpdatePayload {
center_id?: string | null;
category?: string;
amount?: number;
happen_date?: string | null;
description?: string | null;
is_paid?: boolean;
paid_date?: string | null;
is_verified?: boolean;
verified_date?: string | null;
}
export const listSpecialExpenses = (params: {
projectId: string;
centerId?: string;
category?: string;
dateFrom?: string;
dateTo?: string;
}) => apiGet<FeeApiResponse<any[]>>("/api/v1/fees/special", { params });
export const getSpecialExpense = (expenseId: string) => apiGet<FeeApiResponse<any>>(`/api/v1/fees/special/${expenseId}`);
export const createSpecialExpense = (payload: SpecialExpensePayload) =>
apiPost<FeeApiResponse<any>>("/api/v1/fees/special", payload);
export const updateSpecialExpense = (expenseId: string, payload: SpecialExpenseUpdatePayload) =>
apiPatch<FeeApiResponse<any>>(`/api/v1/fees/special/${expenseId}`, payload);
export const deleteSpecialExpense = (expenseId: string) => apiDelete(`/api/v1/fees/special/${expenseId}`);