update
This commit is contained in:
@@ -20,6 +20,9 @@ const ItemDeal: React.FC<ItemDealProps> = ({ item }) => {
|
||||
return null;
|
||||
}
|
||||
|
||||
const remainingQuantity = Number(item.quantity) - Number(item.sale_quantity);
|
||||
const percentRemaining = (remainingQuantity / Number(item.quantity)) * 100;
|
||||
|
||||
return (
|
||||
<div className="product-item">
|
||||
<div className="item-deal">
|
||||
@@ -31,10 +34,12 @@ const ItemDeal: React.FC<ItemDealProps> = ({ item }) => {
|
||||
alt={item.product_info.productName}
|
||||
/>
|
||||
</Link>
|
||||
|
||||
<div className="product-info flex-1">
|
||||
<Link href={item.product_info.productUrl}>
|
||||
<h3 className="product-title line-clamp-3">{item.product_info.productName}</h3>
|
||||
</Link>
|
||||
|
||||
<div className="product-martket-main flex items-center">
|
||||
{Number(item.product_info.marketPrice) > 0 && (
|
||||
<>
|
||||
@@ -45,40 +50,31 @@ const ItemDeal: React.FC<ItemDealProps> = ({ item }) => {
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="product-price-main font-bold">
|
||||
{item.product_info.price > '0'
|
||||
? `${formatCurrency(item.product_info.price)}đ`
|
||||
? `${formatCurrency(item.product_info.price)} đ`
|
||||
: 'Liên hệ'}
|
||||
</div>
|
||||
|
||||
<div className="p-quantity-sale">
|
||||
<i className="sprite sprite-fire-deal"></i>
|
||||
<div className="bg-gradient"></div>
|
||||
{(() => {
|
||||
const percentRemaining =
|
||||
((Number(item.quantity) - Number(item.sale_quantity)) / Number(item.quantity)) *
|
||||
100;
|
||||
|
||||
return <p className="js-line-deal-left" style={{ width: `${percentRemaining}%` }}></p>;
|
||||
})()}
|
||||
<p className="js-line-deal-left" style={{ width: `${percentRemaining}%` }}></p>
|
||||
<span>
|
||||
Còn {Number(item.quantity) - Number(item.sale_quantity)}/{Number(item.quantity)} sản
|
||||
phẩm
|
||||
Còn {remainingQuantity}/{Number(item.quantity)} sản phẩm
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className="js-item-deal-time js-item-time-25404">
|
||||
<div className="time-deal-page flex items-center justify-center gap-2">
|
||||
<div>Kết thúc sau:</div>
|
||||
<CountDown deadline={item.to_time} />
|
||||
</div>
|
||||
</div>
|
||||
<a href="javascript:buyNow(25404)" className="buy-now-deal">
|
||||
|
||||
<Link href={item.product_info.productUrl} className="buy-now-deal">
|
||||
Mua giá sốc
|
||||
</a>
|
||||
<Link
|
||||
href="/bts-gaming-02"
|
||||
className="text-deal-item color-primary mt-3 hidden font-bold"
|
||||
>
|
||||
Xem sản phẩm
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user