|
|
@@ -6,12 +6,13 @@ import Image from "next/image";
|
|
|
import { usePlaceOrder } from "@/utils/hooks/usePlaceOrder";
|
|
|
import { useRouter } from 'next/navigation';
|
|
|
import { useCustomToast } from "@/utils/hooks/useToast";
|
|
|
-import {useConfig} from "@/utils/hooks/useConfig";
|
|
|
import { confirmDialog } from "@/components/theme/ui/kernel/confirm/api";
|
|
|
import { overlayLoading } from "@/components/theme/ui/kernel/loading/api";
|
|
|
import {getProductAdditionalInfo} from "@/utils/orderDetailTools";
|
|
|
import type { OrderDetails, ProductsInOrderDetails } from "@/types/customer/type";
|
|
|
import CommonModal from "@/components/theme/ui/CommonModal";
|
|
|
+import { Price } from "@components/theme/ui/Price";
|
|
|
+
|
|
|
const CountDown = dynamic(() => import("@/components/common/CountDown"), {
|
|
|
ssr: false,
|
|
|
});
|
|
|
@@ -23,11 +24,7 @@ export function UnpaidOrderSection({
|
|
|
const { cancelOrder } = usePlaceOrder();
|
|
|
const router = useRouter();
|
|
|
const { showToast } = useCustomToast();
|
|
|
- const {currencies,getCurrentCurrencyItem} = useConfig();
|
|
|
- const currentCurrency = getCurrentCurrencyItem();
|
|
|
- const currencySymbol = currentCurrency.symbol;
|
|
|
- const orderCurrency = currencies.find(item => item.code === orderDetail.orderCurrencyCode) || null;
|
|
|
- const orderSymbol = orderCurrency?.symbol || currencySymbol;
|
|
|
+
|
|
|
|
|
|
const [isShowUpaidOrder, setIsShowUpaidOrder] = useState(true);
|
|
|
const [showProductsModal, setShowProductsModal] = useState(false);
|
|
|
@@ -114,7 +111,13 @@ export function UnpaidOrderSection({
|
|
|
</div>
|
|
|
|
|
|
<div className=" flex items-center justify-between w-full mt-3">
|
|
|
- <span className="text-ly-14 font-medium">Total: {orderSymbol}{orderDetail.grandTotal}</span>
|
|
|
+ <span className="text-ly-14 font-medium">
|
|
|
+ Total:
|
|
|
+ <Price
|
|
|
+ amount={orderDetail.grandTotal}
|
|
|
+ currencyCode={orderDetail.orderCurrencyCode}
|
|
|
+ />
|
|
|
+ </span>
|
|
|
<button className="flex-none flex justify-center items-center px-2 h-8 text-ly-14 text-white bg-ly-middlegreen rounded-md"
|
|
|
onClick={toContinuePay}
|
|
|
>
|
|
|
@@ -145,7 +148,10 @@ export function UnpaidOrderSection({
|
|
|
<div className="flex w-full justify-between items-center">
|
|
|
<span className="text-ly-14 font-medium">Total:</span>
|
|
|
<button onClick={openDetails} className="flex items-center text-ly-14 font-medium">
|
|
|
- {orderSymbol}{orderDetail.grandTotal}
|
|
|
+ <Price className="text-ly-14 font-bold"
|
|
|
+ amount={orderDetail.grandTotal}
|
|
|
+ currencyCode={orderDetail.orderCurrencyCode}
|
|
|
+ />
|
|
|
<svg className="flex-none w-6 h-6" xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink" width="24" height="24" viewBox="0 0 24 24" fill="none"><path stroke="rgba(0, 0, 0, 1)" strokeWidth="1.5" strokeLinejoin="round" strokeLinecap="square" d="M18 9L12 15L6 9"></path></svg>
|
|
|
</button>
|
|
|
</div>
|
|
|
@@ -182,7 +188,10 @@ export function UnpaidOrderSection({
|
|
|
</div>
|
|
|
<div className="flex items-center justify-between">
|
|
|
<div className="flex items-center gap-1.5">
|
|
|
- <span className="text-ly-14 font-bold">{orderSymbol}{product.price}</span>
|
|
|
+ <Price className="text-ly-14 font-bold"
|
|
|
+ amount={product.price}
|
|
|
+ currencyCode={orderDetail.orderCurrencyCode}
|
|
|
+ />
|
|
|
{/* <span className="text-ly-12 text-[#d3d3d3] line-through">$200.12</span> */}
|
|
|
</div>
|
|
|
|
|
|
@@ -217,7 +226,12 @@ export function UnpaidOrderSection({
|
|
|
|
|
|
<div className="flex justify-between mt-3 first:mt-0">
|
|
|
<p className="text-ly-12 leading-ly-20">Subtotal</p>
|
|
|
- <p className="text-ly-12 leading-ly-20">{orderSymbol}{orderDetail.subTotal}</p>
|
|
|
+ <p className="text-ly-12 leading-ly-20">
|
|
|
+ <Price
|
|
|
+ amount={orderDetail.subTotal}
|
|
|
+ currencyCode={orderDetail.orderCurrencyCode}
|
|
|
+ />
|
|
|
+ </p>
|
|
|
</div>
|
|
|
{orderDetail.rewardPointsEarned > 0 &&
|
|
|
<div className="flex justify-between mt-3 first:mt-0">
|
|
|
@@ -228,55 +242,100 @@ export function UnpaidOrderSection({
|
|
|
{orderDetail.shippingAmount !== 0 &&
|
|
|
<div className="flex justify-between mt-3 first:mt-0">
|
|
|
<p className="text-ly-12 leading-ly-20">Shipping</p>
|
|
|
- <p className="text-ly-12 leading-ly-20">{orderSymbol}{orderDetail.shippingAmount}</p>
|
|
|
+ <p className="text-ly-12 leading-ly-20">
|
|
|
+ <Price
|
|
|
+ amount={orderDetail.shippingAmount}
|
|
|
+ currencyCode={orderDetail.orderCurrencyCode}
|
|
|
+ />
|
|
|
+ </p>
|
|
|
</div>
|
|
|
}
|
|
|
- {Number(orderDetail?.shippingInsuranceAmount) > 0 &&
|
|
|
+ {Number(orderDetail.shippingInsuranceAmount) > 0 &&
|
|
|
<div className="flex justify-between mt-3 first:mt-0">
|
|
|
<p className="text-ly-12 leading-ly-20">Shipping</p>
|
|
|
- <p className="text-ly-12 leading-ly-20">{orderSymbol}{Number(orderDetail.shippingInsuranceAmount)}</p>
|
|
|
+ <p className="text-ly-12 leading-ly-20">
|
|
|
+ <Price
|
|
|
+ amount={orderDetail.shippingInsuranceAmount}
|
|
|
+ currencyCode={orderDetail.orderCurrencyCode}
|
|
|
+ />
|
|
|
+ </p>
|
|
|
</div>
|
|
|
}
|
|
|
{orderDetail.taxAmount !== 0 &&
|
|
|
<div className="flex justify-between mt-3 first:mt-0">
|
|
|
<p className="text-ly-12 leading-ly-20">Tax</p>
|
|
|
- <p className="text-ly-12 leading-ly-20">{orderSymbol}{orderDetail.taxAmount}</p>
|
|
|
+ <p className="text-ly-12 leading-ly-20">
|
|
|
+ <Price
|
|
|
+ amount={orderDetail.taxAmount}
|
|
|
+ currencyCode={orderDetail.orderCurrencyCode}
|
|
|
+ />
|
|
|
+ </p>
|
|
|
</div>
|
|
|
}
|
|
|
{(orderDetail.vipPlusAmount !== '0.00' && orderDetail.vipPlusAmount !== null) &&
|
|
|
<div className="flex justify-between mt-3 first:mt-0">
|
|
|
<p className="text-ly-12 leading-ly-20">Plus Fee</p>
|
|
|
- <p className="text-ly-12 leading-ly-20">{orderSymbol}{orderDetail.vipPlusAmount}</p>
|
|
|
+ <p className="text-ly-12 leading-ly-20">
|
|
|
+ <Price
|
|
|
+ amount={orderDetail.vipPlusAmount}
|
|
|
+ currencyCode={orderDetail.orderCurrencyCode}
|
|
|
+ />
|
|
|
+ </p>
|
|
|
</div>
|
|
|
}
|
|
|
{orderDetail.discountAmount !== 0 &&
|
|
|
<div className="flex justify-between mt-3 first:mt-0">
|
|
|
<p className="text-ly-12 leading-ly-20">Discount</p>
|
|
|
- <p className="text-ly-12 leading-ly-20">-{orderSymbol}{orderDetail.discountAmount}</p>
|
|
|
+ <p className="text-ly-12 leading-ly-20">
|
|
|
+ -<Price
|
|
|
+ amount={orderDetail.discountAmount}
|
|
|
+ currencyCode={orderDetail.orderCurrencyCode}
|
|
|
+ />
|
|
|
+ </p>
|
|
|
</div>
|
|
|
}
|
|
|
{(orderDetail.giftcardAmount !== '0.00' && orderDetail.giftcardAmount !== null) &&
|
|
|
<div className="flex justify-between mt-3 first:mt-0">
|
|
|
<p className="text-ly-12 leading-ly-20">Gift Card</p>
|
|
|
- <p className="text-ly-12 leading-ly-20">-{orderSymbol}{orderDetail.giftcardAmount}</p>
|
|
|
+ <p className="text-ly-12 leading-ly-20">
|
|
|
+ -<Price
|
|
|
+ amount={orderDetail.giftcardAmount}
|
|
|
+ currencyCode={orderDetail.orderCurrencyCode}
|
|
|
+ />
|
|
|
+ </p>
|
|
|
</div>
|
|
|
}
|
|
|
{(orderDetail.vipDiscountAmount !== '0.00' && orderDetail.vipDiscountAmount !== null) &&
|
|
|
<div className="flex justify-between mt-3 first:mt-0">
|
|
|
<p className="text-ly-12 leading-ly-20">Plus Save</p>
|
|
|
- <p className="text-ly-12 leading-ly-20">-{orderSymbol}{orderDetail.vipDiscountAmount}</p>
|
|
|
+ <p className="text-ly-12 leading-ly-20">
|
|
|
+ -<Price
|
|
|
+ amount={orderDetail.vipDiscountAmount}
|
|
|
+ currencyCode={orderDetail.orderCurrencyCode}
|
|
|
+ />
|
|
|
+ </p>
|
|
|
</div>
|
|
|
}
|
|
|
{orderDetail.rewardPointsAmount > 0 &&
|
|
|
<div className="flex justify-between mt-3 first:mt-0">
|
|
|
<p className="text-ly-12 leading-ly-20">You Redeem ({orderDetail.rewardPointsUsed} Reward Points)</p>
|
|
|
- <p className="text-ly-12 leading-ly-20">-{orderSymbol}{orderDetail.rewardPointsAmount}</p>
|
|
|
+ <p className="text-ly-12 leading-ly-20">
|
|
|
+ -<Price
|
|
|
+ amount={orderDetail.rewardPointsAmount}
|
|
|
+ currencyCode={orderDetail.orderCurrencyCode}
|
|
|
+ />
|
|
|
+ </p>
|
|
|
</div>
|
|
|
}
|
|
|
|
|
|
<div className="flex justify-between mt-3 first:mt-0">
|
|
|
<p className="text-ly-16 leading-ly-24">Grand Total</p>
|
|
|
- <p className="text-ly-16 leading-ly-24 font-bold">{orderSymbol}{orderDetail.grandTotal}</p>
|
|
|
+ <p className="text-ly-16 leading-ly-24 font-bold">
|
|
|
+ <Price
|
|
|
+ amount={orderDetail.grandTotal}
|
|
|
+ currencyCode={orderDetail.orderCurrencyCode}
|
|
|
+ />
|
|
|
+ </p>
|
|
|
</div>
|
|
|
</div>
|
|
|
|