product.service.js 13 KB

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