|
@@ -1,23 +1,65 @@
|
|
|
<script>
|
|
<script>
|
|
|
|
|
+import tokenpocketBnb from "@/common/wallet/tokenpocket-wallet/tokenpocket-bnb";
|
|
|
|
|
+import {getTotalMoney} from "@/api/money";
|
|
|
|
|
+
|
|
|
export default {
|
|
export default {
|
|
|
name: "convert-index",
|
|
name: "convert-index",
|
|
|
components: {},
|
|
components: {},
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
- input: '',
|
|
|
|
|
usdtNum:'',
|
|
usdtNum:'',
|
|
|
iconNum:'',
|
|
iconNum:'',
|
|
|
type:1,
|
|
type:1,
|
|
|
toNum:'',
|
|
toNum:'',
|
|
|
- formNUm:''
|
|
|
|
|
|
|
+ formNUm:'',
|
|
|
|
|
+ price:'',
|
|
|
|
|
+ address:''
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
|
|
+ watch:{
|
|
|
|
|
+ 'formNUm':function () {
|
|
|
|
|
+ if(this.formNUm===''){
|
|
|
|
|
+ this.toNum=''
|
|
|
|
|
+ }else {
|
|
|
|
|
+ this.toNum=this.formNUm*this.price
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
mounted() {
|
|
mounted() {
|
|
|
|
|
+ this.getIconNum()
|
|
|
|
|
+ this.getTotalMoney()
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ setMax(){
|
|
|
|
|
+ if(this.type===1){
|
|
|
|
|
+ this.formNUm=this.usdtNum
|
|
|
|
|
+ }else {
|
|
|
|
|
+ this.formNUm=this.iconNum
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ getTotalMoney(){
|
|
|
|
|
+ getTotalMoney().then(res=>{
|
|
|
|
|
+ if (res.code===1){
|
|
|
|
|
+ this.price=res.data.price
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ async getIconNum(){
|
|
|
|
|
+ this.address=tokenpocketBnb.getMyAddress()
|
|
|
|
|
+ if(this.address===''){
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ setTimeout(async ()=>{
|
|
|
|
|
+ this.iconNum= await tokenpocketBnb.getTokenBalance(this.address,0)
|
|
|
|
|
+ this.usdtNum= await tokenpocketBnb.getTokenBalance(this.address,1)
|
|
|
|
|
+ console.log(this.coinNum,"icon-num----------------------")
|
|
|
|
|
+ },100)
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
setType(){
|
|
setType(){
|
|
|
this.type=(this.type===1?2:1)
|
|
this.type=(this.type===1?2:1)
|
|
|
- console.log(' this.type', this.type)
|
|
|
|
|
|
|
+ this.formNUm=''
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
}
|
|
}
|
|
@@ -35,8 +77,8 @@ export default {
|
|
|
></image>
|
|
></image>
|
|
|
<view class="fs-28">USDT</view>
|
|
<view class="fs-28">USDT</view>
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="max-box b-rad-20 fs-28">
|
|
|
|
|
- Max 0.01
|
|
|
|
|
|
|
+ <view class="max-box b-rad-20 fs-28" @click="setMax">
|
|
|
|
|
+ Max {{usdtNum}}
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
<view>
|
|
<view>
|
|
@@ -52,8 +94,8 @@ export default {
|
|
|
></image>
|
|
></image>
|
|
|
<view class="fs-28">DAO</view>
|
|
<view class="fs-28">DAO</view>
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="max-box b-rad-20 fs-28">
|
|
|
|
|
- Max 0.01
|
|
|
|
|
|
|
+ <view class="max-box b-rad-20 fs-28" @click="setMax">
|
|
|
|
|
+ Max {{iconNum}}
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
<view>
|
|
<view>
|