|
|
@ -10,22 +10,6 @@ import alertIcon from "../../assets/icons/alert.svg"; |
|
|
|
|
|
|
|
|
|
|
|
import { connect } from "react-redux"; |
|
|
|
import { connect } from "react-redux"; |
|
|
|
|
|
|
|
|
|
|
|
const PriceStatus = ({ name, value, type, isDark }) => { |
|
|
|
|
|
|
|
return ( |
|
|
|
|
|
|
|
<div className="w-full flex flex-row justify-between py-2"> |
|
|
|
|
|
|
|
<strong className="font-light text-sm dark:text-white">{name}</strong> |
|
|
|
|
|
|
|
<span |
|
|
|
|
|
|
|
className="font-bold text-sm dark:text-white" |
|
|
|
|
|
|
|
style={{ |
|
|
|
|
|
|
|
color: !isDark ? (type === "error" ? "#F1420D" : "#246E8A") : "", |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
{value + " " + "تومان"} |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function ShoppingCart({ |
|
|
|
function ShoppingCart({ |
|
|
|
isDark, |
|
|
|
isDark, |
|
|
|
isMobile, |
|
|
|
isMobile, |
|
|
@ -43,8 +27,8 @@ function ShoppingCart({ |
|
|
|
desktopContentTransform, |
|
|
|
desktopContentTransform, |
|
|
|
}) { |
|
|
|
}) { |
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
// getList();
|
|
|
|
getList(); |
|
|
|
// getFactorInfo({ userId });
|
|
|
|
getFactorInfo({ userId }); |
|
|
|
setHeaderOptions(headerOptions); |
|
|
|
setHeaderOptions(headerOptions); |
|
|
|
}, []); |
|
|
|
}, []); |
|
|
|
|
|
|
|
|
|
|
@ -63,13 +47,52 @@ function ShoppingCart({ |
|
|
|
</strong> |
|
|
|
</strong> |
|
|
|
</header> |
|
|
|
</header> |
|
|
|
<ul className="w-full mt-2 list-none p-0"> |
|
|
|
<ul className="w-full mt-2 list-none p-0"> |
|
|
|
{[0,1].map((product, index) => ( |
|
|
|
{list.map((product, index) => ( |
|
|
|
<Product key={index} product={product} /> |
|
|
|
<Product key={index} product={product} /> |
|
|
|
))} |
|
|
|
))} |
|
|
|
</ul> |
|
|
|
</ul> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
); |
|
|
|
); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const PriceStatus = ({ name, value, type }) => { |
|
|
|
|
|
|
|
return isMobile ? ( |
|
|
|
|
|
|
|
<div className="w-full flex flex-row justify-between py-2"> |
|
|
|
|
|
|
|
<strong className="font-light text-sm dark:text-white">{name}</strong> |
|
|
|
|
|
|
|
<span |
|
|
|
|
|
|
|
className="font-bold text-sm dark:text-white" |
|
|
|
|
|
|
|
style={{ |
|
|
|
|
|
|
|
color: !isDark ? (type === "error" ? "#F1420D" : "#246E8A") : "", |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
{value + " " + "تومان"} |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
) : ( |
|
|
|
|
|
|
|
<div className="w-full flex flex-row justify-between py-4"> |
|
|
|
|
|
|
|
<strong className="font-light text-base dark:text-white text-blue5F"> |
|
|
|
|
|
|
|
{name} |
|
|
|
|
|
|
|
</strong> |
|
|
|
|
|
|
|
<span |
|
|
|
|
|
|
|
className="font-medium text-xl dark:text-white" |
|
|
|
|
|
|
|
style={{ |
|
|
|
|
|
|
|
color: !isDark ? (type === "error" ? "#F1420D" : "#246E8A") : "", |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
{value} |
|
|
|
|
|
|
|
<span |
|
|
|
|
|
|
|
style={{ |
|
|
|
|
|
|
|
color: !isDark ? (type === "error" ? "#F1420D" : "#246E8A") : "", |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
className="text-sm mr-2" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
تومان |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
return isMobile ? ( |
|
|
|
return isMobile ? ( |
|
|
|
<div className="w-full flex flex-col px-4"> |
|
|
|
<div className="w-full flex flex-col px-4"> |
|
|
|
{list.map((product, index) => ( |
|
|
|
{list.map((product, index) => ( |
|
|
@ -81,19 +104,16 @@ function ShoppingCart({ |
|
|
|
name="مبلغ سبد خرید" |
|
|
|
name="مبلغ سبد خرید" |
|
|
|
value={factorInfo?.sumPrice} |
|
|
|
value={factorInfo?.sumPrice} |
|
|
|
type="normal" |
|
|
|
type="normal" |
|
|
|
isDark={isDark} |
|
|
|
|
|
|
|
/> |
|
|
|
/> |
|
|
|
<PriceStatus |
|
|
|
<PriceStatus |
|
|
|
name="میزان تخفیف" |
|
|
|
name="میزان تخفیف" |
|
|
|
value={factorInfo?.offPrice} |
|
|
|
value={factorInfo?.offPrice} |
|
|
|
type="error" |
|
|
|
type="error" |
|
|
|
isDark={isDark} |
|
|
|
|
|
|
|
/> |
|
|
|
/> |
|
|
|
<PriceStatus |
|
|
|
<PriceStatus |
|
|
|
name="مالیات بر ارزش افزوده" |
|
|
|
name="مالیات بر ارزش افزوده" |
|
|
|
value={factorInfo?.sumPrice * 0.009} |
|
|
|
value={factorInfo?.sumPrice * 0.009} |
|
|
|
type="error" |
|
|
|
type="error" |
|
|
|
isDark={isDark} |
|
|
|
|
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="flex flex-row justify-between items-center w-full py-3"> |
|
|
|
<div className="flex flex-row justify-between items-center w-full py-3"> |
|
|
@ -124,14 +144,61 @@ function ShoppingCart({ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
) : ( |
|
|
|
) : ( |
|
|
|
<div |
|
|
|
<div |
|
|
|
className={`w-full flex flex-row relative px-5 ${ |
|
|
|
className={`w-full flex flex-row relative gap-10 px-5 mt-10 ${ |
|
|
|
desktopContentTransform ? "top-24" : "" |
|
|
|
desktopContentTransform ? "top-24" : "" |
|
|
|
}`}
|
|
|
|
}`}
|
|
|
|
> |
|
|
|
> |
|
|
|
<div className="flex flex-col w-3/4 mt-10"> |
|
|
|
<div className="flex flex-col w-3/4"> |
|
|
|
<Table /> |
|
|
|
<Table /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="flex flex-col w-1/4"></div> |
|
|
|
<div |
|
|
|
|
|
|
|
className="flex flex-col w-1/4 p-10 bg-grayF9 border border-solid border-grayDB rounded-md px-4 py-4" |
|
|
|
|
|
|
|
style={{ height: "fit-content" }} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<div className="flex flex-col w-full border-t py-2 border-gray-300 border-b"> |
|
|
|
|
|
|
|
<PriceStatus |
|
|
|
|
|
|
|
name="مبلغ سبد خرید" |
|
|
|
|
|
|
|
value={factorInfo?.sumPrice} |
|
|
|
|
|
|
|
type="normal" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
<PriceStatus |
|
|
|
|
|
|
|
name="میزان تخفیف" |
|
|
|
|
|
|
|
value={factorInfo?.offPrice} |
|
|
|
|
|
|
|
type="error" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
<PriceStatus |
|
|
|
|
|
|
|
name="مالیات بر ارزش افزوده" |
|
|
|
|
|
|
|
value={factorInfo?.sumPrice * 0.009} |
|
|
|
|
|
|
|
type="error" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div className="flex flex-row justify-between items-center w-full py-4 border-t border-b border-grayDB border-solid"> |
|
|
|
|
|
|
|
<strong className="font-medium text-base text-blue5F dark:text-white"> |
|
|
|
|
|
|
|
جمع کل سبد خرید |
|
|
|
|
|
|
|
</strong> |
|
|
|
|
|
|
|
<p className="font-medium text-greenBA text-xl dark:text-white"> |
|
|
|
|
|
|
|
{factorInfo?.payPrice} |
|
|
|
|
|
|
|
<span className="font-medium text-greenBA text-sm mr-2">تومان</span> |
|
|
|
|
|
|
|
</p> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div |
|
|
|
|
|
|
|
className="w-full rounded-md flex flex-row justify-center items-center py-2.5 px-3 mt-10 mb-4" |
|
|
|
|
|
|
|
style={{ backgroundColor: "#196EC01a" }} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<img src={alertIcon} className="w-5 ml-2" /> |
|
|
|
|
|
|
|
<p className="text-xs text-blueC0 dark:text-white text-justify"> |
|
|
|
|
|
|
|
هزینه ارسال کالا پس از تعیین محل آدرس مشخص میشود |
|
|
|
|
|
|
|
</p> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<Button |
|
|
|
|
|
|
|
title="ادامه فرایند خرید" |
|
|
|
|
|
|
|
backgroundColor="bg-blueC0" |
|
|
|
|
|
|
|
border={{ color: "#196EC055", width: "1px" }} |
|
|
|
|
|
|
|
width="100%" |
|
|
|
|
|
|
|
color="text-white" |
|
|
|
|
|
|
|
// onClick={() => }
|
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|