withdrawal.vue 5.4 KB

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