product.service.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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: false })
  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:promotionsId 促销ID
  30. */
  31. queryProductPromotionInfo (data = {}) {
  32. return this.AjaxService.get({ url:'/product/promotion/info', data, isLoading: false })
  33. }
  34. /**
  35. * @查询凑单商品列表
  36. * @param:promotionsId 促销ID
  37. * @param:pageSize 查询条数
  38. * @param:pageNum 查询页数
  39. */
  40. queryProductPromotionList (data = {}) {
  41. return this.AjaxService.get({ url:'/product/promotion/products', data, isLoading: true })
  42. }
  43. /**
  44. * @商品详情-查询商品详情
  45. * @param:userId 用户ID(未登录传0或者'')
  46. * @param:productIds 商品ID
  47. */
  48. queryProductDetils (data = {}) {
  49. return this.AjaxService.get({ url:'/product/details', data, isLoading: false })
  50. }
  51. /**
  52. * @商品详情-相关推荐
  53. * @param:productIds 商品ID
  54. */
  55. queryProductDetilsRelevant (data = {}) {
  56. return this.AjaxService.get({ url:'/product/detail/recommend', data, isLoading: false })
  57. }
  58. /**
  59. * @加入购物车
  60. * @param:userId 用户ID(必填)
  61. * @param:productID 用户ID(必填)
  62. * @param:productCount 商品数量(必填)
  63. */
  64. shoppingAddCart (data = {}) {
  65. return this.AjaxService.post({ url:'/shoppingCart/addCart', data, isLoading: true })
  66. }
  67. /**
  68. * @购物车列表
  69. * @param:userId 用户ID(必填)
  70. */
  71. QueryShoppingCartList (data = {}) {
  72. return this.AjaxService.get({ url:'/shoppingCart/list', data, isLoading: false })
  73. }
  74. /**
  75. * @更新购物车商品增减
  76. * @param:userId 用户ID(必填)
  77. * @param:productID 商品ID(必填)
  78. * @param:productCount 商品数量ID(必填)
  79. */
  80. shoppingCartUpdate (data = {}) {
  81. return this.AjaxService.post({ url:'/shoppingCart/update', data, isLoading: true })
  82. }
  83. /**
  84. * @删除购物车商品
  85. * @param:userId 用户ID(必填)
  86. * @param:productIDs 商品ID(用','号拼接)
  87. */
  88. shoppingCartDelete (data = {}) {
  89. return this.AjaxService.post({ url:'/shoppingCart/delete', data, isLoading: true })
  90. }
  91. /* 二级列表 */
  92. GetPageTopic (data = {}) {
  93. return this.AjaxService.get({ url:'/page/topic', data, isLoading: false })
  94. }
  95. /* 二级列表banner */
  96. GetPageTopicBanner (data = {}) {
  97. return this.AjaxService.get({ url:'/page/topic/info', data, isLoading: false })
  98. }
  99. /* 活动专题列表 */
  100. GetPromotionsrList (data = {}) {
  101. return this.AjaxService.get({ url:'/promotions/list', data, isLoading: false })
  102. }
  103. }