transfer.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <view class="container">
  3. <view class="listBox">
  4. <view class="titleTetx">收款地址</view>
  5. <view class="flex listTpl">
  6. <input type="number" class="inputBox" v-model="address" placeholder="请输入收款地址" />
  7. </view>
  8. </view>
  9. <view class="listBox" style="padding-top: 0rpx;">
  10. <view class="titleTetx">转账数量</view>
  11. <view class="listTpl flex">
  12. <input type="number" class="inputBox" v-model="number" placeholder="请输入转账金额" />
  13. <view class="listAll" @click="number=dataMoney.money">全部</view>
  14. </view>
  15. <view class="flex tipBox">
  16. <view class="tip1">可用余额{{dataMoney.money||0}}USDT</view>
  17. </view>
  18. </view>
  19. <view class="submission">
  20. <button class="golden" type="golden" hover-class="none" @click="submission">确认转账</button>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. import {
  26. trade
  27. } from '@/api/game.js';
  28. import {
  29. qianBao
  30. } from '@/api/wallet.js';
  31. export default {
  32. data() {
  33. return {
  34. address: '',
  35. number: '',
  36. dataMoney:{},
  37. };
  38. },
  39. onLoad() {
  40. this.qianBao();
  41. },
  42. methods: {
  43. qianBao(){
  44. const taht = this;
  45. qianBao({}).then(
  46. (res) => {
  47. taht.dataMoney = res.data.back.USDT.money
  48. taht.dataMoney.money = +taht.dataMoney.money;
  49. }
  50. ).catch(
  51. (res) => {
  52. }
  53. )
  54. },
  55. submission() {
  56. const that = this;
  57. uni.showModal({
  58. title: '请输入支付密码',
  59. editable:true,
  60. success: res => {
  61. if(res.confirm){
  62. trade({
  63. type: "USDT",
  64. num: that.number,
  65. to_user_address: that.address,
  66. trade_psw: res.content,
  67. }).then((res) => {
  68. uni.showToast({
  69. title: res.msg,
  70. duration: 1500,
  71. });
  72. that.number = ''
  73. that.qianBao();
  74. }
  75. ).catch(
  76. (res) => {
  77. }
  78. )
  79. }
  80. },
  81. fail: () => {},
  82. complete: () => {}
  83. });
  84. }
  85. }
  86. };
  87. </script>
  88. <style lang="scss">
  89. .container {
  90. padding: 25rpx 25rpx;
  91. }
  92. .listBox {
  93. padding: 46rpx 25rpx;
  94. background: #1F2A4A;
  95. border-radius: 10rpx;
  96. .titleTetx {
  97. font-weight: bold;
  98. font-size: 24rpx;
  99. color: #FFFFFF;
  100. padding-bottom: 25rpx;
  101. }
  102. .tipBox {
  103. padding-top: 15rpx;
  104. font-size: 24rpx;
  105. .tip1 {
  106. font-family: PingFang SC;
  107. font-weight: 500;
  108. font-size: 26rpx;
  109. color: #0C5AFA;
  110. line-height: 45rpx;
  111. }
  112. }
  113. }
  114. .listTpl {
  115. border-bottom: 1rpx solid #6A7288;
  116. padding-bottom: 25rpx;
  117. .inputBox {
  118. font-size: 35rpx;
  119. color: #FFFFFF;
  120. }
  121. .listTip {}
  122. .listAll {
  123. padding-left: 30rpx;
  124. font-size: 30rpx;
  125. color: #0C5AFA;
  126. }
  127. }
  128. .input-placeholder {
  129. font-family: PingFang SC;
  130. font-weight: 500;
  131. font-size: 26rpx;
  132. color: #666666;
  133. }
  134. .submission {
  135. padding: 80rpx 25rpx;
  136. padding-bottom: 25rpx;
  137. .golden {
  138. background: #0C5AFA;
  139. color: #ffffff;
  140. }
  141. }
  142. </style>