|
|
|
@ -1,6 +1,7 @@ |
|
|
|
|
import React, { useState, useEffect } from "react"; |
|
|
|
|
import { userProduct, userFactor, publicApi } from "../../redux/actions"; |
|
|
|
|
|
|
|
|
|
import DeliveryForm from "../DeliveryForm"; |
|
|
|
|
import Product from "./Product"; |
|
|
|
|
import Code from "./Code"; |
|
|
|
|
import Button from "../../components/Button"; |
|
|
|
@ -26,6 +27,8 @@ function ShoppingCart({ |
|
|
|
|
setHeaderOptions, |
|
|
|
|
desktopContentTransform, |
|
|
|
|
}) { |
|
|
|
|
const [phase, setPhase] = useState("products"); |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
getList(); |
|
|
|
|
getFactorInfo({ userId }); |
|
|
|
@ -70,11 +73,11 @@ function ShoppingCart({ |
|
|
|
|
</div> |
|
|
|
|
) : ( |
|
|
|
|
<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} |
|
|
|
|
</strong> |
|
|
|
|
<span |
|
|
|
|
className="font-medium text-xl dark:text-white" |
|
|
|
|
className="font-medium text-lg dark:text-white" |
|
|
|
|
style={{ |
|
|
|
|
color: !isDark ? (type === "error" ? "#F1420D" : "#246E8A") : "", |
|
|
|
|
}} |
|
|
|
@ -117,7 +120,7 @@ function ShoppingCart({ |
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
<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> |
|
|
|
|
<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"> |
|
|
|
|
<Table /> |
|
|
|
|
{phase === "products" && <Table />} |
|
|
|
|
{phase === "delivery-form" && <DeliveryForm />} |
|
|
|
|
</div> |
|
|
|
|
<div |
|
|
|
|
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 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> |
|
|
|
|
<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> |
|
|
|
|
</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> |
|
|
|
|
{phase === "products" && ( |
|
|
|
|
<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> |
|
|
|
|
)} |
|
|
|
|
{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 |
|
|
|
|
title="ادامه فرایند خرید" |
|
|
|
|
backgroundColor="bg-blueC0" |
|
|
|
|
border={{ color: "#196EC055", width: "1px" }} |
|
|
|
|
width="100%" |
|
|
|
|
color="text-white" |
|
|
|
|
// onClick={() => }
|
|
|
|
|
onClick={() => setPhase(phase === "products" ? "delivery-form" : "")} |
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|