user.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812
  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. *
  14. */
  15. export function getUserInfo() {
  16. return request.get('user');
  17. }
  18. /**
  19. * 登录成功后更新公众号用户信息
  20. */
  21. export function updateWechatInfo(data) {
  22. return request.get('v2/user/wechat', data);
  23. }
  24. /**
  25. * 设置用户分享
  26. *
  27. */
  28. export function userShare() {
  29. return request.post('user/share');
  30. }
  31. /**
  32. * h5用户登录
  33. * @param data object 用户账号密码
  34. */
  35. export function loginH5(data) {
  36. return request.post("login", data, {
  37. noAuth: true
  38. });
  39. }
  40. /**
  41. * h5用户手机号登录
  42. * @param data object 用户手机号 也只能
  43. */
  44. export function loginMobile(data) {
  45. return request.post("login/mobile", data, {
  46. noAuth: true
  47. });
  48. }
  49. /**
  50. * 验证码key
  51. */
  52. export function getCodeApi() {
  53. return request.get("verify_code", {}, {
  54. noAuth: true
  55. });
  56. }
  57. /**
  58. * h5用户发送验证码
  59. * @param data object 用户手机号
  60. */
  61. export function registerVerify(data) {
  62. return request.post("register/verify", data, {
  63. noAuth: true
  64. });
  65. }
  66. /**
  67. * h5用户手机号注册
  68. * @param data object 用户手机号 验证码 密码
  69. */
  70. export function register(data) {
  71. return request.post("register", data, {
  72. noAuth: true
  73. });
  74. }
  75. /**
  76. * 用户手机号修改密码
  77. * @param data object 用户手机号 验证码 密码
  78. */
  79. export function registerReset(data) {
  80. return request.post("register/reset", data, {
  81. noAuth: true
  82. });
  83. }
  84. /**
  85. * 申请供应商接口
  86. *
  87. */
  88. export function applySupplier(id,data) {
  89. return request.post("user/apply/supplier/"+id, data, {
  90. noAuth: true
  91. });
  92. }
  93. /**
  94. * 供应商详情接口
  95. *
  96. */
  97. export function userApply(id) {
  98. return request.get("user/apply/"+id,{},{
  99. noAuth: true
  100. });
  101. }
  102. /**
  103. * 供应商记录接口
  104. *
  105. */
  106. export function recordList(id) {
  107. return request.get("user/apply/record",{},{
  108. noAuth: true
  109. });
  110. }
  111. /**
  112. * 获取用户中心菜单
  113. *
  114. */
  115. export function getMenuList() {
  116. return request.get("menu/user", {}, {
  117. noAuth: true
  118. });
  119. }
  120. /*
  121. * 签到用户信息
  122. * */
  123. export function postSignUser(sign) {
  124. return request.post("sign/user", sign);
  125. }
  126. /**
  127. * 获取签到配置
  128. *
  129. */
  130. export function getSignConfig() {
  131. return request.get('sign/config')
  132. }
  133. /**
  134. * 获取签到列表
  135. * @param object data
  136. */
  137. export function getSignList(data) {
  138. return request.get('sign/list', data);
  139. }
  140. /**
  141. * 用户签到
  142. */
  143. export function setSignIntegral() {
  144. return request.post('sign/integral')
  145. }
  146. /**
  147. * 签到列表(年月)
  148. * @param object data
  149. *
  150. */
  151. export function getSignMonthList(data) {
  152. return request.get('sign/month', data)
  153. }
  154. /**
  155. * 活动状态
  156. *
  157. */
  158. export function userActivity() {
  159. return request.get('user/activity');
  160. }
  161. /*
  162. * 资金明细(types|0=全部,1=消费,2=充值,3=返佣,4=提现)这个接口暂时废弃
  163. * */
  164. export function getCommissionInfo(q, types) {
  165. return request.get("spread/commission/" + types, q);
  166. }
  167. // 资金明细(types|0=全部,1=消费,2=充值,3=返佣,4=提现)
  168. export function moneyList(q, types) {
  169. return request.get("v2/user/money_list/" + types, q);
  170. }
  171. /*
  172. * 积分记录
  173. * */
  174. export function getIntegralList(q) {
  175. return request.get("integral/list", q);
  176. }
  177. /*
  178. * 活动积分
  179. * */
  180. export function getIntegralListAction(q) {
  181. return request.get(`award_integral/${q.type}`, q);
  182. }
  183. /*
  184. * 立即出局
  185. * */
  186. export function getIntegralListActionOut(q) {
  187. return request.post(`award_integral/${q.id}`,q);
  188. }
  189. /*
  190. * 佣金转能量
  191. * */
  192. export function energyImport(q) {
  193. return request.post(`energy/import`,q);
  194. }
  195. /*
  196. * 佣金互转
  197. * */
  198. export function brokerageTrade(q) {
  199. return request.post(`brokerage/trade`,q);
  200. }
  201. /*
  202. * 消费分互转
  203. * */
  204. export function integralTrade(q) {
  205. return request.post(`integral/trade`,q);
  206. }
  207. /**
  208. * 获取分销海报图片
  209. *
  210. */
  211. export function spreadBanner() {
  212. //#ifdef H5 || APP-PLUS
  213. return request.get('spread/banner', {
  214. type: 2
  215. });
  216. //#endif
  217. //#ifdef MP
  218. return request.get('spread/banner', {
  219. type: 1
  220. });
  221. //#endif
  222. }
  223. /**
  224. *
  225. * 获取推广用户一级和二级
  226. * @param object data
  227. */
  228. export function spreadPeople(data) {
  229. return request.post('spread/people', data);
  230. }
  231. /**
  232. *
  233. * 推广佣金/提现总和
  234. * @param int type
  235. */
  236. export function spreadCount(type) {
  237. return request.get('spread/count/' + type);
  238. }
  239. /*
  240. * 推广数据
  241. * */
  242. export function getSpreadInfo() {
  243. return request.get("commission");
  244. }
  245. /**
  246. *
  247. * 推广订单
  248. * @param object data
  249. */
  250. export function spreadOrder(data) {
  251. return request.post('spread/order', data);
  252. }
  253. /*
  254. * 获取推广人排行
  255. * */
  256. export function getRankList(q) {
  257. return request.get("rank", q);
  258. }
  259. /*
  260. * 获取佣金排名
  261. * */
  262. export function getBrokerageRank(q) {
  263. return request.get("brokerage_rank", q);
  264. }
  265. /**
  266. * 提现申请
  267. * @param object data
  268. */
  269. export function extractCash(data) {
  270. return request.post('extract/cash', data)
  271. }
  272. /**
  273. * 能量转股权
  274. * @param object data
  275. */
  276. export function energyExchange(data) {
  277. return request.post('energy/exchange', data)
  278. }
  279. /**
  280. * 提现银行/提现最低金额
  281. *
  282. */
  283. export function extractBank() {
  284. return request.get('extract/bank');
  285. }
  286. // 能量
  287. export function energyBank() {
  288. return request.get('energy/bank');
  289. }
  290. /**
  291. * 会员等级列表
  292. *
  293. */
  294. export function userLevelGrade() {
  295. return request.get('user/level/grade');
  296. }
  297. /**
  298. * 获取某个等级任务
  299. * @param int id 任务id
  300. */
  301. export function userLevelTask(id) {
  302. return request.get('user/level/task/' + id);
  303. }
  304. /**
  305. * 检查用户是否可以成为会员
  306. *
  307. */
  308. export function userLevelDetection() {
  309. return request.get('user/level/detection');
  310. }
  311. /**
  312. *
  313. * 地址列表
  314. * @param object data
  315. */
  316. export function getAddressList(data) {
  317. return request.get('address/list', data);
  318. }
  319. /**
  320. * 设置默认地址
  321. * @param int id
  322. */
  323. export function setAddressDefault(id) {
  324. return request.post('address/default/set', {
  325. id: id
  326. })
  327. }
  328. /**
  329. * 修改 添加地址
  330. * @param object data
  331. */
  332. export function editAddress(data) {
  333. return request.post('address/edit', data);
  334. }
  335. /**
  336. * 删除地址
  337. * @param int id
  338. *
  339. */
  340. export function delAddress(id) {
  341. return request.post('address/del', {
  342. id: id
  343. })
  344. }
  345. /**
  346. * 获取单个地址
  347. * @param int id
  348. */
  349. export function getAddressDetail(id) {
  350. return request.get('address/detail/' + id);
  351. }
  352. /**
  353. * 修改用户信息
  354. * @param object
  355. */
  356. export function userEdit(data) {
  357. return request.post('user/edit', data);
  358. }
  359. /*
  360. * 退出登录
  361. * */
  362. export function getLogout() {
  363. return request.get("logout");
  364. }
  365. /**
  366. * 小程序充值
  367. *
  368. */
  369. export function rechargeRoutine(data) {
  370. return request.post('recharge/routine', data)
  371. }
  372. /**
  373. * 充值
  374. *
  375. */
  376. export function rechargeRecharge(data) {
  377. return request.post('recharge/recharge', data)
  378. }
  379. /*
  380. * 公众号充值
  381. * */
  382. export function rechargeWechat(data) {
  383. return request.post("recharge/wechat", data);
  384. }
  385. /**
  386. * 获取默认地址
  387. *
  388. */
  389. export function getAddressDefault() {
  390. return request.get('address/default');
  391. }
  392. /**
  393. * 充值金额选择
  394. */
  395. export function getRechargeApi() {
  396. return request.get("recharge/index");
  397. }
  398. /**
  399. * 登陆记录
  400. */
  401. export function setVisit(data) {
  402. return request.post('user/set_visit', {
  403. ...data
  404. }, {
  405. noAuth: true
  406. });
  407. }
  408. /**
  409. * 客服列表
  410. */
  411. export function serviceList() {
  412. return request.get("user/service/list");
  413. }
  414. /**
  415. * 客服详情
  416. */
  417. export function getChatRecord(data) {
  418. return request.get("v2/user/service/record", data);
  419. }
  420. /**
  421. * 静默绑定推广人
  422. * @param {Object} puid
  423. */
  424. export function spread(puid) {
  425. return request.post("user/spread", puid);
  426. }
  427. /**
  428. * 会员详情
  429. */
  430. export function getlevelInfo() {
  431. return request.get("user/level/info");
  432. }
  433. /**
  434. * 会员经验列表
  435. */
  436. export function getlevelExpList(data) {
  437. return request.get("user/level/expList", data);
  438. }
  439. /**
  440. * 修改用户信息
  441. * @param {Object} data
  442. */
  443. export function updateUserInfo(data) {
  444. return request.post('v2/user/user_update', data);
  445. }
  446. /**
  447. * 微信直接手机号登录
  448. */
  449. export function phoneWxSilenceAuth(data) {
  450. return request.post('v2/phone_wx_silence_auth', data, {
  451. noAuth: true
  452. });
  453. }
  454. /**
  455. * 小程序直接手机号登录
  456. */
  457. export function phoneSilenceAuth(data) {
  458. return request.post('v2/phone_silence_auth', data, {
  459. noAuth: true
  460. });
  461. }
  462. /**
  463. * 用户发票列表
  464. * @param {Object} data
  465. */
  466. export function invoiceList(data) {
  467. return request.get('v2/invoice', data, {
  468. noAuth: true
  469. });
  470. }
  471. /**
  472. * 用户添加|修改发票
  473. * @param {Object} data
  474. */
  475. export function invoiceSave(data) {
  476. return request.post('v2/invoice/save', data, {
  477. noAuth: true
  478. });
  479. }
  480. /**
  481. * 用户删除发票
  482. * @param {Object} data
  483. */
  484. export function invoiceDelete(id) {
  485. return request.get('v2/invoice/del/' + id);
  486. }
  487. /**
  488. * 获取用户默认发票
  489. * @param {Object} type
  490. */
  491. export function invoiceDefault(type) {
  492. return request.get('v2/invoice/get_default/' + type);
  493. }
  494. /**
  495. * 用户单个发票详情
  496. * @param {Object} id
  497. */
  498. export function invoiceDetail(id) {
  499. return request.get('v2/invoice/detail/' + id);
  500. }
  501. /**
  502. * 订单申请开票
  503. * @param {Object} id
  504. */
  505. export function invoiceOrder(data) {
  506. return request.post('v2/order/make_up_invoice', data);
  507. }
  508. /**
  509. * 订单详情中申请开票
  510. * @param {Object} id
  511. */
  512. export function makeUpinvoice(data) {
  513. return request.post('v2/order/make_up_invoice', data);
  514. }
  515. /**
  516. * 会员卡主界面
  517. */
  518. export function memberCard() {
  519. return request.get('user/member/card/index');
  520. }
  521. /**
  522. * 卡密领取会员卡
  523. * @param {Object} data
  524. */
  525. export function memberCardDraw(data) {
  526. return request.post('user/member/card/draw', data);
  527. }
  528. /**
  529. * 购买会员卡
  530. * @param {Object} data
  531. */
  532. export function memberCardCreate(data) {
  533. return request.post('user/member/card/create', data);
  534. }
  535. /**
  536. * 会员优惠券
  537. */
  538. export function memberCouponsList() {
  539. return request.get('user/member/coupons/list');
  540. }
  541. /**
  542. * svip推荐商品
  543. * @param {Object} id
  544. */
  545. export function groomList(id, data) {
  546. return request.get(`groom/list/${id}`, data);
  547. }
  548. /**
  549. * 付费会员结束
  550. * @param {Object} data
  551. */
  552. export function memberOverdueTime(data) {
  553. return request.get('user/member/overdue/time', data);
  554. }
  555. /**
  556. * 新版分享海报信息获取
  557. */
  558. export function spreadMsg() {
  559. return request.get('user/spread_info');
  560. }
  561. /**
  562. * 已邀请/已下单好友
  563. */
  564. export function agentUserList(type, page, limit) {
  565. return request.get(`v2/agent/agent_user_list/${type}?page=${page}&limit=${limit}`);
  566. }
  567. /**
  568. * 获取用户推广获得收益,佣金轮播,分销规则
  569. */
  570. export function agentInfo() {
  571. return request.get(`v2/agent/agent_info`);
  572. }
  573. /**
  574. * 图片链接转base64
  575. */
  576. export function imgToBase(data) {
  577. return request.post('image_base64', data);
  578. }
  579. /**
  580. * 获取小程序二维码
  581. */
  582. export function routineCode(data) {
  583. return request.get('user/routine_code', data);
  584. }
  585. /**
  586. * 消息中心
  587. */
  588. export function serviceRecord(data) {
  589. return request.get('user/record', data);
  590. }
  591. /**
  592. * 消息中心-站内信列表
  593. */
  594. export function messageSystem(data) {
  595. return request.get('user/message_system/list', data);
  596. }
  597. /**
  598. * 消息中心-站内信列表详情
  599. */
  600. export function getMsgDetails(id) {
  601. return request.get('user/message_system/detail/' + id);
  602. }
  603. /**
  604. * 苹果账号登录
  605. * @param {Object} data
  606. */
  607. export function appleLogin(data) {
  608. return request.post('apple_login', data, {
  609. noAuth: true
  610. });
  611. }
  612. /*
  613. * 获取隐私协议
  614. * */
  615. export function getUserAgreement(type) {
  616. return request.get(`user_agreement/${type}`, {}, {
  617. noAuth: true
  618. });
  619. }
  620. /**
  621. * 获取分销等级列表
  622. * @param int id 任务id
  623. */
  624. export function agentLevelList() {
  625. return request.get('v2/agent/level_list');
  626. }
  627. /**
  628. * 获取分销任务列表
  629. * @param int id 任务id
  630. */
  631. export function agentLevelTaskList(id) {
  632. return request.get('v2/agent/level_task_list?id=' + id);
  633. }
  634. /**
  635. * 获取定位详细地址
  636. * @param int id
  637. *
  638. */
  639. export function getGeocoder(data) {
  640. return request.get(`geoLbscoder?location=${data.lat},${data.long}`, {}, {
  641. noAuth: true
  642. });
  643. }
  644. /**
  645. * 获取当前定位选中的地址
  646. * @param int id
  647. *
  648. */
  649. export function getCityList(address) {
  650. return request.get('v2/cityList', {
  651. address
  652. }, {
  653. noAuth: true
  654. });
  655. }
  656. /**
  657. * 获取版权
  658. *
  659. */
  660. export function getCopyRight() {
  661. return request.get('get_copyright', {}, {
  662. noAuth: true
  663. });
  664. }
  665. /**
  666. * 获取code码
  667. * @param int id
  668. *
  669. */
  670. export function getRandCode() {
  671. return request.get('user/rand_code');
  672. }
  673. /**
  674. * 注销用户
  675. * @param int id
  676. *
  677. */
  678. export function cancelUser() {
  679. return request.get('cancel/user');
  680. }
  681. /**
  682. * 获取激活会员卡需要的信息
  683. * @param int id
  684. *
  685. */
  686. export function levelInfo() {
  687. return request.get('user/level/activate_info');
  688. }
  689. /**
  690. * 用户激活会员卡
  691. * @param int id
  692. *
  693. */
  694. export function levelActivate(data) {
  695. return request.post('user/level/activate',data);
  696. }
  697. // 获取认证信息
  698. export function rate(data) {
  699. return request.get('rate',data);
  700. }
  701. //实名认证获取验证码
  702. export function checkUser(data) {
  703. return request.post('user/check',data);
  704. }
  705. export function realName(data) {
  706. return request.post('rname',data);
  707. }