From fe5fc18b6b1810a61df6ed7d94957f449ca05488 Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期一, 24 二月 2025 13:13:06 +0800
Subject: [PATCH] feat: 订单

---
 packages/components/src/hooks/index.ts |   51 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 50 insertions(+), 1 deletions(-)

diff --git a/packages/components/src/hooks/index.ts b/packages/components/src/hooks/index.ts
index 8513ce7..687cb7c 100644
--- a/packages/components/src/hooks/index.ts
+++ b/packages/components/src/hooks/index.ts
@@ -3,9 +3,13 @@
   LifePayRateListOutput,
   PhoneParValueOutput,
   PhoneParValueResponse,
+  QueryLifePayOrderListInput,
+  LifeRechargeConstants,
 } from '../utils';
 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 +61,48 @@
     phoneParValueList,
   };
 }
+
+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