extract-currency.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  1. <template>
  2. <view class="page-box">
  3. <headContent>
  4. <template #left>
  5. <reverse-back path="pages/content/top-up" />
  6. </template>
  7. <template #content>
  8. <view class="haed-title">
  9. 提币
  10. </view>
  11. </template>
  12. <!-- <template #right>
  13. <view @click.stop="lookRecord()" class="head-record iconfont">&#xe642;</view>
  14. </template> -->
  15. </headContent>
  16. <view class="currency-box">
  17. <view class="currency-item">
  18. <view class="currency-info">
  19. <template v-if="biInfo">
  20. <image class="currency-icon" :src="biInfo.logo" mode="aspectFit"></image>
  21. <text class="currency-name">{{ biInfo.name|| biInfo.currency_name }}</text>
  22. </template>
  23. </view>
  24. <view class="select-currency" @click.stop="selectCurrency">
  25. <text>请选择币种</text>
  26. <text class="iconfont">&#xe8b5;</text>
  27. </view>
  28. </view>
  29. <view class="wallet-box">
  30. <view class="wallet-item">
  31. <text class="item-lable">地址</text>
  32. <input type="text" v-model="address" class="item-input" placeholder-class="item-placeholder"
  33. placeholder="请输入地址">
  34. <view class="item-right" @click.stop="openScanCode()">
  35. <text class="iconfont">&#xe8b6;</text>
  36. <text class="moer-icon iconfont">&#xe8b5;</text>
  37. </view>
  38. </view>
  39. <view class="wallet-item">
  40. <text class="item-lable">金额</text>
  41. <input type="number" v-model="number" class="item-input" placeholder-class="item-placeholder"
  42. placeholder="请输入提币数量">
  43. <view class="item-right">
  44. <text class="tag">USDT</text>
  45. <text class="all"
  46. @click.stop=" WalletCurrencyInfo ? number = WalletCurrencyInfo.legal_balance : ''">全部</text>
  47. </view>
  48. </view>
  49. <view class="wallet-usable">
  50. 可用金额: {{ WalletCurrencyInfo ? WalletCurrencyInfo.legal_balance : '--' }} USDT
  51. </view>
  52. <view class="wallet-item">
  53. <text class="item-lable">资金密码</text>
  54. <input type="password" v-model="pay_password" class="item-input"
  55. placeholder-class="item-placeholder" placeholder="请输入资金密码">
  56. </view>
  57. <view class="service-charge">
  58. 手续费<text> {{ WalletCurrencyInfo ? WalletCurrencyInfo.rate : '--' }} </text> USDT
  59. </view>
  60. <view class="actual-receipt">
  61. <text>实际到账</text>
  62. <text>{{ getSuccessAccount() || '--'}}</text>
  63. </view>
  64. <view :class="['wallet-btn' , checkout() ? 'active-wallet-btn' : '']"
  65. @click.stop="checkoutSuccess ? setWalletCurrency() : ''">
  66. 提币
  67. </view>
  68. <view class="hint-box">
  69. <text class="hint-title">温馨提示</text>
  70. <text class="hint-item">最小提币数量为 10USDT,提币手续费将从提币金额中扣取:</text>
  71. <text class="hint-item">提币前请认真核对收款地址,不要将USDT提币至除USDT之外的地址,否则将无法找回;</text>
  72. <text class="hint-item">请不要直接提现众筹或者ICO地址,Biking不会处理代币的发
  73. 放;</text>
  74. <text class="hint-item">受AML反洗钱等法规因素,OTC买入的数量24小时后才可以
  75. 进行提币申请。</text>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. </template>
  81. <script>
  82. import {
  83. Api_getWalletCurrency,
  84. Api_setWalletOut
  85. } from "@/api/index.js"
  86. import {
  87. scanCode
  88. } from "@/utils/common.js"
  89. export default {
  90. data() {
  91. return {
  92. biInfo: {},
  93. number: "",
  94. address: '',
  95. pay_password: "",
  96. WalletCurrencyInfo: null,
  97. checkoutSuccess: false,
  98. successAccount: ''
  99. };
  100. },
  101. onLoad(opt) {
  102. const key = opt?.key || '';
  103. this.init()
  104. this.biInfo = this.$getStorageSync('select')[key];
  105. this.getWalletCurrency();
  106. },
  107. computed: {
  108. // console.log('数据变动')
  109. },
  110. methods: {
  111. getSuccessAccount() {
  112. if (this.WalletCurrencyInfo) {
  113. const nus = this.$decimalNum.sub(Number(this.number), Number(this.WalletCurrencyInfo.rate));
  114. return nus > 0 ? nus : '--'
  115. }
  116. },
  117. setBiInfo(e) {
  118. this.biInfo = e;
  119. this.getWalletCurrency()
  120. },
  121. checkout() {
  122. if (this.WalletCurrencyInfo && (this.biInfo.currency_id || this.biInfo.id)) {
  123. if (Number(this.number) >= Number(this.WalletCurrencyInfo.min_number) && Number(this.number) > Number(
  124. this
  125. .WalletCurrencyInfo.rate) && Number(this.number) <= Number(this.WalletCurrencyInfo
  126. .legal_balance)) {
  127. } else {
  128. this.successAccount = ''
  129. this.checkoutSuccess = false
  130. return false
  131. }
  132. if (!this.address) {
  133. this.checkoutSuccess = false
  134. return false
  135. }
  136. if (!this.pay_password) {
  137. this.checkoutSuccess = false
  138. return false
  139. }
  140. this.checkoutSuccess = true
  141. return true
  142. } else {
  143. this.checkoutSuccess = false
  144. return false
  145. }
  146. },
  147. getWalletCurrency() {
  148. Api_getWalletCurrency({
  149. currency: this.biInfo.currency_id || this.biInfo.id
  150. }).then(res => {
  151. this.WalletCurrencyInfo = res
  152. }).catch(err => {
  153. })
  154. },
  155. // 选择币种
  156. selectCurrency() {
  157. const pages = getCurrentPages()
  158. if (pages.length > 1 && pages[pages.length - 1].route === 'pages/content/select-currency') {
  159. uni.navigateBack()
  160. } else {
  161. uni.navigateTo({
  162. url: "/pages/content/select-currency?type=withdraw"
  163. });
  164. }
  165. },
  166. // 提币
  167. setWalletCurrency() {
  168. uni.showLoading({
  169. title: ''
  170. })
  171. Api_setWalletOut({
  172. currency: this.biInfo.currency_id || this.biInfo.id,
  173. number: this.number,
  174. address: this.address,
  175. rate: this.WalletCurrencyInfo.rate,
  176. pay_password: this.pay_password
  177. }).then(res => {
  178. this.init()
  179. uni.showToast({
  180. icon:'none',
  181. title: res || '提交成功'
  182. })
  183. this.getWalletCurrency()
  184. }).catch(err => {
  185. })
  186. },
  187. init() {
  188. this.number = "";
  189. this.address = '';
  190. this.pay_password = "";
  191. },
  192. openScanCode() {
  193. scanCode().then(res => {
  194. this.address = res
  195. }).catch(err => {})
  196. }
  197. }
  198. }
  199. </script>
  200. <style lang="scss" scoped>
  201. .page-box {
  202. width: 100%;
  203. min-height: 100vh;
  204. background-color: $page-bg;
  205. }
  206. .head-record {
  207. font-size: 60rpx;
  208. }
  209. .currency-box {
  210. width: 100%;
  211. padding: 30rpx 40rpx;
  212. .currency-item {
  213. width: 100%;
  214. display: flex;
  215. justify-content: space-between;
  216. align-items: center;
  217. .currency-info {
  218. flex-shrink: 0;
  219. display: flex;
  220. align-items: center;
  221. .currency-icon {
  222. width: 46rpx;
  223. height: 46rpx;
  224. flex-shrink: 0;
  225. }
  226. .currency-name {
  227. font-size: 28rpx;
  228. padding-left: 7px;
  229. font-weight: 700;
  230. }
  231. }
  232. .select-currency {
  233. flex-shrink: 0;
  234. display: flex;
  235. align-items: center;
  236. font-size: 24rpx;
  237. .iconfont {
  238. color: #ccc;
  239. transform: rotateY(180deg);
  240. }
  241. }
  242. }
  243. }
  244. .wallet-box {
  245. .wallet-item {
  246. width: 100%;
  247. height: 100rpx;
  248. border-bottom: 1rpx solid $border-color11;
  249. display: flex;
  250. align-items: center;
  251. padding-top: 20rpx;
  252. .item-lable {
  253. width: 160rpx;
  254. flex-shrink: 0;
  255. font-size: 26rpx;
  256. font-family: PingFang SC, PingFang SC-Bold;
  257. font-weight: 700;
  258. text-align: left;
  259. color: #1a1a1a;
  260. }
  261. .item-input {
  262. flex: 1;
  263. padding-right: 20rpx;
  264. font-size: 26rpx;
  265. }
  266. .item-placeholder {
  267. font-size: 24rpx;
  268. font-family: PingFang SC, PingFang SC-Regular;
  269. font-weight: 400;
  270. color: #cccccc;
  271. }
  272. .item-right {
  273. flex-shrink: 0;
  274. display: flex;
  275. align-items: center;
  276. text {
  277. font-size: 26rpx;
  278. }
  279. .iconfont {
  280. font-size: 40rpx;
  281. }
  282. .moer-icon {
  283. transform: rotate(180deg);
  284. color: #666666;
  285. font-size: 36rpx;
  286. }
  287. .tag {
  288. line-height: 1.2;
  289. border-right: 1px solid #d9d9d9;
  290. padding-right: 20rpx;
  291. color: #CCCCCC;
  292. }
  293. .all {
  294. padding-left: 20rpx;
  295. color: $Theme-Color;
  296. }
  297. }
  298. }
  299. .wallet-usable {
  300. width: 100%;
  301. height: 50rpx;
  302. padding: 17rpx 0;
  303. font-size: 24rpx;
  304. font-family: PingFang SC, PingFang SC-Regular;
  305. font-weight: 400;
  306. text-align: right;
  307. color: #1a1a1a;
  308. }
  309. .service-charge {
  310. width: 100%;
  311. padding: 40rpx 0;
  312. line-height: 1.2;
  313. font-size: 26rpx;
  314. font-family: PingFang SC, PingFang SC-Regular;
  315. font-weight: 400;
  316. text-align: left;
  317. color: #808080;
  318. text {
  319. color: #FFBA6A;
  320. }
  321. }
  322. .actual-receipt {
  323. font-size: 26rpx;
  324. line-height: 1.2;
  325. display: flex;
  326. align-items: center;
  327. justify-content: space-between;
  328. padding-bottom: 25rpx;
  329. border-bottom: 1rpx solid $border-color11;
  330. }
  331. .wallet-btn {
  332. width: 100%;
  333. height: 90rpx;
  334. background: #b3b3b3;
  335. border-radius: 8px;
  336. text-align: center;
  337. line-height: 90rpx;
  338. color: #fff;
  339. margin: 40rpx 0;
  340. }
  341. .active-wallet-btn {
  342. background-color: $Theme-Color;
  343. }
  344. // <view class="hint-box">
  345. // <text class="hint-title">温馨提示</text>
  346. // <text class="hint-item">最小提币数量为 10USDT,提币手续费将从提币金额中扣取:</text>
  347. // <text class="hint-item">提币前请认真核对收款地址,不要将USDT提币至除USDT之外的地址,否则将无法找回;</text>
  348. // <text class="hint-item">请不要直接提现众筹或者ICO地址,Biking不会处理代币的发
  349. // 放;</text>
  350. // <text class="hint-item">受AML反洗钱等法规因素,OTC买入的数量24小时后才可以
  351. // 进行提币申请。</text>
  352. // </view>
  353. .hint-box {
  354. width: 100%;
  355. font-size: 26rpx;
  356. display: flex;
  357. flex-direction: column;
  358. font-family: PingFang SC, PingFang SC-Regular;
  359. font-weight: 400;
  360. .hint-title {
  361. padding-bottom: 20rpx;
  362. color: #1a1a1a;
  363. line-height: 1.2;
  364. }
  365. .hint-item {
  366. padding-bottom: 14rpx;
  367. color: #808080;
  368. line-height: 1.2;
  369. }
  370. }
  371. }
  372. </style>