product.service.js 9.0 KB

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