user.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715
  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. export function rechargeWechat(data) {
  308. return request.post("recharge/wechat", data);
  309. }
  310. /**
  311. * 获取默认地址
  312. *
  313. */
  314. export function getAddressDefault() {
  315. return request.get('address/default');
  316. }
  317. /**
  318. * 充值金额选择
  319. */
  320. export function getRechargeApi() {
  321. return request.get("recharge/index");
  322. }
  323. /**
  324. * 登陆记录
  325. */
  326. export function setVisit(data) {
  327. return request.post('user/set_visit', {
  328. ...data
  329. }, {
  330. noAuth: true
  331. });
  332. }
  333. /**
  334. * 客服列表
  335. */
  336. export function serviceList() {
  337. return request.get("user/service/list");
  338. }
  339. /**
  340. * 客服详情
  341. */
  342. export function getChatRecord(data) {
  343. return request.get("v2/user/service/record", data);
  344. }
  345. /**
  346. * 静默绑定推广人
  347. * @param {Object} puid
  348. */
  349. export function spread(puid) {
  350. return request.post("user/spread", puid);
  351. }
  352. /**
  353. * 会员详情
  354. */
  355. export function getlevelInfo() {
  356. return request.get("user/level/info");
  357. }
  358. /**
  359. * 会员经验列表
  360. */
  361. export function getlevelExpList(data) {
  362. return request.get("user/level/expList", data);
  363. }
  364. /**
  365. * 修改用户信息
  366. * @param {Object} data
  367. */
  368. export function updateUserInfo(data) {
  369. return request.post('v2/user/user_update', data);
  370. }
  371. /**
  372. * 微信直接手机号登录
  373. */
  374. export function phoneWxSilenceAuth(data) {
  375. return request.post('v2/phone_wx_silence_auth', data, {
  376. noAuth: true
  377. });
  378. }
  379. /**
  380. * 小程序直接手机号登录
  381. */
  382. export function phoneSilenceAuth(data) {
  383. return request.post('v2/phone_silence_auth', data, {
  384. noAuth: true
  385. });
  386. }
  387. /**
  388. * 用户发票列表
  389. * @param {Object} data
  390. */
  391. export function invoiceList(data) {
  392. return request.get('v2/invoice', data, {
  393. noAuth: true
  394. });
  395. }
  396. /**
  397. * 用户添加|修改发票
  398. * @param {Object} data
  399. */
  400. export function invoiceSave(data) {
  401. return request.post('v2/invoice/save', data, {
  402. noAuth: true
  403. });
  404. }
  405. /**
  406. * 用户删除发票
  407. * @param {Object} data
  408. */
  409. export function invoiceDelete(id) {
  410. return request.get('v2/invoice/del/' + id);
  411. }
  412. /**
  413. * 获取用户默认发票
  414. * @param {Object} type
  415. */
  416. export function invoiceDefault(type) {
  417. return request.get('v2/invoice/get_default/' + type);
  418. }
  419. /**
  420. * 用户单个发票详情
  421. * @param {Object} id
  422. */
  423. export function invoiceDetail(id) {
  424. return request.get('v2/invoice/detail/' + id);
  425. }
  426. /**
  427. * 订单申请开票
  428. * @param {Object} id
  429. */
  430. export function invoiceOrder(data) {
  431. return request.post('v2/order/make_up_invoice', data);
  432. }
  433. /**
  434. * 订单详情中申请开票
  435. * @param {Object} id
  436. */
  437. export function makeUpinvoice(data) {
  438. return request.post('v2/order/make_up_invoice', data);
  439. }
  440. /**
  441. * 会员卡主界面
  442. */
  443. export function memberCard() {
  444. return request.get('user/member/card/index');
  445. }
  446. /**
  447. * 卡密领取会员卡
  448. * @param {Object} data
  449. */
  450. export function memberCardDraw(data) {
  451. return request.post('user/member/card/draw', data);
  452. }
  453. /**
  454. * 购买会员卡
  455. * @param {Object} data
  456. */
  457. export function memberCardCreate(data) {
  458. return request.post('user/member/card/create', data);
  459. }
  460. /**
  461. * 会员优惠券
  462. */
  463. export function memberCouponsList() {
  464. return request.get('user/member/coupons/list');
  465. }
  466. /**
  467. * svip推荐商品
  468. * @param {Object} id
  469. */
  470. export function groomList(id, data) {
  471. return request.get(`groom/list/${id}`, data);
  472. }
  473. /**
  474. * 付费会员结束
  475. * @param {Object} data
  476. */
  477. export function memberOverdueTime(data) {
  478. return request.get('user/member/overdue/time', data);
  479. }
  480. /**
  481. * 新版分享海报信息获取
  482. */
  483. export function spreadMsg() {
  484. return request.get('user/spread_info');
  485. }
  486. /**
  487. * 已邀请/已下单好友
  488. */
  489. export function agentUserList(type, page, limit) {
  490. return request.get(`v2/agent/agent_user_list/${type}?page=${page}&limit=${limit}`);
  491. }
  492. /**
  493. * 获取用户推广获得收益,佣金轮播,分销规则
  494. */
  495. export function agentInfo() {
  496. return request.get(`v2/agent/agent_info`);
  497. }
  498. /**
  499. * 图片链接转base64
  500. */
  501. export function imgToBase(data) {
  502. return request.post('image_base64', data);
  503. }
  504. /**
  505. * 获取小程序二维码
  506. */
  507. export function routineCode(data) {
  508. return request.get('user/routine_code', data);
  509. }
  510. /**
  511. * 消息中心
  512. */
  513. export function serviceRecord(data) {
  514. return request.get('user/record', data);
  515. }
  516. /**
  517. * 消息中心-站内信列表
  518. */
  519. export function messageSystem(data) {
  520. return request.get('user/message_system/list', data);
  521. }
  522. /**
  523. * 消息中心-站内信列表详情
  524. */
  525. export function getMsgDetails(id) {
  526. return request.get('user/message_system/detail/' + id);
  527. }
  528. /**
  529. * 苹果账号登录
  530. * @param {Object} data
  531. */
  532. export function appleLogin(data) {
  533. return request.post('apple_login', data, {
  534. noAuth: true
  535. });
  536. }
  537. /*
  538. * 获取隐私协议
  539. * */
  540. export function getUserAgreement(type) {
  541. return request.get(`user_agreement/${type}`, {}, {
  542. noAuth: true
  543. });
  544. }
  545. /**
  546. * 获取分销等级列表
  547. * @param int id 任务id
  548. */
  549. export function agentLevelList() {
  550. return request.get('v2/agent/level_list');
  551. }
  552. /**
  553. * 获取分销任务列表
  554. * @param int id 任务id
  555. */
  556. export function agentLevelTaskList(id) {
  557. return request.get('v2/agent/level_task_list?id=' + id);
  558. }
  559. /**
  560. * 获取定位详细地址
  561. * @param int id
  562. *
  563. */
  564. export function getGeocoder(data) {
  565. return request.get(`geoLbscoder?location=${data.lat},${data.long}`, {}, {
  566. noAuth: true
  567. });
  568. }
  569. /**
  570. * 获取当前定位选中的地址
  571. * @param int id
  572. *
  573. */
  574. export function getCityList(address) {
  575. return request.get('v2/cityList', {
  576. address
  577. }, {
  578. noAuth: true
  579. });
  580. }
  581. /**
  582. * 获取版权
  583. *
  584. */
  585. export function getCopyRight() {
  586. return request.get('get_copyright', {}, {
  587. noAuth: true
  588. });
  589. }
  590. /**
  591. * 获取code码
  592. * @param int id
  593. *
  594. */
  595. export function getRandCode() {
  596. return request.get('user/rand_code');
  597. }
  598. /**
  599. * 注销用户
  600. * @param int id
  601. *
  602. */
  603. export function cancelUser() {
  604. return request.get('cancel/user');
  605. }
  606. /**
  607. * 获取激活会员卡需要的信息
  608. * @param int id
  609. *
  610. */
  611. export function levelInfo() {
  612. return request.get('user/level/activate_info');
  613. }
  614. /**
  615. * 用户激活会员卡
  616. * @param int id
  617. *
  618. */
  619. export function levelActivate(data) {
  620. return request.post('user/level/activate',data);
  621. }