product.service.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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:name 商品名称关键词
  12. * @param:pageNum 页码
  13. * @param:pageSize 条数
  14. */
  15. QueryProductList (data = {}) {
  16. return this.AjaxService.get({
  17. url:'/product/list',
  18. data,
  19. isLoading: false ,
  20. })
  21. }
  22. /**
  23. * @商品详情-查询商品详情
  24. * @param:userId 用户ID(未登录传0或者'')
  25. * @param:productIds 商品ID
  26. */
  27. QueryProductDetils (data = {}) {
  28. return this.AjaxService.get({
  29. url:'/product/details',
  30. data,
  31. isLoading: false ,
  32. })
  33. }
  34. /**
  35. * @加入购物车
  36. * @param:userId 用户ID(必填)
  37. * @param:productId 用户ID(必填)
  38. * @param:productCount 商品数量(必填)
  39. */
  40. shoppingAddCart (data = {}) {
  41. return this.AjaxService.post({
  42. url:'/shopping/add/cart',
  43. data,
  44. isLoading: true
  45. })
  46. }
  47. /**
  48. * @购物车列表
  49. * @param:userId 用户ID(必填)
  50. */
  51. QueryShoppingCartList (data = {}) {
  52. return this.AjaxService.get({
  53. url:'/shopping/info',
  54. data,
  55. isLoading: false
  56. })
  57. }
  58. /**
  59. * @查询购物车数量
  60. * @param:userId 用户ID(必填)
  61. */
  62. QueryShoppingQuantity (data = {}) {
  63. return this.AjaxService.get({
  64. url:'/shopping/quantity',
  65. data,
  66. isLoading: false
  67. })
  68. }
  69. /**
  70. * @更新购物车商品增减
  71. * @param:cartId 购物车ID
  72. * @param:productCount 商品数量ID(必填)
  73. */
  74. ShoppingCartUpdate (data = {}) {
  75. return this.AjaxService.post({
  76. url:'/shopping/update',
  77. data,
  78. isLoading: true
  79. })
  80. }
  81. /**
  82. * @删除购物车商品
  83. * @param:cartIds 购物车ID(用','号拼接)
  84. */
  85. ShoppingCartDelete (data = {}) {
  86. return this.AjaxService.post({
  87. url:'/shopping/delete',
  88. data,
  89. isLoading: true
  90. })
  91. }
  92. /* 查询搜索历史记录 */
  93. GetProductSearchHistory (data = {}) {
  94. return this.AjaxService.get({
  95. url:'/product/search/history',
  96. data,
  97. isLoading: false ,
  98. })
  99. }
  100. /* 清除搜索历史记录 */
  101. GetDeleteProductSearchHistory (data = {}) {
  102. return this.AjaxService.get({
  103. url:'/product/delete/history',
  104. data,
  105. isLoading: false ,
  106. })
  107. }
  108. /* 搜索商品列表 */
  109. GetProductSearchList (data = {}) {
  110. return this.AjaxService.get({
  111. url:'/search/query/product',
  112. data,
  113. isLoading: true ,
  114. })
  115. }
  116. /* 活动专区 */
  117. GetProductActivityAreaList (data = {}) {
  118. return this.AjaxService.get({
  119. url:'/product/activityArea',
  120. data,
  121. isLoading: true ,
  122. })
  123. }
  124. /* 活动详情 */
  125. GetProductActivityDetails (data = {}) {
  126. return this.AjaxService.get({
  127. url:'/product/activity/details',
  128. data,
  129. isLoading: true ,
  130. })
  131. }
  132. }