user.js 12 KB

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