import request from '@/utils/request'

// 创建区域设置
export function createRegion(data) {
  return request({
    url: '/ecw/region/create',
    method: 'post',
    data: data
  })
}

// 更新区域设置
export function updateRegion(data) {
  return request({
    url: '/ecw/region/update',
    method: 'put',
    data: data
  })
}


// 更新区域设置
export function updateRegionStatus(data) {
  return request({
    url: '/ecw/region/updateStatus',
    method: 'put',
    data: data
  })
}

// 删除区域设置
export function deleteRegion(id) {
  return request({
    url: '/ecw/region/delete?id=' + id,
    method: 'delete'
  })
}

// 获得区域设置
export function getRegion(id) {
  return request({
    url: '/ecw/region/get?id=' + id,
    method: 'get'
  })
}

// 获得区域设置分页
export function getRegionPage(query) {
  return request({
    url: '/ecw/region/page',
    method: 'get',
    params: query
  })
}

// 获得区域设置分页
export function getRegionList(query) {
  return request({
    url: '/ecw/region/list',
    method: 'get',
    params: query
  })
}

// 导出区域设置 Excel
export function exportRegionExcel(query) {
  return request({
    url: '/ecw/region/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

 // 获得国家树
 export function getListTree(query) {
  return request({
    url: '/ecw/region/getListTree',
    method: 'get',
    params: query
  })
}

//获取城市列表
export function getCityList(query) {
  return request({
    url: '/ecw/region/getCityList',
    method: 'get',
    params: query
  })
}

// 获得进出口城市
export function getTradeCityList(query) {
  return request({
    url: '/ecw/region/getTradeCityList',
    method: 'get',
    params: query
  })
}
// 获得目的地国家
export function getTradeCountryList(query) {
  return request({
    url: '/ecw/region/getTradeCountryList',
    method: 'get',
    params: query
  })
}


export function listByIds(params){
  return request({
    url: '/ecw/region/listByIds',
    method: 'get',
    params
  })
}
