cart.js 933 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import request from '@/sheep/request';
  2. const CartApi = {
  3. addCart: (data) => {
  4. return request({
  5. url: '/trade/cart/add',
  6. method: 'POST',
  7. data: data,
  8. custom: {
  9. showSuccess: true,
  10. successMsg: '已添加到购物车~',
  11. }
  12. });
  13. },
  14. updateCartCount: (data) => {
  15. return request({
  16. url: '/trade/cart/update-count',
  17. method: 'PUT',
  18. data: data
  19. });
  20. },
  21. updateCartSelected: (data) => {
  22. return request({
  23. url: '/trade/cart/update-selected',
  24. method: 'PUT',
  25. data: data
  26. });
  27. },
  28. deleteCart: (ids) => {
  29. return request({
  30. url: '/trade/cart/delete',
  31. method: 'DELETE',
  32. params: {
  33. ids
  34. }
  35. });
  36. },
  37. getCartList: () => {
  38. return request({
  39. url: '/trade/cart/list',
  40. method: 'GET',
  41. custom: {
  42. showLoading: false,
  43. auth: true,
  44. },
  45. });
  46. },
  47. };
  48. export default CartApi;