homecart.js 972 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import { requestApi } from '../util/network'
  2. // 获取购物车
  3. export const cartGet =
  4. () =>
  5. requestApi(
  6. '/Membercart/cart_list',
  7. 'POST',
  8. {
  9. },
  10. 'member'
  11. )
  12. // 新增购物车
  13. export const cartAdd =
  14. (goodsId, quantity, blId) =>
  15. requestApi(
  16. '/Membercart/cart_add',
  17. 'POST',
  18. {
  19. 'bl_id': blId,
  20. 'goods_id': goodsId,
  21. 'quantity': quantity
  22. },
  23. 'member'
  24. )
  25. // 删除购物车
  26. export const cartDelete =
  27. (cartId) =>
  28. requestApi(
  29. '/Membercart/cart_del',
  30. 'POST',
  31. {
  32. 'cart_id': cartId
  33. },
  34. 'member'
  35. )
  36. // 购物车更新
  37. export const cartUpdate =
  38. (cartId, quantity) =>
  39. requestApi(
  40. '/Membercart/cart_edit_quantity',
  41. 'POST',
  42. {
  43. 'cart_id': cartId,
  44. 'quantity': quantity
  45. },
  46. 'member'
  47. )
  48. // 购物车数量
  49. export const cartQuantity =
  50. () =>
  51. requestApi(
  52. '/Membercart/cart_count',
  53. 'POST',
  54. {
  55. },
  56. 'member'
  57. )