feeType: '标准',
send: '发送交易',
confirmPassword: '密码',
- confirm: '确认发送',
- cancel: '取消发送',
+ confirm: '提交',
+ cancel: '取消',
emptyPassword: '密码不能为空',
unit: '单位',
asset:'资产',
},
crossChain:{
title:'跨链',
+ detail:'跨链详情',
amountPlaceHolder:"链可用",
amountHint:'跨链交易预计24小时内完成',
toVapor:'转入\nVapor链',
bpPubkey:'节点公钥',
vote:'投票',
votes:'票数',
- voteAccount:'投票账户'
+ voteAccount:'投票账户',
+ vetoAccount:'取消投票账户'
},
listCancel:{
voted:'已投票',
availableVeto:'可取消投票数'
},
vote:{
- selectNode:'选择节点'
+ selectNode:'选择节点',
+ voteDetials:'投票详情',
+ vetoDetials:'取消投票详情',
+ confirmVote:'确认投票',
+ confirmVeto:'确认取消投票',
+ amountPlaceHolder:"可用"
},
signMessage:{
title:'请求签名',
},
crossChain:{
title:'Cross Chain',
+ detail:'Cross Chain Details',
amountPlaceHolder:" available amount: ",
amountHint:'Cross Chain Transaction will be completed in 24 hrs.',
toVapor:'Transfer to \n Vapor Chain',
bpPubkey:'BP Public Key',
vote:'Vote',
votes:'Votes',
- voteAccount:'Vote Account'
+ voteAccount:'Vote Account',
+ vetoAccount:'Veto Account'
},
listCancel:{
voted:'Voted',
availableVeto:'Available veto amount'
},
vote:{
- selectNode:'Select Node'
+ selectNode:'Select Node',
+ voteDetials:'Vote Details',
+ vetoDetials:'Veto Details',
+ confirmVote:'Confirm Vote',
+ confirmVeto:'Confirm Veto',
+ amountPlaceHolder:"available amount: "
},
signMessage:{
title:'Request Signature',
import { BTM } from "@/utils/constants";
import { mapActions, mapGetters, mapState } from 'vuex'
import { Number as Num } from "@/utils/Number"
+ import _ from 'lodash';
-const currencyInPrice = {
+ const currencyInPrice = {
in_cny: 'cny_price',
in_usd: 'usd_price',
in_btc:'btc_price'
let balance, balances
if(this.transaction.type === 'toVapor'){
balances = this.currentAccount.balances
- }else if(this.transaction.type === 'toBytom'){
+ }else if(this.transaction.type === 'toBytom') {
balances = this.currentAccount.vpBalances
}
+
if(balances && balances.length >0 ){
- const balanceObject = balances.filter(b => b.asset === this.selectAsset.asset)[0]
+ if( this.selectAsset.asset === BTM && this.transaction.type === 'toBytom' ){
+ const balanceObject = balances.filter(b => b.asset === BTM)[0]
+ balance = balanceObject.balance
+
+ let vote, lock
+
+ const votes = this.currentAccount.votes
+
+ if (votes && votes.length > 0) {
+ vote = _.sumBy(votes, 'total')
+ lock = _.sumBy(votes, 'locked')
+ }
+
+ balance = Num.formatNue((balance - vote - lock), balanceObject.decimals)
+ }else{
+
+ const balanceObject = balances.filter(b => b.asset === this.selectAsset.asset)[0]
+ balance = Num.formatNue(balanceObject.balance, balanceObject.decimals)
+ }
- balance = Num.formatNue(balanceObject.balance, balanceObject.decimals)
}
if(this.transaction.type === 'toVapor'){
<div class="warp bg-gray">
<section class="header bg-header">
<i class="iconfont icon-back" @click="$router.go(-1)"></i>
- <p>{{ $t('transfer.confirmTransaction') }}</p>
+ <p>{{ title || $t('transfer.confirmTransaction') }}</p>
</section>
<div class="scorll-panel">
data() {
return {
full: false,
+ title:null,
rawData: {},
account: {},
transaction: {
assetAlias:null
};
},
+ beforeRouteEnter (to, from, next) {
+ next(vm => {
+ if(from.name === 'cross-chain') {
+ vm.title = vm.$t('crossChain.detail')
+ }
+
+ next()
+ });
+ },
computed: {
totalAmount(){
if(this.assetAlias && this.assetAlias.toUpperCase() === 'BTM'){
<label class="form-item-label">
{{ $t('transfer.quantity') }}
- <small class="float-right" style="margin-right: 8px;">{{ formatCurrency(transaction.cost||0 )}}</small>
</label>
<div class="form-item-content" style=" display: flex;">
<input type="number" v-model="transaction.amount" :placeholder="bytomBalance">
</div>
</div>
</div>
- <a class="btn btn-primary" @click="send">{{ $t('transfer.send') }}</a>
+ <a class="btn btn-primary" @click="send">{{ $t('transfer.confirm') }}</a>
</section>
</div>
</template>
vetoAmount = Num.formatNue(vote.total-vote.locked,8)
}
- return `Vapor${this.$t("listCancel.availableVeto")}${(vetoAmount != null && vetoAmount != 0) ? vetoAmount : '0.00'}`
+ return `${this.$t("listCancel.availableVeto")}${(vetoAmount != null && vetoAmount != 0) ? vetoAmount : '0.00'}`
},
...mapState([
'bytom',
])
},
watch: {
- "transaction.amount": function (newAmount) {
- this.transaction.cost = Number(this.selectAsset[currencyInPrice[this.currency]] * newAmount).toFixed(2);
-
- },
account: function (newAccount) {
this.guid = newAccount.guid;
}
</div>
</div>
</div>
- <a class="btn btn-primary" @click="send">{{ $t('transfer.send') }}</a>
+ <a class="btn btn-primary" @click="send">{{ $t('transfer.confirm') }}</a>
</section>
</div>
</template>
import { BTM } from "@/utils/constants";
import { mapGetters, mapState } from 'vuex'
import { Number as Num } from "@/utils/Number"
+import _ from 'lodash';
const currencyInPrice = {
in_cny: 'cny_price',
balances = this.currentAccount.vpBalances
if(balances && balances.length >0 ){
const balanceObject = balances.filter(b => b.asset === BTM)[0]
- balance = balanceObject.balance/Math.pow(10,balanceObject.decimals)
+ balance = balanceObject.balance
+
+ let vote, lock
+ const votes = this.currentAccount.votes
+ if(votes && votes.length >0 ){
+ vote = _.sumBy(votes,'total')
+ lock = _.sumBy(votes,'locked')
+ }
+
+ balance = (balance-vote-lock)/Math.pow(10,balanceObject.decimals)
}
- return `Vapor${this.$t("crossChain.amountPlaceHolder")}${(balance != null && balance != 0) ? balance : '0.00'}`
+ return `${this.$t("vote.amountPlaceHolder")}${(balance != null && balance != 0) ? balance : '0.00'}`
},
...mapState([
'bytom',
])
},
watch: {
- "transaction.amount": function (newAmount) {
- this.transaction.cost = Number(this.selectAsset[currencyInPrice[this.currency]] * newAmount).toFixed(2);
- },
account: function (newAccount) {
this.guid = newAccount.guid;
}
<div class="warp bg-gray">
<section class="header bg-header">
<i class="iconfont icon-back" @click="$router.go(-1)"></i>
- <p>{{ title || $t('transfer.confirmTransaction') }}</p>
+ <p>{{ title || $t('vote.voteDetials') }}</p>
</section>
<div class="scorll-panel">
<table>
<tbody>
<tr class="row">
- <td class="col label">{{ $t('listVote.voteAccount') }}</td>
+ <td class="col label">{{ accountLabel }}</td>
<td class="col value">{{account.alias}}</td>
</tr>
<tr v-if="selectVote.name" class="row">
return {
full: false,
title:null,
+ accountLabel: this.$t('listVote.voteAccount'),
rawData: {},
account: {},
transaction: {
assetAlias:null
};
},
- watch: {
- '$route'(to, from) {
- console.log(from)
- console.log(to)
- if (from.name == 'vote') {
- this.title = 'vote'
- }else if(from.name =='veto'){
- this.title = 'veto'
- }
- },
- },
- computed: {
+ beforeRouteEnter (to, from, next) {
+ next(vm => {
+ if(from.name === 'veto') {
+ vm.title = vm.$t('vote.vetoDetials')
+ vm.accountLabel = vm.$t('listVote.vetoAccount')
+ }
+
+ next()
+ });
+ },
+ computed: {
totalAmount(){
if(this.assetAlias && this.assetAlias.toUpperCase() === 'BTM'){
const n = new BigNumber(this.transaction.amount)