| | |
| | | |
| | | type UseInsuranceClaimDetailOptions = { |
| | | insuranceOrderId?: MaybeRef<string>; |
| | | fromRoute?: MaybeRef<string>; |
| | | }; |
| | | |
| | | export function useInsuranceClaimDetail({ insuranceOrderId }: UseInsuranceClaimDetailOptions) { |
| | | export function useInsuranceClaimDetail({ |
| | | insuranceOrderId, |
| | | fromRoute, |
| | | }: UseInsuranceClaimDetailOptions) { |
| | | const DefaultAccidentProcess = `事故经过: |
| | | 治疗医院:二级及以上公立医院 |
| | | 诊断结果(与诊断证明一致) |
| | |
| | | |
| | | const form = reactive({ |
| | | insuranceOrderId: unref(insuranceOrderId), |
| | | fromRoute: unref(fromRoute), |
| | | reportedTime: '', |
| | | accidentTime: '', |
| | | ...DefaultForm, |
| | |
| | | }); |
| | | } |
| | | |
| | | const { isLoading: isClaimDetailLoading } = useQuery({ |
| | | queryKey: ['insuranceClaimServices/getInsuranceClaimDetail', _insuranceOrderId], |
| | | queryFn: async () => { |
| | | return await insuranceClaimServices.getInsuranceClaimDetail( |
| | | { id: form.insuranceOrderId }, |
| | | { |
| | | showLoading: false, |
| | | } |
| | | ); |
| | | }, |
| | | placeholderData: () => ({} as API.InsuranceClaimDetailOutput), |
| | | onSuccess(data) { |
| | | if (data) { |
| | | form.name = data.name; |
| | | form.idNumber = data.idNumber; |
| | | // form.insuredInstitution = data.insuredInstitution; |
| | | form.insuranceScheme = data.insuranceScheme; |
| | | form.reportedTime = data.reportedTime; |
| | | form.contactNumber = data.contactNumber; |
| | | form.bakContactNumber = data.bakContactNumber; |
| | | form.accidentType = data.accidentType; |
| | | form.accidentTime = data.accidentTime; |
| | | form.disabilityRatio = data.disabilityRatio ?? 0; |
| | | form.accidentAddress = data.accidentAddress; |
| | | form.accidentProcess = data.accidentProcess ?? DefaultAccidentProcess; |
| | | |
| | | form.insuranceBeginTime = data.insuranceBeginTime; |
| | | form.insuranceEndTime = data.insuranceEndTime; |
| | | form.laborContractEnterprise = data.laborContractEnterprise; |
| | | form.workEnterprise = data.workEnterprise; |
| | | form.workType = data.workType; |
| | | |
| | | form.channel = data.channel; |
| | | form.onJobFlag = data.onJobFlag; |
| | | form.gender = data.gender; |
| | | form.age = data.age; |
| | | form.premiumAmount = data.premiumAmount; |
| | | form.incDecAmount = data.incDecAmount; |
| | | |
| | | form.claimResult = data.claimResult ?? ('' as any as InsuranceClaimResultEnum); |
| | | form.claimResultTime = data.claimResultTime ?? ''; |
| | | form.downPaymentAmount = data.downPaymentAmount ?? 0; |
| | | |
| | | const attachmentIdCard = convertAttAchmentsToForm( |
| | | data.attachments, |
| | | InsuranceClaimAttachmentBusinessTypeEnum.InjuredIdCardImg |
| | | ); |
| | | form.attachmentFrontIdCards = attachmentIdCard[0] ? [attachmentIdCard[0]] : []; |
| | | form.attachmentBackIdCards = attachmentIdCard[1] ? [attachmentIdCard[1]] : []; |
| | | form.attachmentSites = convertAttAchmentsToForm( |
| | | data.attachments, |
| | | InsuranceClaimAttachmentBusinessTypeEnum.InjurySiteImg |
| | | ); |
| | | form.attachmentHandheldIdCards = convertAttAchmentsToForm( |
| | | data.attachments, |
| | | InsuranceClaimAttachmentBusinessTypeEnum.InjuredHandheldIdCardImg |
| | | ); |
| | | form.attachmentAreas = convertAttAchmentsToForm( |
| | | data.attachments, |
| | | InsuranceClaimAttachmentBusinessTypeEnum.InjuredAreaImg |
| | | ); |
| | | form.attachmentCases = convertAttAchmentsToForm( |
| | | data.attachments, |
| | | InsuranceClaimAttachmentBusinessTypeEnum.CasesImg |
| | | ); |
| | | } |
| | | }, |
| | | enabled: computed(() => !!form.insuranceOrderId && form.fromRoute === 'InsuranceOrderDetail'), |
| | | }); |
| | | |
| | | const { isLoading } = useQuery({ |
| | | queryKey: ['insuranceOrderServices/getInsuranceOrderDetail', _insuranceOrderId], |
| | | queryFn: async () => { |
| | |
| | | onSuccess(data) { |
| | | importInsuranceOrderData(data); |
| | | }, |
| | | enabled: computed(() => !!form.insuranceOrderId), |
| | | enabled: computed(() => !!form.insuranceOrderId && form.fromRoute !== 'InsuranceOrderDetail'), |
| | | }); |
| | | |
| | | function importInsuranceOrderData(data: API.InsuranceOrderListOutput) { |