mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2024-11-19 18:11:30 +01:00
fixed display amount
This commit is contained in:
parent
ea1d9eb088
commit
b0b1446483
@ -360,15 +360,15 @@
|
||||
computed: {
|
||||
amount: function () {
|
||||
if (!this.stack.length) return 0.0
|
||||
return (Number(this.stack.join('')) / 100).toFixed(2)
|
||||
return Number(this.stack.join('') / 100)
|
||||
},
|
||||
famount: function () {
|
||||
return LNbits.utils.formatCurrency(this.amount, this.currency)
|
||||
return LNbits.utils.formatCurrency(this.amount.toFixed(2), this.currency)
|
||||
},
|
||||
sat: function () {
|
||||
if (!this.exchangeRate) return 0
|
||||
return Math.ceil(
|
||||
((this.amount - this.tipAmount) / this.exchangeRate) * 100000000
|
||||
(this.amount / this.exchangeRate) * 100000000
|
||||
)
|
||||
},
|
||||
tipAmountSat: function () {
|
||||
@ -392,26 +392,25 @@
|
||||
processTipSelection: function (selectedTipOption) {
|
||||
this.tipDialog.show = false
|
||||
|
||||
if (selectedTipOption) {
|
||||
const tipAmount = parseFloat(
|
||||
parseFloat((selectedTipOption / 100) * this.amount)
|
||||
)
|
||||
const subtotal = parseFloat(this.amount)
|
||||
const grandTotal = parseFloat((tipAmount + subtotal).toFixed(2))
|
||||
const totalString = grandTotal.toFixed(2).toString()
|
||||
if(!selectedTipOption) return this.showInvoice()
|
||||
|
||||
this.stack = []
|
||||
for (var i = 0; i < totalString.length; i++) {
|
||||
const char = totalString[i]
|
||||
const tipAmount = (selectedTipOption / 100) * this.amount
|
||||
const subtotal = this.amount
|
||||
const grandTotal = (tipAmount + subtotal)
|
||||
const totalString = grandTotal.toFixed(2)
|
||||
|
||||
if (char !== '.') {
|
||||
this.stack.push(char)
|
||||
}
|
||||
this.stack = []
|
||||
for (var i = 0; i < totalString.length; i++) {
|
||||
const char = totalString[i]
|
||||
|
||||
if (char !== '.') {
|
||||
this.stack.push(char)
|
||||
}
|
||||
|
||||
this.tipAmount = tipAmount
|
||||
}
|
||||
|
||||
|
||||
this.tipAmount = tipAmount
|
||||
|
||||
this.showInvoice()
|
||||
},
|
||||
submitForm: function () {
|
||||
|
Loading…
Reference in New Issue
Block a user