import request from '@/router/axios';
import { getToken } from '@/util/auth'

//电子签章查询列表
export const esignatureStatus =
  (current, size, params) => {
    return request({
      url: '/api/jobslink-api/doc/docCompanySeal/getCompanySealList',
      method: 'get',
      params: {
        ...params,
        current,
        size,
      }
    })
  }
//提交抠图后印章图片
export const signSealImg =
  (data) => {
    return request({
      url: '/api/jobslink-api/doc/docCompanySeal/signSeal',
      method: 'post',
      data: data
    })
  }
//确认提交签发印章
export const signSeal =
  (data) => {
    return request({
      url: '/api/jobslink-api/doc/company/cert/signSeal',
      method: 'post',
      data: data
    })
  }
//确认提交签发印章批量
export const signSeals =
  (data) => {
    return request({
      url: '/api/jobslink-api/doc/docCompanySeal/signSeals',
      method: 'post',
      data: data
    })
  }
//下载申请书
export const downloadEsignature =
  (id) => {
    return `jobslink-api/doc/docCompanySeal/download?id=${id}&Jobslink-Auth=${getToken()}`
  }
//批量下载申请书
export const downloadEsignatureList =
  (ids) => {
    return `jobslink-api/doc/docCompanySeal/downloadList?ids=${ids}&Jobslink-Auth=${getToken()}`
  }
//签发成功查看
//  export const detailsImg =
// (id) => {
//     return  `jobslink-api/doc/docCompanySeal/details?id=${id}&Jobslink-Auth=${getToken()}`
// }
export const detailsImg =
  (id) => {
    return request({
      url: '/api/jobslink-api/doc/docCompanySeal/details',
      method: 'get',
      params: {
        id: id
      }
    })
  }
//电子签章查询列表
export const managerList =
  (current, size, params) => {
    return request({
      url: '/api/jobslink-api/doc/contract/manager/list',
      method: 'get',
      params: {
        ...params,
        current,
        size,
      }
    })
  }
//下载电子合同
export const contractDownload =
  (id) => {
    return `jobslink-api/doc/contract/download/${id}?Jobslink-Auth=${getToken()}`
  }
//查看合同
export const viewContractImg =
  (id) => {
    return request({
      url: '/api/jobslink-api/doc/contract/viewContract',
      method: 'get',
      params: {
        id: id
      }
    })
  }
//查看合同图片
export const viewLetter = (userId, servicesNo) => {
  return request({
    url: '/api/jobslink-api/doc/docCompanySeal/company/details',
    method: 'get',
    params: { userId, servicesNo }
  })
}
//查看合同
// export const viewContractImg =
// (id) => {
//   return request({
//     url: '/api/jobslink-api/doc/contract/viewContract',
//     method: 'get',
//     params: {
//       id:id
//     }
// }

/**个人签名管理api */

/**获取已签名用户列表 */
export const getPersonSignatureList =
  (current, size, params) => {
    return request({
      url: '/api/jobslink-api/doc/docUserSeal/signList',
      method: 'get',
      params: {
        ...params,
        current,
        size,
      }
    })
  }

/**重置签名 */
export const resetPersonSignature =
  (userId) => {
    return request({
      url: '/api/jobslink-api/doc/docUserSeal/reSign',
      method: 'post',
      data: { userId }
    })
  }

  export const getPersonSignatureDetail = (userId) => {
    return request({
      url: '/api/jobslink-api/doc/docUserSeal/signLog',
      method: 'post',
      data: {
        userId
      }
    })
  }

  //批量下载合同
export const mutiDownPdf=(ids)=> {
  return  `jobslink-api/doc/contract/contract/bulkDownload?ids=${ids}&Jobslink-Auth=${getToken()}`
}
