| | |
| | | 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(); |
| | |
| | | // }); |
| | | |
| | | const { infiniteLoadingProps } = useInfiniteLoading( |
| | | ({ pageParam }) => { |
| | | async ({ pageParam }) => { |
| | | let params: QueryLifePayOrderListInput = { |
| | | pageModel: { |
| | | rows: 20, |
| | |
| | | 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: [ |
| | |
| | | userId: blLifeRecharge.accountModel.userId, |
| | | }, |
| | | ], |
| | | |
| | | select(data) { |
| | | console.log('data: ', data); |
| | | // data.pages.map((item) => item.data.map((x) => convertOrderFrontStatus(x))) |
| | | return data; |
| | | }, |
| | | } |
| | | ); |
| | | |
| | |
| | | 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 }; |
| | | } |