product.service.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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:productID 商品ID','符号拼接
  23. */
  24. querySearchProductPrice (data = {}) {
  25. return this.AjaxService.get({ url:'/product/listPrice', data, isLoading: false })
  26. }
  27. /**
  28. * @查询凑单商品页初始化
  29. * @param:promotionsId 促销ID
  30. */
  31. queryProductPromotionInfo (data = {}) {
  32. return this.AjaxService.get({ url:'/product/promotion/info', data, isLoading: false })
  33. }
  34. /**
  35. * @查询凑单商品列表
  36. * @param:promotionsId 促销ID
  37. * @param:pageSize 查询条数
  38. * @param:pageNum 查询页数
  39. */
  40. queryProductPromotionList (data = {}) {
  41. return this.AjaxService.get({ url:'/product/promotion/products', data, isLoading: true })
  42. }
  43. /**
  44. * @商品详情-查询商品详情
  45. * @param:userId 用户ID(未登录传0或者'')
  46. * @param:productIds 商品ID
  47. */
  48. queryProductDetils (data = {}) {
  49. return this.AjaxService.get({ url:'/product/details', data, isLoading: false })
  50. }
  51. /**
  52. * @加入购物车
  53. * @param:userId 用户ID(必填)
  54. * @param:productID 用户ID(必填)
  55. * @param:productCount 商品数量(必填)
  56. */
  57. shoppingAddCart (data = {}) {
  58. return this.AjaxService.post({ url:'/shoppingCart/addCart', data, isLoading: true })
  59. }
  60. /**
  61. * @购物车列表
  62. * @param:userId 用户ID(必填)
  63. */
  64. QueryShoppingCartList (data = {}) {
  65. return this.AjaxService.get({ url:'/shoppingCart/list', data, isLoading: false })
  66. }
  67. /**
  68. * @更新购物车商品增减
  69. * @param:userId 用户ID(必填)
  70. * @param:productID 商品ID(必填)
  71. * @param:productCount 商品数量ID(必填)
  72. */
  73. shoppingCartUpdate (data = {}) {
  74. return this.AjaxService.post({ url:'/shoppingCart/update', data, isLoading: true })
  75. }
  76. /**
  77. * @删除购物车商品
  78. * @param:userId 用户ID(必填)
  79. * @param:productIDs 商品ID(用','号拼接)
  80. */
  81. shoppingCartDelete (data = {}) {
  82. return this.AjaxService.post({ url:'/shoppingCart/delete', data, isLoading: true })
  83. }
  84. }