diff --git a/app/vip/page.jsx b/app/vip/page.jsx index f6bad47..f88ceaf 100644 --- a/app/vip/page.jsx +++ b/app/vip/page.jsx @@ -16,10 +16,11 @@ import vipright4 from "@/public/images/vipright4.png"; import viptitle from "@/public/images/viptitle.png"; import Link from "next/link"; import { Toast } from "antd-mobile"; -import { useRouter } from "next/navigation"; +import { useRouter, useSearchParams } from "next/navigation"; export default function Vip() { const router = useRouter(); + const searchParams = useSearchParams(); const alipayBlock = () => { const base = webviewBaseRequest(); @@ -32,6 +33,13 @@ export default function Vip() { }); }; + //检查是否需要使用金币支付 + const [useCoinpay, setUseCoinpay] = useState(false); + useEffect(() => { + const useCoinpayStr = searchParams.get("use_coinpay"); + setUseCoinpay(useCoinpayStr === "1" ? true : false); + }, []); + //检查用户是否是vip const [isVip, setIsVip] = useState(false); const [name, setName] = useState(""); @@ -98,6 +106,25 @@ export default function Vip() { return; } + //金币支付 + if (type === "coin") { + window.ReactNativeWebView.postMessage( + JSON.stringify({ + type: "COINPAY", + data: { + url: "/api/vas/create_order", + body: { product_id: "membership" }, + product: "会员资格", + coinPrice: 490, + validity: "永久", + info: "", + onPurchaseDone: () => {}, + }, + }) + ); + return; + } + setIsLoading(true); const signature = generateSignature(body); @@ -245,35 +272,56 @@ export default function Vip() {
- 支付宝支付 -
+ {useCoinpay ? ( ++ 金币支付 +
+- 微信支付 -
+ ) : ( ++ 支付宝支付 +
++ 微信支付 +
+确认购买即视为同意