transfer.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <view class="content">
  3. <view class="" style="height: 50rpx;"></view>
  4. <view class="wrap">
  5. <view class="imgbox_1">{{ $t('user.hzlx') }}</view>
  6. <view class="flex">
  7. <view class="imgbox_noaction" :class="{ imgbox_action: current == 1 }" @click="current = 1">{{ $t('user.zjzhzhyzh') }}</view>
  8. <view class="imgbox_noaction" :class="{ imgbox_action: current == 2 }" @click="current = 2">{{ $t('user.hyzhzzjzh') }}</view>
  9. </view>
  10. <view class="flex" style="margin-top: 20rpx;">
  11. <view class="item-left">{{ $t('user.zjzh') }}</view>
  12. <view class="item-right">{{ $t('user.kyye') }} {{ userInfo.usdt }} USDT</view>
  13. </view>
  14. <view class="flex">
  15. <view class="item-left">{{ $t('user.hyzh') }}</view>
  16. <view class="item-right">{{ $t('user.kyye') }} {{ userInfo.money }} USDT</view>
  17. </view>
  18. <view class="sr-wrap flex">
  19. <input type="digit" :placeholder="$t('user.qsrhzsl')" class="sr-inp" v-model="tbnum" />
  20. <view class="">USDT</view>
  21. </view>
  22. <view class="sub-btn" @click="transfer">{{ $t('user.tj') }}</view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. import { mapState, mapMutations } from 'vuex';
  28. import { transfer, getUser } from '@/api/login.js';
  29. export default {
  30. data() {
  31. return {
  32. current: 1,
  33. tbnum: '',
  34. loaded: false
  35. };
  36. },
  37. onLoad() {
  38. console.log(this.userInfo);
  39. },
  40. computed: {
  41. ...mapState('user', ['userInfo'])
  42. },
  43. onShow() {
  44. uni.setNavigationBarTitle({ title: this.$t('user.zjhz') });
  45. getUser().then(re => {
  46. this.setUserInfo(re.data);
  47. });
  48. },
  49. onReachBottom() {},
  50. onReady() {},
  51. methods: {
  52. ...mapMutations('user', ['setUserInfo']),
  53. transfer() {
  54. let obj = this;
  55. if (obj.loaded) {
  56. return;
  57. }
  58. obj.loaded = true;
  59. transfer({
  60. tbnum: obj.tbnum,
  61. type: obj.current
  62. })
  63. .then(res => {
  64. uni.showToast({
  65. title: this.$t('user.hzcg'),
  66. duration: 2000,
  67. position: 'top'
  68. });
  69. getUser().then(re => {
  70. obj.loaded = false;
  71. obj.setUserInfo(re.data);
  72. });
  73. })
  74. .catch(err => {
  75. obj.loaded = false;
  76. });
  77. }
  78. }
  79. };
  80. </script>
  81. <style lang="scss">
  82. .wrap {
  83. width: 640rpx;
  84. height: 610rpx;
  85. padding: 40rpx;
  86. background-color: #fff;
  87. margin: auto;
  88. border-radius: 20rpx;
  89. .imgbox_1 {
  90. height: 80rpx;
  91. line-height: 80rpx;
  92. font-size: 32rpx;
  93. }
  94. .imgbox_noaction {
  95. width: 280rpx;
  96. height: 70rpx;
  97. line-height: 70rpx;
  98. text-align: center;
  99. font-size: 24rpx;
  100. border: #ccc solid 1px;
  101. color: #ccc;
  102. border-radius: 20rpx;
  103. }
  104. .imgbox_action {
  105. color: #fcd535;
  106. border: #fcd535 solid 1px;
  107. }
  108. }
  109. .item-left {
  110. height: 60rpx;
  111. line-height: 60rpx;
  112. font-size: 32rpx;
  113. }
  114. .item-right {
  115. height: 60rpx;
  116. line-height: 60rpx;
  117. font-size: 24rpx;
  118. color: #707a8a;
  119. }
  120. .sr-wrap {
  121. width: 560rpx;
  122. height: 80rpx;
  123. background-color: #f5f5f5;
  124. border-radius: 20rpx;
  125. padding: 0 20rpx;
  126. .sr-inp {
  127. width: 352rpx;
  128. height: 60rpx;
  129. line-height: 60rpx;
  130. display: inline-block;
  131. }
  132. }
  133. .sub-btn {
  134. width: 560rpx;
  135. height: 80rpx;
  136. line-height: 80rpx;
  137. color: #000;
  138. text-align: center;
  139. font-size: 28rpx;
  140. background: linear-gradient(to left, #eeb80d, #ffe35b);
  141. margin-top: 30rpx;
  142. border-radius: 20rpx;
  143. }
  144. </style>