transfer.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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. getUser().then(re => {
  70. this.setUserInfo(re.data)
  71. })
  72. },
  73. onReachBottom() {
  74. },
  75. onReady() {
  76. },
  77. methods: {
  78. ...mapMutations('user', ['setUserInfo']),
  79. transfer() {
  80. let obj = this
  81. if(obj.loaded) {
  82. return
  83. }
  84. obj.loaded = true
  85. transfer({
  86. tbnum: obj.tbnum,
  87. type: obj.current
  88. }).then(res => {
  89. uni.showToast({
  90. title: '劃轉成功',
  91. duration: 2000,
  92. position: 'top'
  93. });
  94. getUser().then(re => {
  95. obj.loaded = false
  96. obj.setUserInfo(re.data)
  97. })
  98. }).catch(err => {
  99. obj.loaded = false
  100. })
  101. }
  102. }
  103. }
  104. </script>
  105. <style lang="scss">
  106. .wrap {
  107. width: 640rpx;
  108. height: 610rpx;
  109. padding: 40rpx;
  110. background-color: #fff;
  111. margin: auto;
  112. border-radius: 20rpx;
  113. .imgbox_1 {
  114. height: 80rpx;
  115. line-height: 80rpx;
  116. font-size: 32rpx;
  117. }
  118. .imgbox_noaction {
  119. width: 280rpx;
  120. height: 70rpx;
  121. line-height: 70rpx;
  122. text-align: center;
  123. font-size: 24rpx;
  124. border: #ccc solid 1px;
  125. color: #ccc;
  126. border-radius: 20rpx;
  127. }
  128. .imgbox_action {
  129. color: #FCD535;
  130. border: #FCD535 solid 1px;
  131. }
  132. }
  133. .item-left {
  134. height: 60rpx;
  135. line-height: 60rpx;
  136. font-size: 32rpx;
  137. }
  138. .item-right {
  139. height: 60rpx;
  140. line-height: 60rpx;
  141. font-size: 24rpx;
  142. color: #707A8A;
  143. }
  144. .sr-wrap {
  145. width: 560rpx;
  146. height: 80rpx;
  147. background-color: #f5f5f5;
  148. border-radius: 20rpx;
  149. padding: 0 20rpx;
  150. .sr-inp {
  151. width: 352rpx;
  152. height: 60rpx;
  153. line-height: 60rpx;
  154. display: inline-block;
  155. }
  156. }
  157. .sub-btn {
  158. width: 560rpx;
  159. height: 80rpx;
  160. line-height: 80rpx;
  161. color: #000;
  162. text-align: center;
  163. font-size: 28rpx;
  164. background: linear-gradient(to left, #eeb80d, #ffe35b);
  165. margin-top: 30rpx;
  166. border-radius: 20rpx;
  167. }
  168. </style>