withdraw.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  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 } 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. cashmoney_type({}).then(({ data }) => {
  91. obj.moneyTypeList = data;
  92. if (obj.logo == '') {
  93. obj.logo = obj.moneyTypeList[0].LOGO;
  94. obj.name = obj.moneyTypeList[0].name;
  95. obj.code = obj.moneyTypeList[0].code;
  96. obj.money = obj.moneyTypeList[0].wallet.money;
  97. obj.less = obj.moneyTypeList[0].less;
  98. }
  99. });
  100. },
  101. calculator() {
  102. let obj = this;
  103. calculator({
  104. money_type: obj.code,
  105. money: obj.num
  106. }).then(({ data }) => {
  107. console.log(data);
  108. obj.data = data;
  109. obj.showText = true;
  110. });
  111. },
  112. cash() {
  113. let obj = this;
  114. if (obj.code == '') {
  115. obj.$api.msg('请选择币种!');
  116. return;
  117. }
  118. if (obj.addr == '') {
  119. obj.$api.msg('请输入提币地址!');
  120. return;
  121. }
  122. if (obj.num == '') {
  123. obj.$api.msg('请输入提币数量!');
  124. return;
  125. }
  126. if (obj.num < obj.less) {
  127. obj.$api.msg('最低数量不能低于' + obj.less + '!');
  128. return;
  129. }
  130. this.isHiden = false;
  131. },
  132. pswQd() {
  133. const obj = this;
  134. if (this.password == '') {
  135. obj.$api.msg('请输入密码');
  136. }
  137. cash({
  138. money_type: obj.code,
  139. money: obj.num,
  140. address: obj.addr,
  141. password: obj.password
  142. }).then(data => {
  143. obj.money = '';
  144. obj.address = '';
  145. obj.password = '';
  146. obj.$api.msg(data.msg);
  147. this.isHiden = true;
  148. });
  149. },
  150. cancel() {
  151. this.password = '';
  152. this.isHiden = true;
  153. },
  154. selectOne(options) {
  155. this.logo = options.LOGO;
  156. this.name = options.name;
  157. this.code = options.code;
  158. this.money = options.wallet.money;
  159. this.less = options.less;
  160. },
  161. useOutClickSide() {
  162. this.$refs.easySelect.hideOptions && this.$refs.easySelect.hideOptions();
  163. },
  164. nav(url) {
  165. uni.navigateTo({
  166. url: url
  167. });
  168. },
  169. toBack(){
  170. uni.navigateBack({
  171. delta: 1
  172. });
  173. }
  174. }
  175. };
  176. </script>
  177. <style lang="scss">
  178. page {
  179. min-height: 100%;
  180. background-color: #ffffff;
  181. .container {
  182. width: 100%;
  183. }
  184. }
  185. .list-box {
  186. padding: 104rpx 30rpx 60rpx;
  187. height: 350rpx;
  188. .img {
  189. position: absolute;
  190. top: 0;
  191. left: 0;
  192. right: 0;
  193. width: 100%;
  194. height: 440rpx;
  195. image {
  196. width: 100%;
  197. height: 100%;
  198. }
  199. }
  200. .list {
  201. position: relative;
  202. z-index: 10;
  203. background-color: #ffffff;
  204. border-radius: 15rpx;
  205. padding: 15rpx 23rpx;
  206. .list-item {
  207. font-size: 30rpx;
  208. font-weight: bold;
  209. color: #333333;
  210. image {
  211. width: 43rpx;
  212. height: 43rpx;
  213. margin-right: 15rpx;
  214. }
  215. }
  216. .list-tpl {
  217. image {
  218. width: 15rpx;
  219. height: 25rpx;
  220. margin-left: 20rpx;
  221. }
  222. }
  223. }
  224. }
  225. .from-box {
  226. margin: 74rpx 30rpx;
  227. padding: 44rpx 25rpx;
  228. background-color: #ffffff;
  229. border-radius: 15rpx;
  230. position: relative;
  231. top: -180rpx;
  232. .from-title {
  233. font-size: 24rpx;
  234. font-weight: bold;
  235. color: #333333;
  236. }
  237. .input-box {
  238. font-size: 26rpx;
  239. font-weight: 500;
  240. color: #666666;
  241. margin: 35rpx 0rpx;
  242. }
  243. .all {
  244. font-size: 30rpx;
  245. font-weight: 500;
  246. color: #44969D;
  247. }
  248. .all-num {
  249. font-size: 24rpx;
  250. font-weight: bold;
  251. color: #333333;
  252. }
  253. .submit {
  254. background: linear-gradient(90deg, #60BAB0, #60BAB0, #45969B);
  255. margin-top: 165rpx;
  256. color: #ffffff;
  257. text-align: center;
  258. padding: 26rpx 0rpx;
  259. border-radius: 15rpx;
  260. }
  261. .tpl-box {
  262. text-align: left;
  263. font-size: 28rpx;
  264. font-weight: 500;
  265. color: #fb3a2f;
  266. margin-top: 26rpx;
  267. }
  268. }
  269. .jilv {
  270. margin-top: 30rpx;
  271. text-align: center;
  272. color: #999999;
  273. font-size: 30rpx;
  274. }
  275. .curtain {
  276. position: fixed;
  277. width: 100%;
  278. height: 100%;
  279. top: 0;
  280. background-color: rgba($color: #000000, $alpha: 0.2);
  281. .psw-wrapper {
  282. position: fixed;
  283. top: 50%;
  284. left: 50%;
  285. transform: translate(-50%, -100%);
  286. width: 548.6rpx;
  287. height: 344.4rpx;
  288. background-color: #ffffff;
  289. border-radius: 15rpx 15rpx;
  290. .psw-title {
  291. width: 100%;
  292. font-size: 35rpx;
  293. padding: 43rpx 0 49rpx;
  294. text-align: center;
  295. font-weight: 800;
  296. }
  297. .psw-ipt {
  298. display: block;
  299. background-color: #dce3ed;
  300. height: 90rpx;
  301. width: 464rpx;
  302. padding-left: 30rpx;
  303. margin: 0 auto;
  304. font-size: 80rpx;
  305. }
  306. .psw-btn text {
  307. display: inline-block;
  308. text-align: center;
  309. width: 50%;
  310. padding-top: 29rpx;
  311. font-size: 35rpx;
  312. }
  313. .psw-qd {
  314. color: #5771df;
  315. }
  316. }
  317. }
  318. .ishiden {
  319. display: none;
  320. }
  321. .goback-box {
  322. position: absolute;
  323. left: 18rpx;
  324. top: 0;
  325. height: 80rpx;
  326. display: flex;
  327. align-items: center;
  328. }
  329. .goback {
  330. z-index: 100;
  331. width: 34rpx;
  332. height: 34rpx;
  333. }
  334. .header {
  335. color: #FFFFFF;
  336. position: absolute;
  337. left: 0;
  338. top: 0;
  339. width: 100%;
  340. height: 80rpx;
  341. font-size: 32rpx;
  342. font-weight: 700;
  343. z-index: 99;
  344. display: flex;
  345. justify-content: center;
  346. align-items: center;
  347. }
  348. </style>