fix discount calculating
This commit is contained in:
@@ -44,13 +44,17 @@ export default function OrderSummary() {
|
||||
<ProText type="secondary">{t("cart.basketTotal")}</ProText>
|
||||
<ArabicPrice price={subtotal} />
|
||||
</div>
|
||||
{orderType != OrderType.DineIn && <div className={styles.summaryRow}>
|
||||
<ProText type="secondary">{t("cart.deliveryFee")}</ProText>
|
||||
<ArabicPrice price={Number(restaurant?.delivery_fees || 0)} />
|
||||
</div>}
|
||||
{orderType != OrderType.DineIn && (
|
||||
<div className={styles.summaryRow}>
|
||||
<ProText type="secondary">{t("cart.deliveryFee")}</ProText>
|
||||
<ArabicPrice price={Number(restaurant?.delivery_fees || 0)} />
|
||||
</div>
|
||||
)}
|
||||
<div className={styles.summaryRow}>
|
||||
<ProText type="secondary">{t("cart.discount")}</ProText>
|
||||
<ArabicPrice price={highestLoyaltyItem?.price || 0} />
|
||||
<ArabicPrice
|
||||
price={useLoyaltyPoints ? highestLoyaltyItem?.price || 0 : 0}
|
||||
/>
|
||||
</div>
|
||||
<div className={styles.summaryRow}>
|
||||
<ProText type="secondary">{t("cart.tax")}</ProText>
|
||||
|
||||
@@ -650,7 +650,11 @@ export const selectGrandTotal = (state: RootState) => {
|
||||
? Number(state.order.restaurant?.delivery_fees) || 0
|
||||
: 0;
|
||||
|
||||
return subtotal + taxAmount - loyaltyDiscount + deliveryFee;
|
||||
};
|
||||
return (
|
||||
subtotal +
|
||||
taxAmount -
|
||||
(state.order.useLoyaltyPoints ? loyaltyDiscount : 0) +
|
||||
deliveryFee
|
||||
);};
|
||||
|
||||
export default orderSlice.reducer;
|
||||
|
||||
Reference in New Issue
Block a user