withdraw.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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">认真核对提币地址;手续费:{{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. console.log(obj.moneyTypeList,'22');
  83. if (obj.logo == '') {
  84. obj.logo = obj.moneyTypeList[0].LOGO;
  85. obj.name = obj.moneyTypeList[0].name;
  86. obj.code = obj.moneyTypeList[0].code;
  87. obj.money = obj.moneyTypeList[0].wallet.money;
  88. }
  89. });
  90. },
  91. calculator(){
  92. let obj = this;
  93. calculator({
  94. money_type:obj.code,
  95. money:obj.num
  96. }).then(({data}) => {
  97. obj.data = data;
  98. obj.showText = true;
  99. });
  100. },
  101. cash(){
  102. let obj = this;
  103. if(obj.code == ''){
  104. obj.$api.msg('请选择币种!');
  105. return;
  106. }
  107. if(obj.addr == ''){
  108. obj.$api.msg('请输入提币地址!');
  109. return;
  110. }
  111. if(obj.num == ''){
  112. obj.$api.msg('请输入提币数量!');
  113. return;
  114. }
  115. if(obj.num < 1 ){
  116. obj.$api.msg('最低数量不能低于1!');
  117. return;
  118. }
  119. cash({
  120. money_type:obj.code,
  121. money:obj.num,
  122. address:obj.addr,
  123. }).then((data) => {
  124. obj.money = '';
  125. obj.address = '';
  126. obj.$api.msg(data.msg);
  127. });
  128. },
  129. selectOne(options) {
  130. this.logo = options.LOGO;
  131. this.name = options.name;
  132. this.code = options.code;
  133. this.money = options.wallet.money;
  134. },
  135. useOutClickSide() {
  136. this.$refs.easySelect.hideOptions && this.$refs.easySelect.hideOptions()
  137. },
  138. }
  139. };
  140. </script>
  141. <style lang="scss">
  142. page {
  143. min-height: 100%;
  144. background-color: #eef0ed;
  145. .container {
  146. width: 100%;
  147. }
  148. }
  149. .list-box {
  150. padding: 60rpx 30rpx;
  151. height: 350rpx;
  152. background-color: #141E47;
  153. .list {
  154. background-color: #FFFFFF;
  155. border-radius: 15rpx;
  156. padding: 15rpx 23rpx;
  157. .list-item {
  158. font-size: 30rpx;
  159. font-weight: bold;
  160. color: #333333;
  161. image {
  162. width: 43rpx;
  163. height: 43rpx;
  164. margin-right: 15rpx;
  165. }
  166. }
  167. .list-tpl {
  168. image {
  169. width: 15rpx;
  170. height: 25rpx;
  171. margin-left: 20rpx;
  172. }
  173. }
  174. }
  175. }
  176. .from-box{
  177. margin: 30rpx 30rpx;
  178. padding: 44rpx 25rpx;
  179. background-color: #FFFFFF;
  180. border-radius: 15rpx;
  181. position: relative;
  182. top: -180rpx;
  183. .from-title{
  184. font-size: 24rpx;
  185. font-weight: bold;
  186. color: #333333;
  187. }
  188. .input-box{
  189. font-size: 26rpx;
  190. font-weight: 500;
  191. color: #666666;
  192. margin: 35rpx 0rpx;
  193. }
  194. .all{
  195. font-size: 30rpx;
  196. font-weight: 500;
  197. color: #141E47;
  198. }
  199. .all-num{
  200. font-size: 24rpx;
  201. font-weight: bold;
  202. color: #333333;
  203. }
  204. .submit {
  205. background-color: #141E47;
  206. margin-top: 165rpx;
  207. color: #FFFFFF;
  208. text-align: center;
  209. padding: 26rpx 0rpx;
  210. border-radius: 15rpx;
  211. }
  212. .tpl-box {
  213. text-align: left;
  214. font-size: 28rpx;
  215. font-weight: 500;
  216. color: #FB3A2F;
  217. margin-top: 26rpx;
  218. }
  219. }
  220. </style>