product.service.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  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:userId 用户ID(未登录传0或者'')
  87. * @param:productId 商品ID
  88. * @param:source 来源 1 WWW 2小程序
  89. * @param:status 优惠券领取状态 1 未领取 2 已领取
  90. */
  91. QueryProductDetilsCoupons (data = {}) {
  92. return this.AjaxService.get({
  93. url:'/commodity/coupon/details/coupons',
  94. data,
  95. isLoading: true ,
  96. isHost:true
  97. })
  98. }
  99. /**
  100. * @商品详情-相关推荐
  101. * @param:productIds 商品ID
  102. */
  103. queryProductDetilsRelevant (data = {}) {
  104. return this.AjaxService.get({ url:'/product/detail/recommend', data, isLoading: false })
  105. }
  106. /**
  107. * @加入购物车
  108. * @param:userId 用户ID(必填)
  109. * @param:productID 用户ID(必填)
  110. * @param:productCount 商品数量(必填)
  111. */
  112. shoppingAddCart (data = {}) {
  113. return this.AjaxService.post({
  114. url:'/order/club/cart/add',
  115. data,
  116. isLoading: true ,
  117. isHost:true
  118. })
  119. }
  120. /**
  121. * @查询购物车数量
  122. * @param:userId 用户ID(必填)
  123. */
  124. shoppingHeaderCartNumber (data = {}) {
  125. return this.AjaxService.get({
  126. url:'/shoppingCart/header/cart',
  127. data,
  128. isLoading: false ,
  129. })
  130. }
  131. /**
  132. * @购物车列表
  133. * @param:userId 用户ID(必填)
  134. */
  135. QueryShoppingCartList (data = {}) {
  136. return this.AjaxService.get({
  137. url:'/order/club/cart/list',
  138. data,
  139. isLoading: false ,
  140. isHost:true
  141. })
  142. }
  143. /**
  144. * @更新购物车加减数量
  145. * @param:userId 用户ID(必填)
  146. */
  147. ShoppingCartUpdate (data = {}) {
  148. return this.AjaxService.post({
  149. url:'/order/club/cart/update',
  150. data,
  151. isLoading: false ,
  152. isHost:true
  153. })
  154. }
  155. /**
  156. * @购物车领券弹窗优惠券列表
  157. * @param:userId 用户ID(必填)
  158. * @param:shopId 供应商ID(必填)
  159. * @param:source 来源 1 WWW 2小程序
  160. * @param:status 状态 1 未领取 2已领取
  161. */
  162. ShoppingCartGetCoupon(data = {}) {
  163. return this.AjaxService.get({
  164. url:'/order/club/coupon',
  165. data,
  166. isLoading: true ,
  167. isHost:true
  168. })
  169. }
  170. /**
  171. * @删除购物车商品
  172. * @param:userId 用户ID(必填)
  173. * @param:productIDs 商品ID(用','号拼接)
  174. */
  175. ShoppingCartDelete (data = {}) {
  176. return this.AjaxService.post({
  177. url:'/order/club/cart/delete',
  178. data,
  179. isLoading: true ,
  180. isHost:true
  181. })
  182. }
  183. /* 二级列表 */
  184. GetPageTopic (data = {}) {
  185. return this.AjaxService.get({ url:'/page/topic', data, isLoading: false })
  186. }
  187. /* 二级列表banner */
  188. GetPageTopicBanner (data = {}) {
  189. return this.AjaxService.get({ url:'/page/topic/info', data, isLoading: false })
  190. }
  191. /* 活动专题列表 */
  192. GetPromotionsrList (data = {}) {
  193. return this.AjaxService.get({
  194. url:'/commodity/promotions/list',
  195. data,
  196. isLoading: true ,
  197. isHost:true
  198. })
  199. }
  200. /* 搜索项目仪器列表 */
  201. GetSearchEquipmentList (data = {}) {
  202. return this.AjaxService.get({
  203. url:'/commodity/search/query/equipment',
  204. data,
  205. isLoading: true ,
  206. isHost:true
  207. })
  208. }
  209. /* 项目仪器详情 */
  210. GetEquipmentDetails (data = {}) {
  211. return this.AjaxService.get({
  212. url:'/commodity/equipment/details',
  213. data,
  214. isLoading: true ,
  215. isHost:true
  216. })
  217. }
  218. /* 查询搜索历史记录 */
  219. GetProductSearchHistory (data = {}) {
  220. return this.AjaxService.get({ url:'/product/searchHistory', data, isLoading: false })
  221. }
  222. /* 添加搜索历史记录 */
  223. GetAddProductSearchHistory (data = {}) {
  224. return this.AjaxService.get({ url:'/product/history/add', data, isLoading: true })
  225. }
  226. /* 清除搜索历史记录 */
  227. GetDeleteProductSearchHistory (data = {}) {
  228. return this.AjaxService.get({ url:'/product/searchHistory/delete', data, isLoading: false })
  229. }
  230. /* 搜索商品列表 */
  231. GetProductSearchList (data = {}) {
  232. return this.AjaxService.get({
  233. url:'/commodity/search/query/product',
  234. data,
  235. isLoading: true ,
  236. isHost:true
  237. })
  238. }
  239. /* 搜索分类商品列表 */
  240. GetSearchProductTypeData (data = {}) {
  241. return this.AjaxService.get({
  242. url:'/commodity/search/query/product/type',
  243. data,
  244. isLoading: true,
  245. isHost:true
  246. })
  247. }
  248. /* 搜索分类商品列表 */
  249. GetSearchCombinationProduct (data = {}) {
  250. return this.AjaxService.get({
  251. url:'/commodity/seller/product/combination',
  252. data,
  253. isLoading: true,
  254. isHost:true
  255. })
  256. }
  257. /* 获取商品评价 */
  258. GetProductEvaluate (data = {}) {
  259. return this.AjaxService.get({ url:'/product/evaluate', data, isLoading: false })
  260. }
  261. /* 获取再次购买商品列表 */
  262. GetRepeatBuyAgainProductList (data = {}) {
  263. return this.AjaxService.get({
  264. url:'/commodity/product/repeat',
  265. data,
  266. isLoading: true ,
  267. isHost:true
  268. })
  269. }
  270. /* 新商品搜索查询商品阶梯价格 */
  271. GetSearchProductLadderPrice (data = {}) {
  272. return this.AjaxService.get({
  273. url:'/commodity/price/ladder',
  274. data,
  275. isLoading: false,
  276. isHost:true
  277. })
  278. }
  279. /* 获取分类导航 */
  280. GetProductClassify (data = {}) {
  281. return this.AjaxService.get({ url:'/product/classify', data, isLoading: true })
  282. }
  283. /* 获取小程序三个模块商品列表 */
  284. GetProductPreferred (data = {}) {
  285. return this.AjaxService.get({ url:'/product/preferred', data, isLoading: true })
  286. }
  287. /* 发票信息回显 */
  288. GetPersonalCenterFindInvoice (data = {}) {
  289. return this.AjaxService.get({ url:'/personalCenter/findInvoice', data, isLoading: false })
  290. }
  291. /* 发票信息保存 */
  292. GetPersonalCenterInvoice (data = {}) {
  293. return this.AjaxService.post({ url:'/personalCenter/invoice', data, isLoading: true })
  294. }
  295. /**
  296. * @优惠券-是定商品活动页列表
  297. * @param:userId 用户userId(未登录传0)
  298. * @param:pageNum 页码
  299. * @param:pageSize 每页条数
  300. * @param:couponId 优惠券ID
  301. */
  302. QueryCouponActivityList (data = {}) {
  303. return this.AjaxService.get({
  304. url:'/commodity/coupon/activity/page',
  305. data,
  306. isLoading: true,
  307. isHost:true
  308. })
  309. }
  310. /**
  311. * @优惠券-个人中心优惠券列表
  312. * @param:userId 用户userId(必传)
  313. * @param:pageNum 页码
  314. * @param:pageSize 每页条数
  315. * @param:status 使用状态 1未使用 2已使用 3已失效
  316. */
  317. QueryCouponCenter (data = {}) {
  318. return this.AjaxService.get({
  319. url:'/commodity/coupon/center',
  320. data,
  321. isLoading: false ,
  322. isHost:true
  323. })
  324. }
  325. /**
  326. * @优惠券-领取中心优惠券列表
  327. * @param:userId 用户userId(未登录传0)
  328. * @param:pageNum 每页页码
  329. * @param:pageSize 条数
  330. */
  331. QueryCouponCollarList (data = {}) {
  332. return this.AjaxService.get({
  333. url:'/commodity/coupon/collar/list',
  334. data,
  335. isLoading: false ,
  336. isHost:true
  337. })
  338. }
  339. /**
  340. * @优惠券-领取优惠券
  341. * @param:userId 用户userId
  342. * @param:couponId 优惠券Id
  343. * @param:source 来源: 1WWW 2小程序
  344. */
  345. ReceiveCoupon (data = {}) {
  346. return this.AjaxService.post({
  347. url:'/commodity/coupon/collar',
  348. data,
  349. isLoading: true ,
  350. isHost:true
  351. })
  352. }
  353. /**
  354. * @优惠券-兑换优惠券
  355. * @param:userId 用户userId
  356. * @param:redemptionCode 优惠券兑换码
  357. * @param:source 来源: 1WWW 2小程序
  358. */
  359. ExchangeCoupon (data = {}) {
  360. return this.AjaxService.post({
  361. url:'/commodity/coupon/redeem',
  362. data,
  363. isLoading: true ,
  364. isHost:true
  365. })
  366. }
  367. /**
  368. * @优惠券-我的优惠券数量统计
  369. * @param:userId 用户userId(必传)
  370. */
  371. QueryCouponsCount (data = {}) {
  372. return this.AjaxService.get({
  373. url:'/commodity/coupon/coupons/count',
  374. data,
  375. isLoading: false ,
  376. isHost:true
  377. })
  378. }
  379. /**
  380. * @商品收藏-操作
  381. * @param:userId 用户userId(必传)
  382. * @param:productId 商品Id
  383. */
  384. getProductUserLike (data = {}) {
  385. return this.AjaxService.get({
  386. url:'/commodity/userLike/likeOne',
  387. data,
  388. isLoading: false ,
  389. isHost:true
  390. })
  391. }
  392. /**
  393. * @商品收藏-列表
  394. * @param:userId 用户userId(必传)
  395. * @param:pageNum 页码
  396. * @param:pageSize 条数
  397. */
  398. getProductUserLikeList (data = {}) {
  399. return this.AjaxService.get({
  400. url:'/commodity/userLike/likeList',
  401. data,
  402. isLoading: false ,
  403. isHost:true
  404. })
  405. }
  406. /**
  407. * @商品收藏-取消收藏
  408. * @param:userId 用户userId(必传)
  409. * @param:productIDs 商品Id字符串逗号隔开
  410. */
  411. getDeleteUserLike (data = {}) {
  412. return this.AjaxService.get({
  413. url:'/commodity/userLike/deleteList',
  414. data,
  415. isLoading: false ,
  416. isHost:true
  417. })
  418. }
  419. }