From 40ed21141404ea96af41bac752b22c0f9a838168 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期一, 10 十一月 2025 14:55:20 +0800
Subject: [PATCH] fix: bug

---
 packages/hooks/task.ts |   75 +++++++++++++++++++++++++++++++++++++
 1 files changed, 74 insertions(+), 1 deletions(-)

diff --git a/packages/hooks/task.ts b/packages/hooks/task.ts
index f86c812..58642d8 100644
--- a/packages/hooks/task.ts
+++ b/packages/hooks/task.ts
@@ -12,7 +12,7 @@
   EnumTaskUserApplyStatus,
 } from '@12333/constants';
 import _ from 'lodash';
-import { trim } from '@12333/utils';
+import { OrderUtils, trim } from '@12333/utils';
 import { computed, MaybeRef, reactive, Ref, ref, unref } from 'vue';
 import * as taskServices from '@12333/services/apiV2/task';
 import * as enterpriseWalletServices from '@12333/services/apiV2/enterpriseWallet';
@@ -225,3 +225,76 @@
 
   return { settlementAccessList };
 }
+
+type UseTaskInfoOptions = {
+  id: MaybeRef<string>;
+  onSuccess?: (data: API.GetTaskInfoQueryResult) => any;
+};
+
+export function useTaskInfo({ id, onSuccess }: UseTaskInfoOptions) {
+  const {
+    isLoading,
+    isError,
+    data: detail,
+    refetch,
+  } = useQuery({
+    queryKey: ['taskServices/getTaskInfo', id],
+    queryFn: async () => {
+      return await taskServices.getTaskInfo(
+        { id: unref(id) },
+        {
+          showLoading: false,
+        }
+      );
+    },
+    placeholderData: () => ({} as API.GetTaskInfoQueryResult),
+    onSuccess(data) {
+      onSuccess?.(data);
+    },
+  });
+
+  const isContainCheckIn = computed(() =>
+    OrderUtils.isContainCheckIn(detail.value?.checkReceiveMethods)
+  );
+
+  return { detail, isLoading, isError, refetch, isContainCheckIn };
+}
+
+type UseCheckReceiveTaskUserSubmitOptions = {
+  params: MaybeRef<API.APIgetCheckReceiveTaskUserSubmitParams>;
+  onSuccess?: (data: API.GetCheckReceiveTaskUserSubmitQueryResult) => any;
+};
+
+export function useCheckReceiveTaskUserSubmit({
+  params,
+  onSuccess,
+}: UseCheckReceiveTaskUserSubmitOptions) {
+  const {
+    isLoading,
+    isError,
+    data: detail,
+    refetch,
+  } = useQuery({
+    queryKey: ['taskCheckReceiveServices/getCheckReceiveTaskUserSubmit', params],
+    queryFn: async () => {
+      const _params = unref(params);
+      return await taskCheckReceiveServices.getCheckReceiveTaskUserSubmit(
+        // { ..._params, date: dayjs(_params.date).format('YYYY-MM-DD') },
+        _params,
+        {
+          showLoading: false,
+        }
+      );
+    },
+    placeholderData: () => ({} as API.GetCheckReceiveTaskUserSubmitQueryResult),
+    onSuccess(data) {
+      onSuccess?.(data);
+    },
+  });
+
+  const isContainCheckIn = computed(() =>
+    OrderUtils.isContainCheckIn(detail.value?.checkReceiveMethods)
+  );
+
+  return { detail, isLoading, isError, refetch, isContainCheckIn };
+}

--
Gitblit v1.9.1