zhengyiming
3 天以前 ba48054b6f2680cfa1a0b3b912880925a8b5861b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import { useQuery } from '@tanstack/vue-query';
import { MaybeRef, Ref, unref, ref } from 'vue';
import { BusinessSettingType, TempFolderPath } from '@12333/constants';
 
type UseBusinessSettingByTypeOptions<T extends object = object, TData = T> = {
  type?: MaybeRef<BusinessSettingType>;
  select?: (data: T) => TData;
};
 
// export function useBusinessSettingByType<T extends object = object, TData = T>(
//   options: UseBusinessSettingByTypeOptions = {}
// ) {
//   const { type, select } = options;
 
//   const { data: businessSetting } = useQuery({
//     queryKey: ['settingServices/getBusinessSettingByType', type],
//     queryFn: async () => {
//       return await settingServices.getBusinessSettingByType(
//         {
//           type: unref(type),
//         },
//         { showLoading: false }
//       );
//     },
//     placeholderData: () => ({} as T),
//     staleTime: Infinity,
//     select,
//   });
 
//   return {
//     businessSetting: businessSetting as Ref<TData>,
//   };
// }
 
type UserCertificationSetting = {
  enterprisePowerAttorneyTempPath: string;
  authenticationHelpUrl: string;
  idPhoteTempPath: string;
  payAmount: number;
  receivingAccount: string;
  receivingCompanyName: string;
  receivingBankName: string;
  offlinePayEndTime: string;
  offlinePayEndDays: number;
};
 
export function useUserCertificationSetting() {
  // const { businessSetting } = useBusinessSettingByType<UserCertificationSetting>({
  //   type: BusinessSettingType.UserCertification,
  //   select(data: any) {
  //     return {
  //       ...data,
  //       enterprisePowerAttorneyTempPath: `${TempFolderPath}${data.enterprisePowerAttorneyTempPath}`,
  //       idPhoteTempPath: `${TempFolderPath}${data.idPhoteTempPath}`,
  //       payAmount: data.userCertificationAmount,
  //     };
  //   },
  // });
 
  const businessSetting = ref({
    authenticationHelpUrl: '',
    receivingAccount: '',
    receivingCompanyName: '',
    receivingBankName: '',
    offlinePayEndTime: '',
    offlinePayEndDays: 1,
    enterprisePowerAttorneyTempPath: `${TempFolderPath}`,
    idPhoteTempPath: `${TempFolderPath}`,
    payAmount: 123,
  });
 
  return {
    userCertificationSetting: businessSetting,
  };
}