From 6ac59f6fa91e51272b8cd4797458995e168ec0f9 Mon Sep 17 00:00:00 2001 From: zhengyiming <540361168@qq.com> Date: 星期四, 11 九月 2025 09:13:08 +0800 Subject: [PATCH] feat: 公告 --- packages/components/src/hooks/index.ts | 52 +++++++++++++++++++++++++++++++++++----------------- 1 files changed, 35 insertions(+), 17 deletions(-) diff --git a/packages/components/src/hooks/index.ts b/packages/components/src/hooks/index.ts index 6eca483..624ec3d 100644 --- a/packages/components/src/hooks/index.ts +++ b/packages/components/src/hooks/index.ts @@ -18,17 +18,19 @@ import { useInfiniteLoading } from './infiniteLoading'; import { OrderInputType } from '../constants'; import { convertOrderFrontStatus } from '../utils'; +import { useLifePayRateChannelAllList } from './rate'; export function useGetRate() { const { blLifeRecharge } = useLifeRechargeContext(); - const { data: lifePayRateList, isLoading } = useQuery({ - queryKey: ['blLifeRecharge/getRate'], - queryFn: async () => { - return await blLifeRecharge.services.getRate({ showLoading: false }); - }, - placeholderData: () => [] as LifePayRateListOutput[], - }); + // const { data: lifePayRateList, isLoading } = useQuery({ + // queryKey: ['blLifeRecharge/getRate'], + // queryFn: async () => { + // return await blLifeRecharge.services.getRate({ showLoading: false }); + // }, + // placeholderData: () => [] as LifePayRateListOutput[], + // }); + const { allRateChannelList } = useLifePayRateChannelAllList(); const hasChannel = computed(() => !!blLifeRecharge.accountModel.channlesNum); @@ -50,10 +52,15 @@ if (hasChannel.value && channelRate.value.channlesRate) { return channelRate.value.channlesRate; } + // return ( + // lifePayRateList.value.find( + // (x) => x.rateType === blLifeRecharge.constants.LifePayRateTypeEnum.榛樿璇濊垂鎶樻墸 + // )?.rate ?? 0 + // ); return ( - lifePayRateList.value.find( - (x) => x.rateType === blLifeRecharge.constants.LifePayRateTypeEnum.榛樿璇濊垂鎶樻墸 - )?.rate ?? 0 + allRateChannelList.value + .filter((x) => x.lifePayOrderType == blLifeRecharge.constants.LifePayOrderTypeEnum.璇濊垂璁㈠崟) + .toSorted((a, b) => a.platformRate - b.platformRate)?.[0]?.platformRate ?? 0 ); }); @@ -61,10 +68,15 @@ if (hasChannel.value && channelRate.value.channlesRate) { return channelRate.value.channlesRate; } + // return ( + // lifePayRateList.value.find( + // (x) => x.rateType === blLifeRecharge.constants.LifePayRateTypeEnum.榛樿鐢佃垂鎶樻墸 + // )?.rate ?? 0 + // ); return ( - lifePayRateList.value.find( - (x) => x.rateType === blLifeRecharge.constants.LifePayRateTypeEnum.榛樿鐢佃垂鎶樻墸 - )?.rate ?? 0 + allRateChannelList.value + .filter((x) => x.lifePayOrderType == blLifeRecharge.constants.LifePayOrderTypeEnum.鐢佃垂璁㈠崟) + .toSorted((a, b) => a.platformRate - b.platformRate)?.[0]?.platformRate ?? 0 ); }); @@ -72,18 +84,24 @@ if (hasChannel.value && channelRate.value.channlesRate) { return channelRate.value.channlesRate; } + // return ( + // lifePayRateList.value.find( + // (x) => x.rateType === blLifeRecharge.constants.LifePayRateTypeEnum.榛樿鐕冩皵鎶樻墸 + // )?.rate ?? 0 + // ); return ( - lifePayRateList.value.find( - (x) => x.rateType === blLifeRecharge.constants.LifePayRateTypeEnum.榛樿鐕冩皵鎶樻墸 - )?.rate ?? 0 + allRateChannelList.value + .filter((x) => x.lifePayOrderType == blLifeRecharge.constants.LifePayOrderTypeEnum.鐕冩皵璁㈠崟) + .toSorted((a, b) => a.platformRate - b.platformRate)?.[0]?.platformRate ?? 0 ); }); return { - lifePayRateList, + // lifePayRateList, lifePayPhoneRate, lifePayElectricRate, lifePayGasRate, + allRateChannelList, }; } -- Gitblit v1.9.1