address.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import request from '@/sheep/request';
  2. const AddressApi = {
  3. // 获得用户收件地址列表
  4. getAddressList: (addressType = 1) => {
  5. return request({
  6. url: '/member/address/list',
  7. method: 'GET',
  8. params: { addressType }
  9. });
  10. },
  11. // 创建用户收件地址
  12. createAddress: (data) => {
  13. return request({
  14. url: '/member/address/create',
  15. method: 'POST',
  16. data,
  17. custom: {
  18. showSuccess: true,
  19. successMsg: '保存成功'
  20. },
  21. });
  22. },
  23. // 更新用户收件地址
  24. updateAddress: (data) => {
  25. return request({
  26. url: '/member/address/update',
  27. method: 'PUT',
  28. data,
  29. custom: {
  30. showSuccess: true,
  31. successMsg: '更新成功'
  32. },
  33. });
  34. },
  35. // 获得用户收件地址
  36. getAddress: (id,addressType = 1) => {
  37. console.log('123123',addressType)
  38. return request({
  39. url: '/member/address/get',
  40. method: 'GET',
  41. params: { id ,addressType}
  42. });
  43. },
  44. // 删除用户收件地址
  45. deleteAddress: (id,addressType = 1) => {
  46. return request({
  47. url: '/member/address/delete',
  48. method: 'DELETE',
  49. params: { id,addressType }
  50. });
  51. },
  52. };
  53. export default AddressApi;