withdraw.vue 7.4 KB

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