index.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <view class="page">
  3. <view class="amount_card">
  4. <view class="content">
  5. <view class="amount">
  6. <view class="text">账户余额</view>
  7. <view class="price">{{ currency(wallet.amount, {
  8. symbol: '¥',
  9. fromCents: true
  10. }).format() }}</view>
  11. </view>
  12. <view class="btn" @click="jump('./withdraw?amount='+wallet.amount)">提现</view>
  13. </view>
  14. <view class="footer" @click="jump('./hangingAmount')">
  15. <view class="item">
  16. 即将到账:{{ currency(wallet.waitAmount, {
  17. symbol: '¥',
  18. fromCents: true
  19. }).format() }}
  20. </view>
  21. <u-icon name="arrow-right"></u-icon>
  22. </view>
  23. </view>
  24. <view class="history" @click="jump('./history')">
  25. 提现记录
  26. <u-icon name="arrow-right"></u-icon>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import { getWallet } from "@/api/wallet"
  32. import currency from "@/utils/currency"
  33. export default {
  34. data() {
  35. return {
  36. wallet: {
  37. amount: 0,
  38. waitAmount: 0
  39. },
  40. currency
  41. };
  42. },
  43. methods: {
  44. jump(url) {
  45. uni.navigateTo({
  46. url
  47. });
  48. }
  49. },
  50. onShow() {
  51. getWallet().then(({ content }) => {
  52. if (content) {
  53. this.wallet = content
  54. if (this.wallet.id) {
  55. uni.setStorageSync('walletId', this.wallet.id)
  56. }
  57. }
  58. })
  59. }
  60. };
  61. </script>
  62. <style lang="scss" scoped>
  63. .page {
  64. background: #F9F9F9F9;
  65. min-height: 100vh;
  66. padding: 24rpx 20rpx;
  67. .amount_card {
  68. border-radius: 16rpx;
  69. background-color: #ffffff;
  70. .content {
  71. padding: 30rpx;
  72. display: flex;
  73. justify-content: space-between;
  74. align-items: center;
  75. .amount {
  76. display: flex;
  77. flex-direction: column;
  78. .text {
  79. font-size: 30rpx;
  80. color: #AAAAAA;
  81. margin-bottom: 18rpx;
  82. }
  83. .price {
  84. font-size: 50rpx;
  85. color: #222;
  86. font-weight: bold;
  87. }
  88. }
  89. .btn {
  90. background-color: #FFC000;
  91. text-align: center;
  92. padding: 12rpx;
  93. width: 100rpx;
  94. border-radius: 32rpx;
  95. color: #ffffff;
  96. }
  97. }
  98. .footer {
  99. border-top: 1px solid #F0F0F0;
  100. padding: 30rpx;
  101. display: flex;
  102. color: #AAAAAA;
  103. justify-content: space-between;
  104. align-items: center;
  105. }
  106. }
  107. .history {
  108. margin-top: 20rpx;
  109. background-color: #ffffff;
  110. border-radius: 16rpx;
  111. padding: 30rpx;
  112. font-size: 30rpx;
  113. display: flex;
  114. justify-content: space-between;
  115. align-items: center;
  116. }
  117. }
  118. </style>