|
|
@ -1,6 +1,7 @@ |
|
|
|
import React, { useState, useEffect } from "react"; |
|
|
|
import React, { useState, useEffect } from "react"; |
|
|
|
import { userProduct, userFactor, publicApi } from "../../redux/actions"; |
|
|
|
import { userProduct, userFactor, publicApi } from "../../redux/actions"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import DeliveryForm from "../DeliveryForm"; |
|
|
|
import Product from "./Product"; |
|
|
|
import Product from "./Product"; |
|
|
|
import Code from "./Code"; |
|
|
|
import Code from "./Code"; |
|
|
|
import Button from "../../components/Button"; |
|
|
|
import Button from "../../components/Button"; |
|
|
@ -26,6 +27,8 @@ function ShoppingCart({ |
|
|
|
setHeaderOptions, |
|
|
|
setHeaderOptions, |
|
|
|
desktopContentTransform, |
|
|
|
desktopContentTransform, |
|
|
|
}) { |
|
|
|
}) { |
|
|
|
|
|
|
|
const [phase, setPhase] = useState("products"); |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
getList(); |
|
|
|
getList(); |
|
|
|
getFactorInfo({ userId }); |
|
|
|
getFactorInfo({ userId }); |
|
|
@ -70,11 +73,11 @@ function ShoppingCart({ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
) : ( |
|
|
|
) : ( |
|
|
|
<div className="w-full flex flex-row justify-between py-4"> |
|
|
|
<div className="w-full flex flex-row justify-between py-4"> |
|
|
|
<strong className="font-light text-base dark:text-white text-blue5F"> |
|
|
|
<strong className="font-light text-tiny dark:text-white text-blue5F"> |
|
|
|
{name} |
|
|
|
{name} |
|
|
|
</strong> |
|
|
|
</strong> |
|
|
|
<span |
|
|
|
<span |
|
|
|
className="font-medium text-xl dark:text-white" |
|
|
|
className="font-medium text-lg dark:text-white" |
|
|
|
style={{ |
|
|
|
style={{ |
|
|
|
color: !isDark ? (type === "error" ? "#F1420D" : "#246E8A") : "", |
|
|
|
color: !isDark ? (type === "error" ? "#F1420D" : "#246E8A") : "", |
|
|
|
}} |
|
|
|
}} |
|
|
@ -117,7 +120,7 @@ function ShoppingCart({ |
|
|
|
/> |
|
|
|
/> |
|
|
|
</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"> |
|
|
|
<strong className="font-medium text-sm dark:text-white"> |
|
|
|
<strong className="font-light text-sm dark:text-white"> |
|
|
|
جمع کل سبد خرید |
|
|
|
جمع کل سبد خرید |
|
|
|
</strong> |
|
|
|
</strong> |
|
|
|
<p className="font-medium text-greenBA text-xs dark:text-white"> |
|
|
|
<p className="font-medium text-greenBA text-xs dark:text-white"> |
|
|
@ -149,7 +152,8 @@ function ShoppingCart({ |
|
|
|
}`}
|
|
|
|
}`}
|
|
|
|
> |
|
|
|
> |
|
|
|
<div className="flex flex-col w-3/4"> |
|
|
|
<div className="flex flex-col w-3/4"> |
|
|
|
<Table /> |
|
|
|
{phase === "products" && <Table />} |
|
|
|
|
|
|
|
{phase === "delivery-form" && <DeliveryForm />} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div |
|
|
|
<div |
|
|
|
className="flex flex-col w-1/4 p-10 bg-grayF9 border border-solid border-grayDB rounded-md px-4 py-4" |
|
|
|
className="flex flex-col w-1/4 p-10 bg-grayF9 border border-solid border-grayDB rounded-md px-4 py-4" |
|
|
@ -173,7 +177,7 @@ function ShoppingCart({ |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="flex flex-row justify-between items-center w-full py-4 border-t border-b border-grayDB border-solid"> |
|
|
|
<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 className="font-medium text-tiny text-blue5F dark:text-white"> |
|
|
|
جمع کل سبد خرید |
|
|
|
جمع کل سبد خرید |
|
|
|
</strong> |
|
|
|
</strong> |
|
|
|
<p className="font-medium text-greenBA text-xl dark:text-white"> |
|
|
|
<p className="font-medium text-greenBA text-xl dark:text-white"> |
|
|
@ -181,22 +185,55 @@ function ShoppingCart({ |
|
|
|
<span className="font-medium text-greenBA text-sm mr-2">تومان</span> |
|
|
|
<span className="font-medium text-greenBA text-sm mr-2">تومان</span> |
|
|
|
</p> |
|
|
|
</p> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div |
|
|
|
{phase === "products" && ( |
|
|
|
className="w-full rounded-md flex flex-row justify-center items-center py-2.5 px-3 mt-10 mb-4" |
|
|
|
<div |
|
|
|
style={{ backgroundColor: "#196EC01a" }} |
|
|
|
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"> |
|
|
|
<img src={alertIcon} className="w-5 ml-2" /> |
|
|
|
هزینه ارسال کالا پس از تعیین محل آدرس مشخص میشود |
|
|
|
<p className="text-xs text-blueC0 dark:text-white text-justify"> |
|
|
|
</p> |
|
|
|
هزینه ارسال کالا پس از تعیین محل آدرس مشخص میشود |
|
|
|
</div> |
|
|
|
</p> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
)} |
|
|
|
|
|
|
|
{phase === "delivery-form" && ( |
|
|
|
|
|
|
|
<div className="flex flex-col mt-10"> |
|
|
|
|
|
|
|
<strong className="text-tiny text-blue52 mb-5 font-medium"> |
|
|
|
|
|
|
|
انتخاب شیوه پرداخت |
|
|
|
|
|
|
|
</strong> |
|
|
|
|
|
|
|
<Button |
|
|
|
|
|
|
|
title="ادامه فرایند خرید" |
|
|
|
|
|
|
|
backgroundColor="bg-transparent" |
|
|
|
|
|
|
|
border={{ color: "#77777755", width: "1px" }} |
|
|
|
|
|
|
|
width="100%" |
|
|
|
|
|
|
|
color="text-blue52" |
|
|
|
|
|
|
|
onClick={() => |
|
|
|
|
|
|
|
setPhase(phase === "products" ? "delivery-form" : "") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
<br /> |
|
|
|
|
|
|
|
<Button |
|
|
|
|
|
|
|
title="پرداخت در محل" |
|
|
|
|
|
|
|
backgroundColor="bg-transparent" |
|
|
|
|
|
|
|
border={{ color: "#77777755", width: "1px" }} |
|
|
|
|
|
|
|
width="100%" |
|
|
|
|
|
|
|
color="text-blue52" |
|
|
|
|
|
|
|
onClick={() => |
|
|
|
|
|
|
|
setPhase(phase === "products" ? "delivery-form" : "") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
<br/> |
|
|
|
|
|
|
|
<br/> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
)} |
|
|
|
|
|
|
|
|
|
|
|
<Button |
|
|
|
<Button |
|
|
|
title="ادامه فرایند خرید" |
|
|
|
title="ادامه فرایند خرید" |
|
|
|
backgroundColor="bg-blueC0" |
|
|
|
backgroundColor="bg-blueC0" |
|
|
|
border={{ color: "#196EC055", width: "1px" }} |
|
|
|
border={{ color: "#196EC055", width: "1px" }} |
|
|
|
width="100%" |
|
|
|
width="100%" |
|
|
|
color="text-white" |
|
|
|
color="text-white" |
|
|
|
// onClick={() => }
|
|
|
|
onClick={() => setPhase(phase === "products" ? "delivery-form" : "")} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|