Profile.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757
  1. <template>
  2. <div class="usremei-container">
  3. <!-- Add Toast component -->
  4. <Toast ref="toast" />
  5. <!-- 第一个白色背景板块 -->
  6. <div class="profile-card">
  7. <div class="info-row">
  8. <div class="avatar-section">
  9. <img src="@/assets/avart.png" class="avatar" alt="用户头像" />
  10. <div style="display: flex; flex-direction: column; align-items: flex-start;margin-left: 10px;color: #fff;">
  11. <span class="name">{{ userInfo.nickname }}</span>
  12. <span class="value">{{ userInfo.mobile }}</span>
  13. </div>
  14. </div>
  15. <div class="sign-btn" @click="goToSignin">
  16. <img src="@/assets/sign.png" style="width: 60px;height: 50px;" alt="签到" />
  17. </div>
  18. </div>
  19. <!-- <div class="info-row">
  20. <span class="label">邀请码</span>
  21. <span class="value">{{ userInfo.salt }}</span>
  22. </div> -->
  23. </div>
  24. <!-- 第二个银行卡板块 -->
  25. <!-- <div class="bank-card">
  26. <div class="bank-content">
  27. <img src="@/assets/bank.png" class="bank-logo" alt="银行logo" />
  28. <div class="bank-text">
  29. <div class="bank-name">中国农业银行农泉联名账户</div>
  30. <div><span style="font-size:13px;">余额:</span><span class="balance">{{ userInfo.ukaedu }}</span></div>
  31. </div>
  32. <div class="button-group">
  33. <button class="action-btn button-click-effect" @click="goToCharges">缴纳税费</button>
  34. <button class="action-btn button-click-effect" @click="goToFinancial">提升到账额度</button>
  35. </div>
  36. </div>
  37. </div> -->
  38. <!-- 收益板块组 -->
  39. <div class="profit-section">
  40. <div class="profit-block">
  41. <div class="profit-left">
  42. <div class="profit-header">
  43. <span>红旗资产</span>
  44. <button class="profit-btn button-click-effect" @click="handleRedFlagWithdraw">提现</button>
  45. </div>
  46. <div class="profit-amount">¥{{ userInfo.coins }}</div>
  47. </div>
  48. <div class="profit-right">
  49. <div class="profit-header">
  50. <span>退休补贴</span>
  51. <button class="profit-btn button-click-effect" @click="handleRetirementWithdraw">提现</button>
  52. </div>
  53. <div class="profit-amount">¥{{ userInfo.txbt?userInfo.txbt:0 }}</div>
  54. </div>
  55. <div class="profit-left">
  56. <div class="profit-header">
  57. <span>党员薪资</span>
  58. <button class="profit-btn button-click-effect" @click="handlePartySalaryWithdraw">提现</button>
  59. </div>
  60. <div class="profit-amount">¥{{ userInfo.dyxz?userInfo.dyxz:0 }}</div>
  61. </div>
  62. <div class="profit-right">
  63. <div class="profit-header">
  64. <span>每日现金</span>
  65. <button class="profit-btn button-click-effect" @click="handleDailyCashWithdraw">提现</button>
  66. </div>
  67. <div class="profit-amount">¥{{ userInfo.dayred }}</div>
  68. </div>
  69. <div class="profit-left">
  70. <div class="profit-header">
  71. <span>医疗补贴</span>
  72. <button class="profit-btn button-click-effect" @click="handleMedicalWithdraw">提现</button>
  73. </div>
  74. <div class="profit-amount">¥{{ userInfo.money }}</div>
  75. </div>
  76. <div class="profit-right">
  77. <div class="profit-header">
  78. <span>原始股权</span>
  79. <button class="profit-btn button-click-effect" @click="handleOriginalSharesWithdraw">提现</button>
  80. </div>
  81. <div class="profit-amount">¥{{ userInfo.guquan }}</div>
  82. </div>
  83. </div>
  84. </div>
  85. <!-- 应用中心板块 -->
  86. <div class="app-center">
  87. <div class="section-title">
  88. <span>常用工具</span>
  89. </div>
  90. <div class="function-grid">
  91. <div class="function-item button-click-effect" @click="$router.push('/user-center')">
  92. <img src="@/assets/221.png" alt="实名认证" />
  93. <span>实名认证</span>
  94. </div>
  95. <div class="function-item button-click-effect" @click="$router.push('/bank-card')">
  96. <img src="@/assets/222.png" alt="银行卡绑定" />
  97. <span>银行卡绑定</span>
  98. </div>
  99. <div class="function-item button-click-effect" @click="$router.push('/member')">
  100. <img src="@/assets/223.png" alt="我的团队" />
  101. <span>我的团队</span>
  102. </div>
  103. <div class="function-item button-click-effect" @click="$router.push('/order-list')">
  104. <img src="@/assets/224.png" alt="提现记录" />
  105. <span>提现记录</span>
  106. </div>
  107. <div class="function-item button-click-effect" @click="$router.push('/asset-center')">
  108. <img src="@/assets/225.png" alt="资金明细" />
  109. <span>资金明细</span>
  110. </div>
  111. <div class="function-item button-click-effect" @click="$router.push('/asset-center')">
  112. <img src="@/assets/226.png" alt="股权管理" />
  113. <span>股权管理</span>
  114. </div>
  115. <div class="function-item button-click-effect" @click="$router.push('/retirement-subsidy')">
  116. <img src="@/assets/227.png" alt="退休补贴" />
  117. <span>退休补贴</span>
  118. </div>
  119. <div class="function-item button-click-effect" @click="$router.push('/order-management')">
  120. <img src="@/assets/228.png" alt="订单管理" />
  121. <span>订单管理</span>
  122. </div>
  123. <!-- <div class="function-item button-click-effect" @click="$router.push('/lever-list')">
  124. <span>礼品<br/>福利</span>
  125. </div>
  126. <div class="function-item button-click-effect" @click="toAppDownload">
  127. <span>APP<br/>下载</span>
  128. </div> -->
  129. </div>
  130. </div>
  131. <!-- 退出登录按钮 -->
  132. <div class="logout-wrapper">
  133. <button class="logout-btn button-click-effect" @click="handleLogout">安全退出</button>
  134. </div>
  135. <!-- 自定义确认框 -->
  136. <div class="confirm-dialog" v-if="showConfirm">
  137. <div class="confirm-mask"></div>
  138. <div class="confirm-content">
  139. <div class="confirm-title">提示</div>
  140. <div class="confirm-message">确认退出登录吗?</div>
  141. <div class="confirm-btns">
  142. <button class="confirm-btn cancel" @click="cancelLogout">取消</button>
  143. <button class="confirm-btn confirm" @click="confirmLogout">确认</button>
  144. </div>
  145. </div>
  146. </div>
  147. </div>
  148. </template>
  149. <script>
  150. import { getUserInfo } from '@/api/home';
  151. import { logout, cashOut, withdrawPension } from '@/api/profile';
  152. import Toast from '@/components/Toast.vue';
  153. export default {
  154. name: 'UsreMei',
  155. components: {
  156. Toast
  157. },
  158. data() {
  159. return {
  160. userInfo: {},
  161. showConfirm: false
  162. }
  163. },
  164. mounted() {
  165. this.getUserInfo();
  166. },
  167. methods: {
  168. async getUserInfo() {
  169. const res = await getUserInfo();
  170. this.userInfo = res.data;
  171. },
  172. goToCharges() {
  173. this.$router.push('/charges');
  174. },
  175. goToFinancial() {
  176. this.$router.push('/financial');
  177. },
  178. goToSignin() {
  179. this.$router.push('/signin');
  180. },
  181. async handleCashOut() {
  182. try {
  183. await cashOut();
  184. this.$refs.toast.show('套现成功', 'success');
  185. // 刷新用户信息
  186. await this.getUserInfo();
  187. } catch (error) {
  188. console.error('套现失败:', error);
  189. this.$refs.toast.show('套现失败,请重试', 'error');
  190. }
  191. },
  192. async handlePensionWithdraw() {
  193. try {
  194. await withdrawPension();
  195. this.$refs.toast.show('提现成功', 'success');
  196. // 刷新用户信息
  197. await this.getUserInfo();
  198. } catch (error) {
  199. console.error('提现失败:', error);
  200. this.$refs.toast.show('提现失败,请重试', 'error');
  201. }
  202. },
  203. handleLogout() {
  204. this.showConfirm = true;
  205. },
  206. cancelLogout() {
  207. this.showConfirm = false;
  208. },
  209. toAppDownload() {
  210. window.open(this.userInfo.link[1].value, '_blank');
  211. },
  212. async confirmLogout() {
  213. try {
  214. await logout();
  215. this.$refs.toast.show('退出成功', 'success');
  216. setTimeout(() => {
  217. // 清除本地存储的token等信息
  218. localStorage.removeItem('token');
  219. // 跳转到登录页
  220. this.$router.replace('/login');
  221. }, 2000);
  222. } catch (error) {
  223. this.$refs.toast.show('退出失败,请重试', 'error');
  224. } finally {
  225. this.showConfirm = false;
  226. }
  227. },
  228. // 红旗资产提现
  229. handleRedFlagWithdraw() {
  230. this.$router.push('/mention?type=1');
  231. },
  232. // 退休补贴提现
  233. handleRetirementWithdraw() {
  234. this.$router.push('/mention?type=2');
  235. },
  236. // 党员薪资提现
  237. handlePartySalaryWithdraw() {
  238. this.$router.push('/mention?type=3');
  239. },
  240. // 每日现金提现
  241. handleDailyCashWithdraw() {
  242. this.$router.push('/mention?type=4');
  243. },
  244. // 医疗补贴提现
  245. handleMedicalWithdraw() {
  246. this.$router.push('/mention?type=5');
  247. },
  248. // 原始股权提现
  249. handleOriginalSharesWithdraw() {
  250. this.$router.push('/mention?type=6');
  251. },
  252. }
  253. }
  254. </script>
  255. <style scoped>
  256. .usremei-container {
  257. min-height: 100vh;
  258. background-image: url('../assets/dabag.png');
  259. background-size: cover;
  260. background-position: center;
  261. padding: 20px;
  262. padding-top: 60px;
  263. padding-bottom: 80px; /* 为底部tab预留空间 */
  264. box-sizing: border-box; /* 确保padding不会增加容器高度 */
  265. overflow-y: auto; /* 允许内容滚动 */
  266. position: relative; /* 为fixed定位提供参考 */
  267. }
  268. .profile-card {
  269. margin-bottom: 20px;
  270. position: relative;
  271. }
  272. .avatar-section {
  273. display: flex;
  274. align-items: center;
  275. justify-content: space-between;
  276. /* position: absolute;
  277. top: -40px;
  278. left: 20px; */
  279. }
  280. .avatar {
  281. width: 50px;
  282. height: 50px;
  283. object-fit: cover;
  284. border-radius: 50%;
  285. }
  286. .info-row {
  287. display: flex;
  288. justify-content: space-between;
  289. align-items: center;
  290. margin-bottom: 15px;
  291. font-size: 16px;
  292. }
  293. .name {
  294. font-size: 18px;
  295. font-weight: bold;
  296. }
  297. .sign-icon {
  298. width: 50px;
  299. height: 40px;
  300. }
  301. .label {
  302. color: #666;
  303. }
  304. .value {
  305. color: #fff;
  306. margin-top: 5px;
  307. }
  308. .bank-card {
  309. background: url('../assets/gebg.png');
  310. background-size: cover;
  311. border-radius: 12px;
  312. padding: 20px;
  313. }
  314. .bank-content {
  315. display: flex;
  316. align-items: center;
  317. justify-content: space-between;
  318. gap: 15px;
  319. }
  320. .bank-logo {
  321. width: 50px; /* 稍微缩小logo */
  322. height: 50px;
  323. flex-shrink: 0;
  324. }
  325. .bank-text {
  326. flex: 2; /* 给文字更多空间 */
  327. min-width: 0;
  328. }
  329. .bank-name {
  330. font-weight: bold;
  331. font-size: 10px; /* 稍微减小字号 */
  332. color: #333;
  333. margin-bottom: 10px;
  334. line-height: 1.2;
  335. white-space: normal; /* 允许换行 */
  336. }
  337. .balance {
  338. font-size: 18px;
  339. color: #85370d;
  340. font-weight: bold;
  341. }
  342. .button-group {
  343. display: flex;
  344. flex-direction: column;
  345. gap: 6px; /* 减小按钮间距 */
  346. flex-shrink: 0;
  347. width: 90px; /* 固定按钮组宽度 */
  348. }
  349. .action-btn, .profit-btn, .logout-btn {
  350. position: relative;
  351. overflow: hidden;
  352. transition: all 0.2s;
  353. }
  354. .action-btn {
  355. background-color: #fb3f6c;
  356. color: #fff;
  357. border: none;
  358. border-radius: 4px;
  359. padding: 6px 8px;
  360. font-size: 12px;
  361. cursor: pointer;
  362. white-space: nowrap;
  363. width: 100%;
  364. }
  365. .action-btn:active {
  366. transform: scale(0.98);
  367. opacity: 0.9;
  368. }
  369. .profit-btn {
  370. background-color: #ea0a1c;
  371. color: #fff;
  372. border: none;
  373. border-radius: 4px;
  374. padding: 6px 12px;
  375. font-size: 12px;
  376. cursor: pointer;
  377. position: relative;
  378. overflow: hidden;
  379. }
  380. .profit-btn:active {
  381. transform: scale(0.98);
  382. opacity: 0.9;
  383. }
  384. .function-item {
  385. display: flex;
  386. flex-direction: column;
  387. align-items: center;
  388. justify-content: center;
  389. gap: 8px;
  390. cursor: pointer;
  391. transition: all 0.2s;
  392. background: transparent;
  393. padding: 5px;
  394. }
  395. .function-item:active {
  396. transform: scale(0.95);
  397. opacity: 0.8;
  398. }
  399. @keyframes ripple {
  400. 0% {
  401. transform: scale(0, 0);
  402. opacity: 0.5;
  403. }
  404. 20% {
  405. transform: scale(25, 25);
  406. opacity: 0.3;
  407. }
  408. 100% {
  409. opacity: 0;
  410. transform: scale(40, 40);
  411. }
  412. }
  413. .action-btn::after,
  414. .profit-btn::after,
  415. .logout-btn::after {
  416. content: '';
  417. position: absolute;
  418. top: 50%;
  419. left: 50%;
  420. width: 5px;
  421. height: 5px;
  422. background: rgba(255, 255, 255, 0.5);
  423. opacity: 0;
  424. border-radius: 100%;
  425. transform: scale(1, 1) translate(-50%);
  426. transform-origin: 50% 50%;
  427. }
  428. .action-btn:active::after,
  429. .profit-btn:active::after,
  430. .logout-btn:active::after {
  431. animation: ripple 0.4s ease-out;
  432. }
  433. /* 调整信息行的位置,让它不会被头像遮挡 */
  434. .info-row:first-of-type {
  435. margin-top: 10px;
  436. }
  437. /* 移动端适配 */
  438. @media screen and (max-width: 375px) {
  439. .usremei-container {
  440. padding: 15px;
  441. padding-top: 50px;
  442. padding-bottom: 70px;
  443. }
  444. .profile-card,
  445. .bank-card {
  446. padding: 15px;
  447. }
  448. .bank-content {
  449. flex-direction: column;
  450. align-items: flex-start;
  451. }
  452. .bank-text {
  453. width: 100%;
  454. margin: 10px 0;
  455. }
  456. .button-group {
  457. width: 100%;
  458. }
  459. .action-btn {
  460. width: 100%;
  461. }
  462. }
  463. .profit-section {
  464. display: flex;
  465. flex-direction: column;
  466. gap: 15px;
  467. margin-top: 15px;
  468. margin-bottom: 15px;
  469. }
  470. .profit-block {
  471. display: grid;
  472. grid-template-columns: repeat(2, 1fr);
  473. gap: 10px;
  474. padding: 10px;
  475. background: #fff0e1;
  476. /* border-radius: 12px; */
  477. }
  478. .profit-left, .profit-right {
  479. padding: 10px;
  480. background: #fff0e1;
  481. border-radius: 8px;
  482. }
  483. .profit-header {
  484. display: flex;
  485. justify-content: space-between;
  486. align-items: center;
  487. margin-bottom: 8px;
  488. }
  489. .profit-header span {
  490. color: #85370d;
  491. font-size: 14px;
  492. }
  493. .profit-amount {
  494. font-size: 20px;
  495. font-weight: bold;
  496. color: #85370d;
  497. }
  498. /* 移动端适配 */
  499. @media screen and (max-width: 375px) {
  500. .profit-block {
  501. gap: 8px;
  502. padding: 8px;
  503. }
  504. .profit-left, .profit-right {
  505. padding: 8px;
  506. }
  507. .profit-amount {
  508. font-size: 18px;
  509. }
  510. }
  511. .app-center {
  512. border-radius: 12px;
  513. margin-top: 15px;
  514. }
  515. .section-title {
  516. display: flex;
  517. align-items: center;
  518. gap: 10px;
  519. margin-bottom: 20px;
  520. color: #fff;
  521. }
  522. .title-line {
  523. width: 2px;
  524. height: 16px;
  525. background-color: #ff6b00;
  526. }
  527. .section-title span {
  528. font-size: 16px;
  529. font-weight: bold;
  530. color: #fff;
  531. }
  532. .function-grid {
  533. display: grid;
  534. grid-template-columns: repeat(4, 1fr);
  535. gap: 20px 10px;
  536. /* background-color: #fff; */
  537. padding: 10px;
  538. border-radius: 12px;
  539. }
  540. .function-item img {
  541. width: 28px;
  542. height: 28px;
  543. object-fit: contain;
  544. }
  545. .function-item span {
  546. font-size: 12px;
  547. color: #fff;
  548. text-align: center;
  549. line-height: 1.3;
  550. }
  551. /* 移动端适配补充 */
  552. @media screen and (max-width: 375px) {
  553. .app-center {
  554. padding: 15px;
  555. }
  556. .function-grid {
  557. gap: 15px 8px;
  558. }
  559. .function-item img {
  560. width: 24px;
  561. height: 24px;
  562. }
  563. .function-item span {
  564. font-size: 11px;
  565. }
  566. }
  567. .logout-wrapper {
  568. margin-top: 30px;
  569. margin-bottom: 20px;
  570. padding: 0 20px;
  571. display: flex;
  572. justify-content: center;
  573. align-items: center;
  574. }
  575. .logout-btn {
  576. width: 60%;
  577. background-color: #fff;
  578. color: #000;
  579. border: none;
  580. border-radius: 20px;
  581. padding: 12px 0;
  582. font-size: 16px;
  583. cursor: pointer;
  584. position: relative;
  585. overflow: hidden;
  586. }
  587. .logout-btn:active {
  588. transform: scale(0.98);
  589. opacity: 0.9;
  590. }
  591. /* 移动端适配补充 */
  592. @media screen and (max-width: 375px) {
  593. .logout-btn {
  594. padding: 10px 0;
  595. font-size: 14px;
  596. }
  597. }
  598. .button-click-effect {
  599. position: relative !important;
  600. overflow: hidden !important;
  601. transition: all 0.2s !important;
  602. }
  603. .button-click-effect:active {
  604. transform: scale(0.98) !important;
  605. opacity: 0.9 !important;
  606. }
  607. /* 确认框样式 */
  608. .confirm-dialog {
  609. position: fixed;
  610. top: 0;
  611. left: 0;
  612. width: 100%;
  613. height: 100%;
  614. z-index: 9999;
  615. }
  616. .confirm-mask {
  617. position: absolute;
  618. top: 0;
  619. left: 0;
  620. width: 100%;
  621. height: 100%;
  622. background: rgba(0, 0, 0, 0.5);
  623. }
  624. .confirm-content {
  625. position: absolute;
  626. top: 50%;
  627. left: 50%;
  628. transform: translate(-50%, -50%);
  629. width: 80%;
  630. max-width: 300px;
  631. background: #fff;
  632. border-radius: 12px;
  633. overflow: hidden;
  634. }
  635. .confirm-title {
  636. padding: 15px;
  637. text-align: center;
  638. font-size: 16px;
  639. font-weight: bold;
  640. color: #333;
  641. border-bottom: 1px solid #eee;
  642. }
  643. .confirm-message {
  644. padding: 20px 15px;
  645. text-align: center;
  646. font-size: 14px;
  647. color: #666;
  648. line-height: 1.5;
  649. }
  650. .confirm-btns {
  651. display: flex;
  652. border-top: 1px solid #eee;
  653. }
  654. .confirm-btn {
  655. flex: 1;
  656. padding: 12px;
  657. text-align: center;
  658. font-size: 14px;
  659. background: #fff;
  660. border: none;
  661. cursor: pointer;
  662. transition: all 0.2s;
  663. }
  664. .confirm-btn.cancel {
  665. color: #666;
  666. border-right: 1px solid #eee;
  667. }
  668. .confirm-btn.confirm {
  669. color: #cf0101;
  670. font-weight: bold;
  671. }
  672. .confirm-btn:active {
  673. opacity: 0.8;
  674. background: #f5f5f5;
  675. }
  676. </style>