product.service.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. /**
  2. * 这是与购物有关的业务逻辑的服务
  3. */
  4. export default class ProductService {
  5. constructor(AjaxService) {
  6. Object.assign(this, { AjaxService })
  7. this.name = 'ProductService'
  8. }
  9. /**
  10. * @description 获取楼层数据
  11. */
  12. QueryProductFloor(data = {}) {
  13. return this.AjaxService.get({
  14. url: '/product/floor',
  15. data,
  16. isLoading: false,
  17. })
  18. }
  19. /**
  20. * @description 获取楼层商品详情
  21. * @param:name 商品名称关键词
  22. * @param:pageNum 页码
  23. * @param:pageSize 条数
  24. */
  25. QueryProductList(data = {}) {
  26. return this.AjaxService.get({
  27. url: '/product/floor/detail',
  28. data,
  29. isLoading: false,
  30. })
  31. }
  32. /**
  33. * @description 获取商品列表
  34. * @param:name 商品名称关键词
  35. * @param:pageNum 页码
  36. * @param:pageSize 条数
  37. */
  38. GetProductList(data = {}) {
  39. return this.AjaxService.get({
  40. url: '/product/list',
  41. data,
  42. isLoading: false,
  43. })
  44. }
  45. /**
  46. * @商品详情-查询商品详情
  47. * @param:userId 用户ID(未登录传0或者'')
  48. * @param:productIds 商品ID
  49. */
  50. QueryProductDetils(data = {}) {
  51. return this.AjaxService.get({
  52. url: '/product/details',
  53. data,
  54. isLoading: false,
  55. })
  56. }
  57. /**
  58. * @加入购物车
  59. * @param:userId 用户ID(必填)
  60. * @param:productId 用户ID(必填)
  61. * @param:productCount 商品数量(必填)
  62. */
  63. shoppingAddCart(data = {}) {
  64. return this.AjaxService.post({
  65. url: '/shopping/add/cart',
  66. data,
  67. isLoading: false
  68. })
  69. }
  70. /**
  71. * @再次购买----一键加入购物车
  72. * @param:orderId 用户ID(必填)
  73. */
  74. ShoppingAgainCart(data = {}) {
  75. return this.AjaxService.get({
  76. url: '/shopping/addCart',
  77. data,
  78. isLoading: false
  79. })
  80. }
  81. /**
  82. * @购物车列表
  83. * @param:userId 用户ID(必填)
  84. */
  85. QueryShoppingCartList(data = {}) {
  86. return this.AjaxService.get({
  87. url: '/shopping/info',
  88. data,
  89. isLoading: false
  90. })
  91. }
  92. /**
  93. * @查询购物车数量
  94. * @param:userId 用户ID(必填)
  95. */
  96. QueryShoppingQuantity(data = {}) {
  97. return this.AjaxService.get({
  98. url: '/shopping/quantity',
  99. data,
  100. isLoading: false
  101. })
  102. }
  103. /**
  104. * @更新购物车商品增减
  105. * @param:cartId 购物车ID
  106. * @param:productCount 商品数量ID(必填)
  107. */
  108. ShoppingCartUpdate(data = {}) {
  109. return this.AjaxService.post({
  110. url: '/shopping/update',
  111. data,
  112. isLoading: false
  113. })
  114. }
  115. /**
  116. * @删除购物车商品
  117. * @param:cartIds 购物车ID(用','号拼接)
  118. */
  119. ShoppingCartDelete(data = {}) {
  120. return this.AjaxService.post({
  121. url: '/shopping/delete',
  122. data,
  123. isLoading: false
  124. })
  125. }
  126. /* 查询搜索历史记录 */
  127. GetProductSearchHistory(data = {}) {
  128. return this.AjaxService.get({
  129. url: '/product/search/history',
  130. data,
  131. isLoading: false,
  132. })
  133. }
  134. /* 清除搜索历史记录 */
  135. GetDeleteProductSearchHistory(data = {}) {
  136. return this.AjaxService.get({
  137. url: '/product/delete/history',
  138. data,
  139. isLoading: false,
  140. })
  141. }
  142. /* 搜索商品列表 */
  143. GetProductSearchList(data = {}) {
  144. return this.AjaxService.get({
  145. url: '/search/query/product',
  146. data,
  147. isLoading: true,
  148. })
  149. }
  150. /* 活动专区 */
  151. GetProductActivityAreaList(data = {}) {
  152. return this.AjaxService.get({
  153. url: '/product/activityArea',
  154. data,
  155. isLoading: false,
  156. })
  157. }
  158. /* 活动详情 */
  159. GetProductActivityDetails(data = {}) {
  160. return this.AjaxService.get({
  161. url: '/product/activity/details',
  162. data,
  163. isLoading: false,
  164. })
  165. }
  166. }