product.service.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /**
  2. * 这是与购物有关的业务逻辑的服务
  3. */
  4. export default class ProductService {
  5. constructor(AjaxService) {
  6. Object.assign(this, { AjaxService })
  7. this.name = 'ProductService'
  8. }
  9. /**
  10. * @商城首页-常用商品列表
  11. * @param:userId 用户ID(未登录传0或者''),
  12. * @param:preferredFlag 新品上线(001) 优惠商品(010) 常用商品(100),,
  13. * @param:pageNum 页码
  14. * @param:pageSize 每页条数
  15. */
  16. queryProductPreferred (data = {}) {
  17. return this.AjaxService.get({ url:'/product/preferred', data, isLoading: true })
  18. }
  19. /**
  20. * @商品列表-查询商品价格
  21. * @param:userId 用户ID(未登录传0或者'')
  22. * @param:productID 商品ID','符号拼接
  23. */
  24. querySearchProductPrice (data = {}) {
  25. return this.AjaxService.get({ url:'/product/listPrice', data, isLoading: false })
  26. }
  27. /**
  28. * @商品详情-查询商品详情
  29. * @param:userId 用户ID(未登录传0或者'')
  30. * @param:productIds 商品ID
  31. */
  32. queryProductDetils (data = {}) {
  33. return this.AjaxService.get({ url:'/product/details', data, isLoading: false })
  34. }
  35. /**
  36. * @加入购物车
  37. * @param:userId 用户ID(必填)
  38. * @param:productID 用户ID(必填)
  39. * @param:productCount 商品数量(必填)
  40. */
  41. shoppingAddCart (data = {}) {
  42. return this.AjaxService.post({ url:'/shoppingCart/addCart', data, isLoading: true })
  43. }
  44. /**
  45. * @购物车列表
  46. * @param:userId 用户ID(必填)
  47. */
  48. queryShoppingCartList (data = {}) {
  49. return this.AjaxService.get({ url:'/shoppingCart/list', data, isLoading: false })
  50. }
  51. /**
  52. * @更新购物车商品增减
  53. * @param:userId 用户ID(必填)
  54. * @param:productID 商品ID(必填)
  55. * @param:productCount 商品数量ID(必填)
  56. */
  57. shoppingCartUpdate (data = {}) {
  58. return this.AjaxService.post({ url:'/shoppingCart/update', data, isLoading: true })
  59. }
  60. /**
  61. * @删除购物车商品
  62. * @param:userId 用户ID(必填)
  63. * @param:productIDs 商品ID(用','号拼接)
  64. */
  65. shoppingCartDelete (data = {}) {
  66. return this.AjaxService.post({ url:'/shoppingCart/delete', data, isLoading: true })
  67. }
  68. }