store.js 5.2 KB

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