import axios from '@/libs/axios.js'
// 巡店详情
export const getTaskDetail = params => {
  return axios.request({
    url: `task/${params.id}`,
    method: 'get'
  })
}
// 重置任务项目(重新选择方案)
export const updateTaskItem = params => {
  return axios.request({
    url: `task/changeTaskItem`,
    method: 'post',
	data: params
  })
}
// 巡店任务过期处理
export const taskExpire = params => {
  return axios.request({
    url: `task/expire`,
    method: 'get'
  })
}
// 提交巡店任务
export const submitTask = params => {
  return axios.request({
    url: `task/finish`,
    method: 'post',
    data: params
  })
}
// 巡店列表,type 任务类型(视频巡店，现场巡店，点检任务)
export const getTaskList = params => {
  return axios.request({
    url: `task/query/${params.pageNo}/${params.pageSize}`,
    method: 'post',
    data: params
  })
}
// 巡店列表
export const getTasksList = params => {
	const url = `task/queryList/${params.pageNo}/${params.pageSize}`
	delete params.pageNo
	delete params.pageSize
	return axios.request({
		url: url,
		method: 'post',
		data: params
	})
}
// 查询门店当前任务是否进行
export const queryCurrentTaskUsing = params => {
  return axios.request({
    url: `task/queryCurrentTask`,
    method: 'post',
	data: params
  })
}
// 我的巡店列表
export const queryMyTask = params => {
	const url = `task/queryMyTask/${params.pageNo}/${params.pageSize}`
	delete params.pageNo
	delete params.pageSize
	return axios.request({
		url: url,
		method: 'post',
		data: params
	})
}
// (重新)开始巡店
export const taskStart = params => {
  return axios.request({
    url: `task/save`,
    method: 'post',
    data: params
  })
}
// 提交点检任务
export const savePointTask = params => {
  return axios.request({
    url: `task/savePointTask`,
    method: 'post',
    data: params
  })
}
// 校验当前门店是否在范围内位置;(入参{storeId:XXX,lat:XXX,lng:XXX})
export const validTaskPosition = params => {
  return axios.request({
    url: `task/validPosition`,
    method: 'post',
    data: params
  })
}
//  地址反解析    根据经纬度获取具体位置
export const tencentAddressInfo = params => {
  return axios.request({
    url: `tencent/addressInfo`,
    method: 'post',
    data: params
  })
}