瀏覽代碼

feat: 修改

year 3 周之前
父節點
當前提交
c58a60281d

+ 1 - 1
src/app/[locale]/(TabBar)/deposit/component/deposit/index.tsx

@@ -137,7 +137,7 @@ const Deposit = () => {
         setCurrentChannel(item);
     };
     const inputChange = (value: string) => {
-        const toValue = value.replace(/[^0-9]/, "");
+        const toValue = value.replace(/[^0-9]/gi, "");
         let toAmount = "";
         if (toValue) {
             toAmount = new BigNumber(toValue).toFixed(0, BigNumber.ROUND_DOWN);

+ 1 - 1
src/app/[locale]/(TabBar)/deposit/component/withdraw/index.module.scss

@@ -11,7 +11,7 @@
     }
     :global(.adm-list-item-content-main) {
         padding: 0.08rem 0;
-        display: flex;
+        // display: flex;
         align-items: center;
     }
     :global(.adm-form-item-feedback-error) {

+ 23 - 19
src/app/[locale]/(TabBar)/deposit/component/withdraw/index.tsx

@@ -172,7 +172,7 @@ const Withdraw = () => {
             length?: number;
         }
     ) => {
-        const toValue = value.replace(/[^0-9]/, "");
+        const toValue = value.replace(/[^0-9]/gi, "");
         let toAmount = "";
         if (toValue) {
             toAmount = new BigNumber(toValue).toFixed(0, BigNumber.ROUND_DOWN);
@@ -235,27 +235,31 @@ const Withdraw = () => {
     };
 
     const extractHandler = async () => {
-        const values = formInstanceRef.current?.getFieldValues();
-        const { passport, name, last_name, amount, account_no } = values;
-        if (!amount) {
-            return;
-        }
-        const params: WithDrawParams = {
-            passport,
-            channel_id: currentType.id,
-            amount: Number(amount),
-            account_no,
-            user_name: `${name} ${last_name}`,
-        };
+        const loadingRef = Toast.show({ icon: "loading", duration: 0 });
+        try {
+            const values = formInstanceRef.current?.getFieldsValue();
+            const { passport, name, last_name, amount, account_no } = values;
+            if (!amount) {
+                return;
+            }
+            const params: WithDrawParams = {
+                passport,
+                channel_id: currentType.id,
+                amount: Number(amount),
+                account_no,
+                user_name: `${name} ${last_name}`,
+            };
 
-        const withResult = await getWithDrawApi(params).catch((error) => {
+            const withResult = await getWithDrawApi(params);
+            loadingRef.close();
+            if (withResult && withResult.code === 200) {
+                Toast.show(t("code.200"));
+            }
+            await clearWallet();
+        } catch (error: any) {
+            loadingRef.close();
             Toast.show(t(`code.${error.data.code}`));
-        });
-        if (withResult && withResult.code === 200) {
-            Toast.show(t("code.200"));
         }
-
-        await clearWallet();
     };
     // const goGame = () => {
     //     const current = game.current;