Profile.vue 18 KB

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