store.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. import request from "@utils/request";
  2. /*
  3. * 商品分类
  4. * */
  5. export function getCategory() {
  6. return request.get("/category", {}, { login: false });
  7. }
  8. /*
  9. * 商品详情
  10. * */
  11. export function getProductDetail(id) {
  12. return request.get("/product/detail/" + id, {}, { login: false });
  13. }
  14. /*
  15. * 商品分销二维码
  16. * */
  17. export function getProductCode(id) {
  18. return request.get("/product/code/" + id, {}, { login: true });
  19. }
  20. /*
  21. * 商品列表
  22. * */
  23. export function getProducts(q) {
  24. return request.get("/products", q, { login: false });
  25. }
  26. /*
  27. * 购物车数量
  28. * */
  29. export function getCartNum() {
  30. return request.get("/cart/count");
  31. }
  32. /*
  33. * 添加收藏
  34. * */
  35. export function toCollect(id, category) {
  36. return request.get("/collect/add/" + id + "/" + category);
  37. }
  38. /*
  39. * 为你推荐
  40. * */
  41. export function getHostProducts(page, limit) {
  42. return request.get(
  43. "/product/hot",
  44. { page: page, limit: limit },
  45. { login: false }
  46. );
  47. }
  48. /*
  49. * 精品、热门、首发列表
  50. * */
  51. export function getGroomList(type) {
  52. return request.get("/groom/list/" + type, {}, { login: false });
  53. }
  54. /*
  55. * 购物车 添加
  56. * */
  57. export function postCartAdd(data) {
  58. return request.post("/cart/add", data);
  59. }
  60. /*
  61. * 购物车列表
  62. * */
  63. export function getCartList() {
  64. return request.get("/cart/list");
  65. }
  66. /*
  67. * 购物车 删除
  68. * */
  69. export function postCartDel(ids) {
  70. return request.post("/cart/del", { ids });
  71. }
  72. /*
  73. * 购物车 获取数量
  74. * */
  75. export function getCartCount(data) {
  76. return request.get("/cart/count", data);
  77. }
  78. /*
  79. * 购物车 修改商品数量
  80. * */
  81. export function changeCartNum(id, number) {
  82. return request.post("/cart/num", { id, number });
  83. }
  84. /**
  85. * 搜索推荐关键字
  86. */
  87. export function getSearchKeyword() {
  88. return request.get("/search/keyword", {}, { login: false });
  89. }
  90. /**
  91. * 产品评论列表
  92. */
  93. export function getReplyList(id, q) {
  94. return request.get("/reply/list/" + id, q, { login: false });
  95. }
  96. /**
  97. * 产品评价数量和好评度
  98. */
  99. export function getReplyConfig(id) {
  100. return request.get("/reply/config/" + id, {}, { login: false });
  101. }
  102. /**
  103. * 评价页面获取单个产品详情
  104. */
  105. export function postOrderProduct(unique) {
  106. return request.post("/order/product", { unique }, { login: false });
  107. }
  108. /**
  109. * 提交评价页面;
  110. */
  111. export function postOrderComment(data) {
  112. return request.post("/order/comment", data, { login: false });
  113. }
  114. /**
  115. * 门店列表
  116. */
  117. export function storeListApi(data) {
  118. return request.get("store_list", data, { login: false });
  119. }