address.js 1.2 KB

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