import http from '@/service'

// 获取执行包列表
export function getPackageList(data: any) {
  return http.get(`/admin/api/getUserScorePackageList2`, {
    data
  })
}

// 领取执行包
export function receivePackage(packageId: string | number) {
  return http.get(`/admin/api/receivePackage?packageId=${packageId}`)
}

// 获取执行包详情
export function getScorePackageInfoById(packageId: string | number) {
  return http.get(`/admin/api/getScorePackageInfoById?id=${packageId}`)
}

// 任务完成记录
export function getTaskCompletionList(data: any) {
  return http.get(`/admin/api/getHistoryTaskList`, {
    data
  })
}

// 我的任务记录列表
export function getTaskListByPackageIdApi(data: any) {
  return http.get(`/admin/api/getTaskListByPackageId`, {
    data
  })
}

// 获取点的半径
export function getDictPointApi() {
  return http.get('/admin/dict/type/point_jwd')
}

// 获取点的半径
export function getPointSignInfoApi(params: any) {
  return http.get('/admin/api/getPointSignInfo', { params })
}

// 根据类型获取执行包列表
export function getPackageListByTaskTypeApi(type: string) {
  return http.get(`/admin/api/getPackageListByTaskType?type=${type}`)
}

// 获取签到记录
export function getSignListByUserIdApi(signUserid: string) {
  return http.get(`/admin/api/getSignListByUserId?signUserid=${signUserid}`)
}

// 签到
export function saveSignInfoApi(data: any) {
  return http.post(`/admin/api/saveSignInfo`, data)
}

export function getTaskContentConfigByTaskTypeIdApi(taskTypeId: string) {
  return http.get(`admin/api/getTaskContentConfigByTaskTypeId/${taskTypeId}`)
}

// h5 详情
export function getH5TaskContentConfigByTaskTypeIdApi(taskTypeId: string) {
  return http.get(`admin/api/getTaskContentConfigByTaskTypeByShareId/${taskTypeId}`)
}

// 获取医院列表
export function getListHospitalByNameApi(params: any) {
  return http.get('/admin/wmdahospital/listHospitalByName', { params })
}
// 获取药店列表
export function getListDrugstoreByNameApi(params: any) {
  return http.get('/admin/wmdapharmacy/listWmDaPharmacyByName', { params })
}
// 获取商业公司列表
export function getListCompanyByNameApi(params: any) {
  return http.get('/admin/wmdadistribution/listDistributionByName', { params })
}

// 获取药品
export function getListDrugsByNameApi(params: any) {
  return http.get('/admin/wmscorepackage/drugs', { params })
}

// 保存任务草稿
export function saveTaskInfoApi(data: any) {
  return http.post(`/admin/api/task-content/draft`, data)
}

// 获取任务草稿内容
export function getSaveTaskInfoApi(taskTypeId: string) {
  return http.get(`/admin/api/task-content/draft/${taskTypeId}`)
}

// 提交任务
export function saveTaskContentApi(data: any) {
  return http.post(`/admin/api/saveTaskContent`, data)
}

// 根据名字获取药店
export function getPharmacyByNameApi(params: any) {
  return http.get('/admin/wmdapharmacy/getWmDaPharmacyByName', { params })
}

// 获取医院详情
export function getHospitalDetailApi(id: string) {
  return http.get(`/admin/wmdahospital/${id}`)
}

// 根据名字获取医院
export function getHospitalByNameApi(params: any) {
  return http.get('/admin/wmdahospital/getHospitalByName', { params })
}

// 获取商业公司详情
export function getCompaniesDetailApi(id: string) {
  return http.get(`/admin/wmdadistribution/${id}`)
}

// 根据名字获取商业公司
export function getCompaniesByNameApi(params: any) {
  return http.get('/admin/wmdadistribution/getDistributionByName', { params })
}

// 根据Id获取任务详情
export function getTaskInfoByIdApi(id: string) {
  return http.get(`/admin/api/getTaskInfoById?taskId=${id}`)
}

// 根据id获取拜访签到记录
export function getSignInfoByTaskIdApi(params: any) {
  return http.get(`/admin/api/getSignInfoByTaskId`, { params })
}

// 根据链接生成二维码图片
export function getQrCodeByUrlApi(url: string) {
  return http.get(
    `/admin/api/getQrCodeByUrl?url=${encodeURIComponent(url)}&width=${170}&height=${170}`
  )
}

// 执行包详情导出报告
export function exportZbInfoFormWeiNewApi(params: any) {
  return http.get(`/admin/reportExport/exportZbInfoFormWeiNew`, { params })
}

// 签到
export function signTempApi(data: any) {
  return http.post(`/admin/wmusersign/temp/sign`, data)
}

export function getSignTempResultApi(data: any) {
  return http.post(`/admin/wmusersign/temp/sign/result`, data)
}

// 获取积分包详情

export function getPkgTaskDetailsApi(params: any) {
  return http.get(`/admin/api/v2/getPkgTaskDetails`, { params })
}
