小程序端工程代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

183 lines
2.8 KiB

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