import axios from 'axios'
import request from '@/utils/request'

// 获取当前位置
export function apiMapLocation(params) {
    return new Promise(async (resolve, reject) => {
        const { data } = await axios.get('/tecent/ws/location/v1/ip', { params })
        data.status === 0 ? resolve(data) : reject(data.message)
    })
}
// 根据地址获取经纬度
export function getLonAndLatByArea(params) {
    return new Promise(async (resolve, reject) => {
        const { data } = await axios.get('/tecent/ws/geocoder/v1', { params })
        data.status === 0 ? resolve(data) : reject(data.message)
    })
}
// 根据当前位置获取区域列表
export function getAreaListByLocation(params) {
    return request.get({ url: '/serviceArea/list', params });
}
// 添加区域
export function addArea(params) {
    return request.post({ url: '/serviceArea/add', params })
}
// 删除区域
export function delArea(params) {
    return request.get({ url: '/serviceArea/del', params })
}