store.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. // +----------------------------------------------------------------------
  2. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  3. // +----------------------------------------------------------------------
  4. // | Copyright (c) 2016~2021 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,data) {
  17. return request.get('product/detail/' + id, data, {
  18. noAuth: true
  19. });
  20. }
  21. /**
  22. * 获取产品活动相关详情
  23. * @param int id
  24. *
  25. */
  26. export function getProductCtivity(id,data) {
  27. return request.get('product/detail/activity/' + id, data, {
  28. noAuth: true
  29. });
  30. }
  31. /**
  32. * 获取产品详情中推荐商品列表
  33. * @param int id
  34. *
  35. */
  36. export function getProductRecommend(id) {
  37. return request.get('product/detail/recommend/' + id, {},{
  38. noAuth: true
  39. });
  40. }
  41. /**
  42. * 产品分享二维码 推广员
  43. * @param int id
  44. */
  45. // #ifdef H5 || APP-PLUS
  46. export function getProductCode(id) {
  47. return request.get('product/code/' + id, {});
  48. }
  49. // #endif
  50. // #ifdef MP
  51. export function getProductCode(id) {
  52. return request.get('product/code/' + id, {
  53. user_type: 'routine'
  54. });
  55. }
  56. // #endif
  57. /**
  58. * 添加收藏
  59. * @param int id
  60. * @param string category product=普通产品,product_seckill=秒杀产品
  61. */
  62. export function collectAdd(id, category) {
  63. return request.post('collect/add', {
  64. id: id,
  65. 'category': category === undefined ? 'product' : category
  66. });
  67. }
  68. /**
  69. * 删除收藏产品
  70. * @param int id
  71. * @param string category product=普通产品,product_seckill=秒杀产品
  72. */
  73. export function collectDel(id, category) {
  74. return request.post('collect/del', {
  75. id: id,
  76. category: category === undefined ? 'product' : category
  77. });
  78. }
  79. /**
  80. * 购车添加
  81. *
  82. */
  83. export function postCartAdd(data) {
  84. return request.post('cart/add', data);
  85. }
  86. /**
  87. * 获取分类列表
  88. *
  89. */
  90. export function getCategoryList() {
  91. return request.get('category', {}, {
  92. noAuth: true
  93. });
  94. }
  95. /**
  96. * 商品详情diy
  97. * @param {*} data
  98. */
  99. export function diyProduct() {
  100. return request.get('v2/diy/product_detail', {}, {
  101. noAuth: true
  102. });
  103. }
  104. /**
  105. * 获取产品列表
  106. * @param object data
  107. */
  108. export function getProductslist(data) {
  109. return request.get('products', data, {
  110. noAuth: true
  111. });
  112. }
  113. /**
  114. * 获取推荐产品
  115. *
  116. */
  117. export function getProductHot(page, limit) {
  118. return request.get("product/hot", {
  119. page: page === undefined ? 1 : page,
  120. limit: limit === undefined ? 4 : limit
  121. }, {
  122. noAuth: true
  123. });
  124. }
  125. /**
  126. * 批量收藏
  127. *
  128. * @param object id 产品编号 join(',') 切割成字符串
  129. * @param string category
  130. */
  131. export function collectAll(id, category) {
  132. return request.post('collect/all', {
  133. id: id,
  134. category: category === undefined ? 'product' : category
  135. });
  136. }
  137. /**
  138. * 首页产品的轮播图和产品信息
  139. * @param int type
  140. *
  141. */
  142. export function getGroomList(type, data) {
  143. return request.get('groom/list/' + type, data, {
  144. noAuth: true
  145. });
  146. }
  147. /**
  148. * 获取收藏列表
  149. * @param object data
  150. */
  151. export function getCollectUserList(data) {
  152. return request.get('collect/user', data)
  153. }
  154. /**
  155. * 获取浏览记录列表
  156. * @param object data
  157. */
  158. export function getVisitList(data) {
  159. return request.get('user/visit_list', data)
  160. }
  161. /**
  162. * 获取浏览记录列表-删除
  163. * @param object data
  164. */
  165. export function deleteVisitList(data) {
  166. return request.delete('user/visit', data)
  167. }
  168. /**
  169. * 获取产品评论
  170. * @param int id
  171. * @param object data
  172. *
  173. */
  174. export function getReplyList(id, data) {
  175. return request.get('v2/reply/list/' + id, data,{noAuth: true})
  176. }
  177. /**
  178. * 产品评价数量和好评度
  179. * @param int id
  180. */
  181. export function getReplyConfig(id) {
  182. return request.get('reply/config/' + id,{},{noAuth: true});
  183. }
  184. /**
  185. * 评论点赞
  186. * @param int id
  187. */
  188. export function getReplyPraise(id) {
  189. return request.post('reply/reply_praise/' + id);
  190. }
  191. /**
  192. * 取消评论点赞
  193. * @param int id
  194. */
  195. export function getUnReplyPraise(id) {
  196. return request.post('reply/un_reply_praise/' + id);
  197. }
  198. /**
  199. * 获取评论详情
  200. * @param int id
  201. */
  202. export function getReplyInfo(id) {
  203. return request.get('reply/info/' + id);
  204. }
  205. /**
  206. * 获取评论回复列表
  207. * @param int id
  208. */
  209. export function getReplyComment(id,data) {
  210. return request.get('reply/comment/' + id,data);
  211. }
  212. /**
  213. * 评论回复点赞
  214. * @param int id
  215. */
  216. export function postReplyPraise(id) {
  217. return request.post('reply/praise/' + id);
  218. }
  219. /**
  220. * 取消评论回复点赞
  221. * @param int id
  222. */
  223. export function postUnReplyPraise(id) {
  224. return request.post('reply/un_praise/' + id);
  225. }
  226. /**
  227. * 保存商品评价回复
  228. * @param int id
  229. */
  230. export function replyComment(id,data) {
  231. return request.post('reply/comment/' + id,data);
  232. }
  233. /**
  234. * 获取搜索关键字获取
  235. *
  236. */
  237. export function getSearchKeyword() {
  238. return request.get('search/keyword', {}, {
  239. noAuth: true
  240. });
  241. }
  242. /**
  243. * 门店列表
  244. * @returns {*}
  245. */
  246. export function storeListApi(data) {
  247. return request.get("store_list", data, {
  248. noAuth: true
  249. });
  250. }
  251. /**
  252. * 套餐列表
  253. * @param int id
  254. *
  255. */
  256. export function storeDiscountsList(id) {
  257. return request.get('store_discounts/list/' + id, {}, {
  258. noAuth: true
  259. });
  260. }
  261. /**
  262. * 购车添加、减少、修改
  263. *
  264. */
  265. export function postCartNum(data) {
  266. return request.post('v2/set_cart_num', data);
  267. }
  268. /**
  269. * 获取首页的属性
  270. * @returns {*}
  271. */
  272. export function getAttr(id,type) {
  273. return request.get("v2/get_attr/"+id+"/"+type);
  274. }
  275. /**
  276. * 获取店员推广微信会员卡二维码
  277. */
  278. export function storeCardApi() {
  279. return request.get("store/staff/card/code");
  280. }
  281. /**
  282. * 分类列表-品牌列表
  283. */
  284. export function brand(data) {
  285. return request.get("brand",data,{
  286. noAuth: true
  287. });
  288. }
  289. /**
  290. * 新人专享商品详情
  291. */
  292. export function newcomerDetail(id) {
  293. return request.get("marketing/newcomer/product_detail/"+id,{},{
  294. noAuth: true
  295. });
  296. }