withdrawal.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <view class="all">
  3. <navBar :show-title="true" :title="$t('user.提现1')" url="/pages/user/user"></navBar>
  4. <view class="top">
  5. <!-- <view class="topO">
  6. 提現類型
  7. </view> -->
  8. <!-- <view class="topT flex-start padding-b-30">
  9. <view class="TT">USDT</view>
  10. <view class="TT noaction" @click="openPkr">BCMM</view>
  11. </view> -->
  12. <!-- <view class="topO">
  13. 提現地址
  14. </view> -->
  15. <!-- <view class="topF margin-b-30">
  16. <input class="FF" type="text" placeholder="請輸入提現地址" v-model="address"
  17. placeholder-class="placeholder-input" />
  18. </view> -->
  19. <view class="topO ">
  20. {{$t('user.提现金额')}} <text class="font-color-gray font-size-sm">(USDT:{{userWallet}})</text>
  21. </view>
  22. <view class="topF flex margin-b-30">
  23. <input class="FF" type="number" v-model="withdrawal" :placeholder="$t('user.请输入提现金额')"
  24. placeholder-class="placeholder-input" />
  25. <view class="btn" @click="withdrawal=userWallet">USDT {{$t('user.全部1')}}</view>
  26. </view>
  27. <view class="topO ">
  28. {{$t('user.手续费')}} ({{num}}%)
  29. </view>
  30. <view class="topF flex">
  31. <text>{{charge}}</text>
  32. </view>
  33. </view>
  34. <view class="last margin-t-30" @click="submit">
  35. <view class="la" :class="{action:loding}">{{$t('user.立即提现')}}</view>
  36. </view>
  37. <!-- <uni-popup type="bottom" ref="popup">
  38. <inputPassword @commit='KeyInfo'></inputPassword>
  39. </uni-popup> -->
  40. </view>
  41. </template>
  42. <script>
  43. import {
  44. gameWallet,
  45. extractCalculator,
  46. loadIndexs
  47. } from "@/api/index.js";
  48. import {
  49. getUserInfo
  50. } from "@/api/user.js";
  51. import navBar from "@/components/nav/nav.vue"
  52. export default {
  53. components: {
  54. navBar
  55. },
  56. data() {
  57. return {
  58. address: '', //提现地址
  59. loding: false,
  60. type: 0,
  61. num: 0, //手续费百分比
  62. userWallet: '',
  63. withdrawal: '',
  64. };
  65. },
  66. computed: {
  67. charge() {
  68. return Number((this.withdrawal * this.num / 100).toFixed(18))
  69. }
  70. },
  71. onLoad(option) {
  72. this.getUserInfo();
  73. },
  74. methods: {
  75. openPkr() {
  76. uni.showToast({
  77. title: this.$t('user.暂未开放'),
  78. icon: 'error'
  79. });
  80. },
  81. // 获取用户信息
  82. getUserInfo() {
  83. const that = this;
  84. getUserInfo().then((res) => {
  85. // console.log(res)
  86. that.userWallet = +res.data.USDT;
  87. // console.log(that.userWallet)
  88. })
  89. loadIndexs().then((res) => {
  90. // console.log(res)
  91. that.num = +res.data.commission;
  92. // console.log(that.userWallet)
  93. })
  94. },
  95. // 提交
  96. submit() {
  97. const that = this;
  98. uni.showLoading({
  99. mask: true
  100. });
  101. if (that.userWallet < that.withdrawal) {
  102. uni.showToast({
  103. title:this.$t('user.余额不足'),
  104. icon: 'error'
  105. });
  106. return
  107. };
  108. that.loding = true;
  109. extractCalculator({
  110. number: that.withdrawal,
  111. token: "USDT",
  112. }).then((res) => {
  113. that.loding = false;
  114. uni.hideLoading()
  115. uni.showToast({
  116. title: this.$t("user.提现成功")
  117. });
  118. this.address = '';
  119. this.withdrawal = ''; //提现金额
  120. this.password = '';
  121. }).catch((res) => {
  122. uni.showToast({
  123. title: this.$t("user.提现失败"),
  124. icon: 'error'
  125. });
  126. that.loding = false;
  127. uni.hideLoading()
  128. })
  129. }
  130. }
  131. }
  132. </script>
  133. <style lang="scss" scoped>
  134. .all {
  135. color: #FFFFFF;
  136. line-height: 1;
  137. padding-bottom: 150rpx;
  138. background-color: rgb(12, 8, 21);
  139. min-height: 100vh;
  140. }
  141. .placeholder-input {
  142. color: $font-color-light;
  143. }
  144. .top {
  145. background: rgba(255, 255, 255, .09);
  146. border-radius: 20rpx;
  147. padding: 40rpx 30rpx;
  148. margin: 0 30rpx;
  149. .topO {
  150. font-size: $font-lg;
  151. padding-bottom: 30rpx;
  152. }
  153. .topT {
  154. .TT {
  155. border: 2px solid #DDBA82;
  156. border-radius: 10rpx;
  157. font-size: 26rpx;
  158. color: #FEB041;
  159. padding: 20rpx 24rpx;
  160. &.noaction {
  161. margin-left: 20rpx;
  162. border-color: #999999;
  163. color: #999999;
  164. }
  165. }
  166. }
  167. .topF {
  168. background-color: rgba(254, 176, 65, 0.09);
  169. border-radius: 20rpx;
  170. padding: 20rpx 30rpx;
  171. .FF {
  172. font-size: $font-base;
  173. flex-grow: 1;
  174. }
  175. .btn {
  176. font-size: $font-base;
  177. }
  178. }
  179. }
  180. .center {
  181. background: #191A1F;
  182. border-radius: 20rpx;
  183. font-weight: 500;
  184. padding: 30rpx;
  185. .tx {
  186. font-size: 29rpx;
  187. line-height: 30rpx;
  188. }
  189. .buzhou {
  190. font-size: 24rpx;
  191. color: #999999;
  192. line-height: 40rpx;
  193. }
  194. }
  195. .last {
  196. background: linear-gradient(90deg, #7D32FF, #3EE0FF);
  197. border-radius: 10rpx;
  198. overflow: hidden;
  199. position: fixed;
  200. bottom: 30rpx;
  201. left: 30rpx;
  202. right: 30rpx;
  203. .la {
  204. font-size: $font-lg;
  205. font-weight: bold;
  206. color: #FFF;
  207. text-align: center;
  208. padding: 30rpx;
  209. &.action {
  210. color: #FFF;
  211. background-color: $font-color-light;
  212. }
  213. }
  214. }
  215. </style>