|  |  | 
 |  |  |   LifePayRateListOutput, | 
 |  |  |   PhoneParValueOutput, | 
 |  |  |   PhoneParValueResponse, | 
 |  |  | } from '../utils'; | 
 |  |  |   QueryLifePayOrderListInput, | 
 |  |  |   LifeRechargeConstants, | 
 |  |  |   ElectricParValueResponse, | 
 |  |  |   ElectricSupportAreaResponse, | 
 |  |  | } from '@life-payment/core-vue'; | 
 |  |  | import { useQuery } from '@tanstack/vue-query'; | 
 |  |  | import { computed } from 'vue'; | 
 |  |  | import { computed, MaybeRef, reactive, unref } from 'vue'; | 
 |  |  | import { useInfiniteLoading } from './infiniteLoading'; | 
 |  |  | import { OrderInputType } from '../constants'; | 
 |  |  |  | 
 |  |  | export function useGetRate() { | 
 |  |  |   const { blLifeRecharge } = useLifeRechargeContext(); | 
 |  |  | 
 |  |  |       return await blLifeRecharge.services.getPhoneParValue({ showLoading: false }); | 
 |  |  |     }, | 
 |  |  |     select(data) { | 
 |  |  |       return data.phoneParValue ?? []; | 
 |  |  |       return data?.phoneParValue ?? []; | 
 |  |  |     }, | 
 |  |  |     placeholderData: () => ({} as PhoneParValueResponse), | 
 |  |  |   }); | 
 |  |  | 
 |  |  |     phoneParValueList, | 
 |  |  |   }; | 
 |  |  | } | 
 |  |  |  | 
 |  |  | export function useGetElectricParValue() { | 
 |  |  |   const { blLifeRecharge } = useLifeRechargeContext(); | 
 |  |  |  | 
 |  |  |   const { data: electricParValueList, isLoading } = useQuery({ | 
 |  |  |     queryKey: ['blLifeRecharge/getElectricSupportArea'], | 
 |  |  |     queryFn: async () => { | 
 |  |  |       return await blLifeRecharge.services.getElectricSupportArea({ showLoading: false }); | 
 |  |  |     }, | 
 |  |  |     select(data) { | 
 |  |  |       return data.electricAreaList ?? []; | 
 |  |  |     }, | 
 |  |  |     placeholderData: () => ({} as ElectricSupportAreaResponse), | 
 |  |  |   }); | 
 |  |  |  | 
 |  |  |   return { | 
 |  |  |     electricParValueList, | 
 |  |  |   }; | 
 |  |  | } | 
 |  |  |  | 
 |  |  | export type UseGetUserLifePayOrderPageOptions = { | 
 |  |  |   lifePayOrderType?: MaybeRef<LifeRechargeConstants.LifePayOrderTypeEnum>; | 
 |  |  | }; | 
 |  |  |  | 
 |  |  | export function useGetUserLifePayOrderPage(options: UseGetUserLifePayOrderPageOptions = {}) { | 
 |  |  |   const { lifePayOrderType } = options; | 
 |  |  |  | 
 |  |  |   const { blLifeRecharge } = useLifeRechargeContext(); | 
 |  |  |  | 
 |  |  |   // const queryState = reactive({ | 
 |  |  |   //   lifePayOrderType: LifeRechargeConstants.LifePayOrderTypeEnum, | 
 |  |  |   // }); | 
 |  |  |  | 
 |  |  |   const { infiniteLoadingProps } = useInfiniteLoading( | 
 |  |  |     ({ pageParam }) => { | 
 |  |  |       let params: QueryLifePayOrderListInput = { | 
 |  |  |         pageModel: { | 
 |  |  |           rows: 20, | 
 |  |  |           page: pageParam, | 
 |  |  |           orderInput: [{ property: 'id', order: OrderInputType.Desc }], | 
 |  |  |         }, | 
 |  |  |         lifePayOrderType: unref(lifePayOrderType), | 
 |  |  |         userId: blLifeRecharge.accountModel.userId, | 
 |  |  |       }; | 
 |  |  |  | 
 |  |  |       return blLifeRecharge.services.getUserLifePayOrderPage(params, { | 
 |  |  |         showLoading: false, | 
 |  |  |       }); | 
 |  |  |     }, | 
 |  |  |     { | 
 |  |  |       queryKey: [ | 
 |  |  |         'blLifeRecharge/getUserLifePayOrderPage', | 
 |  |  |         { | 
 |  |  |           lifePayOrderType, | 
 |  |  |           userId: blLifeRecharge.accountModel.userId, | 
 |  |  |         }, | 
 |  |  |       ], | 
 |  |  |     } | 
 |  |  |   ); | 
 |  |  |  | 
 |  |  |   return { | 
 |  |  |     infiniteLoadingProps, | 
 |  |  |   }; | 
 |  |  | } |