2026-06-12 23:40:28 +09:00
|
|
|
// ============================================================================
|
|
|
|
|
// 보험계약 API — 백엔드 /api/contracts (ContractController)
|
|
|
|
|
// 계약(contract): 고객이 가입한 보험증권 1건. 모든 수수료 계산의 출발점.
|
|
|
|
|
// - premium(보험료): 계약자가 내는 보험료. payCycle(납입주기): 월납/연납 등.
|
|
|
|
|
// - policyNo(증권번호): 계약 식별 번호. contractorName(계약자)/insuredName(피보험자).
|
|
|
|
|
// ============================================================================
|
2026-05-09 22:38:10 +09:00
|
|
|
import api, { PageResponse, unwrap } from './request';
|
|
|
|
|
|
2026-06-12 23:40:28 +09:00
|
|
|
// 계약 조회 응답. 설계사/상품/보험사/보험료/상태 등 계약 요약.
|
2026-05-09 22:38:10 +09:00
|
|
|
export interface ContractResp {
|
|
|
|
|
contractId: number;
|
|
|
|
|
agentId: number;
|
|
|
|
|
agentName: string;
|
|
|
|
|
orgName?: string;
|
|
|
|
|
productCode?: string;
|
|
|
|
|
productName?: string;
|
|
|
|
|
companyCode?: string;
|
|
|
|
|
companyName?: string;
|
|
|
|
|
insuranceType?: string;
|
|
|
|
|
policyNo: string;
|
|
|
|
|
contractorName?: string;
|
|
|
|
|
insuredName?: string;
|
|
|
|
|
premium?: number;
|
|
|
|
|
payCycle?: string;
|
|
|
|
|
payCycleName?: string;
|
|
|
|
|
status: string;
|
|
|
|
|
statusName?: string;
|
|
|
|
|
contractDate: string;
|
2026-06-06 17:32:25 +09:00
|
|
|
salesChannel?: string;
|
|
|
|
|
salesChannelName?: string;
|
2026-05-09 22:38:10 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ContractSearchParam {
|
|
|
|
|
pageNum?: number;
|
|
|
|
|
pageSize?: number;
|
|
|
|
|
searchKeyword?: string;
|
|
|
|
|
agentId?: number;
|
|
|
|
|
companyId?: number;
|
|
|
|
|
insuranceType?: string;
|
|
|
|
|
status?: string;
|
|
|
|
|
startDate?: string;
|
|
|
|
|
endDate?: string;
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-12 23:40:28 +09:00
|
|
|
// 계약 등록/수정 요청. payPeriod(납입기간)/coveragePeriod(보장기간) 등 포함.
|
2026-05-10 22:43:57 +09:00
|
|
|
export interface ContractSaveReq {
|
|
|
|
|
agentId: number;
|
|
|
|
|
productId: number;
|
|
|
|
|
policyNo: string;
|
|
|
|
|
contractorName?: string;
|
|
|
|
|
insuredName?: string;
|
|
|
|
|
premium?: number;
|
|
|
|
|
payCycle?: string;
|
|
|
|
|
payPeriod?: number;
|
|
|
|
|
coveragePeriod?: number;
|
|
|
|
|
contractDate?: string;
|
|
|
|
|
effectiveDate?: string;
|
2026-06-06 17:32:25 +09:00
|
|
|
salesChannel?: string;
|
2026-05-10 22:43:57 +09:00
|
|
|
}
|
|
|
|
|
|
2026-05-09 22:38:10 +09:00
|
|
|
export const contractApi = {
|
2026-06-12 23:40:28 +09:00
|
|
|
// 계약 목록 — GET /api/contracts
|
2026-05-09 22:38:10 +09:00
|
|
|
list: (p: ContractSearchParam) =>
|
|
|
|
|
unwrap<PageResponse<ContractResp>>(api.get('/api/contracts', { params: p })),
|
2026-06-12 23:40:28 +09:00
|
|
|
// 계약 상세 — GET /api/contracts/{id}
|
2026-05-09 22:38:10 +09:00
|
|
|
detail: (id: number) => unwrap<ContractResp>(api.get(`/api/contracts/${id}`)),
|
2026-06-12 23:40:28 +09:00
|
|
|
// 계약 등록(생성된 id 반환) — POST /api/contracts
|
2026-05-10 22:43:57 +09:00
|
|
|
create: (req: ContractSaveReq) => unwrap<number>(api.post('/api/contracts', req)),
|
2026-06-12 23:40:28 +09:00
|
|
|
// 계약 수정 — PUT /api/contracts/{id}
|
2026-05-10 22:43:57 +09:00
|
|
|
update: (id: number, req: ContractSaveReq) => unwrap<void>(api.put(`/api/contracts/${id}`, req)),
|
2026-05-09 22:38:10 +09:00
|
|
|
};
|