import request from '@/sheep/request';

const AddressApi = {
  // 获得用户收件地址列表
  getAddressList: (addressType = 1) => {
    return request({
      url: '/member/address/list',
      method: 'GET',
	  params: { addressType }
    });
  },
  // 创建用户收件地址
  createAddress: (data) => {
    return request({
      url: '/member/address/create',
      method: 'POST',
      data,
      custom: {
        showSuccess: true,
        successMsg: '保存成功'
      },
    });
  },
  // 更新用户收件地址
  updateAddress: (data) => {
    return request({
      url: '/member/address/update',
      method: 'PUT',
      data,
      custom: {
        showSuccess: true,
        successMsg: '更新成功'
      },
    });
  },
  // 获得用户收件地址
  getAddress: (id,addressType = 1) => {
	  console.log('123123',addressType)
    return request({
      url: '/member/address/get',
      method: 'GET',
      params: { id ,addressType}
    });
  },
  // 删除用户收件地址
  deleteAddress: (id,addressType = 1) => {
    return request({
      url: '/member/address/delete',
      method: 'DELETE',
      params: { id,addressType }
    });
  },
};

export default AddressApi;
