store.js 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  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 getProductStoreDetail(id,data) {
  27. return request.get('product/store/detail/' + id, data, {
  28. noAuth: true
  29. });
  30. }
  31. /**
  32. * 获取产品活动相关详情
  33. * @param int id
  34. *
  35. */
  36. export function getProductCtivity(id,data) {
  37. return request.get('product/detail/activity/' + id, data, {
  38. noAuth: true
  39. });
  40. }
  41. /**
  42. * 获取产品详情中推荐商品列表
  43. * @param int id
  44. *
  45. */
  46. export function getProductRecommend(id) {
  47. return request.get('product/detail/recommend/' + id, {},{
  48. noAuth: true
  49. });
  50. }
  51. /**
  52. * 产品分享二维码 推广员
  53. * @param int id
  54. */
  55. // #ifdef H5 || APP-PLUS
  56. export function getProductCode(id) {
  57. return request.get('product/code/' + id, {});
  58. }
  59. // #endif
  60. // #ifdef MP
  61. export function getProductCode(id) {
  62. return request.get('product/code/' + id, {
  63. user_type: 'routine'
  64. });
  65. }
  66. // #endif
  67. /**
  68. * 添加收藏
  69. * @param int id
  70. * @param string category product=普通产品,product_seckill=秒杀产品
  71. */
  72. export function collectAdd(id, category) {
  73. return request.post('collect/add', {
  74. id: id,
  75. 'category': category === undefined ? 'product' : category
  76. });
  77. }
  78. /**
  79. * 删除收藏产品
  80. * @param int id
  81. * @param string category product=普通产品,product_seckill=秒杀产品
  82. */
  83. export function collectDel(id, category) {
  84. return request.post('collect/del', {
  85. id: id,
  86. category: category === undefined ? 'product' : category
  87. });
  88. }
  89. /**
  90. * 购车添加
  91. *
  92. */
  93. export function postCartAdd(data) {
  94. return request.post('cart/add', data);
  95. }
  96. /**
  97. * 获取分类列表
  98. *
  99. */
  100. export function getCategoryList() {
  101. return request.get('category', {}, {
  102. noAuth: true
  103. });
  104. }
  105. /**
  106. * 商品详情diy
  107. * @param {*} data
  108. */
  109. export function diyProduct() {
  110. return request.get('v2/diy/product_detail', {}, {
  111. noAuth: true
  112. });
  113. }
  114. /**
  115. * 获取产品列表
  116. * @param object data
  117. */
  118. export function getProductslist(data) {
  119. return request.get('products', data, {
  120. noAuth: true
  121. });
  122. }
  123. /**
  124. * 获取推荐产品
  125. *
  126. */
  127. export function getProductHot(page, limit) {
  128. return request.get("product/hot", {
  129. page: page === undefined ? 1 : page,
  130. limit: limit === undefined ? 4 : limit
  131. }, {
  132. noAuth: true
  133. });
  134. }
  135. /**
  136. * 批量收藏
  137. *
  138. * @param object id 产品编号 join(',') 切割成字符串
  139. * @param string category
  140. */
  141. export function collectAll(id, category) {
  142. return request.post('collect/all', {
  143. id: id,
  144. category: category === undefined ? 'product' : category
  145. });
  146. }
  147. /**
  148. * 首页产品的轮播图和产品信息
  149. * @param int type
  150. *
  151. */
  152. export function getGroomList(type, data) {
  153. return request.get('groom/list/' + type, data, {
  154. noAuth: true
  155. });
  156. }
  157. /**
  158. * 获取收藏列表
  159. * @param object data
  160. */
  161. export function getCollectUserList(data) {
  162. return request.get('collect/user', data)
  163. }
  164. /**
  165. * 获取浏览记录列表
  166. * @param object data
  167. */
  168. export function getVisitList(data) {
  169. return request.get('user/visit_list', data)
  170. }
  171. /**
  172. * 获取浏览记录列表-删除
  173. * @param object data
  174. */
  175. export function deleteVisitList(data) {
  176. return request.delete('user/visit', data)
  177. }
  178. /**
  179. * 获取产品评论
  180. * @param int id
  181. * @param object data
  182. *
  183. */
  184. export function getReplyList(id, data) {
  185. return request.get('v2/reply/list/' + id, data,{noAuth: true})
  186. }
  187. /**
  188. * 产品评价数量和好评度
  189. * @param int id
  190. */
  191. export function getReplyConfig(id) {
  192. return request.get('reply/config/' + id,{},{noAuth: true});
  193. }
  194. /**
  195. * 评论点赞
  196. * @param int id
  197. */
  198. export function getReplyPraise(id) {
  199. return request.post('reply/reply_praise/' + id);
  200. }
  201. /**
  202. * 取消评论点赞
  203. * @param int id
  204. */
  205. export function getUnReplyPraise(id) {
  206. return request.post('reply/un_reply_praise/' + id);
  207. }
  208. /**
  209. * 获取评论详情
  210. * @param int id
  211. */
  212. export function getReplyInfo(id) {
  213. return request.get('reply/info/' + id);
  214. }
  215. /**
  216. * 获取评论回复列表
  217. * @param int id
  218. */
  219. export function getReplyComment(id,data) {
  220. return request.get('reply/comment/' + id,data);
  221. }
  222. /**
  223. * 评论回复点赞
  224. * @param int id
  225. */
  226. export function postReplyPraise(id) {
  227. return request.post('reply/praise/' + id);
  228. }
  229. /**
  230. * 取消评论回复点赞
  231. * @param int id
  232. */
  233. export function postUnReplyPraise(id) {
  234. return request.post('reply/un_praise/' + id);
  235. }
  236. /**
  237. * 保存商品评价回复
  238. * @param int id
  239. */
  240. export function replyComment(id,data) {
  241. return request.post('reply/comment/' + id,data);
  242. }
  243. /**
  244. * 获取搜索关键字获取
  245. *
  246. */
  247. export function getSearchKeyword() {
  248. return request.get('search/keyword', {}, {
  249. noAuth: true
  250. });
  251. }
  252. /**
  253. * 门店列表
  254. * @returns {*}
  255. */
  256. export function storeListApi(data) {
  257. return request.get("store_list", data, {
  258. noAuth: true
  259. });
  260. }
  261. /**
  262. * 套餐列表
  263. * @param int id
  264. *
  265. */
  266. export function storeDiscountsList(id) {
  267. return request.get('store_discounts/list/' + id, {}, {
  268. noAuth: true
  269. });
  270. }
  271. /**
  272. * 购车添加、减少、修改
  273. *
  274. */
  275. export function postCartNum(data) {
  276. return request.post('v2/set_cart_num', data);
  277. }
  278. /**
  279. * 获取首页的属性
  280. * @returns {*}
  281. */
  282. export function getAttr(id,type) {
  283. return request.get("v2/get_attr/"+id+"/"+type);
  284. }
  285. /**
  286. * 获取店员推广微信会员卡二维码
  287. */
  288. export function storeCardApi() {
  289. return request.get("store/staff/card/code");
  290. }
  291. /**
  292. * 分类列表-品牌列表
  293. */
  294. export function brand(data) {
  295. return request.get("brand",data,{
  296. noAuth: true
  297. });
  298. }
  299. /**
  300. * 新人专享商品详情
  301. */
  302. export function newcomerDetail(id) {
  303. return request.get("marketing/newcomer/product_detail/"+id,{},{
  304. noAuth: true
  305. });
  306. }
  307. /**
  308. * 发起拼单
  309. * @param {Object} data
  310. */
  311. export function initCollage(data) {
  312. return request.get("v2/user/initiate/collage",data);
  313. }
  314. /**
  315. * 检查用户是否发起拼单
  316. */
  317. export function hasCollage() {
  318. return request.get("v2/is/user/initiate/collage");
  319. }
  320. /**
  321. * 检查拼单
  322. * @param {Object} data
  323. */
  324. export function getCollage(data) {
  325. return request.get("v2/is/initiate/collage", data);
  326. }
  327. /**
  328. * 拼单购物车列表
  329. * @param {Object} data
  330. */
  331. export function getCollageCart(data) {
  332. return request.get("v2/user/initiate/collage/cart_list", data);
  333. }
  334. /**
  335. * 拼单用户购物车统计数量
  336. * @param {Object} data
  337. */
  338. export function getCollageCount(data) {
  339. return request.get("v2/user/initiate/collage/count", data);
  340. }
  341. /**
  342. * 用户添加拼单商品
  343. * @param {Object} data
  344. */
  345. export function addCollageCart(data) {
  346. return request.post('v2/add/collage/partake', data);
  347. }
  348. /**
  349. * 获取用户拼单数据
  350. * @param {Object} data
  351. */
  352. export function getCollagePartake(data) {
  353. return request.get("v2/user/collage/partake", data);
  354. }
  355. /**
  356. * 复制他人拼单商品
  357. * @param {Object} data
  358. */
  359. export function duplicateCollagePartake(data) {
  360. return request.get("v2/duplicate/collage/partake", data);
  361. }
  362. /**
  363. * 用户清空拼单数据
  364. * @param {Object} data
  365. */
  366. export function emptyCollagePartake(data) {
  367. return request.get("v2/empty/collage/partake", data);
  368. }
  369. /**
  370. * 取消拼单
  371. * @param {Object} data
  372. */
  373. export function cancelCollage(data) {
  374. return request.get("v2/user/cancel", data);
  375. }
  376. /**
  377. * 结算拼单
  378. * @param {Object} data
  379. */
  380. export function settleCollage(data) {
  381. return request.get("v2/user/settle/collage", data);
  382. }
  383. /**
  384. * 验证是否在配送范围
  385. * @param {Object} data
  386. */
  387. export function isWithin(data) {
  388. return request.get("v2/is/within", data);
  389. }
  390. /**
  391. * 门店桌码配置
  392. */
  393. export function getTableData(data) {
  394. return request.get("v2/table/data", data);
  395. }
  396. /**
  397. * 记录桌码
  398. * @param {Object} data
  399. */
  400. export function addTableCode(data) {
  401. return request.get("v2/add/table/code", data);
  402. }
  403. /**
  404. * 检查桌码记录
  405. * @param {Object} data
  406. */
  407. export function isTableCode(data) {
  408. return request.get("v2/is/table/code", data);
  409. }
  410. /**
  411. * 处理换桌商品
  412. * @param {Object} data
  413. */
  414. export function changeTable(data) {
  415. return request.get("v2/changing/table", data);
  416. }
  417. /**
  418. * 购物车统计数量
  419. * @param {Object} data
  420. */
  421. export function getCartCount(data) {
  422. return request.get("v2/cart/count", data);
  423. }
  424. /**
  425. * 获取门店信息
  426. * @param {Object} data
  427. */
  428. export function getStoreData(data) {
  429. return request.get("v2/get/store/data", data);
  430. }
  431. /**
  432. * 获取购物车
  433. * @param {Object} data
  434. */
  435. export function getCateList(data) {
  436. return request.get("v2/get/cate/list", data);
  437. }
  438. /**
  439. * 用户添加桌码商品
  440. * @param {Object} data
  441. */
  442. export function addTableCate(data) {
  443. return request.get("v2/add/table/cate", data);
  444. }
  445. /**
  446. * 确认下单
  447. * @param {Object} data
  448. */
  449. export function placeOrder(data) {
  450. return request.get("v2/user/place/order", data);
  451. }
  452. /**
  453. * 获取桌码数据
  454. * @param {Object} data
  455. */
  456. export function getTablePartake(data) {
  457. return request.get("v2/get/table/partake", data);
  458. }
  459. /**
  460. * 获取二维码信息
  461. * @param {Object} data
  462. */
  463. export function getCodeData(data) {
  464. return request.get("v2/get/code/data", data);
  465. }
  466. /**
  467. * 获取桌码记录
  468. * @param {Object} data
  469. */
  470. export function getTableCode(data) {
  471. return request.get("v2/get/table/code", data);
  472. }
  473. /**
  474. * 桌码结账
  475. * @param {Object} data
  476. */
  477. export function settleTable(data) {
  478. return request.get("v2/user/settle/table", data);
  479. }
  480. /**
  481. * 用户清空购物车
  482. * @param {Object} data
  483. */
  484. export function emptyTableData(data) {
  485. return request.get("v2/user/empty/data", data);
  486. }