index.js 879 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. const { request } = require('../../../api/request')
  2. /**
  3. * 商品列表
  4. * @param obj
  5. * @returns {Promise}
  6. */
  7. export const getProductList = (obj) => request({
  8. url: '/api/shop/product/list',
  9. method: 'POST',
  10. data: {
  11. 'page': obj.pageNum,
  12. 'page_size': obj.pageSize,
  13. 'type': obj.type // 商品状态
  14. },
  15. showLoading: true
  16. })
  17. /**
  18. * 商品删除
  19. * @param id
  20. * @returns {Promise | Promise<unknown>}
  21. */
  22. export const postProductDelete = (id) => request({
  23. url: '/api/shop/product/delete',
  24. method: 'POST',
  25. data: {
  26. id
  27. },
  28. showLoading: true
  29. })
  30. /**
  31. * 商品上下架
  32. * @param id
  33. * @param productStatus
  34. * @returns {Promise<*>}
  35. */
  36. export const postProductUp = (id, productStatus) => request({
  37. url: '/api/shop/product/up',
  38. method: 'POST',
  39. data: {
  40. id,
  41. 'product_status': productStatus // 状态(0下架1上架)
  42. },
  43. showLoading: true
  44. })