|  |  | 
 |  |  |   UserCertificationChannelEnum, | 
 |  |  |   UserCertificationPayType, | 
 |  |  | } from '@12333/constants'; | 
 |  |  | import * as commonServices from '@12333/services/api/Common'; | 
 |  |  | import * as userServices from '@12333/services/api/User'; | 
 |  |  | import { FormValidator, Message } from '@12333/utils'; | 
 |  |  | import { useUserCertificationSetting } from '@12333/hooks'; | 
 |  |  | import Taro from '@tarojs/taro'; | 
 |  |  | 
 |  |  |  | 
 |  |  |   const form = reactive({ | 
 |  |  |     licenseUrl: [] as FileItem[], | 
 |  |  |     enterpriseType: userDetail.value?.authType ?? EnterpriseType.HREnterprise, | 
 |  |  |     // enterpriseType: userDetail.value?.authType ?? EnterpriseType.HREnterprise, | 
 |  |  |     enterpriseName: '', | 
 |  |  |     societyCreditCode: '', | 
 |  |  |     certificationMode: certificationMode, | 
 |  |  | 
 |  |  |     ], | 
 |  |  |   }; | 
 |  |  |  | 
 |  |  |   const { updateUserInfo } = useUser(); | 
 |  |  |   // const { updateUserInfo } = useUser(); | 
 |  |  |  | 
 |  |  |   const formRef = ref<any>(null); | 
 |  |  |  | 
 |  |  | 
 |  |  |     if (!formRef.value) return; | 
 |  |  |     formRef.value.validate().then(({ valid, errors }: any) => { | 
 |  |  |       if (valid) { | 
 |  |  |         addUserCertificationAudit(); | 
 |  |  |         // addUserCertificationAudit(); | 
 |  |  |       } | 
 |  |  |     }); | 
 |  |  |   } | 
 |  |  |  | 
 |  |  |   const loading = ref(false); | 
 |  |  |  | 
 |  |  |   async function addUserCertificationAudit() { | 
 |  |  |     try { | 
 |  |  |       let params: API.AddUserCertificationAuditInput = { | 
 |  |  |         enterpriseType: form.enterpriseType, | 
 |  |  |         licenseUrl: form.licenseUrl[0].path, | 
 |  |  |         enterpriseName: form.enterpriseName, | 
 |  |  |         societyCreditCode: form.societyCreditCode, | 
 |  |  |         certificationMode: form.certificationMode, | 
 |  |  |         legalPersonName: form.legalPersonName, | 
 |  |  |         legalPersonIdNumber: form.legalPersonIdNumber, | 
 |  |  |         legalPersonIdImgUrl: form.legalPersonIdFrontImgUrl?.[0]?.path ?? '', | 
 |  |  |         legalPersonIdBackImgUrl: form.legalPersonIdBackImgUrl?.[0]?.path ?? '', | 
 |  |  |         legalPersonBankCardImgUrl: form.legalPersonBankCardImgUrl?.[0]?.path ?? '', | 
 |  |  |         certificationContact: | 
 |  |  |           form.certificationElement === UserCertificationElementEnum.Identity4 | 
 |  |  |             ? form.legalPersonName | 
 |  |  |             : form.proxyPersonName, | 
 |  |  |         certificationContactPhone: | 
 |  |  |           form.certificationElement === UserCertificationElementEnum.Identity4 | 
 |  |  |             ? form.legalPersonContactPhone | 
 |  |  |             : form.proxyPersonContactPhone, | 
 |  |  |         proxyPersonName: form.proxyPersonName, | 
 |  |  |         proxyPersonIdNumber: form.proxyPersonIdNumber, | 
 |  |  |         proxyPersonIdImgUrl: form.proxyPersonIdFrontImgUrl?.[0]?.path ?? '', | 
 |  |  |         proxyPersonIdBackImgUrl: form.proxyPersonIdBackImgUrl?.[0]?.path ?? '', | 
 |  |  |         proxyPersonBankCardImgUrl: form.proxyPersonBankCardImgUrl?.[0]?.path ?? '', | 
 |  |  |         proxyPowerAttorneyUrl: form.proxyPowerAttorneyUrl?.[0]?.path ?? '', | 
 |  |  |         certificationChannel: UserCertificationChannelEnum.ThirdParty, | 
 |  |  |         certificationElement: form.certificationElement, | 
 |  |  |         vCode: form.verificationCode, | 
 |  |  |         bankCardNumber: form.bankCardNumber, | 
 |  |  |         payType: UserCertificationPayType.NotNeedPay, | 
 |  |  |       }; | 
 |  |  |       loading.value = true; | 
 |  |  |       let res = await userServices.addUserCertificationAudit(params, { showLoading: false }); | 
 |  |  |       if (res) { | 
 |  |  |         updateUserInfo(); | 
 |  |  |         Taro.redirectTo({ | 
 |  |  |           url: RouterPath.authenticationResult, | 
 |  |  |         }); | 
 |  |  |       } | 
 |  |  |     } catch (error) { | 
 |  |  |     } finally { | 
 |  |  |       loading.value = false; | 
 |  |  |     } | 
 |  |  |   } | 
 |  |  |   // async function addUserCertificationAudit() { | 
 |  |  |   //   try { | 
 |  |  |   //     let params: API.AddUserCertificationAuditInput = { | 
 |  |  |   //       enterpriseType: form.enterpriseType, | 
 |  |  |   //       licenseUrl: form.licenseUrl[0].path, | 
 |  |  |   //       enterpriseName: form.enterpriseName, | 
 |  |  |   //       societyCreditCode: form.societyCreditCode, | 
 |  |  |   //       certificationMode: form.certificationMode, | 
 |  |  |   //       legalPersonName: form.legalPersonName, | 
 |  |  |   //       legalPersonIdNumber: form.legalPersonIdNumber, | 
 |  |  |   //       legalPersonIdImgUrl: form.legalPersonIdFrontImgUrl?.[0]?.path ?? '', | 
 |  |  |   //       legalPersonIdBackImgUrl: form.legalPersonIdBackImgUrl?.[0]?.path ?? '', | 
 |  |  |   //       legalPersonBankCardImgUrl: form.legalPersonBankCardImgUrl?.[0]?.path ?? '', | 
 |  |  |   //       certificationContact: | 
 |  |  |   //         form.certificationElement === UserCertificationElementEnum.Identity4 | 
 |  |  |   //           ? form.legalPersonName | 
 |  |  |   //           : form.proxyPersonName, | 
 |  |  |   //       certificationContactPhone: | 
 |  |  |   //         form.certificationElement === UserCertificationElementEnum.Identity4 | 
 |  |  |   //           ? form.legalPersonContactPhone | 
 |  |  |   //           : form.proxyPersonContactPhone, | 
 |  |  |   //       proxyPersonName: form.proxyPersonName, | 
 |  |  |   //       proxyPersonIdNumber: form.proxyPersonIdNumber, | 
 |  |  |   //       proxyPersonIdImgUrl: form.proxyPersonIdFrontImgUrl?.[0]?.path ?? '', | 
 |  |  |   //       proxyPersonIdBackImgUrl: form.proxyPersonIdBackImgUrl?.[0]?.path ?? '', | 
 |  |  |   //       proxyPersonBankCardImgUrl: form.proxyPersonBankCardImgUrl?.[0]?.path ?? '', | 
 |  |  |   //       proxyPowerAttorneyUrl: form.proxyPowerAttorneyUrl?.[0]?.path ?? '', | 
 |  |  |   //       certificationChannel: UserCertificationChannelEnum.ThirdParty, | 
 |  |  |   //       certificationElement: form.certificationElement, | 
 |  |  |   //       vCode: form.verificationCode, | 
 |  |  |   //       bankCardNumber: form.bankCardNumber, | 
 |  |  |   //       payType: UserCertificationPayType.NotNeedPay, | 
 |  |  |   //     }; | 
 |  |  |   //     loading.value = true; | 
 |  |  |   //     let res = await userServices.addUserCertificationAudit(params, { showLoading: false }); | 
 |  |  |   //     if (res) { | 
 |  |  |   //       updateUserInfo(); | 
 |  |  |   //       Taro.redirectTo({ | 
 |  |  |   //         url: RouterPath.authenticationResult, | 
 |  |  |   //       }); | 
 |  |  |   //     } | 
 |  |  |   //   } catch (error) { | 
 |  |  |   //   } finally { | 
 |  |  |   //     loading.value = false; | 
 |  |  |   //   } | 
 |  |  |   // } | 
 |  |  |  | 
 |  |  |   return { | 
 |  |  |     form, |