增加会员的金币支付
This commit is contained in:
parent
747903396b
commit
bb9c05273f
100
app/vip/page.jsx
100
app/vip/page.jsx
|
@ -16,10 +16,11 @@ import vipright4 from "@/public/images/vipright4.png";
|
||||||
import viptitle from "@/public/images/viptitle.png";
|
import viptitle from "@/public/images/viptitle.png";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { Toast } from "antd-mobile";
|
import { Toast } from "antd-mobile";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter, useSearchParams } from "next/navigation";
|
||||||
|
|
||||||
export default function Vip() {
|
export default function Vip() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const searchParams = useSearchParams();
|
||||||
|
|
||||||
const alipayBlock = () => {
|
const alipayBlock = () => {
|
||||||
const base = webviewBaseRequest();
|
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
|
//检查用户是否是vip
|
||||||
const [isVip, setIsVip] = useState(false);
|
const [isVip, setIsVip] = useState(false);
|
||||||
const [name, setName] = useState("");
|
const [name, setName] = useState("");
|
||||||
|
@ -98,6 +106,25 @@ export default function Vip() {
|
||||||
return;
|
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);
|
setIsLoading(true);
|
||||||
|
|
||||||
const signature = generateSignature(body);
|
const signature = generateSignature(body);
|
||||||
|
@ -245,35 +272,56 @@ export default function Vip() {
|
||||||
<div className="flex flex-col w-full fixed left-0 bottom-0 z-20">
|
<div className="flex flex-col w-full fixed left-0 bottom-0 z-20">
|
||||||
<div className="h-12 bg-gradient-to-t from-[#07050AE5] to-[#07050A00]"></div>
|
<div className="h-12 bg-gradient-to-t from-[#07050AE5] to-[#07050A00]"></div>
|
||||||
<div className="flex flex-col pt-3 pb-11 px-4 bg-[#07050AE5]">
|
<div className="flex flex-col pt-3 pb-11 px-4 bg-[#07050AE5]">
|
||||||
<div className="flex flex-row justify-between">
|
{useCoinpay ? (
|
||||||
<div className="basis-1/2 px-2">
|
<div className="flex flex-row justify-between">
|
||||||
<div
|
<div className="w-full px-2">
|
||||||
onClick={() => createOrder("alipay_h5")}
|
<div
|
||||||
className="flex flex-row cursor-pointer gap-1.5 h-11 items-center justify-center bg-primary rounded-full"
|
onClick={() => createOrder("coin")}
|
||||||
>
|
className="flex flex-row cursor-pointer gap-1.5 h-11 items-center justify-center bg-primary rounded-full"
|
||||||
<Image src={alipay} width={22} alt="" />
|
>
|
||||||
<p className="text-white text-base font-medium whitespace-nowrap">
|
<svg viewBox="0 0 1024 1024" width="18" height="18">
|
||||||
支付宝支付
|
<path
|
||||||
</p>
|
d="M512 967.0656c-251.392 0-455.0656-203.776-455.0656-455.0656S260.608 56.9344 512 56.9344s455.0656 203.776 455.0656 455.0656S763.392 967.0656 512 967.0656z m-57.344-540.3648h-84.8896c-15.6672 0-28.4672 12.6976-28.4672 28.4672 0 15.6672 12.6976 28.4672 28.4672 28.4672h113.7664v85.2992H369.7664c-15.6672 0-28.4672 12.6976-28.4672 28.4672 0 15.6672 12.6976 28.4672 28.4672 28.4672h113.7664v113.7664c0 15.6672 12.6976 28.4672 28.4672 28.4672s28.4672-12.6976 28.4672-28.4672V625.7664h113.7664c15.6672 0 28.4672-12.6976 28.4672-28.4672 0-15.6672-12.6976-28.4672-28.4672-28.4672H540.4672v-85.2992h113.7664c15.6672 0 28.4672-12.6976 28.4672-28.4672 0-15.6672-12.6976-28.4672-28.4672-28.4672h-82.944l81.92-81.92c11.0592-11.0592 11.0592-29.0816 0-40.2432-11.0592-11.0592-29.0816-11.0592-40.2432 0L513.024 404.48l-99.9424-99.9424c-11.0592-11.0592-29.0816-11.0592-40.2432 0-11.0592 11.0592-11.0592 29.0816 0 40.2432l81.8176 81.92z"
|
||||||
|
fill="#FFFFFF"
|
||||||
|
></path>
|
||||||
|
</svg>
|
||||||
|
<p className="text-white text-base font-medium whitespace-nowrap">
|
||||||
|
金币支付
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="basis-1/2 px-2">
|
) : (
|
||||||
<div
|
<div className="flex flex-row justify-between">
|
||||||
onClick={() => createOrder("wxpay_h5")}
|
<div className="basis-1/2 px-2">
|
||||||
className="flex flex-row cursor-pointer gap-1.5 h-11 items-center justify-center bg-primary rounded-full"
|
<div
|
||||||
>
|
onClick={() => createOrder("alipay_h5")}
|
||||||
<svg viewBox="0 0 1228 1024" width="18" height="18">
|
className="flex flex-row cursor-pointer gap-1.5 h-11 items-center justify-center bg-primary rounded-full"
|
||||||
<path
|
>
|
||||||
d="M530.8928 703.1296a41.472 41.472 0 0 1-35.7376-19.8144l-2.7136-5.5808L278.272 394.752a18.7392 18.7392 0 0 1-2.048-8.1408 19.968 19.968 0 0 1 20.48-19.3536c4.608 0 8.8576 1.4336 12.288 3.84l234.3936 139.9296a64.4096 64.4096 0 0 0 54.528 5.9392L1116.2624 204.8C1004.9536 80.896 821.76 0 614.4 0 275.0464 0 0 216.576 0 483.6352c0 145.7152 82.7392 276.8896 212.2752 365.5168a38.1952 38.1952 0 0 1 17.2032 31.488 44.4928 44.4928 0 0 1-2.1504 12.3904l-27.6992 97.4848c-1.3312 4.608-3.328 9.3696-3.328 14.1312 0 10.752 9.216 19.3536 20.48 19.3536 4.4032 0 8.0384-1.536 11.776-3.584l134.5536-73.3184c10.1376-5.5296 20.7872-8.96 32.6144-8.96 6.2976 0 12.288 0.9216 18.0736 2.5088 62.72 17.0496 130.4576 26.5728 200.5504 26.5728C953.7024 967.168 1228.8 750.592 1228.8 483.6352c0-80.9472-25.4464-157.1328-70.0416-224.1024l-604.9792 436.992-4.4544 2.4064a42.1376 42.1376 0 0 1-18.432 4.1984z"
|
<Image src={alipay} width={22} alt="" />
|
||||||
fill="#FFFFFF"
|
<p className="text-white text-base font-medium whitespace-nowrap">
|
||||||
></path>
|
支付宝支付
|
||||||
</svg>
|
</p>
|
||||||
<p className="text-white text-base font-medium whitespace-nowrap">
|
</div>
|
||||||
微信支付
|
</div>
|
||||||
</p>
|
<div className="basis-1/2 px-2">
|
||||||
|
<div
|
||||||
|
onClick={() => createOrder("wxpay_h5")}
|
||||||
|
className="flex flex-row cursor-pointer gap-1.5 h-11 items-center justify-center bg-primary rounded-full"
|
||||||
|
>
|
||||||
|
<svg viewBox="0 0 1228 1024" width="18" height="18">
|
||||||
|
<path
|
||||||
|
d="M530.8928 703.1296a41.472 41.472 0 0 1-35.7376-19.8144l-2.7136-5.5808L278.272 394.752a18.7392 18.7392 0 0 1-2.048-8.1408 19.968 19.968 0 0 1 20.48-19.3536c4.608 0 8.8576 1.4336 12.288 3.84l234.3936 139.9296a64.4096 64.4096 0 0 0 54.528 5.9392L1116.2624 204.8C1004.9536 80.896 821.76 0 614.4 0 275.0464 0 0 216.576 0 483.6352c0 145.7152 82.7392 276.8896 212.2752 365.5168a38.1952 38.1952 0 0 1 17.2032 31.488 44.4928 44.4928 0 0 1-2.1504 12.3904l-27.6992 97.4848c-1.3312 4.608-3.328 9.3696-3.328 14.1312 0 10.752 9.216 19.3536 20.48 19.3536 4.4032 0 8.0384-1.536 11.776-3.584l134.5536-73.3184c10.1376-5.5296 20.7872-8.96 32.6144-8.96 6.2976 0 12.288 0.9216 18.0736 2.5088 62.72 17.0496 130.4576 26.5728 200.5504 26.5728C953.7024 967.168 1228.8 750.592 1228.8 483.6352c0-80.9472-25.4464-157.1328-70.0416-224.1024l-604.9792 436.992-4.4544 2.4064a42.1376 42.1376 0 0 1-18.432 4.1984z"
|
||||||
|
fill="#FFFFFF"
|
||||||
|
></path>
|
||||||
|
</svg>
|
||||||
|
<p className="text-white text-base font-medium whitespace-nowrap">
|
||||||
|
微信支付
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
)}
|
||||||
<p className="text-secondary text-xs font-medium mt-4 text-center mb-1">
|
<p className="text-secondary text-xs font-medium mt-4 text-center mb-1">
|
||||||
确认购买即视为同意
|
确认购买即视为同意
|
||||||
<Link
|
<Link
|
||||||
|
|
Loading…
Reference in New Issue