user.js 13 KB

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