store.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  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 diyProductApi() {
  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(data) {
  248. return request.get('search/keyword', data, {
  249. noAuth: true
  250. });
  251. }
  252. /**
  253. * 获取搜索关键字获取
  254. *
  255. */
  256. export function getHotWordApi() {
  257. return request.get('search/hot_keyword', {}, {
  258. noAuth: true
  259. });
  260. }
  261. /**
  262. * 获取搜索销量评分商品列表
  263. *
  264. */
  265. export function getSearchRecommendApi(type) {
  266. return request.get(`search/recommend/${type}`, {}, {
  267. noAuth: true
  268. });
  269. }
  270. /**
  271. * 门店列表
  272. * @returns {*}
  273. */
  274. export function storeListApi(data) {
  275. return request.get("store_list", data, {
  276. noAuth: true
  277. });
  278. }
  279. /**
  280. * 套餐列表
  281. * @param int id
  282. *
  283. */
  284. export function storeDiscountsList(id) {
  285. return request.get('store_discounts/list/' + id, {}, {
  286. noAuth: true
  287. });
  288. }
  289. /**
  290. * 购车添加、减少、修改
  291. *
  292. */
  293. export function postCartNum(data) {
  294. return request.post('v2/set_cart_num', data);
  295. }
  296. /**
  297. * 获取首页的属性
  298. * @returns {*}
  299. */
  300. export function getAttr(id,type) {
  301. return request.get("v2/get_attr/"+id+"/"+type);
  302. }
  303. /**
  304. * 获取店员推广微信会员卡二维码
  305. */
  306. export function storeCardApi() {
  307. return request.get("store/staff/card/code");
  308. }
  309. /**
  310. * 分类列表-品牌列表
  311. */
  312. export function searchFilterApi(data) {
  313. return request.get("search/filter",data,{
  314. noAuth: true
  315. });
  316. }
  317. /**
  318. * 分类列表-同级分类
  319. */
  320. export function levelCategoryApi(data) {
  321. return request.get("level_category",data,{
  322. noAuth: true
  323. });
  324. }
  325. /**
  326. * 新人专享商品详情
  327. */
  328. export function newcomerDetail(id) {
  329. return request.get("marketing/newcomer/product_detail/"+id,{},{
  330. noAuth: true
  331. });
  332. }
  333. /**
  334. * 排行榜商品分类
  335. */
  336. export function rankCategoryApi() {
  337. return request.get("product/rank/category",{},{
  338. noAuth: true
  339. });
  340. }
  341. /**
  342. * 排行榜商品列表
  343. * @param {type} type 1:销量 2:评分
  344. * @param {data} 分页
  345. */
  346. export function rankListApi(type, data) {
  347. return request.get(`product/rank/${type}`,data,{
  348. noAuth: true
  349. });
  350. }
  351. /**
  352. * 搭配够商品列表
  353. * @param {id} 商品id
  354. * @param {data} 分页参数
  355. */
  356. export function matchPayListApi(id, data) {
  357. return request.get(`store_discounts/list/${id}`,data,{
  358. noAuth: true
  359. });
  360. }
  361. /**
  362. * 发起拼单
  363. * @param {Object} data
  364. */
  365. export function initCollage(data) {
  366. return request.get("v2/user/initiate/collage",data);
  367. }
  368. /**
  369. * 检查用户是否发起拼单
  370. */
  371. export function hasCollage() {
  372. return request.get("v2/is/user/initiate/collage");
  373. }
  374. /**
  375. * 检查拼单
  376. * @param {Object} data
  377. */
  378. export function getCollage(data) {
  379. return request.get("v2/is/initiate/collage", data);
  380. }
  381. /**
  382. * 获取用户拼单数据
  383. * @param {Object} data
  384. */
  385. export function getCollagePartake(data) {
  386. return request.get("v2/user/collage/partake", data);
  387. }
  388. /**
  389. * 复制他人拼单商品
  390. * @param {Object} data
  391. */
  392. export function duplicateCollagePartake(data) {
  393. return request.get("v2/duplicate/collage/partake", data);
  394. }
  395. /**
  396. * 用户清空拼单数据
  397. * @param {Object} data
  398. */
  399. export function emptyCollagePartake(data) {
  400. return request.get("v2/empty/collage/partake", data);
  401. }
  402. /**
  403. * 取消拼单
  404. * @param {Object} data
  405. */
  406. export function cancelCollage(data) {
  407. return request.get("v2/user/cancel", data);
  408. }
  409. /**
  410. * 结算拼单
  411. * @param {Object} data
  412. */
  413. export function settleCollage(data) {
  414. return request.get("v2/user/settle/collage", data);
  415. }
  416. /**
  417. * 验证是否在配送范围
  418. * @param {Object} data
  419. */
  420. export function isWithin(data) {
  421. return request.get("v2/is/within", data);
  422. }
  423. /**
  424. * 拼单购物车列表
  425. * @param {Object} data
  426. */
  427. export function getCollageCart(data) {
  428. return request.get("v2/user/initiate/collage/cart_list", data);
  429. }
  430. /**
  431. * 拼单用户购物车统计数量
  432. * @param {Object} data
  433. */
  434. export function getCollageCount(data) {
  435. return request.get("v2/user/initiate/collage/count", data);
  436. }
  437. /**
  438. * 用户添加拼单商品
  439. * @param {Object} data
  440. */
  441. export function addCollageCart(data) {
  442. return request.post('v2/add/collage/partake', data);
  443. }
  444. /**
  445. * 门店桌码配置
  446. */
  447. export function getTableData(data) {
  448. return request.get("v2/table/data", data);
  449. }
  450. /**
  451. * 记录桌码
  452. * @param {Object} data
  453. */
  454. export function addTableCode(data) {
  455. return request.get("v2/add/table/code", data);
  456. }
  457. /**
  458. * 检查桌码记录
  459. * @param {Object} data
  460. */
  461. export function isTableCode(data) {
  462. return request.get("v2/is/table/code", data);
  463. }
  464. /**
  465. * 处理换桌商品
  466. * @param {Object} data
  467. */
  468. export function changeTable(data) {
  469. return request.get("v2/changing/table", data);
  470. }
  471. /**
  472. * 购物车统计数量
  473. * @param {Object} data
  474. */
  475. export function getCartCount(data) {
  476. return request.get("v2/cart/count", data);
  477. }
  478. /**
  479. * 获取门店信息
  480. * @param {Object} data
  481. */
  482. export function getStoreData(data) {
  483. return request.get("v2/get/store/data", data);
  484. }
  485. /**
  486. * 获取购物车
  487. * @param {Object} data
  488. */
  489. export function getCateList(data) {
  490. return request.get("v2/get/cate/list", data);
  491. }
  492. /**
  493. * 用户添加桌码商品
  494. * @param {Object} data
  495. */
  496. export function addTableCate(data) {
  497. return request.get("v2/add/table/cate", data);
  498. }
  499. /**
  500. * 确认下单
  501. * @param {Object} data
  502. */
  503. export function placeOrder(data) {
  504. return request.get("v2/user/place/order", data);
  505. }
  506. /**
  507. * 用户清空购物车
  508. * @param {Object} data
  509. */
  510. export function emptyTableData(data) {
  511. return request.get("v2/user/empty/data", data);
  512. }
  513. /**
  514. * 获取桌码数据
  515. * @param {Object} data
  516. */
  517. export function getTablePartake(data) {
  518. return request.get("v2/get/table/partake", data);
  519. }
  520. /**
  521. * 获取二维码信息
  522. * @param {Object} data
  523. */
  524. export function getCodeData(data) {
  525. return request.get("v2/get/code/data", data);
  526. }
  527. /**
  528. * 获取桌码记录
  529. * @param {Object} data
  530. */
  531. export function getTableCode(data) {
  532. return request.get("v2/get/table/code", data);
  533. }
  534. /**
  535. * 桌码结账
  536. * @param {Object} data
  537. */
  538. export function settleTable(data) {
  539. return request.get("v2/user/settle/table", data);
  540. }