fixes to amounts

This commit is contained in:
2025-09-18 14:12:41 -04:00
parent dc71eee4db
commit f7bc23d9ed
4 changed files with 247 additions and 42 deletions

View File

@@ -142,7 +142,7 @@
<div class="flex justify-between items-center">
<span class="text-lg font-bold">Total to be Charged</span>
<span class="text-2xl font-bold text-accent">
${{ promo_active ? total_amount_after_discount : total_amount }}
${{ calculateTotalAmount() }}
</span>
</div>
</div>
@@ -461,6 +461,29 @@ export default defineComponent({
this.customer = response.data
})
},
calculateTotalAmount() {
if (this.total_amount_after_discount == null || this.total_amount_after_discount === undefined) {
return '0.00';
}
let totalNum = Number(this.total_amount_after_discount);
if (isNaN(totalNum)) {
return '0.00';
}
if (this.delivery && this.delivery.prime == 1 && this.pricing && this.pricing.price_prime) {
totalNum += Number(this.pricing.price_prime) || 0;
}
if (this.delivery && this.delivery.same_day == 1 && this.pricing && this.pricing.price_same_day) {
totalNum += Number(this.pricing.price_same_day) || 0;
}
if (this.delivery && this.delivery.emergency == 1 && this.pricing && this.pricing.price_emergency) {
totalNum += Number(this.pricing.price_emergency) || 0;
}
return totalNum.toFixed(2);
},
checkoutOilUpdatePayment(payment_type: number) {
let path = import.meta.env.VITE_BASE_URL + "/delivery/cash/" + this.delivery.id + '/' + payment_type;
axios({