import ajax from './ajax'
import { LOCATION_URL } from '@/config/config'

// 1. 定义基础路径
// const BASE_URL = '/huiqicha'
const BASE_URL = LOCATION_URL
// const BASE_URL = 'https://lhlas-dev.zrubft.com'
// const BASE_URL = 'http://158.226.90.148:10022'

//行政网格列表
export const regionBaseList = (params) => ajax(BASE_URL + 
    `/grid/region/list?gridPattern=${params.gridPattern}&gridLevel=${params.gridLevel}&gridName=${params.gridName}&pageNum=${params.pageNum}&pageSize=${params.pageSize}`,
     {}, 'GET');

//自定义地图列表
export const mapBaseList = (params) => ajax(BASE_URL + 
    `/draw/grid/list?gridPattern=${params.gridPattern}&gridName=${params.gridName}&pageNum=${params.pageNum}&pageSize=${params.pageSize}`,
     {}, 'GET');

//自定义名单列表
export const nameBaseList = (params) => ajax(BASE_URL + 
    `/grid/virtual/list?gridPattern=${params.gridPattern}&gridName=${params.gridName}&pageNum=${params.pageNum}&pageSize=${params.pageSize}`,
     {}, 'GET');


// 行政详情
export const regionBaseDetail = (params) => ajax(BASE_URL + 
    `/grid/region/cust/list?gridId=${params.gridId}&custType=${params.custType}&custName=${params.custName}&pageNum=${params.pageNum}&pageSize=${params.pageSize}`,
     {}, 'GET');

// 自定义地图详情
export const mapBaseDetail = (params) => ajax(BASE_URL + 
    `/draw/grid/cust/list?gridId=${params.gridId}&custType=${params.custType}&custName=${params.custName}&pageNum=${params.pageNum}&pageSize=${params.pageSize}`,
     {}, 'GET');

     
// 自定义名单详情
export const nameBaseDetail = (params) => ajax(BASE_URL + 
    `/grid/virtual/cust/list?gridId=${params.gridId}&custType=${params.custType}&custName=${params.custName}&pageNum=${params.pageNum}&pageSize=${params.pageSize}`,
     {}, 'GET');

// 获取经营状态
export const getBusinessList = (params) => ajax(BASE_URL + 
    `/system/business/getRegStatus`,{}, 'GET');

// 坐标和半径搜索用户数量
export const searchCircleCount = (params) => ajax(BASE_URL + 
    `/cust/map/search/circle/count`,params, 'post');

// 坐标和半径查询用户列表
export const searchCircleList = (params) => ajax(BASE_URL + 
    `/cust/map/search/circle`,params, 'post');

// 搜藏、取消搜藏
export const updateFavoriteList = (id) => ajax(BASE_URL + 
    `/cust/map/favorite/update?radarId=${id}`,{}, 'get');

// 获取收藏列表
export const searchFavoriteList = (params) => ajax(BASE_URL + 
    `/cust/map/favorite/list?pageNum=${params.pageNum}&pageSize=${params.pageSize} + 
    &latitude=${params.latitude}&longitude=${params.longitude}&isAsc=${params.isAsc}`,{}, 'get');

    
// 获取收藏地图数据
export const searchFavoriteMap = () => ajax(BASE_URL + 
    `/cust/map/favorite/map`,{}, 'get');

// 查询行业
export const getIndustryTree = () => ajax(BASE_URL + 
    `/system/retail/selectIndustryTree`,{}, 'get');

// 查询企业
export const getQiyeTree = () => ajax(BASE_URL + 
    `/cust/map/metric/company/type`,{}, 'get');

// 特色区域地质解析
export const queryAddressList=(params)=>ajax(BASE_URL + 
    `/address/analyse/placeSearch?address=${params.address}`,{}, 'get');

// 地址转码
export const translateLocApi=(params)=>ajax(BASE_URL + 
    `/address/analyse/gps?lat=${params.lat}&lng=${params.lng}`,{}, 'get');

// 总行行政网格/支行行政网格
export const gridSelectRegion=(params)=>ajax(BASE_URL + 
    `/my/customer/grid/select/region?gridLevel=${params.gridLevel}&opsDept=${params.opsDept}`,{}, 'get');

// 自绘地图网格
export const gridSelectDraw=(params)=>ajax(BASE_URL + 
    `/my/customer/grid/select/draw?opsDept=${params.opsDept}`,{}, 'get');

// 自建名单网格
export const gridSelectVirtual=(params)=>ajax(BASE_URL + 
    `/my/customer/grid/select/virtual?opsDept=${params.opsDept}`,{}, 'get');

