product.service.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  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. * @机构添加购物车替换Sku
  132. * @param:userId 用户ID(必填)
  133. */
  134. ShoppingCheckSku (data = {}) {
  135. return this.AjaxService.get({
  136. url:'/order/club/check/sku',
  137. data,
  138. isLoading: false ,
  139. })
  140. }
  141. /**
  142. * @查询购物车数量
  143. * @param:userId 用户ID(必填)
  144. */
  145. ProductCartNumber (data = {}) {
  146. return this.AjaxService.get({
  147. url:'/order/club/cart/count',
  148. data,
  149. isLoading: false ,
  150. })
  151. }
  152. /**
  153. * @购物车列表
  154. * @param:userId 用户ID(必填)
  155. */
  156. QueryShoppingCartList (data = {}) {
  157. return this.AjaxService.get({
  158. url:'/order/club/cart/list',
  159. data,
  160. isLoading: false ,
  161. })
  162. }
  163. /**
  164. * @更新购物车加减数量
  165. * @param:userId 用户ID(必填)
  166. */
  167. ShoppingCartUpdate (data = {}) {
  168. return this.AjaxService.post({
  169. url:'/order/club/cart/update',
  170. data,
  171. isLoading: false ,
  172. })
  173. }
  174. /**
  175. * @购物车领券弹窗优惠券列表
  176. * @param:userId 用户ID(必填)
  177. * @param:shopId 供应商ID(必填)
  178. * @param:source 来源 1 WWW 2小程序
  179. * @param:status 状态 1 未领取 2已领取
  180. */
  181. ShoppingCartGetCoupon(data = {}) {
  182. return this.AjaxService.get({
  183. url:'/order/club/coupon',
  184. data,
  185. isLoading: true ,
  186. })
  187. }
  188. /**
  189. * @删除购物车商品
  190. * @param:userId 用户ID(必填)
  191. * @param:productIDs 商品ID(用','号拼接)
  192. */
  193. ShoppingCartDelete (data = {}) {
  194. return this.AjaxService.post({
  195. url:'/order/club/cart/delete',
  196. data,
  197. isLoading: 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. })
  215. }
  216. /* 搜索项目仪器列表 */
  217. GetSearchEquipmentList (data = {}) {
  218. return this.AjaxService.get({
  219. url:'/commodity/search/query/equipment',
  220. data,
  221. isLoading: true ,
  222. })
  223. }
  224. /* 项目仪器详情 */
  225. GetEquipmentDetails (data = {}) {
  226. return this.AjaxService.get({
  227. url:'/commodity/equipment/details',
  228. data,
  229. isLoading: true ,
  230. })
  231. }
  232. /* 查询搜索历史记录 */
  233. GetProductSearchHistory (data = {}) {
  234. return this.AjaxService.get({
  235. url:'/commodity/search/query/history',
  236. data,
  237. isLoading: false ,
  238. })
  239. }
  240. /* 添加搜索历史记录 */
  241. GetAddProductSearchHistory (data = {}) {
  242. return this.AjaxService.get({
  243. url:'/commodity/search/query/history/add',
  244. data,
  245. isLoading: true ,
  246. })
  247. }
  248. /* 清除搜索历史记录 */
  249. GetDeleteProductSearchHistory (data = {}) {
  250. return this.AjaxService.get({
  251. url:'/commodity/search/query/history/delete',
  252. data,
  253. isLoading: false ,
  254. })
  255. }
  256. /* 搜索商品列表 */
  257. GetProductSearchList (data = {}) {
  258. return this.AjaxService.get({
  259. url:'/commodity/search/query/product',
  260. data,
  261. isLoading: true ,
  262. })
  263. }
  264. /* 搜索分类商品列表 */
  265. GetSearchProductTypeData (data = {}) {
  266. return this.AjaxService.get({
  267. url:'/commodity/search/query/product/type',
  268. data,
  269. isLoading: true,
  270. })
  271. }
  272. /* 搜索分类商品列表 */
  273. GetSearchCombinationProduct (data = {}) {
  274. return this.AjaxService.get({
  275. url:'/commodity/seller/product/combination',
  276. data,
  277. isLoading: true,
  278. })
  279. }
  280. /* 获取商品评价 */
  281. GetProductEvaluate (data = {}) {
  282. return this.AjaxService.get({ url:'/product/evaluate', data, isLoading: false })
  283. }
  284. /* 获取再次购买商品列表 */
  285. GetRepeatBuyAgainProductList (data = {}) {
  286. return this.AjaxService.get({
  287. url:'/commodity/product/repeat',
  288. data,
  289. isLoading: true ,
  290. })
  291. }
  292. /* 新商品搜索查询商品阶梯价格 */
  293. GetSearchProductLadderPrice (data = {}) {
  294. return this.AjaxService.get({
  295. url:'/commodity/price/ladder',
  296. data,
  297. isLoading: false,
  298. })
  299. }
  300. /* 获取分类导航 */
  301. GetProductClassify (data = {}) {
  302. return this.AjaxService.get({ url:'/product/classify', data, isLoading: true })
  303. }
  304. /* 获取小程序三个模块商品列表 */
  305. GetProductPreferred (data = {}) {
  306. return this.AjaxService.get({ url:'/product/preferred', data, isLoading: true })
  307. }
  308. /* 发票信息回显 */
  309. GetPersonalCenterFindInvoice (data = {}) {
  310. return this.AjaxService.get({ url:'/personalCenter/findInvoice', data, isLoading: false })
  311. }
  312. /* 发票信息保存 */
  313. GetPersonalCenterInvoice (data = {}) {
  314. return this.AjaxService.post({ url:'/personalCenter/invoice', data, isLoading: true })
  315. }
  316. /**
  317. * @优惠券-是定商品活动页列表
  318. * @param:userId 用户userId(未登录传0)
  319. * @param:pageNum 页码
  320. * @param:pageSize 每页条数
  321. * @param:couponId 优惠券ID
  322. */
  323. QueryCouponActivityList (data = {}) {
  324. return this.AjaxService.get({
  325. url:'/commodity/coupon/activity/page',
  326. data,
  327. isLoading: true,
  328. })
  329. }
  330. /**
  331. * @优惠券-个人中心优惠券列表
  332. * @param:userId 用户userId(必传)
  333. * @param:pageNum 页码
  334. * @param:pageSize 每页条数
  335. * @param:status 使用状态 1未使用 2已使用 3已失效
  336. */
  337. QueryCouponCenter (data = {}) {
  338. return this.AjaxService.get({
  339. url:'/commodity/coupon/center',
  340. data,
  341. isLoading: false ,
  342. })
  343. }
  344. /**
  345. * @优惠券-领取中心优惠券列表
  346. * @param:userId 用户userId(未登录传0)
  347. * @param:pageNum 每页页码
  348. * @param:pageSize 条数
  349. */
  350. QueryCouponCollarList (data = {}) {
  351. return this.AjaxService.get({
  352. url:'/commodity/coupon/collar/list',
  353. data,
  354. isLoading: false ,
  355. })
  356. }
  357. /**
  358. * @优惠券-美博会优惠券列表
  359. * @param:userId 用户userId(未登录传0)
  360. * @param:pageNum 每页页码
  361. * @param:pageSize 条数
  362. */
  363. QueryCouponCenterList (data = {}) {
  364. return this.AjaxService.get({
  365. url:'/commodity/coupon/center/list',
  366. data,
  367. isLoading: false ,
  368. })
  369. }
  370. /**
  371. * @优惠券-协销价值优惠券列表
  372. * @param:pageNum 每页页码
  373. * @param:pageSize 条数
  374. */
  375. QueryMoneyCouponList (data = {}) {
  376. return this.AjaxService.get({
  377. url:'/commodity/coupon/money/coupon/list',
  378. data,
  379. isLoading: true ,
  380. })
  381. }
  382. /**
  383. * @优惠券-根据优惠券查询优惠券详细信息
  384. * @param:couponId 优惠券Id
  385. */
  386. QueryCouponDetail (data = {}) {
  387. return this.AjaxService.get({
  388. url:'/commodity/coupon/coupon/detail',
  389. data,
  390. isLoading: true ,
  391. })
  392. }
  393. /**
  394. * @优惠券-领取优惠券
  395. * @param:userId 用户userId
  396. * @param:couponId 优惠券Id
  397. * @param:source 来源: 1WWW 2小程序
  398. */
  399. ReceiveCoupon (data = {}) {
  400. return this.AjaxService.post({
  401. url:'/commodity/coupon/collar',
  402. data,
  403. isLoading: true ,
  404. })
  405. }
  406. /**
  407. * @优惠券-兑换优惠券
  408. * @param:userId 用户userId
  409. * @param:redemptionCode 优惠券兑换码
  410. * @param:source 来源: 1WWW 2小程序
  411. */
  412. ExchangeCoupon (data = {}) {
  413. return this.AjaxService.post({
  414. url:'/commodity/coupon/redeem',
  415. data,
  416. isLoading: true ,
  417. })
  418. }
  419. /**
  420. * @优惠券-我的优惠券数量统计
  421. * @param:userId 用户userId(必传)
  422. */
  423. QueryCouponsCount (data = {}) {
  424. return this.AjaxService.get({
  425. url:'/commodity/coupon/coupons/count',
  426. data,
  427. isLoading: false ,
  428. })
  429. }
  430. /**
  431. * @商品收藏-操作
  432. * @param:userId 用户userId(必传)
  433. * @param:productId 商品Id
  434. */
  435. getProductUserLike (data = {}) {
  436. return this.AjaxService.get({
  437. url:'/commodity/userLike/likeOne',
  438. data,
  439. isLoading: false ,
  440. })
  441. }
  442. /**
  443. * @商品收藏-列表
  444. * @param:userId 用户userId(必传)
  445. * @param:pageNum 页码
  446. * @param:pageSize 条数
  447. */
  448. getProductUserLikeList (data = {}) {
  449. return this.AjaxService.get({
  450. url:'/commodity/userLike/likeList',
  451. data,
  452. isLoading: false ,
  453. })
  454. }
  455. /**
  456. * @商品收藏-取消收藏
  457. * @param:userId 用户userId(必传)
  458. * @param:productIDs 商品Id字符串逗号隔开
  459. */
  460. getDeleteUserLike (data = {}) {
  461. return this.AjaxService.get({
  462. url:'/commodity/userLike/deleteList',
  463. data,
  464. isLoading: false ,
  465. })
  466. }
  467. /**
  468. * @会员优惠商品
  469. * @param:userId 用户userId(必传)
  470. * @param:productIDs 商品Id字符串逗号隔开
  471. */
  472. getSvipProductPage (data = {}) {
  473. return this.AjaxService.get({
  474. url:'/commodity/svip/product/page',
  475. data,
  476. isLoading: true ,
  477. })
  478. }
  479. /**
  480. * @商品详情组合商品列表
  481. * @param:userId 用户userId(必传)
  482. * @param:productId 商品Id字符串逗号隔开
  483. * @param:source 来源 1 网站 2 小程序
  484. */
  485. getCommodityCombinationList (data = {}) {
  486. return this.AjaxService.get({
  487. url:'/commodity/seller/combination/list',
  488. data,
  489. isLoading: true ,
  490. })
  491. }
  492. /**
  493. * @搜索筛选项查询商品品牌
  494. * @param:keyword 关键词
  495. * @param:id 分类id
  496. * @param:idtype 1 一级分类 2 二级分类 3 三级分类
  497. * @param:identity
  498. */
  499. getCommoditySearchQUeryBrand (data = {}) {
  500. return this.AjaxService.get({
  501. url:'/commodity/search/query/brand',
  502. data,
  503. isloading: true ,
  504. })
  505. }
  506. /**
  507. * @数据统计
  508. * @param:TypeId 1:首页banner;2:直播模块;3:最新活动;4:热门文章;5:新品橱窗;6:活动列表
  509. */
  510. sYsStatisticsTypesSatisticsNumber (data = {}) {
  511. return this.AjaxService.get({
  512. url:'/commodity/StatisticsType/statisticsNumber',
  513. data,
  514. isLoading: false ,
  515. })
  516. }
  517. }