store.js 4.6 KB

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