product.service.js 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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:bigTypeID
  23. * @param:smallTypeID,
  24. * @param:tinyTypeID
  25. * @param:sortType
  26. * @param:pageNum 页码
  27. * @param:pageSize 每页条数
  28. */
  29. GetProductListByTypeID(data = {}) {
  30. return this.AjaxService.get({ url:'/product/listByTypeID', data, isLoading: false })
  31. }
  32. /**
  33. * @商品列表-查询商品价格
  34. * @param:userId 用户ID(未登录传0或者'')
  35. * @param:productID 商品ID','符号拼接
  36. */
  37. querySearchProductPrice (data = {}) {
  38. return this.AjaxService.get({ url:'/product/listPrice', data, isLoading: false })
  39. }
  40. /**
  41. * @查询凑单商品页初始化
  42. * @param:promotionsId 促销ID
  43. */
  44. queryProductPromotionInfo (data = {}) {
  45. return this.AjaxService.get({ url:'/product/promotion/info', data, isLoading: false })
  46. }
  47. /**
  48. * @查询凑单商品列表
  49. * @param:promotionsId 促销ID
  50. * @param:pageSize 查询条数
  51. * @param:pageNum 查询页数
  52. */
  53. queryProductPromotionList (data = {}) {
  54. return this.AjaxService.get({ url:'/product/promotion/products', data, isLoading: true })
  55. }
  56. /**
  57. * @商品详情-查询商品详情
  58. * @param:userId 用户ID(未登录传0或者'')
  59. * @param:productIds 商品ID
  60. */
  61. queryProductDetils (data = {}) {
  62. return this.AjaxService.get({ url:'/product/details', data, isLoading: false })
  63. }
  64. /**
  65. * @商品详情-相关推荐
  66. * @param:productIds 商品ID
  67. */
  68. queryProductDetilsRelevant (data = {}) {
  69. return this.AjaxService.get({ url:'/product/detail/recommend', data, isLoading: false })
  70. }
  71. /**
  72. * @加入购物车
  73. * @param:userId 用户ID(必填)
  74. * @param:productID 用户ID(必填)
  75. * @param:productCount 商品数量(必填)
  76. */
  77. shoppingAddCart (data = {}) {
  78. return this.AjaxService.post({ url:'/shoppingCart/addCart', data, isLoading: true })
  79. }
  80. /**
  81. * @购物车列表
  82. * @param:userId 用户ID(必填)
  83. */
  84. QueryShoppingCartList (data = {}) {
  85. return this.AjaxService.get({ url:'/shoppingCart/list', data, isLoading: false })
  86. }
  87. /**
  88. * @更新购物车商品增减
  89. * @param:userId 用户ID(必填)
  90. * @param:productID 商品ID(必填)
  91. * @param:productCount 商品数量ID(必填)
  92. */
  93. ShoppingCartUpdate (data = {}) {
  94. return this.AjaxService.post({ url:'/shoppingCart/update', data, isLoading: true })
  95. }
  96. /**
  97. * @删除购物车商品
  98. * @param:userId 用户ID(必填)
  99. * @param:productIDs 商品ID(用','号拼接)
  100. */
  101. ShoppingCartDelete (data = {}) {
  102. return this.AjaxService.post({ url:'/shoppingCart/delete', data, isLoading: true })
  103. }
  104. /* 二级列表 */
  105. GetPageTopic (data = {}) {
  106. return this.AjaxService.get({ url:'/page/topic', data, isLoading: false })
  107. }
  108. /* 二级列表banner */
  109. GetPageTopicBanner (data = {}) {
  110. return this.AjaxService.get({ url:'/page/topic/info', data, isLoading: false })
  111. }
  112. /* 活动专题列表 */
  113. GetPromotionsrList (data = {}) {
  114. return this.AjaxService.get({ url:'/promotions/list', data, isLoading: true })
  115. }
  116. /* 搜索项目仪器列表 */
  117. GetSearchEquipmentList (data = {}) {
  118. return this.AjaxService.get({ url:'/search/query/equipment', data, isLoading: true })
  119. }
  120. /* 项目仪器详情 */
  121. GetEquipmentDetails (data = {}) {
  122. return this.AjaxService.get({ url:'/equipment/recommend', data, isLoading: true })
  123. }
  124. /* 查询搜索历史记录 */
  125. GetProductSearchHistory (data = {}) {
  126. return this.AjaxService.get({ url:'/product/searchHistory', data, isLoading: false })
  127. }
  128. /* 添加搜索历史记录 */
  129. GetAddProductSearchHistory (data = {}) {
  130. return this.AjaxService.get({ url:'/product/history/add', data, isLoading: true })
  131. }
  132. /* 清除搜索历史记录 */
  133. GetDeleteProductSearchHistory (data = {}) {
  134. return this.AjaxService.get({ url:'/product/searchHistory/delete', data, isLoading: false })
  135. }
  136. /* 搜索商品列表 */
  137. GetProductSearchList (data = {}) {
  138. return this.AjaxService.get({ url:'/search/query/product', data, isLoading: true })
  139. }
  140. /* 搜索分类商品列表 */
  141. GetSearchProductTypeData (data = {}) {
  142. return this.AjaxService.get({ url:'/search/query/product/type', data, isLoading: true })
  143. }
  144. /* 获取商品评价 */
  145. GetProductEvaluate (data = {}) {
  146. return this.AjaxService.get({ url:'/product/evaluate', data, isLoading: false })
  147. }
  148. /* 获取再次购买商品列表 */
  149. GetRepeatBuyAgainProductList (data = {}) {
  150. return this.AjaxService.get({ url:'/repeat/buyAgain', data, isLoading: true })
  151. }
  152. /* 新商品搜索查询商品阶梯价格 */
  153. GetSearchProductLadderPrice (data = {}) {
  154. return this.AjaxService.get({ url:'/product/ladderPrice', data, isLoading: false })
  155. }
  156. /* 获取分类导航 */
  157. GetProductClassify (data = {}) {
  158. return this.AjaxService.get({ url:'/product/classify', data, isLoading: true })
  159. }
  160. /* 获取小程序三个模块商品列表 */
  161. GetProductPreferred (data = {}) {
  162. return this.AjaxService.get({ url:'/product/preferred', data, isLoading: true })
  163. }
  164. /* 发票信息回显 */
  165. GetPersonalCenterFindInvoice (data = {}) {
  166. return this.AjaxService.get({ url:'/personalCenter/findInvoice', data, isLoading: false })
  167. }
  168. /* 发票信息保存 */
  169. GetPersonalCenterInvoice (data = {}) {
  170. return this.AjaxService.post({ url:'/personalCenter/invoice', data, isLoading: true })
  171. }
  172. }