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.

230 lines
4.3 KiB

3 months ago
  1. // +----------------------------------------------------------------------
  2. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  3. // +----------------------------------------------------------------------
  4. // | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
  5. // +----------------------------------------------------------------------
  6. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  7. // +----------------------------------------------------------------------
  8. // | Author: CRMEB Team <admin@crmeb.com>
  9. // +----------------------------------------------------------------------
  10. import request from "@/utils/request.js";
  11. /**
  12. * 获取产品详情
  13. * @param int id
  14. *
  15. */
  16. export function getProductDetail(id, type) {
  17. return request.get('product/detail/' + id + '?type=' + type, {}, {
  18. noAuth: true
  19. });
  20. }
  21. /**
  22. * 产品分享二维码 推广员
  23. * @param int id
  24. */
  25. // #ifndef MP
  26. export function getProductCode(id) {
  27. return request.get('product/code/' + id, {});
  28. }
  29. // #endif
  30. // #ifdef MP
  31. export function getProductCode(id) {
  32. return request.get('product/code/' + id, {
  33. user_type: 'routine'
  34. });
  35. }
  36. // #endif
  37. /**
  38. * 添加收藏
  39. * @param int id
  40. * @param string category product=普通产品,product_seckill=秒杀产品
  41. */
  42. export function collectAdd(id, category) {
  43. return request.post('collect/add', {
  44. id: id,
  45. 'category': category === undefined ? 'product' : category
  46. });
  47. }
  48. /**
  49. * 取消收藏产品
  50. * @param int id
  51. */
  52. export function collectDel(proId) {
  53. return request.post(`collect/cancel/${proId}`);
  54. }
  55. /**
  56. * 删除收藏产品
  57. * @param string id
  58. */
  59. export function collectDelete(ids) {
  60. return request.post(`collect/delete`,ids);
  61. }
  62. /**
  63. * 购车添加
  64. *
  65. */
  66. export function postCartAdd(data) {
  67. return request.post('cart/save', data, {});
  68. }
  69. /**
  70. * 获取分类列表
  71. *
  72. */
  73. export function getCategoryList() {
  74. return request.get('category', {}, {
  75. noAuth: true
  76. });
  77. }
  78. /**
  79. * 获取产品列表
  80. * @param object data
  81. */
  82. export function getProductslist(data) {
  83. return request.get('products', data, {
  84. noAuth: true
  85. });
  86. }
  87. /**
  88. * 商品列表(个别分类模型使用)
  89. * @param object data
  90. */
  91. export function productList(data) {
  92. return request.get('product/list', data, {
  93. noAuth: true
  94. });
  95. }
  96. /**
  97. * 获取推荐产品
  98. *
  99. */
  100. export function getProductHot(page, limit) {
  101. return request.get("product/hot", {
  102. page: page === undefined ? 1 : page,
  103. limit: limit === undefined ? 4 : limit
  104. }, {
  105. noAuth: true
  106. });
  107. }
  108. /**
  109. * 批量收藏
  110. *
  111. * @param object id 产品编号 join(',') 切割成字符串
  112. * @param string category
  113. */
  114. export function collectAll(id, category) {
  115. return request.post('collect/all', {
  116. id: id,
  117. category: category === undefined ? 'product' : category
  118. });
  119. }
  120. /**
  121. * 首页产品的轮播图和产品信息
  122. * @param int type
  123. *
  124. */
  125. export function getGroomList(type, data) {
  126. return request.get('index/product/' + type, data, {
  127. noAuth: true
  128. });
  129. }
  130. /**
  131. * 获取收藏列表
  132. * @param object data
  133. */
  134. export function getCollectUserList(data) {
  135. return request.get('collect/user', data)
  136. }
  137. /**
  138. * 获取产品评论
  139. * @param int id
  140. * @param object data
  141. *
  142. */
  143. export function getReplyList(id, data) {
  144. return request.get('reply/list/' + id, data,{
  145. noAuth: true
  146. })
  147. }
  148. /**
  149. * 产品评价数量和好评度
  150. * @param int id
  151. */
  152. export function getReplyConfig(id) {
  153. return request.get('reply/config/' + id,{},{
  154. noAuth: true
  155. });
  156. }
  157. /**
  158. * 获取搜索关键字获取
  159. *
  160. */
  161. export function getSearchKeyword() {
  162. return request.get('search/keyword', {}, {
  163. noAuth: true
  164. });
  165. }
  166. /**
  167. * 门店列表
  168. * @returns {*}
  169. */
  170. export function storeListApi(data) {
  171. return request.post("store/list", data, {}, 1);
  172. }
  173. /**
  174. * 优品推荐
  175. * @param object data
  176. */
  177. export function getProductGood() {
  178. return request.get('product/good',{},{
  179. noAuth: true
  180. });
  181. }
  182. /**
  183. * 详情页产品评论
  184. * @param int id
  185. * @param object data
  186. *
  187. */
  188. export function getReplyProduct(id) {
  189. return request.get('reply/product/' + id,{}, {
  190. noAuth: true
  191. })
  192. }
  193. /**
  194. * 获取商品的sku
  195. * @returns {*}
  196. */
  197. export function getAttr(id) {
  198. return request.get("product/sku/detail/" + id);
  199. }
  200. /**
  201. * 根据商品id集合查询对应商品
  202. * @param {string} ids
  203. */
  204. export function productByidsApi(ids) {
  205. return request.get(`product/byids/${ids}`,{}, {
  206. noAuth: true
  207. });
  208. }