extract-currency.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  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" class="item-input" placeholder-class="item-placeholder"
  55. 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. WalletCurrencyInfo: null,
  96. checkoutSuccess: false,
  97. successAccount: ''
  98. };
  99. },
  100. onLoad(opt) {
  101. const key = opt?.key || '';
  102. this.biInfo = this.$getStorageSync('select')[key];
  103. this.getWalletCurrency();
  104. },
  105. computed: {
  106. // console.log('数据变动')
  107. },
  108. methods: {
  109. getSuccessAccount() {
  110. if (this.WalletCurrencyInfo) {
  111. const nus = this.$decimalNum.sub(Number(this.number), Number(this.WalletCurrencyInfo.rate));
  112. return nus > 0 ? nus : '--'
  113. }
  114. },
  115. setBiInfo(e) {
  116. this.biInfo = e;
  117. this.getWalletCurrency()
  118. },
  119. checkout() {
  120. if (this.WalletCurrencyInfo && (this.biInfo.currency_id || this.biInfo.id)) {
  121. if (Number(this.number) >= Number(this.WalletCurrencyInfo.min_number) && Number(this.number) > Number(
  122. this
  123. .WalletCurrencyInfo.rate) && Number(this.number) <= Number(this.WalletCurrencyInfo
  124. .legal_balance)) {
  125. console.log('0')
  126. // this.successAccount = this.$decimalNum.sub(Number(this.number), Number(this
  127. // .WalletCurrencyInfo.rate))
  128. } else {
  129. this.successAccount = ''
  130. this.checkoutSuccess = false
  131. return false
  132. }
  133. if (!this.address) {
  134. this.checkoutSuccess = false
  135. return false
  136. }
  137. this.checkoutSuccess = true
  138. return true
  139. } else {
  140. this.checkoutSuccess = false
  141. return false
  142. }
  143. },
  144. getWalletCurrency() {
  145. Api_getWalletCurrency({
  146. currency: this.biInfo.currency_id || this.biInfo.id
  147. }).then(res => {
  148. this.WalletCurrencyInfo = res
  149. }).catch(err => {
  150. })
  151. },
  152. // 选择币种
  153. selectCurrency() {
  154. const pages = getCurrentPages()
  155. if (pages.length > 1 && pages[pages.length - 1].route === 'pages/content/select-currency') {
  156. uni.navigateBack()
  157. } else {
  158. uni.navigateTo({
  159. url: "/pages/content/select-currency?type=withdraw"
  160. });
  161. }
  162. },
  163. // 提币
  164. setWalletCurrency() {
  165. uni.showLoading({
  166. title: ''
  167. })
  168. Api_setWalletOut({
  169. currency: this.biInfo.currency_id || this.biInfo.id,
  170. number: this.number,
  171. address: this.address,
  172. rate: this.WalletCurrencyInfo.rate,
  173. }).then(res => {
  174. this.getWalletCurrency()
  175. }).catch(err => {
  176. })
  177. },
  178. openScanCode() {
  179. scanCode().then(res => {
  180. this.address = res
  181. }).catch(err => {})
  182. }
  183. }
  184. }
  185. </script>
  186. <style lang="scss" scoped>
  187. .page-box {
  188. width: 100%;
  189. min-height: 100vh;
  190. background-color: $page-bg;
  191. }
  192. .head-record {
  193. font-size: 60rpx;
  194. }
  195. .currency-box {
  196. width: 100%;
  197. padding: 30rpx 40rpx;
  198. .currency-item {
  199. width: 100%;
  200. display: flex;
  201. justify-content: space-between;
  202. align-items: center;
  203. .currency-info {
  204. flex-shrink: 0;
  205. display: flex;
  206. align-items: center;
  207. .currency-icon {
  208. width: 46rpx;
  209. height: 46rpx;
  210. flex-shrink: 0;
  211. }
  212. .currency-name {
  213. font-size: 28rpx;
  214. padding-left: 7px;
  215. font-weight: 700;
  216. }
  217. }
  218. .select-currency {
  219. flex-shrink: 0;
  220. display: flex;
  221. align-items: center;
  222. font-size: 24rpx;
  223. .iconfont {
  224. color: #ccc;
  225. transform: rotateY(180deg);
  226. }
  227. }
  228. }
  229. }
  230. .wallet-box {
  231. .wallet-item {
  232. width: 100%;
  233. height: 100rpx;
  234. border-bottom: 1rpx solid $border-color11;
  235. display: flex;
  236. align-items: center;
  237. padding-top: 20rpx;
  238. .item-lable {
  239. width: 160rpx;
  240. flex-shrink: 0;
  241. font-size: 26rpx;
  242. font-family: PingFang SC, PingFang SC-Bold;
  243. font-weight: 700;
  244. text-align: left;
  245. color: #1a1a1a;
  246. }
  247. .item-input {
  248. flex: 1;
  249. padding-right: 20rpx;
  250. font-size: 26rpx;
  251. }
  252. .item-placeholder {
  253. font-size: 24rpx;
  254. font-family: PingFang SC, PingFang SC-Regular;
  255. font-weight: 400;
  256. color: #cccccc;
  257. }
  258. .item-right {
  259. flex-shrink: 0;
  260. display: flex;
  261. align-items: center;
  262. text {
  263. font-size: 26rpx;
  264. }
  265. .iconfont {
  266. font-size: 40rpx;
  267. }
  268. .moer-icon {
  269. transform: rotate(180deg);
  270. color: #666666;
  271. font-size: 36rpx;
  272. }
  273. .tag {
  274. line-height: 1.2;
  275. border-right: 1px solid #d9d9d9;
  276. padding-right: 20rpx;
  277. color: #CCCCCC;
  278. }
  279. .all {
  280. padding-left: 20rpx;
  281. color: $Theme-Color;
  282. }
  283. }
  284. }
  285. .wallet-usable {
  286. width: 100%;
  287. height: 50rpx;
  288. padding: 17rpx 0;
  289. font-size: 24rpx;
  290. font-family: PingFang SC, PingFang SC-Regular;
  291. font-weight: 400;
  292. text-align: right;
  293. color: #1a1a1a;
  294. }
  295. .service-charge {
  296. width: 100%;
  297. padding: 40rpx 0;
  298. line-height: 1.2;
  299. font-size: 26rpx;
  300. font-family: PingFang SC, PingFang SC-Regular;
  301. font-weight: 400;
  302. text-align: left;
  303. color: #808080;
  304. text {
  305. color: #FFBA6A;
  306. }
  307. }
  308. .actual-receipt {
  309. font-size: 26rpx;
  310. line-height: 1.2;
  311. display: flex;
  312. align-items: center;
  313. justify-content: space-between;
  314. padding-bottom: 25rpx;
  315. border-bottom: 1rpx solid $border-color11;
  316. }
  317. .wallet-btn {
  318. width: 100%;
  319. height: 90rpx;
  320. background: #b3b3b3;
  321. border-radius: 8px;
  322. text-align: center;
  323. line-height: 90rpx;
  324. color: #fff;
  325. margin: 40rpx 0;
  326. }
  327. .active-wallet-btn {
  328. background-color: $Theme-Color;
  329. }
  330. // <view class="hint-box">
  331. // <text class="hint-title">温馨提示</text>
  332. // <text class="hint-item">最小提币数量为 10USDT,提币手续费将从提币金额中扣取:</text>
  333. // <text class="hint-item">提币前请认真核对收款地址,不要将USDT提币至除USDT之外的地址,否则将无法找回;</text>
  334. // <text class="hint-item">请不要直接提现众筹或者ICO地址,Biking不会处理代币的发
  335. // 放;</text>
  336. // <text class="hint-item">受AML反洗钱等法规因素,OTC买入的数量24小时后才可以
  337. // 进行提币申请。</text>
  338. // </view>
  339. .hint-box {
  340. width: 100%;
  341. font-size: 26rpx;
  342. display: flex;
  343. flex-direction: column;
  344. font-family: PingFang SC, PingFang SC-Regular;
  345. font-weight: 400;
  346. .hint-title {
  347. padding-bottom: 20rpx;
  348. color: #1a1a1a;
  349. line-height: 1.2;
  350. }
  351. .hint-item {
  352. padding-bottom: 14rpx;
  353. color: #808080;
  354. line-height: 1.2;
  355. }
  356. }
  357. }
  358. </style>