From 3ee683d6b002f098e5b7fed11b54615126d82a3c Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期一, 24 二月 2025 10:57:26 +0800
Subject: [PATCH] fix: 对接
---
packages/components/src/hooks/index.ts | 73 +++++++++++++++++++++++++++++++++++-
1 files changed, 71 insertions(+), 2 deletions(-)
diff --git a/packages/components/src/hooks/index.ts b/packages/components/src/hooks/index.ts
index 8513ce7..5071f6a 100644
--- a/packages/components/src/hooks/index.ts
+++ b/packages/components/src/hooks/index.ts
@@ -3,9 +3,14 @@
LifePayRateListOutput,
PhoneParValueOutput,
PhoneParValueResponse,
-} from '../utils';
+ QueryLifePayOrderListInput,
+ LifeRechargeConstants,
+ ElectricParValueResponse,
+} 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();
@@ -57,3 +62,67 @@
phoneParValueList,
};
}
+
+export function useGetElectricParValue() {
+ const { blLifeRecharge } = useLifeRechargeContext();
+
+ const { data: electricParValueList, isLoading } = useQuery({
+ queryKey: ['blLifeRecharge/getElectricParValue'],
+ queryFn: async () => {
+ return await blLifeRecharge.services.getElectricParValue({ showLoading: false });
+ },
+ select(data) {
+ return data.electricParValue ?? [];
+ },
+ placeholderData: () => ({} as ElectricParValueResponse),
+ });
+
+ 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,
+ };
+}
--
Gitblit v1.9.1