fix(payment): update currency display from تومان to ریال and adjust amount formatting

This commit is contained in:
hamed
2026-06-24 20:39:34 +03:30
parent cc6b42c1a5
commit 537f3e47d5
5 changed files with 16 additions and 13 deletions
+10 -7
View File
@@ -5,7 +5,6 @@ import { Button, MenuItem, Select, FormControl, InputLabel } from "@mui/material
import ButtonFixed from "./ButtonFixed";
import { request } from "@/services/response";
const APPOINTMENT_AMOUNT_RIALS = 150000;
const PAYMENT_TTL = 900;
const banks = [
@@ -17,6 +16,7 @@ function Paying({ setStep, appointmentId, expiresAt, doctor, data, isForAnother,
const [selectedBank, setSelectedBank] = useState("mellat");
const [loading, setLoading] = useState(false);
const [testMode, setTestMode] = useState(null);
const [feeRials, setFeeRials] = useState(null);
const computeLeft = () =>
expiresAt
@@ -32,8 +32,11 @@ function Paying({ setStep, appointmentId, expiresAt, doctor, data, isForAnother,
useEffect(() => {
request
.getPaymentConfig()
.then((res) => setTestMode(Boolean(res?.data?.test_mode)))
.catch(() => setTestMode(false));
.then((res) => {
setTestMode(Boolean(res?.data?.test_mode));
setFeeRials(Number(res?.data?.appointment_fee_rials) || 0);
})
.catch(() => { setTestMode(false); setFeeRials(0); });
}, []);
const formatTime = (seconds) => {
@@ -42,7 +45,7 @@ function Paying({ setStep, appointmentId, expiresAt, doctor, data, isForAnother,
return `${m}:${s.toString().padStart(2, "0")}`;
};
const toman = (APPOINTMENT_AMOUNT_RIALS / 10).toLocaleString("fa-IR");
const rials = feeRials != null ? feeRials.toLocaleString("fa-IR") : "—";
const patientName = isForAnother
? [data?.name?.value, data?.family?.value].filter(Boolean).join(" ").trim()
: data?.name?.value;
@@ -109,7 +112,7 @@ function Paying({ setStep, appointmentId, expiresAt, doctor, data, isForAnother,
مبلغ قابل پرداخت
</span>
<span className="text-[#3B3B3B] text-[18px] md:text-[20px] font-bold">
{toman} <span className="text-[14px] font-normal text-[#616161]">تومان</span>
{rials} <span className="text-[14px] font-normal text-[#616161]">ریال</span>
</span>
</div>
@@ -195,10 +198,10 @@ function Paying({ setStep, appointmentId, expiresAt, doctor, data, isForAnother,
className="!flex !w-full md:!w-fit !mr-auto !gap-[6px] !px-[16px] !py-[10px] !min-w-[180px]"
onClick={handlePayment}
variant="contained"
disabled={loading || testMode === null}
disabled={loading || testMode === null || feeRials === null}
>
<span className={`text-[#FFF] text-[16px] font-medium ${loading ? "opacity-0" : ""}`}>
{testMode ? "پرداخت آزمایشی" : `پرداخت ${toman} تومان`}
{testMode ? "پرداخت آزمایشی" : `پرداخت ${rials} ریال`}
</span>
{!loading && <ArrowLeftB />}
</Button>