product.service.js 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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:'/commodity/product/details',
  79. data,
  80. isLoading: false ,
  81. isHost:true
  82. })
  83. }
  84. /**
  85. * @商品详情-相关推荐
  86. * @param:productIds 商品ID
  87. */
  88. queryProductDetilsRelevant (data = {}) {
  89. return this.AjaxService.get({ url:'/product/detail/recommend', data, isLoading: false })
  90. }
  91. /**
  92. * @加入购物车
  93. * @param:userId 用户ID(必填)
  94. * @param:productID 用户ID(必填)
  95. * @param:productCount 商品数量(必填)
  96. */
  97. shoppingAddCart (data = {}) {
  98. return this.AjaxService.post({ url:'/shoppingCart/addCart', data, isLoading: true })
  99. }
  100. /**
  101. * @购物车列表
  102. * @param:userId 用户ID(必填)
  103. */
  104. QueryShoppingCartList (data = {}) {
  105. return this.AjaxService.get({ url:'/shoppingCart/list', data, isLoading: false })
  106. }
  107. /**
  108. * @更新购物车商品增减
  109. * @param:userId 用户ID(必填)
  110. * @param:productID 商品ID(必填)
  111. * @param:productCount 商品数量ID(必填)
  112. */
  113. ShoppingCartUpdate (data = {}) {
  114. return this.AjaxService.post({ url:'/shoppingCart/update', data, isLoading: true })
  115. }
  116. /**
  117. * @删除购物车商品
  118. * @param:userId 用户ID(必填)
  119. * @param:productIDs 商品ID(用','号拼接)
  120. */
  121. ShoppingCartDelete (data = {}) {
  122. return this.AjaxService.post({ url:'/shoppingCart/delete', data, isLoading: true })
  123. }
  124. /* 二级列表 */
  125. GetPageTopic (data = {}) {
  126. return this.AjaxService.get({ url:'/page/topic', data, isLoading: false })
  127. }
  128. /* 二级列表banner */
  129. GetPageTopicBanner (data = {}) {
  130. return this.AjaxService.get({ url:'/page/topic/info', data, isLoading: false })
  131. }
  132. /* 活动专题列表 */
  133. GetPromotionsrList (data = {}) {
  134. return this.AjaxService.get({
  135. url:'/commodity/promotions/list',
  136. data,
  137. isLoading: true ,
  138. isHost:true
  139. })
  140. }
  141. /* 搜索项目仪器列表 */
  142. GetSearchEquipmentList (data = {}) {
  143. return this.AjaxService.get({
  144. url:'/commodity/search/query/equipment',
  145. data,
  146. isLoading: true ,
  147. isHost:true
  148. })
  149. }
  150. /* 项目仪器详情 */
  151. GetEquipmentDetails (data = {}) {
  152. return this.AjaxService.get({
  153. url:'/commodity/equipment/details',
  154. data,
  155. isLoading: true ,
  156. isHost:true
  157. })
  158. }
  159. /* 查询搜索历史记录 */
  160. GetProductSearchHistory (data = {}) {
  161. return this.AjaxService.get({ url:'/product/searchHistory', data, isLoading: false })
  162. }
  163. /* 添加搜索历史记录 */
  164. GetAddProductSearchHistory (data = {}) {
  165. return this.AjaxService.get({ url:'/product/history/add', data, isLoading: true })
  166. }
  167. /* 清除搜索历史记录 */
  168. GetDeleteProductSearchHistory (data = {}) {
  169. return this.AjaxService.get({ url:'/product/searchHistory/delete', data, isLoading: false })
  170. }
  171. /* 搜索商品列表 */
  172. GetProductSearchList (data = {}) {
  173. return this.AjaxService.get({
  174. url:'/commodity/search/query/product',
  175. data,
  176. isLoading: true ,
  177. isHost:true
  178. })
  179. }
  180. /* 搜索分类商品列表 */
  181. GetSearchProductTypeData (data = {}) {
  182. return this.AjaxService.get({
  183. url:'/commodity/search/query/product/type',
  184. data,
  185. isLoading: true,
  186. isHost:true
  187. })
  188. }
  189. /* 搜索分类商品列表 */
  190. GetSearchCombinationProduct (data = {}) {
  191. return this.AjaxService.get({
  192. url:'/commodity/seller/product/combination',
  193. data,
  194. isLoading: true,
  195. isHost:true
  196. })
  197. }
  198. /* 获取商品评价 */
  199. GetProductEvaluate (data = {}) {
  200. return this.AjaxService.get({ url:'/product/evaluate', data, isLoading: false })
  201. }
  202. /* 获取再次购买商品列表 */
  203. GetRepeatBuyAgainProductList (data = {}) {
  204. return this.AjaxService.get({
  205. url:'/commodity/product/repeat',
  206. data,
  207. isLoading: true ,
  208. isHost:true
  209. })
  210. }
  211. /* 新商品搜索查询商品阶梯价格 */
  212. GetSearchProductLadderPrice (data = {}) {
  213. return this.AjaxService.get({
  214. url:'/commodity/price/ladder',
  215. data,
  216. isLoading: false,
  217. isHost:true
  218. })
  219. }
  220. /* 获取分类导航 */
  221. GetProductClassify (data = {}) {
  222. return this.AjaxService.get({ url:'/product/classify', data, isLoading: true })
  223. }
  224. /* 获取小程序三个模块商品列表 */
  225. GetProductPreferred (data = {}) {
  226. return this.AjaxService.get({ url:'/product/preferred', data, isLoading: true })
  227. }
  228. /* 发票信息回显 */
  229. GetPersonalCenterFindInvoice (data = {}) {
  230. return this.AjaxService.get({ url:'/personalCenter/findInvoice', data, isLoading: false })
  231. }
  232. /* 发票信息保存 */
  233. GetPersonalCenterInvoice (data = {}) {
  234. return this.AjaxService.post({ url:'/personalCenter/invoice', data, isLoading: true })
  235. }
  236. }