homegoodsdetail.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. import { requestApi } from '../util/network'
  2. // 获取商品
  3. export const getGoodsInfo =
  4. (id, token, extra = {}) =>
  5. requestApi(
  6. '/goods/goods_detail',
  7. 'GET',
  8. Object.assign(
  9. {
  10. 'goods_id': id,
  11. 'key': token
  12. },
  13. extra)
  14. )
  15. // 门店列表
  16. export const getChainList =
  17. (data) =>
  18. requestApi(
  19. '/goods/chain_list',
  20. 'GET',
  21. data
  22. )
  23. // 商品评论
  24. export const getReviewList =
  25. (id, type, per_page, page=1) =>
  26. requestApi(
  27. '/goods/goods_evaluate',
  28. 'GET',
  29. {
  30. 'goods_id': id,
  31. 'type': type,
  32. 'per_page': per_page,
  33. 'page': page
  34. }
  35. )
  36. // 组合搭配
  37. export const productAccessoryList =
  38. (id) =>
  39. requestApi(
  40. '/goods/get_bundling',
  41. 'GET',
  42. {
  43. 'goods_id': id
  44. }
  45. )
  46. // 收藏商品
  47. export const productLike =
  48. (id) =>
  49. requestApi(
  50. '/Memberfavorites/favorites_add',
  51. 'POST',
  52. {
  53. 'goods_id': id
  54. },
  55. 'member'
  56. )
  57. // 取消收藏
  58. export const productUnlike =
  59. (id) =>
  60. requestApi(
  61. '/Memberfavorites/favorites_del',
  62. 'POST',
  63. {
  64. 'fav_id': id
  65. },
  66. 'member'
  67. )
  68. // 获取商品
  69. export const getGoodsConsult =
  70. (params, id) =>
  71. requestApi(
  72. '/goods/consulting_list',
  73. 'GET',
  74. {
  75. 'goods_id': id,
  76. 'page': params.page,
  77. 'per_page': params.per_page
  78. }
  79. )
  80. export const addGoodsConsult =
  81. (id, consult_type_id, content, token) =>
  82. requestApi(
  83. '/goods/save_consult',
  84. 'POST',
  85. {
  86. 'goods_content': content,
  87. 'consult_type_id': consult_type_id,
  88. 'goods_id': id,
  89. 'key': token
  90. }
  91. )