capital-switch.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <view class="">
  3. <switchPopup ref="switchPopupRef" :availableMoney="getBiMoney(from_field)" :from_field="from_field" :to_field="to_field">
  4. <template #accountbox>
  5. <view class="account-item">
  6. {{ getBiName(from_field) }}账户
  7. </view>
  8. <view class="account-link" @click.stop="switchBiType">
  9. <text class="iconfont">&#xe607;</text>
  10. <text>划转</text>
  11. </view>
  12. <view class="account-item">
  13. {{ getBiName(to_field) }}账户
  14. </view>
  15. </template>
  16. </switchPopup>
  17. </view>
  18. <!-- <uni-popup ref="popupRef">
  19. <view class="unopen-box">
  20. <text class="z-close iconfont" @click.stop="close">&#xe621;</text>
  21. <view class="unopen-title">
  22. <text>资金划转</text>
  23. </view>
  24. <view class="unopen-content">
  25. <view class="account-box">
  26. </view>
  27. <view class="capital-type">
  28. <text class="type-left">全部</text>
  29. <input class="type-input" type="number">
  30. <text class="type-rigth">USDT</text>
  31. </view>
  32. <view class="capital-nums">
  33. <text class="num-title">可划转金额:</text>
  34. <text class="num">{{ getBiMoney(from_field) }} USDT</text>
  35. </view>
  36. <view class="capital-btn" @click.stop="changeAccount">
  37. 确定
  38. </view>
  39. </view>
  40. </view>
  41. </uni-popup> -->
  42. </template>
  43. <script>
  44. import {
  45. mapGetters
  46. } from 'vuex'
  47. import { biName } from "../card.js"
  48. import { setChangeAccount } from "./../card.js"
  49. import switchPopup from "../switch.vue"
  50. // 合约 - 币币
  51. // 币币 - 合约 / 法币
  52. export default {
  53. name: "capitalSwitchModules",
  54. components:{switchPopup},
  55. data() {
  56. return {
  57. from_field:'lever',
  58. to_field:'change'
  59. };
  60. },
  61. computed: {
  62. ...mapGetters([
  63. 'contractAccount',
  64. 'bibiAccount'
  65. ]),
  66. getBiName(){
  67. return function(key){
  68. return biName[key]
  69. }
  70. },
  71. getBiMoney(){
  72. return function(key){
  73. let nums = 0;
  74. switch(key){
  75. case 'lever':
  76. nums = this.contractAccount.usdt_totle
  77. break;
  78. case 'change':
  79. nums = this.bibiAccount.usdt_totle
  80. break;
  81. }
  82. console.log('contractAccount = ' , this.contractAccount)
  83. return nums || 0
  84. }
  85. }
  86. },
  87. mounted() {
  88. // this.open()
  89. },
  90. methods: {
  91. // 切换币
  92. switchBiType(){
  93. const k = this.from_field;
  94. this.from_field = this.to_field;
  95. this.to_field = k;
  96. // this.from_field:'legal',
  97. // to_field:'change'
  98. },
  99. open() {
  100. this.$nextTick(() => {
  101. this.$refs.switchPopupRef.open();
  102. })
  103. },
  104. close() {
  105. this.$refs.popupRef.close();
  106. },
  107. // changeAccount(){
  108. // let data = {
  109. // currency_id:'1',
  110. // number:100,
  111. // from_field:this.from_field,
  112. // to_field:this.to_field
  113. // }
  114. // setChangeAccount(data).then(res => {
  115. // }).catch(err => {
  116. // }).finally(() => {})
  117. // }
  118. }
  119. }
  120. </script>
  121. <style lang="scss" scoped>
  122. @import "~./../switch.scss";
  123. </style>