store.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. import request from "@/utils/request.js";
  2. // 购车添加
  3. export function postCartAdd(data) {
  4. return request({
  5. url: '/api/cart/add',
  6. method: 'post',
  7. data
  8. });
  9. }
  10. /**
  11. * 购车添加
  12. *
  13. */
  14. // export function postCartAdd(data) {
  15. // return request.post('cart/add', data);
  16. // }
  17. /**
  18. * 获取产品详情
  19. * @param int id
  20. *
  21. */
  22. export function getProductDetail(id){
  23. return request.get('product/detail/' + id, {}, { noAuth : true });
  24. }
  25. /**
  26. * 产品分享二维码 推广员
  27. * @param int id
  28. */
  29. // #ifndef MP
  30. export function getProductCode(id){
  31. return request.get('product/code/' + id, {});
  32. }
  33. // #endif
  34. // #ifdef MP
  35. export function getProductCode(id){
  36. return request.get('product/code/' + id, {user_type:'routine'});
  37. }
  38. // #endif
  39. /**
  40. * 添加收藏
  41. * @param int id
  42. * @param string category product=普通产品,product_seckill=秒杀产品
  43. */
  44. export function collectAdd(id, category){
  45. return request.post('collect/add', { id: id, 'product': category === undefined ? 'product' : category });
  46. }
  47. /**
  48. * 删除收藏产品
  49. * @param int id
  50. * @param string category product=普通产品,product_seckill=秒杀产品
  51. */
  52. export function collectDel(id, category) {
  53. return request.post('collect/del', { id: id, category: category === undefined ? 'product' : category });
  54. }
  55. /**
  56. * 获取分类列表
  57. *
  58. */
  59. export function getCategoryList(){
  60. return request.get('category', {}, { noAuth:true});
  61. }
  62. /**
  63. * 获取产品列表
  64. * @param object data
  65. */
  66. export function getProductslist(data){
  67. return request.get('products',data,{noAuth:true});
  68. }
  69. /**
  70. * 获取推荐产品
  71. *
  72. */
  73. export function getProductHot(page,limit) {
  74. return request.get("product/hot", {
  75. page: page === undefined ? 1 : page,
  76. limit:limit === undefined ? 4 :limit
  77. },{noAuth:true});
  78. }
  79. /**
  80. * 批量收藏
  81. *
  82. * @param object id 产品编号 join(',') 切割成字符串
  83. * @param string category
  84. */
  85. export function collectAll(id, category) {
  86. return request.post('collect/all', { id: id, category: category === undefined ? 'product' : category });
  87. }
  88. /**
  89. * 首页产品的轮播图和产品信息
  90. * @param int type
  91. *
  92. */
  93. export function getGroomList(type,data){
  94. return request.get('groom/list/'+type,data,{noAuth:true});
  95. }
  96. /**
  97. * 获取收藏列表
  98. * @param object data
  99. */
  100. export function getCollectUserList(data) {
  101. return request.get('collect/user', data)
  102. }
  103. /**
  104. * 获取产品评论
  105. * @param int id
  106. * @param object data
  107. *
  108. */
  109. export function getReplyList(id,data){
  110. return request.get('reply/list/'+id,data)
  111. }
  112. /**
  113. * 产品评价数量和好评度
  114. * @param int id
  115. */
  116. export function getReplyConfig(id){
  117. return request.get('reply/config/'+id);
  118. }
  119. /**
  120. * 获取搜索关键字获取
  121. *
  122. */
  123. export function getSearchKeyword(){
  124. return request.get('search/keyword',{},{noAuth:true});
  125. }
  126. /**
  127. * 门店列表
  128. * @returns {*}
  129. */
  130. export function storeListApi(data) {
  131. return request.get("store_list", data);
  132. }