From f007e0d025a8feb10c13c39fb83ce540cdcebaa7 Mon Sep 17 00:00:00 2001 From: yezian Date: Mon, 27 May 2024 18:07:26 +0800 Subject: [PATCH] iap --- app/vip/page.jsx | 76 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 51 insertions(+), 25 deletions(-) diff --git a/app/vip/page.jsx b/app/vip/page.jsx index f6bad47..e501bea 100644 --- a/app/vip/page.jsx +++ b/app/vip/page.jsx @@ -34,11 +34,13 @@ export default function Vip() { //检查用户是否是vip const [isVip, setIsVip] = useState(false); + const [isIos, setIsIos] = useState(false); const [name, setName] = useState(""); const [isFetching, setIsFetching] = useState(true); const getUserData = async () => { try { const base = webviewBaseRequest(); + if (base.b_dt === 1) setIsIos(true); const signature = generateSignature({ ...base, mid: base.b_mid, @@ -120,6 +122,14 @@ export default function Vip() { return; } switch (type) { + case "iap": + window.ReactNativeWebView.postMessage( + JSON.stringify({ + type: "IAP", + data: "member_forever", + }) + ); + break; case "alipay_h5": router.push(`${data.data.alipay_h5_param_str}`); break; @@ -245,35 +255,51 @@ export default function Vip() {
-
-
-
createOrder("alipay_h5")} - className="flex flex-row cursor-pointer gap-1.5 h-11 items-center justify-center bg-primary rounded-full" - > - -

- 支付宝支付 -

+ {!isIos && ( +
+
+
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" + > + + + +

+ 微信支付 +

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

- 微信支付 -

+ )} + {isIos && ( +
+
+
createOrder("iap")} + className="flex flex-row cursor-pointer gap-1.5 h-11 items-center justify-center bg-primary rounded-full" + > +

+ 立即开通 +

+
-
+ )}

确认购买即视为同意