import request from 'libs/request'

export function fetchCityList (params) {
  const defalutParams = {
    type: '',
    query_name: params.searchKey || '',
  }
  return request.get('region/list', {params: Object.assign(defalutParams, params)})
}

export function createCity (data) {
  return request.post('region/save', data)
}

export function fetchChildCity (parent_id) {
  return request.get('region/child/list', {params: {parent_id}})
}

export function delRegion (ids) {
  return request.post('region/delete', { ids })
}

export function fetchRegionDetail (region_id) {
  return request.get(`region/info/${region_id}`)
}

export function updateRegion (data) {
  return request.post('region/update', data)
}

export function deleteRegion (strIds) {
  return request.post('region/delete', { strIds })
}

