store.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. // +----------------------------------------------------------------------
  2. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  3. // +----------------------------------------------------------------------
  4. // | Copyright (c) 2016~2023 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) {
  17. return request.get('product/detail/' + id, {}, {
  18. noAuth: true
  19. });
  20. }
  21. /**
  22. * 产品分享二维码 推广员
  23. * @param int id
  24. */
  25. // #ifdef H5 || APP-PLUS
  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. 'product': category === undefined ? 'product' : category
  46. });
  47. }
  48. /**
  49. * 删除收藏产品
  50. * @param int id
  51. * @param string category product=普通产品,product_seckill=秒杀产品
  52. */
  53. export function collectDel(id, category) {
  54. return request.post('collect/del', {
  55. id: id,
  56. category: category === undefined ? 'product' : category
  57. });
  58. }
  59. /**
  60. * 购车添加
  61. *
  62. */
  63. export function postCartAdd(data) {
  64. return request.post('cart/add', data);
  65. }
  66. /**
  67. * 获取分类列表
  68. *
  69. */
  70. export function getCategoryList() {
  71. return request.get('category', {}, {
  72. noAuth: true
  73. });
  74. }
  75. /**
  76. * 获取产品列表
  77. * @param object data
  78. */
  79. export function getProductslist(data) {
  80. return request.get('products', data, {
  81. noAuth: true
  82. });
  83. }
  84. /**
  85. * 获取推荐产品
  86. *
  87. */
  88. export function getProductHot(page, limit) {
  89. return request.get("product/hot", {
  90. page: page === undefined ? 1 : page,
  91. limit: limit === undefined ? 4 : limit
  92. }, {
  93. noAuth: true
  94. });
  95. }
  96. /**
  97. * 批量收藏
  98. *
  99. * @param object id 产品编号 join(',') 切割成字符串
  100. * @param string category
  101. */
  102. export function collectAll(id, category) {
  103. return request.post('collect/all', {
  104. id: id,
  105. category: category === undefined ? 'product' : category
  106. });
  107. }
  108. /**
  109. * 首页产品的轮播图和产品信息
  110. * @param int type
  111. *
  112. */
  113. export function getGroomList(type, data) {
  114. return request.get('groom/list/' + type, data, {
  115. noAuth: true
  116. });
  117. }
  118. /**
  119. * 获取收藏列表
  120. * @param object data
  121. */
  122. export function getCollectUserList(data) {
  123. return request.get('collect/user', data)
  124. }
  125. /**
  126. * 获取产品评论
  127. * @param int id
  128. * @param object data
  129. *
  130. */
  131. export function getReplyList(id, data) {
  132. return request.get('reply/list/' + id, data)
  133. }
  134. /**
  135. * 产品评价数量和好评度
  136. * @param int id
  137. */
  138. export function getReplyConfig(id) {
  139. return request.get('reply/config/' + id);
  140. }
  141. /**
  142. * 获取搜索关键字获取
  143. *
  144. */
  145. export function getSearchKeyword() {
  146. return request.get('search/keyword', {}, {
  147. noAuth: true
  148. });
  149. }
  150. /**
  151. * 门店列表
  152. * @returns {*}
  153. */
  154. export function storeListApi(data) {
  155. return request.get("store_list", data);
  156. }
  157. /**
  158. * 套餐列表
  159. * @param int id
  160. *
  161. */
  162. export function storeDiscountsList(id) {
  163. return request.get('store_discounts/list/' + id, {}, {
  164. noAuth: true
  165. });
  166. }
  167. /**
  168. * 购车添加、减少、修改
  169. *
  170. */
  171. export function postCartNum(data) {
  172. return request.post('v2/set_cart_num', data);
  173. }
  174. /**
  175. * 代理商申请
  176. *
  177. */
  178. export function create(data) {
  179. return request.post(`agent/apply/${data.id}`, data);
  180. }
  181. /**
  182. * 代理商规则
  183. * @param object data
  184. */
  185. export function getAgentAgreement(data) {
  186. return request.get('agent/get_agent_agreement', {}, {
  187. noAuth: true
  188. });
  189. }
  190. /**
  191. * h5用户发送验证码
  192. * @param data object 用户手机号
  193. */
  194. export function registerVerify(data) {
  195. return request.post("register/verify", data, {
  196. noAuth: true
  197. });
  198. }
  199. /**
  200. * 验证码key
  201. */
  202. export function getCodeApi() {
  203. return request.get("verify_code", {}, {
  204. noAuth: true
  205. });
  206. }
  207. /**
  208. * 获取代理商表单信息
  209. */
  210. export function getGoodsDetails() {
  211. return request.get("agent/apply/info", {}, {
  212. noAuth: true
  213. });
  214. }
  215. /**
  216. * 获取首页的属性
  217. * @returns {*}
  218. */
  219. export function getAttr(id, type) {
  220. return request.get("v2/get_attr/" + id + "/" + type);
  221. }
  222. /**
  223. * 获取首页商品列表(所有活动的)
  224. * @param object data
  225. */
  226. export function getHomeProducts(data) {
  227. return request.get('home/products', data, {
  228. noAuth: true
  229. });
  230. }
  231. /**
  232. * 预售详情
  233. * @returns {*}
  234. */
  235. export function getPresellProductDetail(id) {
  236. return request.get("advance/detail/" + id);
  237. }
  238. /**
  239. * 获取浏览记录列表
  240. * @param object data
  241. */
  242. export function getVisitList(data) {
  243. return request.get('user/visit_list', data)
  244. }
  245. /**
  246. * 获取浏览记录列表-删除
  247. * @param object data
  248. */
  249. export function deleteVisitList(data) {
  250. return request.delete('user/visit', data)
  251. }