cart.js 964 B

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