store.js 3.8 KB

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