From 6a5d66d21df56c4549648b259609419e357e9470 Mon Sep 17 00:00:00 2001 From: zhengyiming <540361168@qq.com> Date: 星期五, 21 三月 2025 17:17:00 +0800 Subject: [PATCH] fix: 三期需求 --- packages/components/src/hooks/index.ts | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 47 insertions(+), 2 deletions(-) diff --git a/packages/components/src/hooks/index.ts b/packages/components/src/hooks/index.ts index 912a1b6..d8ff400 100644 --- a/packages/components/src/hooks/index.ts +++ b/packages/components/src/hooks/index.ts @@ -17,6 +17,7 @@ import { computed, MaybeRef, reactive, unref } from 'vue'; import { useInfiniteLoading } from './infiniteLoading'; import { OrderInputType } from '../constants'; +import { convertOrderFrontStatus } from '../utils'; export function useGetRate() { const { blLifeRecharge } = useLifeRechargeContext(); @@ -110,7 +111,7 @@ // }); const { infiniteLoadingProps } = useInfiniteLoading( - ({ pageParam }) => { + async ({ pageParam }) => { let params: QueryLifePayOrderListInput = { pageModel: { rows: 20, @@ -121,9 +122,18 @@ userId: blLifeRecharge.accountModel.userId, }; - return blLifeRecharge.services.getUserLifePayOrderPage(params, { + let res = await blLifeRecharge.services.getUserLifePayOrderPage(params, { showLoading: false, }); + res.data = res.data.map((x) => ({ + ...x, + frontStatus: convertOrderFrontStatus( + x.payStatus, + x.lifePayOrderStatus, + x.lifePayRefundStatus + ), + })); + return res; }, { queryKey: [ @@ -133,6 +143,12 @@ userId: blLifeRecharge.accountModel.userId, }, ], + + select(data) { + console.log('data: ', data); + // data.pages.map((item) => item.data.map((x) => convertOrderFrontStatus(x))) + return data; + }, } ); @@ -264,3 +280,32 @@ gasParValueList, }; } + +type UseIntroInfoOptions = { + lifePayOrderType: MaybeRef<LifeRechargeConstants.LifePayOrderTypeEnum>; + onSuccess?: (data: API.LifePayIntroInfoOutput[]) => any; +}; + +export function useIntroInfo({ lifePayOrderType, onSuccess }: UseIntroInfoOptions) { + const { blLifeRecharge } = useLifeRechargeContext(); + + const { data: introInfo } = useQuery({ + queryKey: ['blLifeRecharge/getIntroInfo', lifePayOrderType], + queryFn: async () => { + return await blLifeRecharge.services.getIntroInfo( + { + type: unref(lifePayOrderType), + }, + { + showLoading: false, + } + ); + }, + placeholderData: () => [] as API.LifePayIntroInfoOutput[], + onSuccess: (data) => { + onSuccess?.(data); + }, + }); + + return { introInfo }; +} -- Gitblit v1.9.1