mirror of
https://github.com/lnbits/lnbits.git
synced 2025-06-29 02:01:35 +02:00
fixed display amount
This commit is contained in:
committed by
Vlad Stan
parent
ea1d9eb088
commit
b0b1446483
@ -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,26 +392,25 @@
|
|||||||
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 subtotal = parseFloat(this.amount)
|
|
||||||
const grandTotal = parseFloat((tipAmount + subtotal).toFixed(2))
|
|
||||||
const totalString = grandTotal.toFixed(2).toString()
|
|
||||||
|
|
||||||
this.stack = []
|
const tipAmount = (selectedTipOption / 100) * this.amount
|
||||||
for (var i = 0; i < totalString.length; i++) {
|
const subtotal = this.amount
|
||||||
const char = totalString[i]
|
const grandTotal = (tipAmount + subtotal)
|
||||||
|
const totalString = grandTotal.toFixed(2)
|
||||||
|
|
||||||
if (char !== '.') {
|
this.stack = []
|
||||||
this.stack.push(char)
|
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()
|
this.showInvoice()
|
||||||
},
|
},
|
||||||
submitForm: function () {
|
submitForm: function () {
|
||||||
|
Reference in New Issue
Block a user