product.service.js 6.0 KB

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