update
This commit is contained in:
@@ -83,14 +83,24 @@ export class PosLandingStore {
|
|||||||
readonly payments = computed(() => this.state$().payments);
|
readonly payments = computed(() => this.state$().payments);
|
||||||
|
|
||||||
readonly orderPricingInfo = computed(() => {
|
readonly orderPricingInfo = computed(() => {
|
||||||
const totalAmount = 0;
|
let totalAmount = 0;
|
||||||
const taxAmount = totalAmount * 0.1;
|
let taxAmount = 0;
|
||||||
|
let totalBaseAmount = 0;
|
||||||
|
let discountAmount = 0;
|
||||||
|
|
||||||
|
this.inOrderGoods().forEach((inOrderGood) => {
|
||||||
|
totalBaseAmount += parseInt(inOrderGood.base_total_amount + '') || 0;
|
||||||
|
totalAmount += parseInt(inOrderGood.total_amount + '') || 0;
|
||||||
|
taxAmount += parseInt(inOrderGood.tax_amount + '') || 0;
|
||||||
|
discountAmount += parseInt(inOrderGood.discount_amount + '') || 0;
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
totalItems: this.inOrderGoods().length,
|
totalItems: this.inOrderGoods().length,
|
||||||
totalBaseAmount: this.inOrderGoods().reduce((acc, curr) => acc + curr.base_total_amount, 0),
|
totalBaseAmount,
|
||||||
totalAmount: this.inOrderGoods().reduce((acc, curr) => acc + curr.total_amount, 0),
|
totalAmount,
|
||||||
taxAmount: this.inOrderGoods().reduce((acc, curr) => acc + curr.tax_amount, 0),
|
taxAmount,
|
||||||
discountAmount: this.inOrderGoods().reduce((acc, curr) => acc + curr.discount_amount, 0),
|
discountAmount,
|
||||||
payableAmount: totalAmount + taxAmount,
|
payableAmount: totalAmount + taxAmount,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
+4
-4
@@ -168,8 +168,8 @@ export class AmountPercentageInputComponent {
|
|||||||
const amountValue = (this.baseAmount * percentageValue) / 100;
|
const amountValue = (this.baseAmount * percentageValue) / 100;
|
||||||
this.lastValidAmount = Number.isFinite(amountValue) ? amountValue : 0;
|
this.lastValidAmount = Number.isFinite(amountValue) ? amountValue : 0;
|
||||||
|
|
||||||
this.percentageControl.setValue(this.lastValidPercentage);
|
this.percentageControl.setValue(this.lastValidPercentage, { emitEvent: false });
|
||||||
this.amountControl.setValue(this.lastValidAmount);
|
this.amountControl.setValue(this.lastValidAmount, { emitEvent: false });
|
||||||
this.preparedLabel.set(this.prepareLabel(true));
|
this.preparedLabel.set(this.prepareLabel(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,8 +189,8 @@ export class AmountPercentageInputComponent {
|
|||||||
: '0';
|
: '0';
|
||||||
this.lastValidPercentage = this.parseValue(percentageValue);
|
this.lastValidPercentage = this.parseValue(percentageValue);
|
||||||
|
|
||||||
this.amountControl.setValue(this.lastValidAmount);
|
this.amountControl.setValue(this.lastValidAmount, { emitEvent: false });
|
||||||
this.percentageControl.setValue(percentageValue);
|
this.percentageControl.setValue(percentageValue, { emitEvent: false });
|
||||||
this.preparedLabel.set(this.prepareLabel(false));
|
this.preparedLabel.set(this.prepareLabel(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user