store.js 3.2 KB

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