|  |  |  | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </ContentScrollView> | 
|---|
|  |  |  | <PageFooter v-if="detail?.userSignContractStatus === EnumTaskUserSignContractStatus.Wait"> | 
|---|
|  |  |  | <PageFooterBtn type="primary" @click="goToSign">去签约</PageFooterBtn> | 
|---|
|  |  |  | <PageFooterBtn type="primary" @click="goToSign" :loading="btnLoading">去签约</PageFooterBtn> | 
|---|
|  |  |  | </PageFooter> | 
|---|
|  |  |  | </LoadingLayout> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  | 
|---|
|  |  |  | //灵工Id | 
|---|
|  |  |  | const id = router.params?.id; | 
|---|
|  |  |  | const code = router.params?.code || options?.query?.scene; | 
|---|
|  |  |  | const btnLoading = ref(false); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const { | 
|---|
|  |  |  | isLoading, | 
|---|
|  |  |  | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function checkAgreement() { | 
|---|
|  |  |  | if (detail?.value?.userSignContractStatus === EnumTaskUserSignContractStatus.Wait) { | 
|---|
|  |  |  | goToSign(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if ( | 
|---|
|  |  |  | detail?.value?.userSignContractStatus === EnumTaskUserSignContractStatus.Stop || | 
|---|
|  |  |  | detail?.value?.userSignContractStatus === EnumTaskUserSignContractStatus.Pass | 
|---|
|  |  |  | ) { | 
|---|
|  |  |  | if (!detail?.value?.contractUrl) { | 
|---|
|  |  |  | Message.warning('协议无法查看,请稍后再试'); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | async function checkAgreement() { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | const res = await refetch(); | 
|---|
|  |  |  | if (res?.data?.userSignContractStatus === EnumTaskUserSignContractStatus.Wait) { | 
|---|
|  |  |  | goToSign(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | openDocument(setOSSLink(detail?.value?.contractUrl)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if ( | 
|---|
|  |  |  | res?.data?.userSignContractStatus === EnumTaskUserSignContractStatus.Stop || | 
|---|
|  |  |  | res?.data?.userSignContractStatus === EnumTaskUserSignContractStatus.Pass | 
|---|
|  |  |  | ) { | 
|---|
|  |  |  | if (!res?.data?.contractUrl) { | 
|---|
|  |  |  | Message.warning('协议无法查看,请稍后再试'); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | openDocument(setOSSLink(res?.data?.contractUrl)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (error) {} | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const goToSign = _.debounce( | 
|---|
|  |  |  | useAccessReal(async () => { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | let params: API.PersonalUserElectronSignCommand = { | 
|---|
|  |  |  | id: detail.value?.id, | 
|---|
|  |  |  | returnUrl: `${RouterPath.mineAgreementSignDetail}?id=${id}`, | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | let res = await enterpriseEmployeeServices.personalUserElectronSign(params); | 
|---|
|  |  |  | if (res) { | 
|---|
|  |  |  | if (detail.value?.contractTemplateAccess === EnumElectronSignAccess.AlipaySign) { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | await Message.confirm({ | 
|---|
|  |  |  | message: `签约短信已发送至您${hiddenPhone( | 
|---|
|  |  |  | detail.value?.contactPhoneNumber | 
|---|
|  |  |  | )}的手机,请及时查看并签约`, | 
|---|
|  |  |  | cancelText: '未收到短信', | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } catch (error) { | 
|---|
|  |  |  | goToSign(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | const encodedUrl = encodeURIComponent(res.signContractLongUrl); | 
|---|
|  |  |  | Taro.redirectTo({ url: `${RouterPath.extraPage}?url=${encodedUrl}` }); | 
|---|
|  |  |  | const goToSign = useAccessReal(async () => { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | btnLoading.value = true; | 
|---|
|  |  |  | let params: API.PersonalUserElectronSignCommand = { | 
|---|
|  |  |  | id: detail.value?.id, | 
|---|
|  |  |  | returnUrl: `${RouterPath.mineAgreementSignDetail}?id=${id}`, | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | let res = await enterpriseEmployeeServices.personalUserElectronSign(params); | 
|---|
|  |  |  | if (res) { | 
|---|
|  |  |  | if (detail.value?.contractTemplateAccess === EnumElectronSignAccess.AlipaySign) { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | await Message.confirm({ | 
|---|
|  |  |  | message: `签约短信已发送至您${hiddenPhone( | 
|---|
|  |  |  | detail.value?.contactPhoneNumber | 
|---|
|  |  |  | )}的手机,请及时查看并签约`, | 
|---|
|  |  |  | cancelText: '未收到短信', | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } catch (error) { | 
|---|
|  |  |  | goToSign(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | const encodedUrl = encodeURIComponent(res.signContractLongUrl); | 
|---|
|  |  |  | Taro.redirectTo({ url: `${RouterPath.extraPage}?url=${encodedUrl}` }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (error) {} | 
|---|
|  |  |  | }), | 
|---|
|  |  |  | 1000, | 
|---|
|  |  |  | { leading: true, trailing: true } | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | btnLoading.value = false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (error) { | 
|---|
|  |  |  | btnLoading.value = false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Taro.useDidShow(() => { | 
|---|
|  |  |  | refetch(); | 
|---|