product.service.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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: false
  45. })
  46. }
  47. /**
  48. * @再次购买----一键加入购物车
  49. * @param:orderId 用户ID(必填)
  50. */
  51. ShoppingAgainCart (data = {}) {
  52. return this.AjaxService.get({
  53. url:'/shopping/addCart',
  54. data,
  55. isLoading: false
  56. })
  57. }
  58. /**
  59. * @购物车列表
  60. * @param:userId 用户ID(必填)
  61. */
  62. QueryShoppingCartList (data = {}) {
  63. return this.AjaxService.get({
  64. url:'/shopping/info',
  65. data,
  66. isLoading: false
  67. })
  68. }
  69. /**
  70. * @查询购物车数量
  71. * @param:userId 用户ID(必填)
  72. */
  73. QueryShoppingQuantity (data = {}) {
  74. return this.AjaxService.get({
  75. url:'/shopping/quantity',
  76. data,
  77. isLoading: false
  78. })
  79. }
  80. /**
  81. * @更新购物车商品增减
  82. * @param:cartId 购物车ID
  83. * @param:productCount 商品数量ID(必填)
  84. */
  85. ShoppingCartUpdate (data = {}) {
  86. return this.AjaxService.post({
  87. url:'/shopping/update',
  88. data,
  89. isLoading: true
  90. })
  91. }
  92. /**
  93. * @删除购物车商品
  94. * @param:cartIds 购物车ID(用','号拼接)
  95. */
  96. ShoppingCartDelete (data = {}) {
  97. return this.AjaxService.post({
  98. url:'/shopping/delete',
  99. data,
  100. isLoading: true
  101. })
  102. }
  103. /* 查询搜索历史记录 */
  104. GetProductSearchHistory (data = {}) {
  105. return this.AjaxService.get({
  106. url:'/product/search/history',
  107. data,
  108. isLoading: false ,
  109. })
  110. }
  111. /* 清除搜索历史记录 */
  112. GetDeleteProductSearchHistory (data = {}) {
  113. return this.AjaxService.get({
  114. url:'/product/delete/history',
  115. data,
  116. isLoading: false ,
  117. })
  118. }
  119. /* 搜索商品列表 */
  120. GetProductSearchList (data = {}) {
  121. return this.AjaxService.get({
  122. url:'/search/query/product',
  123. data,
  124. isLoading: true ,
  125. })
  126. }
  127. /* 活动专区 */
  128. GetProductActivityAreaList (data = {}) {
  129. return this.AjaxService.get({
  130. url:'/product/activityArea',
  131. data,
  132. isLoading: true ,
  133. })
  134. }
  135. /* 活动详情 */
  136. GetProductActivityDetails (data = {}) {
  137. return this.AjaxService.get({
  138. url:'/product/activity/details',
  139. data,
  140. isLoading: true ,
  141. })
  142. }
  143. }