zhengyiming
2025-03-13 07d73df3d817d01ce47f6c7b7a8d8514cd389295
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
<template>
  <PageLayoutWithBg title="在线签约" has-border class="online-sign-result-page">
    <LoadingLayout :loading="isLoading">
      <ContentScrollView>
        <OnlineResult
          title="宁波人力无忧公司"
          :icon="IconMain"
          contentTitle="签署成功!"
          :items="['签署情况:已签署', '已经成功使用您的CA证书签署成功']"
        >
          <template #actions>
            <PageFooterBtn
              v-if="data && data.contractUrl"
              style="width: 100%"
              :hasMargin="false"
              @click="downloadContract"
              >下载合同</PageFooterBtn
            >
          </template>
        </OnlineResult>
      </ContentScrollView>
    </LoadingLayout>
  </PageLayoutWithBg>
</template>
 
<script setup lang="ts">
import { LoadingLayout } from '@bole-core/components';
import IconMain from '@/assets/online-sign-result/icon-main.png';
import OnlineResult from './components/OnlineResult.vue';
import { useQuery, useQueryClient } from '@tanstack/vue-query';
import * as lgGigWorkerServices from '@/services/api/LgGigWorker';
import { downloadFileByUrl } from '@/utils';
import { SignChannelEnum } from '@/constants';
 
defineOptions({
  name: 'OnlineSignResult',
});
 
const route = useRoute();
const customerId = (route.query.customerId as string) ?? '';
const templateId = (route.query.templateId as string) ?? '';
const companyId = (route.query.companyId as string) ?? '';
const phoneNumber = (route.query.phoneNumber as string) ?? '';
const action = Number(route.query.action as string);
const bussinessCode = route.query.bussinessCode as string;
const isFromShotMessage = !!bussinessCode;
console.log('bussinessCode: ', bussinessCode);
 
const { data, isLoading } = useQuery({
  queryKey: ['lgGigWorkerServices/getLgGigWorkerContractUrl'],
  queryFn: async () => {
    return await lgGigWorkerServices.getLgGigWorkerContractUrl(
      {
        phone: phoneNumber,
        companyId: companyId,
        bussinessCode: bussinessCode,
      },
      { showLoading: false }
    );
  },
  placeholderData: () => null as API.GetLgGigWorkerContractUrlOutput,
});
 
function downloadContract() {
  if (data.value && data.value.contractUrl) {
    if (data.value.signChannel === SignChannelEnum.Alipay) {
      location.href = data.value.contractUrl;
    } else {
      downloadFileByUrl(data.value.contractUrl);
    }
  }
}
</script>