product.service.js 13 KB

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