product.service.js 14 KB

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