user.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778
  1. // +----------------------------------------------------------------------
  2. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  3. // +----------------------------------------------------------------------
  4. // | Copyright (c) 2016~2024 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. import Cache from '@/utils/cache'
  12. /**
  13. * 获取用户信息
  14. *
  15. */
  16. export function getUserInfo() {
  17. return request.get('user');
  18. }
  19. /**
  20. * 头像
  21. *
  22. */
  23. export function editAvatar(data) {
  24. return request.post('user/change/info',data);
  25. }
  26. // 修改昵称
  27. export function updateInfo(data) {
  28. return request.post('user/change/avatar',data);
  29. }
  30. /**
  31. * h5用户登录
  32. * @param data object 用户账号密码
  33. */
  34. export function loginH5(data) {
  35. return request.post("auth/login", data, {
  36. noAuth: true
  37. });
  38. }
  39. /**
  40. * h5用户手机号登录
  41. * @param data object 用户手机号 也只能
  42. */
  43. export function loginMobile(data) {
  44. return request.post("auth/smslogin", data, {
  45. noAuth: true
  46. });
  47. }
  48. /**
  49. * h5用户手机号登录
  50. * @param data object
  51. */
  52. export function loginMpPhone(data) {
  53. return request.post("auth/mp_phone", data, {
  54. noAuth: true
  55. });
  56. }
  57. /**
  58. * h5获取登录授权auth_token
  59. * @param data object
  60. */
  61. export function getAuthType(data) {
  62. return request.post("auth/mp_login_type", data, {
  63. noAuth: true
  64. });
  65. }
  66. /**
  67. * 验证码key
  68. */
  69. export function getCodeApi() {
  70. return request.get("verify_code", {}, {
  71. noAuth: true
  72. });
  73. }
  74. /**
  75. * h5用户发送验证码
  76. * @param data object 用户手机号
  77. */
  78. export function registerVerify(data) {
  79. return request.post("auth/verify", data, {
  80. noAuth: true
  81. });
  82. }
  83. /**
  84. * h5用户手机号注册
  85. * @param data object 用户手机号 验证码 密码
  86. */
  87. export function register(data) {
  88. return request.post("auth/register", data, {
  89. noAuth: true
  90. });
  91. }
  92. /**
  93. * 用户手机号修改密码
  94. * @param data object 用户手机号 验证码 密码
  95. */
  96. export function registerReset(data) {
  97. return request.post("/register/reset", data, {
  98. noAuth: true
  99. });
  100. }
  101. /**
  102. * 用户手机号忘记密码
  103. */
  104. export function registerForget(data) {
  105. return request.post("user/change_pwd", data, {
  106. noAuth: true
  107. });
  108. }
  109. /**
  110. * 获取用户中心菜单
  111. *
  112. */
  113. export function getMenuList() {
  114. return request.get("common/menus",{},{noAuth: true});
  115. }
  116. /*
  117. * 签到用户信息
  118. * */
  119. export function getSignUser() {
  120. return request.get("user/sign/info");
  121. }
  122. /**
  123. * 获取签到配置
  124. *
  125. */
  126. export function getSignConfig() {
  127. return request.get('sign/config')
  128. }
  129. /**
  130. * 获取签到列表
  131. * @param object data
  132. */
  133. export function getSignList(data) {
  134. return request.get('user/sign/lst', data);
  135. }
  136. /**
  137. * 用户签到
  138. */
  139. export function setSignIntegral() {
  140. return request.post('user/sign/create')
  141. }
  142. /**
  143. * 签到列表(年月)
  144. * @param object data
  145. *
  146. */
  147. export function getSignMonthList(data) {
  148. return request.get('user/sign/month', data)
  149. }
  150. /**
  151. * 活动状态
  152. *
  153. */
  154. export function userActivity() {
  155. return request.get('user/activity');
  156. }
  157. /*
  158. * 资金明细(types|0=全部,1=消费,2=充值,3=返佣)
  159. * */
  160. export function getCommissionInfo(q, types) {
  161. return request.get("user/bill", q);
  162. }
  163. /*
  164. * 提现列表
  165. * */
  166. export function extractLst(data) {
  167. return request.get("user/extract/lst", data);
  168. }
  169. /*
  170. * 积分记录
  171. * */
  172. export function getIntegralList(data) {
  173. return request.get("user/integral/lst", data);
  174. }
  175. /*
  176. * 消费券记录
  177. * */
  178. export function getCashList(data) {
  179. return request.get("user/cash/lst", data);
  180. }
  181. /**
  182. * 获取分销海报图片
  183. *
  184. */
  185. export function spreadBanner() {
  186. //#ifdef H5
  187. return request.get('user/spread_image', {
  188. type: 'wechat'
  189. });
  190. //#endif
  191. //#ifdef MP
  192. return request.get('user/spread_image', {
  193. type: 'routine'
  194. });
  195. //#endif
  196. }
  197. /**
  198. *
  199. * 获取推广用户一级和二级
  200. * @param object data
  201. */
  202. export function spreadPeople(data) {
  203. return request.get('user/spread_list', data);
  204. }
  205. /**
  206. *
  207. * 推广佣金/提现总和
  208. * @param int type
  209. */
  210. export function spreadCount(type) {
  211. return request.get('spread/count/' + type);
  212. }
  213. /*
  214. * 推广数据
  215. * */
  216. export function getSpreadInfo() {
  217. return request.get("/commission");
  218. }
  219. /**
  220. *
  221. * 推广订单
  222. * @param object data
  223. */
  224. export function spreadOrder(data) {
  225. return request.get('user/spread_order', data);
  226. }
  227. /*
  228. * 获取推广人排行
  229. * */
  230. export function getRankList(data) {
  231. return request.get("user/spread_top", data);
  232. }
  233. /*
  234. * 获取佣金排名
  235. * */
  236. export function getBrokerageRank(q) {
  237. return request.get("user/brokerage_top", q);
  238. }
  239. /**
  240. * 提现申请
  241. * @param object data
  242. */
  243. export function extractCash(data) {
  244. return request.post('user/extract/create', data)
  245. }
  246. /**
  247. * 提现银行/提现最低金额
  248. *
  249. */
  250. export function extractBank() {
  251. return request.get('user/extract/banklst');
  252. }
  253. /**
  254. * 会员等级列表
  255. *
  256. */
  257. export function userLevelGrade() {
  258. return request.get('user/level/grade');
  259. }
  260. /**
  261. * 获取某个等级任务
  262. * @param int id 任务id
  263. */
  264. export function userLevelTask(id) {
  265. return request.get('user/level/task/' + id);
  266. }
  267. /**
  268. * 检查用户是否可以成为会员
  269. *
  270. */
  271. export function userLevelDetection() {
  272. return request.get('user/level/detection');
  273. }
  274. /**
  275. *
  276. * 地址列表
  277. * @param object data
  278. */
  279. export function getAddressList(data) {
  280. return request.get('user/address/lst', data);
  281. }
  282. /**
  283. * 设置默认地址
  284. * @param int id
  285. */
  286. export function setAddressDefault(id) {
  287. return request.post('user/address/update/' + id)
  288. }
  289. /**
  290. * 修改 添加地址
  291. * @param object data
  292. */
  293. export function editAddress(data) {
  294. return request.post('user/address/create', data);
  295. }
  296. /**
  297. * 删除地址
  298. * @param int id
  299. *
  300. */
  301. export function delAddress(id) {
  302. return request.post('user/address/delete/' + id)
  303. }
  304. /**
  305. * 获取单个地址
  306. * @param int id
  307. */
  308. export function getAddressDetail(id) {
  309. return request.get('user/address/detail/' + id);
  310. }
  311. /**
  312. * 修改用户信息
  313. * @param object
  314. */
  315. export function userEdit(data) {
  316. return request.post('user/edit', data);
  317. }
  318. /*
  319. * 退出登录
  320. * */
  321. export function getLogout() {
  322. return request.post("logout");
  323. }
  324. /**
  325. * 佣金转入
  326. *
  327. */
  328. export function rechargeBrokerage(data) {
  329. return request.post('user/recharge/brokerage', data)
  330. }
  331. /**
  332. * 小程序充值
  333. *
  334. */
  335. export function rechargeRoutine(data) {
  336. return request.post('recharge/routine', data)
  337. }
  338. /*
  339. * 公众号充值
  340. * */
  341. export function rechargeWechat(data) {
  342. return request.post("user/recharge", data);
  343. }
  344. /**
  345. * 获取默认地址
  346. *
  347. */
  348. export function getAddressDefault() {
  349. return request.get('address/default');
  350. }
  351. /**
  352. * 充值金额选择
  353. */
  354. export function getRechargeApi() {
  355. return request.get("common/recharge_quota");
  356. }
  357. /**
  358. * 登陆记录
  359. */
  360. export function setVisit(data) {
  361. return request.post('user/set_visit', { ...data
  362. }, {
  363. noAuth: true
  364. });
  365. }
  366. /**
  367. * 客服列表
  368. */
  369. export function serviceList(data) {
  370. return request.get("service/list", data);
  371. }
  372. /**
  373. * 客服列表
  374. */
  375. export function serviceLogin(key, data) {
  376. return request.post("service/scan_login/" + key, data);
  377. }
  378. /**
  379. * 客服获取客户列表
  380. */
  381. export function serviceUserList(mer_id, data) {
  382. return request.get("service/user_list/"+mer_id, data);
  383. }
  384. /**
  385. * 用户获取聊天记录详情
  386. */
  387. export function getChatRecord(to_uid, data) {
  388. return request.get("service/history/" + to_uid, data);
  389. }
  390. /**
  391. * 客服获取聊天记录详情
  392. */
  393. export function getMerHistory(userid, mer_id, data) {
  394. return request.get("service/mer_history/" + mer_id + '/' + userid, data);
  395. }
  396. /**
  397. * 静默绑定推广人
  398. * @param {Object} puid
  399. */
  400. export function spread(puid) {
  401. Cache.set("spread", puid || 0);
  402. return request.post("user/spread", {
  403. spread_spid: puid
  404. });
  405. }
  406. /**
  407. * 反馈类型
  408. */
  409. export function feedbackType() {
  410. return request.get("common/feedback_type");
  411. }
  412. /**
  413. * 提交反馈
  414. */
  415. export function feedback(data) {
  416. return request.post("user/feedback", { ...data
  417. });
  418. }
  419. /**
  420. * 反馈列表
  421. */
  422. export function feedbackList(data) {
  423. return request.get("user/feedback/list", data);
  424. }
  425. /**
  426. * 反馈列表
  427. */
  428. export function feedbackDetail(id) {
  429. return request.get("user/feedback/detail/" + id);
  430. }
  431. /**
  432. * 浏览记录
  433. */
  434. export function historyList(data) {
  435. return request.get("user/history", data);
  436. }
  437. /**
  438. * 删除浏览记录
  439. */
  440. export function historyDelete(id) {
  441. return request.post("user/history/delete/" + id);
  442. }
  443. /**
  444. * 批量删除浏览记录
  445. */
  446. export function historyBatchDelete(data) {
  447. return request.post("user/history/batch/delete", data);
  448. }
  449. /**
  450. * 批量收藏浏览记录
  451. */
  452. export function historyBatchCollect(data) {
  453. return request.post("user/relation/batch/create", data);
  454. }
  455. /**
  456. * 佣金记录
  457. */
  458. export function brokerage_list(data) {
  459. return request.get("user/brokerage_list", data);
  460. }
  461. /**
  462. * 佣金数据
  463. */
  464. export function spreadInfo() {
  465. return request.get("user/spread_info");
  466. }
  467. // 图片验证码
  468. export function getCaptcha() {
  469. return request.get('captcha', {}, {
  470. noAuth: true
  471. });
  472. }
  473. // 用户账户列表
  474. export function userAcc() {
  475. return request.get('user/account', {}, {
  476. noAuth: true
  477. });
  478. }
  479. // 创建发票
  480. export function invoiceSave(data) {
  481. return request.post('user/receipt/create', data);
  482. }
  483. // 编辑发票
  484. export function invoiceUpdate(id, data) {
  485. return request.post('user/receipt/update/' + id, data);
  486. }
  487. // 获取默认发票
  488. export function invoiceDefault(id) {
  489. return request.post('user/receipt/is_default/' + id);
  490. }
  491. // 发票抬头--列表
  492. export function invoice(data) {
  493. return request.get('user/receipt/lst', data);
  494. }
  495. // 发票抬头--删除
  496. export function invoiceDelete(id) {
  497. return request.post('user/receipt/delete/' + id);
  498. }
  499. // 发票--详情
  500. export function invoiceDetail(id) {
  501. return request.get('user/receipt/detail/' + id);
  502. }
  503. /**
  504. * 新版分享海报信息获取
  505. *
  506. */
  507. export function spreadMsg(data) {
  508. return request.get('user/v2/spread_image', data);
  509. }
  510. /**
  511. * 图片链接转base64
  512. *
  513. */
  514. export function imgToBase(data) {
  515. return request.post('common/base64', data, {noAuth: true});
  516. }
  517. /**
  518. * 获取协议
  519. *
  520. */
  521. export function getAgreementApi(key) {
  522. return request.get('agreement/'+key,{},{noAuth: true});
  523. }
  524. /**
  525. * 获取协议
  526. *
  527. */
  528. export function getIntegralInfo() {
  529. return request.get('user/integral/info');
  530. }
  531. /**
  532. * 获取店铺列表
  533. *
  534. */
  535. export function getStoreList(data) {
  536. return request.get('user/services', data);
  537. }
  538. /*
  539. 获取佣金说明
  540. */
  541. export function commissionDescription() {
  542. return request.get('agreement/sys_extension_agree')
  543. }
  544. /*
  545. 获取用户分销等级信息
  546. */
  547. export function getBrokerageInfo() {
  548. return request.get('user/brokerage/info')
  549. }
  550. /*
  551. 获取用户分销等级表格数据
  552. */
  553. export function getBrokerageGrade() {
  554. return request.get('user/brokerage/all')
  555. }
  556. /*
  557. 分销员升级提醒
  558. */
  559. export function brokerageNotice(data) {
  560. return request.get(`user/brokerage/notice`, data)
  561. }
  562. /*
  563. 口令解析
  564. */
  565. export function pwdResolution(data) {
  566. return request.get(`command/copy?key=${data}`)
  567. }
  568. /*
  569. 获取佣金说明
  570. */
  571. export function getInstructions(key) {
  572. return request.get(`agreement/${key}`)
  573. }
  574. /*
  575. 会员信息
  576. */
  577. export function memberInfo() {
  578. return request.get('user/member/info')
  579. }
  580. /**
  581. * 成长值记录
  582. * @param object data
  583. *
  584. */
  585. export function growthValueRecord(data) {
  586. return request.get('user/member/log', data)
  587. }
  588. /**
  589. * 协议规则列表
  590. * @param object data
  591. *
  592. */
  593. export function cacheLst() {
  594. return request.get('agreement_lst',{}, {noAuth: true})
  595. }
  596. /**
  597. * 协议规则列表对应的数据
  598. * @param object data
  599. *
  600. */
  601. export function cacheInfo(key) {
  602. return request.get(`agreement/${key}`,{}, {noAuth: true})
  603. }
  604. /**
  605. * 注销账户
  606. * @param object data
  607. *
  608. */
  609. export function userOut(data) {
  610. return request.post(`user/cancel`, data)
  611. }
  612. /**
  613. * 获取聊天用户信息
  614. * @param object data
  615. *
  616. */
  617. export function serviceUser(merId, uid) {
  618. return request.get(`service/user/${merId}/${uid}`)
  619. }
  620. /**
  621. * 保存聊天用户备注
  622. * @param object data
  623. *
  624. */
  625. export function serviceSaveMark(merId, uid, mark) {
  626. return request.post(`service/mark/${merId}/${uid}`, {mark})
  627. }
  628. /**
  629. * 获取会员卡类型
  630. * @param object data
  631. *
  632. */
  633. export function memberCard() {
  634. return request.get(`svip/pay_lst`)
  635. }
  636. /**
  637. * 开通付费会员--支付
  638. * @param object data
  639. *
  640. */
  641. export function memberCardCreate(id, data) {
  642. return request.post(`svip/pay/${id}`, data)
  643. }
  644. /**
  645. * 付费会员权益
  646. * @param object data
  647. *
  648. */
  649. export function memberEquity() {
  650. return request.get(`svip/user_info`, {}, {noAuth: true})
  651. }
  652. /**
  653. * 付费会员优惠券
  654. * @param object data
  655. *
  656. */
  657. export function memberCouponLst() {
  658. return request.get(`svip/coupon_lst`, {}, {noAuth: true})
  659. }
  660. /**
  661. * 付费会员优惠券--领取
  662. * @param object data
  663. *
  664. */
  665. export function receiveMemberCoupon(id) {
  666. return request.post(`svip/coupon_receive/${id}`)
  667. }
  668. /**
  669. * 付费会员--会员商品
  670. * @param object data
  671. *
  672. */
  673. export function groomList(data) {
  674. return request.get(`svip/product_lst`, data, {noAuth: true})
  675. }
  676. /**
  677. * 客服聊天--撤回消息
  678. * @param object data
  679. *
  680. */
  681. export function chatReverstApi(id) {
  682. return request.post(`service/recall/${id}`)
  683. }
  684. /**
  685. * 客服聊天--判断店铺是否有在线客服
  686. * @param object data
  687. *
  688. */
  689. export function hasServiceApi(id) {
  690. return request.get(`has_service/${id}`)
  691. }
  692. /**
  693. * 银行卡提现--银行卡信息
  694. * @param object data
  695. *
  696. */
  697. export function getBankInfo() {
  698. return request.get(`user/extract/history_bank`)
  699. }
  700. /**
  701. * 用户设置--信息
  702. * @param object data
  703. *
  704. */
  705. export function getUserSetting() {
  706. return request.get(`user/fields/info`)
  707. }
  708. /**
  709. * 用户设置--修改
  710. * @param object data
  711. *
  712. */
  713. export function userSettingEdit(data) {
  714. return request.post(`user/fields/save`, data)
  715. }
  716. /**
  717. * 报名活动--详情
  718. * @param object data
  719. *
  720. */
  721. export function registrateDetail(id) {
  722. return request.get(`system/form/detail/${id}`,{}, {noAuth: true})
  723. }
  724. /**
  725. * 报名活动--提交数据
  726. * @param object data
  727. *
  728. */
  729. export function registrateCreate(id,data) {
  730. return request.post(`user/form/create/${id}`, data)
  731. }
  732. /**
  733. * 报名活动--列表
  734. * @param object data
  735. *
  736. */
  737. export function getRechargeList(data) {
  738. return request.get(`system/form/lst`, data, {noAuth: true})
  739. }
  740. /**
  741. * 报名活动--记录
  742. * @param object data
  743. *
  744. */
  745. export function getRechargeRecordList(data) {
  746. return request.get(`user/form/lst`, data)
  747. }
  748. /**
  749. * 报名活动--分享海报
  750. * @param object data
  751. *
  752. */
  753. export function registratePoster(id) {
  754. return request.get(`system/form/share_posters/${id}`, {})
  755. }
  756. /**
  757. * 报名活动--提交记录详情
  758. * @param object data
  759. *
  760. */
  761. export function registrateRecordDetail(id) {
  762. return request.get(`user/form/show/${id}`)
  763. }
  764. /**
  765. * 系统表单--表单详情数据
  766. * @param object data
  767. *
  768. */
  769. export function systemFormData(id) {
  770. return request.get(`system/form/info/${id}`, {}, {noAuth: true})
  771. }