import request from '@/utils/request'

// 任务列表信息
export function taskList(query) {
  return request({
    url: '/system/campaign/list',
    method: 'get',
    params: query
  })
}

//导出
export function exportTaskList(params) {
  return request({
    url: `/visit/record/user/export`,
    method: 'post',
    data: params
    // responseType: 'blob'
  })
}

// 详情列表信息
export function taskListDetail(query) {
  return request({
    url: '/system/campaign/listDetail',
    method: 'get',
    params: query
  })
}

// 客户下拉
export function getGroupList(query) {
  return request({
    url: '/system/group/groupListNoPage',
    method: 'get',
    params: query
  })
}
// 二次推送获取客户名称
export function getGroupInfoByGroupId(query) {
  return request({
    url: `/system/group/getGroupInfoByGroupId`,
    method: 'get',
    params: query
  })
}
// 新增活动
export function addCampaign(data) {
  return request({
    url: `/system/campaign/add`,
    method: 'post',
    data
  })
}
// 新增协作活动
export function addCoopCampaign(data) {
  return request({
    url: `/system/campaign/add/coop`,
    method: 'post',
    data
  })
}

// 营销下拉
export function getCmpmByCustType(query) {
  return request({
    url: `/system/campaign/getCmpmByCustType?custType=${query}`,
    method: 'get'

  })
}

// 获取跟进列表
export function getVisitData(query) {
  return request({
    url: `/task/visit/list`,
    method: 'get',
    params: query
  })
}

// 删除
export function campaignDelete(data) {
  return request({
    url: `/system/campaign/delete`,
    method: 'post',
    data
  })
}

// 新增跟进
export function addVisitData(data) {
  return request({
    url: `/task/visit/add`,
    method: 'post',
    data: data
  })
}

// 新增无法触达
export function addNotCuda(data) {
  return request({
    url: `/task/visit/error/add`,
    method: 'post',
    data: data
  })
}

// 查看任务创建详情
export function getDetailByCampaign(id) {
  return request({
    url: `/system/campaign/${id}`,
    method: 'get'
  })
}

// 认领
export function claimTask(query) {
  return request({
    url: `/task/visit/list`,
    method: 'get',
    params: query
  })
}

// 去分配
export function apportTask(query) {
  return request({
    url: `/task/visit/list`,
    method: 'get',
    params: query
  })
}

// 获取反馈模板
export function getCampaignModelList(query) {
  return request({
    url: `/system/campaign/modelList`,
    method: 'get',
    params: query
  })
}

// 获取走访记录列表
export function getVisitRecord(query) {
  return request({
    url: `/visit/record/user`,
    method: 'get',
    params: query
  })
}

// 获取走访记录详情
export function getVisitRecordDetail(query) {
  return request({
    url: `/visit/record/detail`,
    method: 'get',
    params: query
  })
}

// 获取反馈
export function getFeedbackTemplate(query) {
  return request({
    url: `/visit/feedback/template`,
    method: 'get',
    params: query
  })
}

// 域内
export function getAreaIn(query) {
  return request({
    url: `/address/region/area/in`,
    method: 'get',
    params: query
  })
}

// 域外
export function getAreaOut(query) {
  return request({
    url: `/address/region/area/out`,
    method: 'get',
    params: query
  })
}

// 我预约的客户
export function getAppointmentList(query) {
  return request({
    url: `/appointment/list`,
    method: 'get',
    params: query
  })
}

// 搜索要预约的客户
export function getAppointmentCust(query) {
  return request({
    url: `/appointment/searchCust`,
    method: 'get',
    params: query
  })
}

// 预约客户
export function addAppiontment(data) {
  return request({
    url: `/appointment/cust`,
    method: 'post',
    data: data
  })
}

// 我认领的客户
export function getClaimList(query) {
  return request({
    url: `/appointment/claimList`,
    method: 'get',
    params: query
  })
}

// 搜索要认领的客户
export function getClaimCust(query) {
  return request({
    url: `/appointment/searchClaimCust`,
    method: 'get',
    params: query
  })
}

// 认领客户
export function claimCust(data) {
  return request({
    url: `/appointment/claimCust`,
    method: 'post',
    data: data
  })
}

// 查询所有产品
export function getAllProds(query) {
  return request({
    url: `/appointment/allProds`,
    method: 'get',
    params: query
  })
}

// 查询已认领产品
export function getClaimProd(query) {
  return request({
    url: `/appointment/cust/detail`,
    method: 'get',
    params: query
  })
}

// 认领客户详情
export function getClaimDetail(query) {
  return request({
    url: `/appointment/claimCust/detail`,
    method: 'get',
    params: query
  })
}
