2020-05-14 05:15:18 +00:00
|
|
|
<template>
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-header">Balance</div>
|
|
|
|
<div class="card-body">
|
2020-05-14 05:22:27 +00:00
|
|
|
<p v-if="balance.note">
|
|
|
|
<strong>{{ balance.note }}</strong>
|
|
|
|
</p>
|
2020-05-14 05:15:18 +00:00
|
|
|
<b-table class="table-sm" :items="balance.currencies" :fields="table_fields">
|
|
|
|
<template slot="bottom-row">
|
2020-05-14 05:16:07 +00:00
|
|
|
<td><strong>Total</strong></td>
|
2020-05-14 05:15:18 +00:00
|
|
|
<td></td>
|
|
|
|
<!-- this is a computed prop that adds up all the expenses in the visible rows -->
|
2020-05-14 05:16:07 +00:00
|
|
|
<td>
|
|
|
|
<strong>{{ formatCurrency(balance.total) }}</strong>
|
|
|
|
</td>
|
2020-05-14 05:15:18 +00:00
|
|
|
</template>
|
|
|
|
</b-table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { mapState } from 'vuex';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'Balance',
|
|
|
|
computed: {
|
|
|
|
...mapState('ftbot', ['balance']),
|
|
|
|
table_fields() {
|
|
|
|
return [
|
|
|
|
{ key: 'currency', label: 'Currency' },
|
|
|
|
{ key: 'free', label: 'Available', formatter: 'formatCurrency' },
|
|
|
|
{ key: 'est_stake', label: `in ${this.balance.stake}`, formatter: 'formatCurrency' },
|
|
|
|
];
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
formatCurrency(value) {
|
2020-05-14 16:12:20 +00:00
|
|
|
return value ? value.toFixed(5) : '';
|
2020-05-14 05:15:18 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|