"use client"; import React, { useState, useEffect } from "react"; import { generateSignature } from "@/utils/crypto"; import webviewBaseRequest from "@/utils/webviewBaseRequest"; import Image from "next/image"; import vipbackground from "@/public/images/vipbackground.png"; import isvip from "@/public/images/isvip.png"; import notvip from "@/public/images/notvip.png"; import alipay from "@/public/images/alipay.png"; import contact from "@/public/images/contact.png"; import vipright1 from "@/public/images/vipright1.png"; import vipright2 from "@/public/images/vipright2.png"; import vipright3 from "@/public/images/vipright3.png"; 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"; export default function Vip() { const router = useRouter(); const alipayBlock = () => { const base = webviewBaseRequest(); if (base?.b_mid === 161) { createOrder("alipay_h5"); return; } Toast.show({ content: "支付渠道维护升级中,请24小时后再试", }); }; //检查用户是否是vip const [isVip, setIsVip] = useState(false); const [name, setName] = useState(""); const [isFetching, setIsFetching] = useState(true); useEffect(() => { const getUserData = async () => { try { const base = webviewBaseRequest(); const signature = generateSignature({ ...base, mid: base.b_mid, }); const detailResponse = await fetch( `/api/account/list_by_mid?signature=${signature}`, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ ...base, mid: base.b_mid, }), } ); const detailData = await detailResponse.json(); if (detailData.ret === -1) { Toast.show({ content: detailData.msg, }); return; } setName(detailData.data.account.name); if (detailData.data.account.is_a_member === 1) setIsVip(true); setIsFetching(false); } catch (error) { console.error(error); } }; setTimeout(() => { getUserData(); }, 500); }, []); //创建充值订单 const [isLoading, setIsLoading] = useState(false); const createOrder = async (type = "alipay_h5") => { const base = webviewBaseRequest(); const body = { ...base, product_id: "membership", pay_type: type, from: "app", }; //如果是微信jsapi支付直接跳转到中间页 if (type === "wxpay_jsapi") { router.push(`/pay/${encodeURIComponent(JSON.stringify(body))}`); return; } setIsLoading(true); const signature = generateSignature(body); try { const response = await fetch( `/api/vas/create_order?signature=${signature}`, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify(body), } ); const data = await response.json(); if (data.ret === -1) { Toast.show({ content: data.msg, }); return; } switch (type) { case "alipay_h5": router.push(`${data.data.alipay_h5_param_str}`); break; case "wxpay_h5": router.push( `https://weixin.tiefen.fun/pay/wxpay_h5/${encodeURIComponent( data.data.wxpay_h5_param_str )}` ); break; default: router.push(`${data.data.alipay_h5_param_str}`); break; } } catch (error) { console.error(error); } finally { setIsLoading(false); } }; if (isFetching) { return (
); } return (
{isLoading && ( )}
{isVip ? (

{name}

) : ( )}

会员权益

解锁动态

永久查看

身份标签

专属标识

专属客服

极速服务

期待更多

惊喜福利

会员规则

1、会员权限永久有效,开通后请勿传播平台付费内容;

2、更多特权内容敬请期待,详情请关注本页面会员权益信息变化。

注意事项

1、会员特权属于虚拟商品,一经售出概不退换;

2、请确保支付时您的网络环境保持畅通,避免因第三方网络环境导致的支付失败;

3、本项特权内容最终解释权归铁粉空间运营方所有。

{!isVip && (
{/*
createOrder("alipay_h5")} className="flex flex-row cursor-pointer gap-1.5 h-11 items-center justify-center bg-primary rounded-full" >

支付宝支付

*/}
createOrder("wxpay_h5")} className="flex flex-row cursor-pointer gap-1.5 h-11 items-center justify-center bg-primary rounded-full" >

微信支付

确认购买即视为同意 《用户充值协议》

)}
); }