/**
 * zdx
 * moduleName: 地址
 */

import { request } from '../index'

// 地址列表
const addresses = () => {
  return request({
    url: 'mall/addresses',
    method: 'GET'
  })
}

// 新增地址
const addAddresses = (data) => {
  return request({
    url: 'mall/addresses',
    method: 'post',
    data: data
  })
}
// 根据地址id获取地址的详细信息
const getAddresses = (id) => {
  return request({
    url: 'mall/addresses/'+id,
    method: 'get'
  })
}
// 编辑
const editAddresses = (id,data) => {
  return request({
    url: 'mall/addresses/'+id,
    method: 'put',
    data:data
  })
}
// 删除
const delAddresses = (id) => {
  return request({
    url: 'mall/addresses/'+id,
    method: 'DELETE'
  })
}
// 默认
const defaultAddresses = (id) => {
  return request({
    url: 'mall/addresses/'+id+'/default',
    method: 'post'
  })
}


export {
  addresses,
  addAddresses,
  getAddresses,
  editAddresses,
  delAddresses,
  defaultAddresses
}
