product.service.js 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  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({ url:'/shoppingCart/update', data, isLoading: false })
  149. }
  150. /**
  151. * @购物车领券弹窗优惠券列表
  152. * @param:userId 用户ID(必填)
  153. * @param:shopId 供应商ID(必填)
  154. * @param:source 来源 1 WWW 2小程序
  155. * @param:status 状态 1 未领取 2已领取
  156. */
  157. ShoppingCartGetCoupon(data = {}) {
  158. return this.AjaxService.get({ url:'/shoppingCart/get/coupon', data, isLoading: true })
  159. }
  160. /**
  161. * @删除购物车商品
  162. * @param:userId 用户ID(必填)
  163. * @param:productIDs 商品ID(用','号拼接)
  164. */
  165. ShoppingCartDelete (data = {}) {
  166. return this.AjaxService.post({ url:'/shoppingCart/delete', data, isLoading: true })
  167. }
  168. /* 二级列表 */
  169. GetPageTopic (data = {}) {
  170. return this.AjaxService.get({ url:'/page/topic', data, isLoading: false })
  171. }
  172. /* 二级列表banner */
  173. GetPageTopicBanner (data = {}) {
  174. return this.AjaxService.get({ url:'/page/topic/info', data, isLoading: false })
  175. }
  176. /* 活动专题列表 */
  177. GetPromotionsrList (data = {}) {
  178. return this.AjaxService.get({
  179. url:'/commodity/promotions/list',
  180. data,
  181. isLoading: true ,
  182. isHost:true
  183. })
  184. }
  185. /* 搜索项目仪器列表 */
  186. GetSearchEquipmentList (data = {}) {
  187. return this.AjaxService.get({
  188. url:'/commodity/search/query/equipment',
  189. data,
  190. isLoading: true ,
  191. isHost:true
  192. })
  193. }
  194. /* 项目仪器详情 */
  195. GetEquipmentDetails (data = {}) {
  196. return this.AjaxService.get({
  197. url:'/commodity/equipment/details',
  198. data,
  199. isLoading: true ,
  200. isHost:true
  201. })
  202. }
  203. /* 查询搜索历史记录 */
  204. GetProductSearchHistory (data = {}) {
  205. return this.AjaxService.get({ url:'/product/searchHistory', data, isLoading: false })
  206. }
  207. /* 添加搜索历史记录 */
  208. GetAddProductSearchHistory (data = {}) {
  209. return this.AjaxService.get({ url:'/product/history/add', data, isLoading: true })
  210. }
  211. /* 清除搜索历史记录 */
  212. GetDeleteProductSearchHistory (data = {}) {
  213. return this.AjaxService.get({ url:'/product/searchHistory/delete', data, isLoading: false })
  214. }
  215. /* 搜索商品列表 */
  216. GetProductSearchList (data = {}) {
  217. return this.AjaxService.get({
  218. url:'/commodity/search/query/product',
  219. data,
  220. isLoading: true ,
  221. isHost:true
  222. })
  223. }
  224. /* 搜索分类商品列表 */
  225. GetSearchProductTypeData (data = {}) {
  226. return this.AjaxService.get({
  227. url:'/commodity/search/query/product/type',
  228. data,
  229. isLoading: true,
  230. isHost:true
  231. })
  232. }
  233. /* 搜索分类商品列表 */
  234. GetSearchCombinationProduct (data = {}) {
  235. return this.AjaxService.get({
  236. url:'/commodity/seller/product/combination',
  237. data,
  238. isLoading: true,
  239. isHost:true
  240. })
  241. }
  242. /* 获取商品评价 */
  243. GetProductEvaluate (data = {}) {
  244. return this.AjaxService.get({ url:'/product/evaluate', data, isLoading: false })
  245. }
  246. /* 获取再次购买商品列表 */
  247. GetRepeatBuyAgainProductList (data = {}) {
  248. return this.AjaxService.get({
  249. url:'/commodity/product/repeat',
  250. data,
  251. isLoading: true ,
  252. isHost:true
  253. })
  254. }
  255. /* 新商品搜索查询商品阶梯价格 */
  256. GetSearchProductLadderPrice (data = {}) {
  257. return this.AjaxService.get({
  258. url:'/commodity/price/ladder',
  259. data,
  260. isLoading: false,
  261. isHost:true
  262. })
  263. }
  264. /* 获取分类导航 */
  265. GetProductClassify (data = {}) {
  266. return this.AjaxService.get({ url:'/product/classify', data, isLoading: true })
  267. }
  268. /* 获取小程序三个模块商品列表 */
  269. GetProductPreferred (data = {}) {
  270. return this.AjaxService.get({ url:'/product/preferred', data, isLoading: true })
  271. }
  272. /* 发票信息回显 */
  273. GetPersonalCenterFindInvoice (data = {}) {
  274. return this.AjaxService.get({ url:'/personalCenter/findInvoice', data, isLoading: false })
  275. }
  276. /* 发票信息保存 */
  277. GetPersonalCenterInvoice (data = {}) {
  278. return this.AjaxService.post({ url:'/personalCenter/invoice', data, isLoading: true })
  279. }
  280. /**
  281. * @优惠券-是定商品活动页列表
  282. * @param:userId 用户userId(未登录传0)
  283. * @param:pageNum 页码
  284. * @param:pageSize 每页条数
  285. * @param:couponId 优惠券ID
  286. */
  287. QueryCouponActivityList (data = {}) {
  288. return this.AjaxService.get({
  289. url:'/commodity/coupon/activity/page',
  290. data,
  291. isLoading: true,
  292. isHost:true
  293. })
  294. }
  295. /**
  296. * @优惠券-个人中心优惠券列表
  297. * @param:userId 用户userId(必传)
  298. * @param:pageNum 页码
  299. * @param:pageSize 每页条数
  300. * @param:status 使用状态 1未使用 2已使用 3已失效
  301. */
  302. QueryCouponCenter (data = {}) {
  303. return this.AjaxService.get({
  304. url:'/commodity/coupon/center',
  305. data,
  306. isLoading: false ,
  307. isHost:true
  308. })
  309. }
  310. /**
  311. * @优惠券-领取中心优惠券列表
  312. * @param:userId 用户userId(未登录传0)
  313. * @param:pageNum 每页页码
  314. * @param:pageSize 条数
  315. */
  316. QueryCouponCollarList (data = {}) {
  317. return this.AjaxService.get({
  318. url:'/commodity/coupon/collar/list',
  319. data,
  320. isLoading: false ,
  321. isHost:true
  322. })
  323. }
  324. /**
  325. * @优惠券-领取优惠券
  326. * @param:userId 用户userId
  327. * @param:couponId 优惠券Id
  328. * @param:source 来源: 1WWW 2小程序
  329. */
  330. ReceiveCoupon (data = {}) {
  331. return this.AjaxService.post({
  332. url:'/commodity/coupon/collar',
  333. data,
  334. isLoading: true ,
  335. isHost:true
  336. })
  337. }
  338. /**
  339. * @优惠券-兑换优惠券
  340. * @param:userId 用户userId
  341. * @param:redemptionCode 优惠券兑换码
  342. * @param:source 来源: 1WWW 2小程序
  343. */
  344. ExchangeCoupon (data = {}) {
  345. return this.AjaxService.post({
  346. url:'/commodity/coupon/redeem',
  347. data,
  348. isLoading: true ,
  349. isHost:true
  350. })
  351. }
  352. /**
  353. * @优惠券-我的优惠券数量统计
  354. * @param:userId 用户userId(必传)
  355. */
  356. QueryCouponsCount (data = {}) {
  357. return this.AjaxService.get({
  358. url:'/commodity/coupon/coupons/count',
  359. data,
  360. isLoading: false ,
  361. isHost:true
  362. })
  363. }
  364. }