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

export const getList =
    (current, size, params) => {
      return request({
        url: '/api/jobslink-api/tenant/insure/list',
        method: 'get',
        params: {
          ...params,
          current,
          size,
        }
      })
    }

export const getDetail =
    (current, size, insureId, params) => {
      return request({
        url: '/api/jobslink-api/tenant/insure/item/list',
        method: 'get',
        params: {current, size, insureId, ...params}
      })
    }

export const add =
    (row) => {
      return request(
          {url: '/api/jobslink-api/tenant/insure/save', method: 'post', data: row})
    }

export const downloadExcel =
    (insureId) => {
      return `/api/jobslink-api/tenant/insure/item/export-insureItem?insureId=${
          insureId}&Jobslink-Auth=${getToken()}`
    }

export const record =
    (current, size, params) => {
      return request({
        url: '/api/jobslink-api/tenant/insure/item/record',
        method: 'get',
        params: {current, size, ...params}
      })
    }

export const remove =
    (id) => {
      return request({
        url: '/api/jobslink-api/tenant/insure/remove',
        method: 'post',
        params: {id}
      })
    }

export const removeItem =
    (ids, insureId) => {
      return request({
        url: '/api/jobslink-api/tenant/insure/item/remove',
        method: 'post',
        params: {ids, insureId}
      })
    }

export const confirm =
    (insureId, companyId) => {
      return request({
        url: '/api/jobslink-api/payment/businessOrder/submit/insure/order',
        method: 'post',
        params: {insureId, companyId}
      })
    }

/*下载凭证*/
export const downloadVoucher = (companyId) => {
  return `/api/jobslink-api/tenant/insure/generateInsurePDF/${companyId}?&Jobslink-Auth=${getToken()}`
}
/*导出商保明细*/
export const cusExportInsure = (query) => {
  return `/api/jobslink-api/tenant/insure/customer/export-insure/?${query}&Jobslink-Auth=${getToken()}`
}

export const getMain = null

/**=============优化后的客服端-商保管理接口=========== */

/**获取参保单列表 */
export const getInsureList=(current, size, params)=>{
  return request({
    url:'/api/jobslink-api/tenant/insure/item/customer/getInsureItemList',
    method:'get',
    params:{
      ...params,
      current,
      size
    }
  })
}

/**下载保单凭证 */
export const exportInsureLetter=(policyNo,stime,etime)=>{
  return `/api/jobslink-api/tenant/insure/item/customer/downloadInsure?policyNo=${policyNo}&stime=${stime}&etime=${etime}&Jobslink-Auth=${getToken()}`
}
/*export const exportInsureLetter=(policyNo,stime,etime)=>{
  return request({
    url:`/api/jobslink-api/tenant/insure/item/customer/downloadInsure?policyNo=${policyNo}&stime=${stime}&etime=${etime}`,
    method:'get',
    params:{
      policyNo,stime,etime
    }
  })
}
*/
