fixed display amount

This commit is contained in:
Tiago Vasconcelos
2022-10-27 19:14:26 +01:00
committed by Vlad Stan
parent ea1d9eb088
commit b0b1446483

View File

@ -360,15 +360,15 @@
computed: { computed: {
amount: function () { amount: function () {
if (!this.stack.length) return 0.0 if (!this.stack.length) return 0.0
return (Number(this.stack.join('')) / 100).toFixed(2) return Number(this.stack.join('') / 100)
}, },
famount: function () { famount: function () {
return LNbits.utils.formatCurrency(this.amount, this.currency) return LNbits.utils.formatCurrency(this.amount.toFixed(2), this.currency)
}, },
sat: function () { sat: function () {
if (!this.exchangeRate) return 0 if (!this.exchangeRate) return 0
return Math.ceil( return Math.ceil(
((this.amount - this.tipAmount) / this.exchangeRate) * 100000000 (this.amount / this.exchangeRate) * 100000000
) )
}, },
tipAmountSat: function () { tipAmountSat: function () {
@ -392,13 +392,12 @@
processTipSelection: function (selectedTipOption) { processTipSelection: function (selectedTipOption) {
this.tipDialog.show = false this.tipDialog.show = false
if (selectedTipOption) { if(!selectedTipOption) return this.showInvoice()
const tipAmount = parseFloat(
parseFloat((selectedTipOption / 100) * this.amount) const tipAmount = (selectedTipOption / 100) * this.amount
) const subtotal = this.amount
const subtotal = parseFloat(this.amount) const grandTotal = (tipAmount + subtotal)
const grandTotal = parseFloat((tipAmount + subtotal).toFixed(2)) const totalString = grandTotal.toFixed(2)
const totalString = grandTotal.toFixed(2).toString()
this.stack = [] this.stack = []
for (var i = 0; i < totalString.length; i++) { for (var i = 0; i < totalString.length; i++) {
@ -409,8 +408,8 @@
} }
} }
this.tipAmount = tipAmount this.tipAmount = tipAmount
}
this.showInvoice() this.showInvoice()
}, },