transfer.vue 3.3 KB

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