Przeglądaj źródła

fix: 修改支付链接跳转方式

Before 6 miesięcy temu
rodzic
commit
0816c68954

+ 5 - 2
src/app/[locale]/(navbar)/doings/discount/DepositData.tsx

@@ -10,6 +10,7 @@ import { useTranslations } from "next-intl";
 import { FC, Fragment, useLayoutEffect, useRef, useState } from "react";
 
 import ButtonOwn from "@/components/ButtonOwn";
+import { useRouter } from "@/i18n/routing";
 import "@/styles/deposit.scss";
 import { server } from "@/utils/client";
 import Image from "next/image";
@@ -76,6 +77,7 @@ const DepositData: FC<Props> = (props) => {
     // const { deposits } = props;
     const t = useTranslations();
     const userInfo = useUserInfoStore((state) => state.userInfo);
+    const router = useRouter();
 
     // 选中类型
 
@@ -98,14 +100,15 @@ const DepositData: FC<Props> = (props) => {
         getUserRechargeApi(params)
             .then(async (res) => {
                 formInstanceRef.current?.resetFields();
-                Toast.show({ icon: "success", content: t("code.200"), maskClickable: false });
                 setAmount(undefined);
 
                 const data = await getDepositApi();
                 setDepositState(data);
                 setActiveType(data[0]);
                 if (res.data.pay_url) {
-                    window.open(res.data.pay_url);
+                    router.push(`/payinfo?url=${res.data.pay_url}`);
+                } else {
+                    Toast.show({ icon: "success", content: t("code.200"), maskClickable: false });
                 }
             })
             .catch((error) => {