|
@@ -25,6 +25,7 @@ interface Props {
|
|
|
channel?: PayChannel[];
|
|
|
currentChannel?: PayChannel;
|
|
|
setChannel?: (data: PayChannel) => void;
|
|
|
+ currentShop?: ShopInfo;
|
|
|
}
|
|
|
|
|
|
const getDepositApi = async () => {
|
|
@@ -40,7 +41,7 @@ const getDepositApi = async () => {
|
|
|
});
|
|
|
};
|
|
|
const DepositData: FC<Props> = (props) => {
|
|
|
- const { shopInfo, channel, currentChannel, setChannel } = props;
|
|
|
+ const { shopInfo, channel, currentChannel, setChannel, currentShop } = props;
|
|
|
const t = useTranslations();
|
|
|
// const router = useRouter();
|
|
|
const userInfo = useUserInfoStore((state) => state.userInfo);
|
|
@@ -100,6 +101,7 @@ const DepositData: FC<Props> = (props) => {
|
|
|
setFormData(params);
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
handleUserRecharge(false, params);
|
|
|
};
|
|
|
// const handleUserRecharge = (type: boolean) => {};
|
|
@@ -141,16 +143,24 @@ const DepositData: FC<Props> = (props) => {
|
|
|
setAmount(value);
|
|
|
};
|
|
|
const amountValidator = (rules: any, value: any) => {
|
|
|
- if (!value) return Promise.reject(new Error(t("form.amount")));
|
|
|
- if (shopInfo?.condition) {
|
|
|
- if (+value < shopInfo.condition.min)
|
|
|
- return Promise.reject(
|
|
|
- new Error(t("form.amountMinReg", { amount: shopInfo.condition.min }))
|
|
|
- );
|
|
|
- if (+value > shopInfo.condition.max)
|
|
|
- return Promise.reject(
|
|
|
- new Error(t("form.amountMaxReg", { amount: shopInfo.condition.max }))
|
|
|
- );
|
|
|
+ if (!value) {
|
|
|
+ let msg = t("form.amount");
|
|
|
+ Toast.show({ content: msg, maskClickable: false });
|
|
|
+
|
|
|
+ return Promise.reject(new Error(msg));
|
|
|
+ }
|
|
|
+ if (currentShop?.condition) {
|
|
|
+ if (+value < currentShop.condition.min) {
|
|
|
+ let msg = t("form.amountMinReg", { amount: currentShop.condition.min });
|
|
|
+ Toast.show({ content: msg, maskClickable: false });
|
|
|
+
|
|
|
+ return Promise.reject(new Error(msg));
|
|
|
+ }
|
|
|
+ if (+value > currentShop.condition.max) {
|
|
|
+ let msg = t("form.amountMaxReg", { amount: currentShop.condition.max });
|
|
|
+ Toast.show({ content: msg, maskClickable: false });
|
|
|
+ return Promise.reject(new Error(msg));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return Promise.resolve();
|
|
@@ -224,12 +234,12 @@ const DepositData: FC<Props> = (props) => {
|
|
|
name="amount"
|
|
|
label=""
|
|
|
rules={[{ required: true, type: "number", validator: amountValidator }]}
|
|
|
- // style={{ display: shopInfo?.type === 2 ? "block" : "none" }}
|
|
|
+ style={{ display: shopInfo?.type === 2 ? "block" : "none" }}
|
|
|
>
|
|
|
<Input
|
|
|
- placeholder={`${t("DepositPage.Montante")}: (${shopInfo?.condition?.min}-${shopInfo?.condition?.max})`}
|
|
|
+ placeholder={`${t("DepositPage.Montante")}: (${currentShop?.condition?.min}-${currentShop?.condition?.max})`}
|
|
|
type={"number"}
|
|
|
- maxLength={shopInfo?.condition?.max}
|
|
|
+ maxLength={currentShop?.condition?.max}
|
|
|
/>
|
|
|
</Form.Item>
|
|
|
|