withdraw.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  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. console.log(options,"123456")
  178. this.logo = options.LOGO;
  179. this.name = options.name;
  180. this.code = options.code;
  181. this.money = options.money.money;
  182. this.less = options.less;
  183. },
  184. useOutClickSide() {
  185. this.$refs.easySelect.hideOptions && this.$refs.easySelect.hideOptions();
  186. },
  187. nav(url) {
  188. uni.navigateTo({
  189. url: url
  190. });
  191. },
  192. toBack() {
  193. uni.switchTab({
  194. url: '/pages/assets/assets'
  195. });
  196. }
  197. }
  198. };
  199. </script>
  200. <style lang="scss">
  201. page {
  202. min-height: 100%;
  203. background-color: #ffffff;
  204. .container {
  205. width: 100%;
  206. }
  207. }
  208. .status_bar {
  209. height: var(--status-bar-height);
  210. width: 100%;
  211. background: linear-gradient(90deg, #60bab0, #45969b);
  212. }
  213. .list-box {
  214. padding: 104rpx 30rpx 60rpx;
  215. height: 350rpx;
  216. .img {
  217. position: absolute;
  218. top: 0;
  219. left: 0;
  220. right: 0;
  221. width: 100%;
  222. height: 440rpx;
  223. image {
  224. width: 100%;
  225. height: 100%;
  226. }
  227. }
  228. .list {
  229. position: relative;
  230. z-index: 10;
  231. background-color: #ffffff;
  232. border-radius: 15rpx;
  233. padding: 15rpx 23rpx;
  234. .list-item {
  235. font-size: 30rpx;
  236. font-weight: bold;
  237. color: #333333;
  238. image {
  239. width: 43rpx;
  240. height: 43rpx;
  241. margin-right: 15rpx;
  242. }
  243. }
  244. .list-tpl {
  245. image {
  246. width: 15rpx;
  247. height: 25rpx;
  248. margin-left: 20rpx;
  249. }
  250. }
  251. }
  252. }
  253. .from-box {
  254. margin: 74rpx 30rpx;
  255. padding: 44rpx 25rpx;
  256. background-color: #ffffff;
  257. border-radius: 15rpx;
  258. position: relative;
  259. top: -180rpx;
  260. .from-title {
  261. font-size: 24rpx;
  262. font-weight: bold;
  263. color: #333333;
  264. }
  265. .input-box {
  266. font-size: 26rpx;
  267. font-weight: 500;
  268. color: #666666;
  269. margin: 35rpx 0rpx;
  270. }
  271. .all {
  272. font-size: 30rpx;
  273. font-weight: 500;
  274. color: #44969d;
  275. }
  276. .all-num {
  277. font-size: 24rpx;
  278. font-weight: bold;
  279. color: #333333;
  280. }
  281. .submit {
  282. background: linear-gradient(90deg, #60bab0, #60bab0, #45969b);
  283. margin-top: 165rpx;
  284. color: #ffffff;
  285. text-align: center;
  286. padding: 26rpx 0rpx;
  287. border-radius: 15rpx;
  288. }
  289. .tpl-box {
  290. text-align: left;
  291. font-size: 28rpx;
  292. font-weight: 500;
  293. color: #fb3a2f;
  294. margin-top: 26rpx;
  295. }
  296. }
  297. .jilv {
  298. margin-top: 30rpx;
  299. text-align: center;
  300. color: #999999;
  301. font-size: 30rpx;
  302. }
  303. .curtain {
  304. position: fixed;
  305. width: 100%;
  306. height: 100%;
  307. top: 0;
  308. background-color: rgba($color: #000000, $alpha: 0.2);
  309. .psw-wrapper {
  310. position: fixed;
  311. top: 50%;
  312. left: 50%;
  313. transform: translate(-50%, -100%);
  314. width: 548.6rpx;
  315. height: 344.4rpx;
  316. background-color: #ffffff;
  317. border-radius: 15rpx 15rpx;
  318. .psw-title {
  319. width: 100%;
  320. font-size: 35rpx;
  321. padding: 43rpx 0 49rpx;
  322. text-align: center;
  323. font-weight: 800;
  324. }
  325. .psw-ipt {
  326. display: block;
  327. background-color: #dce3ed;
  328. height: 90rpx;
  329. width: 464rpx;
  330. padding-left: 30rpx;
  331. margin: 0 auto;
  332. font-size: 80rpx;
  333. }
  334. .psw-btn text {
  335. display: inline-block;
  336. text-align: center;
  337. width: 50%;
  338. padding-top: 29rpx;
  339. font-size: 35rpx;
  340. }
  341. .psw-qd {
  342. color: #5771df;
  343. }
  344. }
  345. }
  346. .ishiden {
  347. display: none;
  348. }
  349. .goback-box {
  350. position: absolute;
  351. left: 18rpx;
  352. top: var(--status-bar-height);
  353. height: 80rpx;
  354. display: flex;
  355. align-items: center;
  356. }
  357. .goback {
  358. z-index: 100;
  359. width: 34rpx;
  360. height: 34rpx;
  361. }
  362. .header {
  363. color: #ffffff;
  364. position: absolute;
  365. left: 0;
  366. top: var(--status-bar-height);
  367. width: 100%;
  368. height: 80rpx;
  369. font-size: 32rpx;
  370. font-weight: 700;
  371. z-index: 99;
  372. display: flex;
  373. justify-content: center;
  374. align-items: center;
  375. }
  376. </style>