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