withdrawal.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <view class="all">
  3. <view class="top">
  4. <view class="topO">
  5. {{$t('userinfo.u6')}}
  6. </view>
  7. <view class="topT flex-start padding-b-30">
  8. <view class="TT">USDT-TRC20</view>
  9. </view>
  10. <view class="topO">
  11. {{$t('userinfo.u7')}}
  12. </view>
  13. <view class="topF margin-b-30">
  14. <input class="FF" type="text" :placeholder="$t('userinfo.u17')" v-model="address"
  15. placeholder-class="placeholder-input" />
  16. </view>
  17. <view class="topO ">
  18. {{$t('userinfo.u8')}} <text class="font-color-gray font-size-sm">({{$t('userinfo.u19')}}:{{userWallet}})</text>
  19. </view>
  20. <view class="topF flex margin-b-30">
  21. <input class="FF" type="number" v-model="withdrawal" :placeholder="$t('userinfo.u18')"
  22. placeholder-class="placeholder-input" />
  23. <view class="btn" @click="withdrawal=userWallet">USDT {{$t('userinfo.u20')}}</view>
  24. </view>
  25. <view class="topO ">
  26. {{$t('userinfo.u21')}} (3%)
  27. </view>
  28. <view class="topF flex">
  29. <text v-if="type==1">{{charge}}</text>
  30. <text v-else>{{num}}</text>
  31. </view>
  32. </view>
  33. <view class="center margin-t-30">
  34. <view class="tx">{{$t('userinfo.u9')}}</view>
  35. <view class="buzhou margin-t-20">
  36. <view class="">1.{{$t('userinfo.u10')}} </view>
  37. <view class="">① {{$t('userinfo.u11')}}</view>
  38. <view class="">② {{$t('userinfo.u12')}} </view>
  39. <view class="">2.{{$t('userinfo.u13')}}</view>
  40. <view class="">3.{{$t('userinfo.u14')}}</view>
  41. <view class="">4.{{$t('userinfo.u15')}}</view>
  42. </view>
  43. </view>
  44. <view class="last margin-t-30" @click="openPayPassword">
  45. <view class="la" :class="{action:loding}">{{$t('userinfo.u16')}}</view>
  46. </view>
  47. <uni-popup type="bottom" ref="popup">
  48. <inputPassword @commit='KeyInfo'></inputPassword>
  49. </uni-popup>
  50. </view>
  51. </template>
  52. <script>
  53. import {
  54. gameWallet
  55. } from "@/api/game.js";
  56. import {
  57. extractCash
  58. } from "@/api/wallet.js";
  59. import inputPassword from "@/components/input-password/input-password.vue";
  60. export default {
  61. components: {
  62. inputPassword
  63. },
  64. data() {
  65. return {
  66. address: '', //提现地址
  67. withdrawal: '', //提现金额
  68. userWallet: '',
  69. loding: false,
  70. password: '',
  71. // 手续费信息
  72. type: 0,
  73. num: 0
  74. };
  75. },
  76. computed: {
  77. charge() {
  78. return Number( (this.withdrawal*this.num/100).toFixed(8))
  79. }
  80. },
  81. onLoad() {
  82. uni.setNavigationBarTitle({
  83. title: this.$t("tab.a8"),
  84. });
  85. this.gameWallet();
  86. },
  87. methods: {
  88. // 支付弹窗
  89. openPayPassword() {
  90. if (this.userWallet < this.withdrawal) {
  91. uni.showToast({
  92. // title: '余额不足!',
  93. title: this.$t("userinfo.u22"),
  94. icon: 'error'
  95. });
  96. return
  97. };
  98. this.$refs.popup.open();
  99. },
  100. // 关闭支付弹窗
  101. colsePayPassword() {
  102. this.$refs.popup.close();
  103. },
  104. // 密码输入完成
  105. KeyInfo(val) {
  106. this.password = val;
  107. this.colsePayPassword();
  108. this.submit();
  109. },
  110. // 获取用户信息
  111. gameWallet() {
  112. const that = this;
  113. gameWallet().then((res) => {
  114. that.userWallet = +res.data.back.USDT.money.money;
  115. that.type = +res.data.back.USDT.cash_commission_count_type;
  116. that.num = +res.data.back.USDT.cash_commission_ratio;
  117. })
  118. },
  119. // 提交
  120. submit() {
  121. const that = this;
  122. uni.showLoading({
  123. title: this.$t("userinfo.u23"),
  124. mask: true
  125. });
  126. that.loding = true;
  127. extractCash({
  128. money: that.withdrawal,
  129. money_type: "USDT",
  130. address: that.address,
  131. trade_password: that.password,
  132. }).then((res) => {
  133. that.loding = false;
  134. uni.hideLoading()
  135. uni.showToast({
  136. title: this.$t("userinfo.u24")
  137. });
  138. this.address = '';
  139. this.withdrawal = ''; //提现金额
  140. this.password = '';
  141. }).catch((res) => {
  142. uni.showToast({
  143. title: this.$t("userinfo.u25"),
  144. icon: 'error'
  145. });
  146. that.loding = false;
  147. uni.hideLoading()
  148. })
  149. }
  150. }
  151. }
  152. </script>
  153. <style lang="scss" scoped>
  154. .all {
  155. color: #FFFFFF;
  156. padding: 0 30rpx;
  157. line-height: 1;
  158. padding-bottom: 150rpx;
  159. }
  160. .placeholder-input {
  161. color: $font-color-light;
  162. }
  163. .top {
  164. background: #191A1F;
  165. border-radius: 20rpx;
  166. padding: 40rpx 30rpx;
  167. .topO {
  168. font-size: $font-lg;
  169. padding-bottom: 30rpx;
  170. }
  171. .topT {
  172. .TT {
  173. border: 2px solid #DDBA82;
  174. border-radius: 10rpx;
  175. font-size: 26rpx;
  176. color: #FEB041;
  177. padding: 20rpx 24rpx;
  178. }
  179. }
  180. .topF {
  181. background-color: rgba(254, 176, 65, 0.09);
  182. border-radius: 20rpx;
  183. padding: 20rpx 30rpx;
  184. .FF {
  185. font-size: $font-base;
  186. flex-grow: 1;
  187. }
  188. .btn {
  189. font-size: $font-base;
  190. }
  191. }
  192. }
  193. .center {
  194. background: #191A1F;
  195. border-radius: 20rpx;
  196. font-weight: 500;
  197. padding: 30rpx;
  198. .tx {
  199. font-size: 29rpx;
  200. line-height: 30rpx;
  201. }
  202. .buzhou {
  203. font-size: 24rpx;
  204. color: #999999;
  205. line-height: 40rpx;
  206. }
  207. }
  208. .last {
  209. background: #feb041;
  210. border-radius: 10rpx;
  211. overflow: hidden;
  212. position: fixed;
  213. bottom: 30rpx;
  214. left: 30rpx;
  215. right:30rpx;
  216. .la {
  217. font-size: $font-lg;
  218. font-weight: bold;
  219. color: #040404;
  220. text-align: center;
  221. padding: 30rpx;
  222. &.action {
  223. color: #FFF;
  224. background-color: $font-color-light;
  225. }
  226. }
  227. }
  228. </style>