withdraw.vue 4.8 KB

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