withdraw.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. <template>
  2. <view class="container">
  3. <view class="status_bar"><!-- 这里是状态栏 --></view>
  4. <view class="goback-box" @click="toBack"><image class="goback" src="../../static/img/fanhui.png" mode=""></image></view>
  5. <view class="header">提币</view>
  6. <view class="list-box">
  7. <view class="img"><image src="../../static/img/zhuanzhang-bg.png" mode=""></image></view>
  8. <view class="list flex">
  9. <view class="flex_item list-item">
  10. <image :src="logo"></image>
  11. <view>{{ name }}</view>
  12. </view>
  13. <view class="flex_item list-tpl">
  14. <view class="content" @click="useOutClickSide"><selectss ref="easySelect" :options="moneyTypeList" :value="name" @selectOne="selectOne"></selectss></view>
  15. <image src="../../static/img/jiantou.png"></image>
  16. </view>
  17. </view>
  18. </view>
  19. <view class="from-box">
  20. <view class="from-title">提币地址</view>
  21. <input class="input-box" type="text" v-model="addr" placeholder="请输入提币地址" />
  22. <view class="from-title">数量</view>
  23. <view class="flex input-tpl">
  24. <input class="input-box" type="number" v-model="num" :placeholder="'最低数量 ' + less + name" />
  25. <view class="all" @click="num = money">全部</view>
  26. </view>
  27. <view class="all-num">
  28. 可用
  29. <text>{{ money * 1 }}</text>
  30. {{ name }}
  31. </view>
  32. <view class="submit" @click="cash">确定</view>
  33. <view class="tpl-box" v-show="showText == true">提币数量在{{ less }}-10000.0个之间,认真核对提币地址;手续费:{{ data.service }}{{ data.service_type }}</view>
  34. </view>
  35. <view class="curtain" :class="{ ishiden: isHiden }" @touchmove.stop.prevent="moveHandle">
  36. <view class="psw-wrapper">
  37. <view class="psw-title">请输入支付密码</view>
  38. <input type="password" v-model="password" class="psw-ipt" />
  39. <view class="psw-btn">
  40. <text @click="cancel">取消</text>
  41. <text class="psw-qd" @click="pswQd">确定</text>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. import { cash, cashmoney_type, calculator, wallet } from '@/api/finance.js';
  49. import selectss from '@/components/select.vue';
  50. export default {
  51. components: {
  52. selectss
  53. },
  54. data() {
  55. return {
  56. moneyTypeList: [],
  57. name: '',
  58. code: '',
  59. logo: '',
  60. money: '',
  61. less: '',
  62. addr: '',
  63. num: '',
  64. isHiden: true,
  65. data: '',
  66. showText: false,
  67. password: ''
  68. };
  69. },
  70. onLoad(option) {
  71. console.log(option);
  72. if (option.name) {
  73. this.name = option.name;
  74. }
  75. this.moneyType();
  76. },
  77. onShow() {},
  78. watch: {
  79. num(newVal, oldVal) {
  80. this.calculator();
  81. }
  82. },
  83. methods: {
  84. // 所有币种
  85. async moneyType() {
  86. let obj = this;
  87. wallet({}).then(({ data }) => {
  88. const arr = Object.keys(data.back);
  89. console.log(arr);
  90. let ar = [];
  91. arr.forEach(e => {
  92. ar.push(data.back[e]);
  93. });
  94. obj.moneyTypeList = ar.filter(e => {
  95. console.log(e);
  96. if (e.can_cash == 1) {
  97. return e;
  98. } else {
  99. return;
  100. }
  101. });
  102. console.log(obj.moneyTypeList);
  103. if (obj.name == '') {
  104. obj.logo = obj.moneyTypeList[0].LOGO;
  105. obj.name = obj.moneyTypeList[0].name;
  106. obj.code = obj.moneyTypeList[0].code;
  107. obj.money = obj.moneyTypeList[0].money.money;
  108. obj.less = obj.moneyTypeList[0].less;
  109. } else {
  110. for (let i = 0; i < obj.moneyTypeList.length; i++) {
  111. if (obj.moneyTypeList[i].name == this.name) {
  112. obj.logo = obj.moneyTypeList[i].LOGO;
  113. obj.name = obj.moneyTypeList[i].name;
  114. obj.code = obj.moneyTypeList[i].code;
  115. obj.money = obj.moneyTypeList[i].money.money;
  116. obj.less = obj.moneyTypeList[i].less;
  117. break;
  118. }
  119. }
  120. }
  121. });
  122. },
  123. calculator() {
  124. let obj = this;
  125. calculator({
  126. money_type: obj.code,
  127. money: obj.num
  128. }).then(({ data }) => {
  129. console.log(data);
  130. obj.data = data;
  131. obj.showText = true;
  132. });
  133. },
  134. cash() {
  135. let obj = this;
  136. if (obj.code == '') {
  137. obj.$api.msg('请选择币种!');
  138. return;
  139. }
  140. if (obj.addr == '') {
  141. obj.$api.msg('请输入提币地址!');
  142. return;
  143. }
  144. if (obj.num == '') {
  145. obj.$api.msg('请输入提币数量!');
  146. return;
  147. }
  148. if (obj.num < obj.less) {
  149. obj.$api.msg('最低数量不能低于' + obj.less + '!');
  150. return;
  151. }
  152. this.isHiden = false;
  153. },
  154. pswQd() {
  155. const obj = this;
  156. if (this.password == '') {
  157. obj.$api.msg('请输入密码');
  158. }
  159. cash({
  160. money_type: obj.code,
  161. money: obj.num,
  162. address: obj.addr,
  163. password: obj.password
  164. }).then(data => {
  165. obj.money = '';
  166. obj.address = '';
  167. obj.password = '';
  168. obj.$api.msg(data.msg);
  169. this.isHiden = true;
  170. });
  171. },
  172. cancel() {
  173. this.password = '';
  174. this.isHiden = true;
  175. },
  176. selectOne(options) {
  177. this.logo = options.LOGO;
  178. this.name = options.name;
  179. this.code = options.code;
  180. this.money = options.wallet.money;
  181. this.less = options.less;
  182. },
  183. useOutClickSide() {
  184. this.$refs.easySelect.hideOptions && this.$refs.easySelect.hideOptions();
  185. },
  186. nav(url) {
  187. uni.navigateTo({
  188. url: url
  189. });
  190. },
  191. toBack() {
  192. uni.switchTab({
  193. url: '/pages/assets/assets'
  194. });
  195. }
  196. }
  197. };
  198. </script>
  199. <style lang="scss">
  200. page {
  201. min-height: 100%;
  202. background-color: #ffffff;
  203. .container {
  204. width: 100%;
  205. }
  206. }
  207. .status_bar {
  208. height: var(--status-bar-height);
  209. width: 100%;
  210. background: linear-gradient(90deg, #60bab0, #45969b);
  211. }
  212. .list-box {
  213. padding: 104rpx 30rpx 60rpx;
  214. height: 350rpx;
  215. .img {
  216. position: absolute;
  217. top: 0;
  218. left: 0;
  219. right: 0;
  220. width: 100%;
  221. height: 440rpx;
  222. image {
  223. width: 100%;
  224. height: 100%;
  225. }
  226. }
  227. .list {
  228. position: relative;
  229. z-index: 10;
  230. background-color: #ffffff;
  231. border-radius: 15rpx;
  232. padding: 15rpx 23rpx;
  233. .list-item {
  234. font-size: 30rpx;
  235. font-weight: bold;
  236. color: #333333;
  237. image {
  238. width: 43rpx;
  239. height: 43rpx;
  240. margin-right: 15rpx;
  241. }
  242. }
  243. .list-tpl {
  244. image {
  245. width: 15rpx;
  246. height: 25rpx;
  247. margin-left: 20rpx;
  248. }
  249. }
  250. }
  251. }
  252. .from-box {
  253. margin: 74rpx 30rpx;
  254. padding: 44rpx 25rpx;
  255. background-color: #ffffff;
  256. border-radius: 15rpx;
  257. position: relative;
  258. top: -180rpx;
  259. .from-title {
  260. font-size: 24rpx;
  261. font-weight: bold;
  262. color: #333333;
  263. }
  264. .input-box {
  265. font-size: 26rpx;
  266. font-weight: 500;
  267. color: #666666;
  268. margin: 35rpx 0rpx;
  269. }
  270. .all {
  271. font-size: 30rpx;
  272. font-weight: 500;
  273. color: #44969d;
  274. }
  275. .all-num {
  276. font-size: 24rpx;
  277. font-weight: bold;
  278. color: #333333;
  279. }
  280. .submit {
  281. background: linear-gradient(90deg, #60bab0, #60bab0, #45969b);
  282. margin-top: 165rpx;
  283. color: #ffffff;
  284. text-align: center;
  285. padding: 26rpx 0rpx;
  286. border-radius: 15rpx;
  287. }
  288. .tpl-box {
  289. text-align: left;
  290. font-size: 28rpx;
  291. font-weight: 500;
  292. color: #fb3a2f;
  293. margin-top: 26rpx;
  294. }
  295. }
  296. .jilv {
  297. margin-top: 30rpx;
  298. text-align: center;
  299. color: #999999;
  300. font-size: 30rpx;
  301. }
  302. .curtain {
  303. position: fixed;
  304. width: 100%;
  305. height: 100%;
  306. top: 0;
  307. background-color: rgba($color: #000000, $alpha: 0.2);
  308. .psw-wrapper {
  309. position: fixed;
  310. top: 50%;
  311. left: 50%;
  312. transform: translate(-50%, -100%);
  313. width: 548.6rpx;
  314. height: 344.4rpx;
  315. background-color: #ffffff;
  316. border-radius: 15rpx 15rpx;
  317. .psw-title {
  318. width: 100%;
  319. font-size: 35rpx;
  320. padding: 43rpx 0 49rpx;
  321. text-align: center;
  322. font-weight: 800;
  323. }
  324. .psw-ipt {
  325. display: block;
  326. background-color: #dce3ed;
  327. height: 90rpx;
  328. width: 464rpx;
  329. padding-left: 30rpx;
  330. margin: 0 auto;
  331. font-size: 80rpx;
  332. }
  333. .psw-btn text {
  334. display: inline-block;
  335. text-align: center;
  336. width: 50%;
  337. padding-top: 29rpx;
  338. font-size: 35rpx;
  339. }
  340. .psw-qd {
  341. color: #5771df;
  342. }
  343. }
  344. }
  345. .ishiden {
  346. display: none;
  347. }
  348. .goback-box {
  349. position: absolute;
  350. left: 18rpx;
  351. top: var(--status-bar-height);
  352. height: 80rpx;
  353. display: flex;
  354. align-items: center;
  355. }
  356. .goback {
  357. z-index: 100;
  358. width: 34rpx;
  359. height: 34rpx;
  360. }
  361. .header {
  362. color: #ffffff;
  363. position: absolute;
  364. left: 0;
  365. top: var(--status-bar-height);
  366. width: 100%;
  367. height: 80rpx;
  368. font-size: 32rpx;
  369. font-weight: 700;
  370. z-index: 99;
  371. display: flex;
  372. justify-content: center;
  373. align-items: center;
  374. }
  375. </style>