address.js 863 B

123456789101112131415161718192021222324252627282930
  1. // 地址相关接口
  2. import { get, post } from '@/core/http/http-client'
  3. import { buildRestPath } from '@/core/config/api-paths'
  4. /**
  5. * 获取地址列表
  6. * 对接 88live 的 /wanlshop/address/getaddress 接口
  7. */
  8. export async function pullAddressList() {
  9. const { data } = await get(buildRestPath('address/getaddress'))
  10. return Array.isArray(data) ? data : (data.data || [])
  11. }
  12. /**
  13. * 新增/编辑地址
  14. * 对接 88live 的 /wanlshop/address/address 接口
  15. * type: 'add' | 'edit' | 'newadd'
  16. */
  17. export async function postAddressSave({ data, type = 'add' }) {
  18. const { data: resData } = await post(buildRestPath('address/address'), { data, type })
  19. return resData
  20. }
  21. /**
  22. * 删除地址
  23. * 对接 88live 的 /wanlshop/address/deladdress 接口
  24. */
  25. export async function postAddressDelete({ id }) {
  26. await post(buildRestPath('address/deladdress'), { id })
  27. }