withdraw.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <template>
  2. <view class="container">
  3. <view class="list-box">
  4. <view class="list flex">
  5. <view class="flex_item list-item">
  6. <image :src="logo"></image>
  7. <view>{{name}}</view>
  8. </view>
  9. <view class="flex_item list-tpl">
  10. <view class="content" @click="useOutClickSide">
  11. <selectss ref="easySelect" :options='moneyTypeList' :value="name" @selectOne="selectOne">
  12. </selectss>
  13. </view>
  14. <image src="../../static/img/img23.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="'最低数量 1.0'+name"/>
  24. <view class="all" @click="num = money">全部</view>
  25. <!-- <view class="all"@click="xuhaolan">
  26. 11111
  27. </view> -->
  28. </view>
  29. <view class="all-num">可用<text>{{money *1 }}</text>{{name}}</view>
  30. <view class="submit" @click="cash">确定</view>
  31. <view class="tpl-box" v-show="showText == true">提币数量在1.0-10000.0个之间,认真核对提币地址;手续费:{{data.service}}{{data.service_type}}</view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import { cash,cashmoney_type,calculator } from '@/api/finance.js';
  37. import selectss from '@/components/select.vue';
  38. export default {
  39. components: {
  40. selectss
  41. },
  42. data() {
  43. return {
  44. moneyTypeList: [],
  45. name: '',
  46. code: '',
  47. logo: '',
  48. money:'',
  49. addr: '',
  50. num: '',
  51. data:'',
  52. showText:false
  53. };
  54. },
  55. onLoad(option) {
  56. if (option.name) {
  57. this.name = option.name;
  58. this.logo = option.logo;
  59. this.code = option.code;
  60. this.money = option.money;
  61. }
  62. this.moneyType();
  63. },
  64. onShow() {
  65. },
  66. watch:{
  67. num(newVal, oldVal) {
  68. this.calculator();
  69. }
  70. },
  71. methods: {
  72. ['xuhaolan'](){
  73. console.log('我是你爹');
  74. },
  75. // 所有币种
  76. async moneyType() {
  77. let obj = this;
  78. cashmoney_type({}).then(({
  79. data
  80. }) => {
  81. obj.moneyTypeList = data;
  82. if (obj.logo == '') {
  83. obj.logo = obj.moneyTypeList[0].LOGO;
  84. obj.name = obj.moneyTypeList[0].name;
  85. obj.code = obj.moneyTypeList[0].code;
  86. obj.money = obj.moneyTypeList[0].wallet.money;
  87. }
  88. });
  89. },
  90. calculator(){
  91. let obj = this;
  92. calculator({
  93. money_type:obj.code,
  94. money:obj.num
  95. }).then(({data}) => {
  96. obj.data = data;
  97. obj.showText = true;
  98. });
  99. },
  100. cash(){
  101. let obj = this;
  102. if(obj.code == ''){
  103. obj.$api.msg('请选择币种!');
  104. return;
  105. }
  106. if(obj.addr == ''){
  107. obj.$api.msg('请输入提币地址!');
  108. return;
  109. }
  110. if(obj.num == ''){
  111. obj.$api.msg('请输入提币数量!');
  112. return;
  113. }
  114. if(obj.num < 1 ){
  115. obj.$api.msg('最低数量不能低于1!');
  116. return;
  117. }
  118. cash({
  119. money_type:obj.code,
  120. money:obj.num,
  121. address:obj.addr,
  122. }).then((data) => {
  123. obj.money = '';
  124. obj.address = '';
  125. obj.$api.msg(data.msg);
  126. });
  127. },
  128. selectOne(options) {
  129. this.logo = options.LOGO;
  130. this.name = options.name;
  131. this.code = options.code;
  132. this.money = options.wallet.money;
  133. },
  134. useOutClickSide() {
  135. this.$refs.easySelect.hideOptions && this.$refs.easySelect.hideOptions()
  136. },
  137. }
  138. };
  139. </script>
  140. <style lang="scss">
  141. page {
  142. min-height: 100%;
  143. background-color: #eef0ed;
  144. .container {
  145. width: 100%;
  146. }
  147. }
  148. .list-box {
  149. padding: 60rpx 30rpx;
  150. height: 350rpx;
  151. background-color: #141E47;
  152. .list {
  153. background-color: #FFFFFF;
  154. border-radius: 15rpx;
  155. padding: 15rpx 23rpx;
  156. .list-item {
  157. font-size: 30rpx;
  158. font-weight: bold;
  159. color: #333333;
  160. image {
  161. width: 43rpx;
  162. height: 43rpx;
  163. margin-right: 15rpx;
  164. }
  165. }
  166. .list-tpl {
  167. image {
  168. width: 15rpx;
  169. height: 25rpx;
  170. margin-left: 20rpx;
  171. }
  172. }
  173. }
  174. }
  175. .from-box{
  176. margin: 30rpx 30rpx;
  177. padding: 44rpx 25rpx;
  178. background-color: #FFFFFF;
  179. border-radius: 15rpx;
  180. position: relative;
  181. top: -180rpx;
  182. .from-title{
  183. font-size: 24rpx;
  184. font-weight: bold;
  185. color: #333333;
  186. }
  187. .input-box{
  188. font-size: 26rpx;
  189. font-weight: 500;
  190. color: #666666;
  191. margin: 35rpx 0rpx;
  192. }
  193. .all{
  194. font-size: 30rpx;
  195. font-weight: 500;
  196. color: #141E47;
  197. }
  198. .all-num{
  199. font-size: 24rpx;
  200. font-weight: bold;
  201. color: #333333;
  202. }
  203. .submit {
  204. background-color: #141E47;
  205. margin-top: 165rpx;
  206. color: #FFFFFF;
  207. text-align: center;
  208. padding: 26rpx 0rpx;
  209. border-radius: 15rpx;
  210. }
  211. .tpl-box {
  212. text-align: left;
  213. font-size: 28rpx;
  214. font-weight: 500;
  215. color: #FB3A2F;
  216. margin-top: 26rpx;
  217. }
  218. }
  219. </style>