user.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754
  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. */
  181. export function spreadBanner() {
  182. //#ifdef H5 || APP-PLUS
  183. return request.get('spread/banner', {
  184. type: 2
  185. });
  186. //#endif
  187. //#ifdef MP
  188. return request.get('spread/banner', {
  189. type: 1
  190. });
  191. //#endif
  192. }
  193. /**
  194. *
  195. * 获取推广用户一级和二级
  196. * @param object data
  197. */
  198. export function spreadPeople(data) {
  199. return request.post('spread/people', data);
  200. }
  201. /**
  202. *
  203. * 推广佣金/提现总和
  204. * @param int type
  205. */
  206. export function spreadCount(type) {
  207. return request.get('spread/count/' + type);
  208. }
  209. /*
  210. * 推广数据
  211. * */
  212. export function getSpreadInfo() {
  213. return request.get("commission");
  214. }
  215. /**
  216. *
  217. * 推广订单
  218. * @param object data
  219. */
  220. export function spreadOrder(data) {
  221. return request.post('spread/order', data);
  222. }
  223. /*
  224. * 获取推广人排行
  225. * */
  226. export function getRankList(q) {
  227. return request.get("rank", q);
  228. }
  229. /*
  230. * 获取佣金排名
  231. * */
  232. export function getBrokerageRank(q) {
  233. return request.get("brokerage_rank", q);
  234. }
  235. /**
  236. * 提现申请
  237. * @param object data
  238. */
  239. export function extractCash(data) {
  240. return request.post('extract/cash', data)
  241. }
  242. /**
  243. * 提现银行/提现最低金额
  244. *
  245. */
  246. export function extractBank() {
  247. return request.get('extract/bank');
  248. }
  249. /**
  250. * 会员等级列表
  251. *
  252. */
  253. export function userLevelGrade() {
  254. return request.get('user/level/grade');
  255. }
  256. /**
  257. * 获取某个等级任务
  258. * @param int id 任务id
  259. */
  260. export function userLevelTask(id) {
  261. return request.get('user/level/task/' + id);
  262. }
  263. /**
  264. * 检查用户是否可以成为会员
  265. *
  266. */
  267. export function userLevelDetection() {
  268. return request.get('user/level/detection');
  269. }
  270. /**
  271. *
  272. * 地址列表
  273. * @param object data
  274. */
  275. export function getAddressList(data) {
  276. return request.get('address/list', data);
  277. }
  278. /**
  279. * 设置默认地址
  280. * @param int id
  281. */
  282. export function setAddressDefault(id) {
  283. return request.post('address/default/set', {
  284. id: id
  285. })
  286. }
  287. /**
  288. * 修改 添加地址
  289. * @param object data
  290. */
  291. export function editAddress(data) {
  292. return request.post('address/edit', data);
  293. }
  294. /**
  295. * 删除地址
  296. * @param int id
  297. *
  298. */
  299. export function delAddress(id) {
  300. return request.post('address/del', {
  301. id: id
  302. })
  303. }
  304. /**
  305. * 获取单个地址
  306. * @param int id
  307. */
  308. export function getAddressDetail(id) {
  309. return request.get('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.get("logout");
  323. }
  324. /**
  325. * 小程序充值
  326. *
  327. */
  328. export function rechargeRoutine(data) {
  329. return request.post('recharge/routine', data)
  330. }
  331. /**
  332. * 充值
  333. *
  334. */
  335. export function rechargeRecharge(data) {
  336. return request.post('recharge/recharge', data)
  337. }
  338. /*
  339. * 公众号充值
  340. * */
  341. export function rechargeWechat(data) {
  342. return request.post("recharge/wechat", 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("recharge/index");
  356. }
  357. /**
  358. * 登陆记录
  359. */
  360. export function setVisit(data) {
  361. return request.post('user/set_visit', {
  362. ...data
  363. }, {
  364. noAuth: true
  365. });
  366. }
  367. /**
  368. * 客服列表
  369. */
  370. export function serviceList() {
  371. return request.get("user/service/list");
  372. }
  373. /**
  374. * 客服详情
  375. */
  376. export function getChatRecord(data) {
  377. return request.get("v2/user/service/record", data);
  378. }
  379. /**
  380. * 静默绑定推广人
  381. * @param {Object} puid
  382. */
  383. export function spread(puid) {
  384. return request.post("user/spread", puid);
  385. }
  386. /**
  387. * 会员详情
  388. */
  389. export function getlevelInfo() {
  390. return request.get("user/level/info");
  391. }
  392. /**
  393. * 会员经验列表
  394. */
  395. export function getlevelExpList(data) {
  396. return request.get("user/level/expList", data);
  397. }
  398. /**
  399. * 修改用户信息
  400. * @param {Object} data
  401. */
  402. export function updateUserInfo(data) {
  403. return request.post('v2/user/user_update', data);
  404. }
  405. /**
  406. * 微信直接手机号登录
  407. */
  408. export function phoneWxSilenceAuth(data) {
  409. return request.post('v2/phone_wx_silence_auth', data, {
  410. noAuth: true
  411. });
  412. }
  413. /**
  414. * 小程序直接手机号登录
  415. */
  416. export function phoneSilenceAuth(data) {
  417. return request.post('v2/phone_silence_auth', data, {
  418. noAuth: true
  419. });
  420. }
  421. /**
  422. * 用户发票列表
  423. * @param {Object} data
  424. */
  425. export function invoiceList(data) {
  426. return request.get('v2/invoice', data, {
  427. noAuth: true
  428. });
  429. }
  430. /**
  431. * 用户添加|修改发票
  432. * @param {Object} data
  433. */
  434. export function invoiceSave(data) {
  435. return request.post('v2/invoice/save', data, {
  436. noAuth: true
  437. });
  438. }
  439. /**
  440. * 用户删除发票
  441. * @param {Object} data
  442. */
  443. export function invoiceDelete(id) {
  444. return request.get('v2/invoice/del/' + id);
  445. }
  446. /**
  447. * 获取用户默认发票
  448. * @param {Object} type
  449. */
  450. export function invoiceDefault(type) {
  451. return request.get('v2/invoice/get_default/' + type);
  452. }
  453. /**
  454. * 用户单个发票详情
  455. * @param {Object} id
  456. */
  457. export function invoiceDetail(id) {
  458. return request.get('v2/invoice/detail/' + id);
  459. }
  460. /**
  461. * 订单申请开票
  462. * @param {Object} id
  463. */
  464. export function invoiceOrder(data) {
  465. return request.post('v2/order/make_up_invoice', data);
  466. }
  467. /**
  468. * 订单详情中申请开票
  469. * @param {Object} id
  470. */
  471. export function makeUpinvoice(data) {
  472. return request.post('v2/order/make_up_invoice', data);
  473. }
  474. /**
  475. * 会员卡主界面
  476. */
  477. export function memberCard() {
  478. return request.get('user/member/card/index');
  479. }
  480. /**
  481. * 卡密领取会员卡
  482. * @param {Object} data
  483. */
  484. export function memberCardDraw(data) {
  485. return request.post('user/member/card/draw', data);
  486. }
  487. /**
  488. * 购买会员卡
  489. * @param {Object} data
  490. */
  491. export function memberCardCreate(data) {
  492. return request.post('user/member/card/create', data);
  493. }
  494. /**
  495. * 会员优惠券
  496. */
  497. export function memberCouponsList() {
  498. return request.get('user/member/coupons/list');
  499. }
  500. /**
  501. * svip推荐商品
  502. * @param {Object} id
  503. */
  504. export function groomList(id, data) {
  505. return request.get(`groom/list/${id}`, data);
  506. }
  507. /**
  508. * 付费会员结束
  509. * @param {Object} data
  510. */
  511. export function memberOverdueTime(data) {
  512. return request.get('user/member/overdue/time', data);
  513. }
  514. /**
  515. * 新版分享海报信息获取
  516. */
  517. export function spreadMsg() {
  518. return request.get('user/spread_info');
  519. }
  520. /**
  521. * 已邀请/已下单好友
  522. */
  523. export function agentUserList(type, page, limit) {
  524. return request.get(`v2/agent/agent_user_list/${type}?page=${page}&limit=${limit}`);
  525. }
  526. /**
  527. * 获取用户推广获得收益,佣金轮播,分销规则
  528. */
  529. export function agentInfo() {
  530. return request.get(`v2/agent/agent_info`);
  531. }
  532. /**
  533. * 图片链接转base64
  534. */
  535. export function imgToBase(data) {
  536. return request.post('image_base64', data);
  537. }
  538. /**
  539. * 获取小程序二维码
  540. */
  541. export function routineCode(data) {
  542. return request.get('user/routine_code', data);
  543. }
  544. /**
  545. * 消息中心
  546. */
  547. export function serviceRecord(data) {
  548. return request.get('user/record', data);
  549. }
  550. /**
  551. * 消息中心-站内信列表
  552. */
  553. export function messageSystem(data) {
  554. return request.get('user/message_system/list', data);
  555. }
  556. /**
  557. * 消息中心-站内信列表详情
  558. */
  559. export function getMsgDetails(id) {
  560. return request.get('user/message_system/detail/' + id);
  561. }
  562. /**
  563. * 苹果账号登录
  564. * @param {Object} data
  565. */
  566. export function appleLogin(data) {
  567. return request.post('apple_login', data, {
  568. noAuth: true
  569. });
  570. }
  571. /*
  572. * 获取隐私协议
  573. * */
  574. export function getUserAgreement(type) {
  575. return request.get(`user_agreement/${type}`, {}, {
  576. noAuth: true
  577. });
  578. }
  579. /**
  580. * 获取分销等级列表
  581. * @param int id 任务id
  582. */
  583. export function agentLevelList() {
  584. return request.get('v2/agent/level_list');
  585. }
  586. /**
  587. * 获取分销任务列表
  588. * @param int id 任务id
  589. */
  590. export function agentLevelTaskList(id) {
  591. return request.get('v2/agent/level_task_list?id=' + id);
  592. }
  593. /**
  594. * 获取定位详细地址
  595. * @param int id
  596. *
  597. */
  598. export function getGeocoder(data) {
  599. return request.get(`geoLbscoder?location=${data.lat},${data.long}`, {}, {
  600. noAuth: true
  601. });
  602. }
  603. /**
  604. * 获取当前定位选中的地址
  605. * @param int id
  606. *
  607. */
  608. export function getCityList(address) {
  609. return request.get('v2/cityList', {
  610. address
  611. }, {
  612. noAuth: true
  613. });
  614. }
  615. /**
  616. * 获取版权
  617. *
  618. */
  619. export function getCopyRight() {
  620. return request.get('get_copyright', {}, {
  621. noAuth: true
  622. });
  623. }
  624. /**
  625. * 获取code码
  626. * @param int id
  627. *
  628. */
  629. export function getRandCode() {
  630. return request.get('user/rand_code');
  631. }
  632. /**
  633. * 注销用户
  634. * @param int id
  635. *
  636. */
  637. export function cancelUser() {
  638. return request.get('cancel/user');
  639. }
  640. /**
  641. * 获取激活会员卡需要的信息
  642. * @param int id
  643. *
  644. */
  645. export function levelInfo() {
  646. return request.get('user/level/activate_info');
  647. }
  648. /**
  649. * 用户激活会员卡
  650. * @param int id
  651. *
  652. */
  653. export function levelActivate(data) {
  654. return request.post('user/level/activate',data);
  655. }