| | |
| | | EnumTaskUserApplyStatus, |
| | | } from '@12333/constants'; |
| | | import _ from 'lodash'; |
| | | import { trim } from '@12333/utils'; |
| | | import { computed, MaybeRef, reactive, ref, unref } from 'vue'; |
| | | 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'; |
| | | import dayjs from 'dayjs'; |
| | |
| | | }; |
| | | } |
| | | |
| | | export function useEnterpriseWalletAccessSelect() { |
| | | type EnterpriseWalletAccessSelectOptions = { |
| | | supplierEnterpriseId: MaybeRef<string>; |
| | | }; |
| | | |
| | | export function useEnterpriseWalletAccessSelect(options: EnterpriseWalletAccessSelectOptions) { |
| | | const { supplierEnterpriseId } = options; |
| | | const { data } = useQuery({ |
| | | queryKey: ['enterpriseWalletServices/getEnterpriseWalletAccessSelect'], |
| | | queryKey: ['enterpriseWalletServices/getEnterpriseWalletAccessSelect', supplierEnterpriseId], |
| | | queryFn: () => { |
| | | return enterpriseWalletServices.getEnterpriseWalletAccessSelect( |
| | | {}, |
| | | { supplierEnterpriseId: unref(supplierEnterpriseId) }, |
| | | { |
| | | showLoading: false, |
| | | } |
| | |
| | | |
| | | 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 }; |
| | | } |