From 0886e91fdfe3b5528f80d2b6742083aa11d16ebb Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期三, 02 四月 2025 15:54:15 +0800
Subject: [PATCH] fix: 四期bug

---
 apps/taro/src/hooks/lifepay.ts |   62 +++++++++++++++++++++++++++++++
 1 files changed, 62 insertions(+), 0 deletions(-)

diff --git a/apps/taro/src/hooks/lifepay.ts b/apps/taro/src/hooks/lifepay.ts
new file mode 100644
index 0000000..28090cd
--- /dev/null
+++ b/apps/taro/src/hooks/lifepay.ts
@@ -0,0 +1,62 @@
+import { useQuery } from '@tanstack/vue-query';
+import { useLifeRechargeContext, CreateEditPayChannelsInput } from '@life-payment/core-vue';
+import { MaybeRef } from 'vue';
+
+export function useOnlineService() {
+  const { blLifeRecharge } = useLifeRechargeContext();
+
+  const { data } = useQuery({
+    queryKey: ['blLifeRecharge/getOnlineService'],
+    queryFn: async () => {
+      return await blLifeRecharge.services.getOnlineService({
+        showLoading: false,
+      });
+    },
+    placeholderData: () => '',
+  });
+
+  return {
+    onlineServiceLink: data,
+  };
+}
+
+type UseLifePayChannlesAllListOptions = {
+  params?: MaybeRef<API.QueryLifePayChannlesInput>;
+  onSuccess?: (data: API.CreateEditPayChannelsInput[]) => any;
+};
+
+export function useLifePayChannlesAllList(options: UseLifePayChannlesAllListOptions = {}) {
+  const { onSuccess, params = {} } = options;
+
+  const { blLifeRecharge } = useLifeRechargeContext();
+
+  const {
+    data: allChannlesList,
+    isLoading,
+    refetch,
+  } = useQuery({
+    queryKey: ['blLifeRecharge/getLifePayChannlesAllList', params],
+    queryFn: async () => {
+      return await blLifeRecharge.services.getLifePayChannlesAllList(unref(params), {
+        showLoading: false,
+      });
+    },
+    placeholderData: () => [] as CreateEditPayChannelsInput[],
+    onSuccess: (data) => {
+      onSuccess?.(data);
+    },
+  });
+
+  function getChannlesNameByNum(channlesNum: string) {
+    return (
+      allChannlesList.value.find((item) => item.channlesNum === channlesNum)?.channlesName ?? ''
+    );
+  }
+
+  return {
+    allChannlesList,
+    isLoading,
+    refetch,
+    getChannlesNameByNum,
+  };
+}

--
Gitblit v1.9.1