Bytom Wallet for Chrome
Révision | 7ec8de2bcd07fa8b180fb6d75191ff79f6165acb (tree) |
---|---|
l'heure | 2019-09-10 15:50:02 |
Auteur | Zhiting Lin <zlin035@uott...> |
Commiter | Zhiting Lin |
update the total amount display in advanced transfer
@@ -108,10 +108,16 @@ | ||
108 | 108 | |
109 | 109 | <div class="divider"></div> |
110 | 110 | |
111 | + <tr v-for="(amountInput, index) in transaction.amounts" :key="index" class="row"> | |
112 | + <td class="col label">{{index ==0 && $t('transfer.transferAmount') }}</td> | |
113 | + <td class="col value">{{amountInput.amount}}<span class="uint uppercase">{{amountInput.alias || amountInput.asset}}</span></td> | |
114 | + </tr> | |
115 | + | |
111 | 116 | <tr class="row"> |
112 | 117 | <td class="col label">{{ $t('transfer.fee') }}</td> |
113 | 118 | <td class="col value">{{transaction.fee}}<span class="uint">BTM</span></td> |
114 | 119 | </tr> |
120 | + | |
115 | 121 | </tbody> |
116 | 122 | </table> |
117 | 123 | </section> |
@@ -140,13 +146,16 @@ import { LocalStream } from 'extension-streams'; | ||
140 | 146 | import {apis} from '@/utils/BrowserApis'; |
141 | 147 | import NotificationService from '../../services/NotificationService' |
142 | 148 | import { mapActions, mapGetters, mapState } from 'vuex' |
149 | +import _ from 'lodash'; | |
150 | +import account from "@/models/account"; | |
151 | +import { Number as Num } from "@/utils/Number" | |
152 | + | |
153 | + | |
143 | 154 | |
144 | 155 | export default { |
145 | 156 | data() { |
146 | 157 | return { |
147 | 158 | full: false, |
148 | - // full2: false, | |
149 | - // account: {}, | |
150 | 159 | transaction: { |
151 | 160 | input: "", |
152 | 161 | output: "", |
@@ -162,6 +171,8 @@ export default { | ||
162 | 171 | computed: { |
163 | 172 | ...mapGetters([ |
164 | 173 | 'currentAccount', |
174 | + 'net', | |
175 | + 'netType', | |
165 | 176 | ]) |
166 | 177 | }, |
167 | 178 | watch: { |
@@ -205,7 +216,10 @@ export default { | ||
205 | 216 | body: getLang(error.message) |
206 | 217 | }); |
207 | 218 | }); |
208 | - } | |
219 | + }, | |
220 | + queryAsset: function(assetID){ | |
221 | + return transaction.asset(assetID) | |
222 | + } | |
209 | 223 | }, mounted() { |
210 | 224 | this.prompt = window.data || apis.extension.getBackgroundPage().notification || null; |
211 | 225 |
@@ -228,7 +242,30 @@ export default { | ||
228 | 242 | } |
229 | 243 | |
230 | 244 | const array = inout.input.filter(action => action.type ==='spend_wallet') |
231 | - this.transaction.amounts = array | |
245 | + | |
246 | + if(array.length>0){ | |
247 | + account.setupNet(`${this.net}${this.netType}`) | |
248 | + const promise = | |
249 | + _(array) | |
250 | + .groupBy('asset') | |
251 | + .map((objs, key) => { | |
252 | + return this.queryAsset(key).then(resp =>{ | |
253 | + return { | |
254 | + 'asset': key, | |
255 | + 'alias':resp.alias, | |
256 | + 'amount':Num.formatNue( _.sumBy(objs, 'amount'), resp.decimals) | |
257 | + } | |
258 | + }) | |
259 | + }) | |
260 | + | |
261 | + let that = this; | |
262 | + Promise.all(promise).then(function(output) { | |
263 | + that.transaction.amounts = output | |
264 | + }) | |
265 | + | |
266 | + } | |
267 | + | |
268 | + | |
232 | 269 | } |
233 | 270 | } |
234 | 271 | }; |