withdraw.vue 4.6 KB

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