From 5032d290a7acc6797d8af9c0af43df8b000607f2 Mon Sep 17 00:00:00 2001 From: yezian Date: Mon, 5 Feb 2024 23:36:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BE=AE=E4=BF=A1=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/pay/[weixin]/page.jsx | 4 +- app/pay/page.jsx | 93 ++++++++++++--------------------------- app/vip/page.jsx | 81 +++++++++++++++++----------------- 3 files changed, 71 insertions(+), 107 deletions(-) diff --git a/app/pay/[weixin]/page.jsx b/app/pay/[weixin]/page.jsx index ab66dec..d2e39b0 100644 --- a/app/pay/[weixin]/page.jsx +++ b/app/pay/[weixin]/page.jsx @@ -66,13 +66,13 @@ export default function Weixin({ params }) {
diff --git a/app/pay/page.jsx b/app/pay/page.jsx index aa8f08e..2d5f803 100644 --- a/app/pay/page.jsx +++ b/app/pay/page.jsx @@ -67,7 +67,7 @@ export default function Pay() { //创建充值订单 const [isLoading, setIsLoading] = useState(false); - const createOrder = async () => { + const createOrder = async (type = "alipay_h5") => { if (!selectedPrice.id && !customCoin.selected) { Toast.show({ content: "请选择充值档位", @@ -86,7 +86,7 @@ export default function Pay() { ...base, product_id: customCoin.selected ? "h5_custom_coin" : selectedPrice.id, custom_coins: customCoin.selected ? customCoin.num : 0, - pay_type: "alipay_h5", + pay_type: type, from: "app", }; const signature = generateSignature(body); @@ -108,7 +108,19 @@ export default function Pay() { }); return; } - router.push(`${data.data.alipay_h5_param_str}`); + switch (type) { + case "alipay_h5": + router.push(`${data.data.alipay_h5_param_str}`); + break; + case "wxpay_native": + router.push( + `/pay/${encodeURIComponent(data.data.wxpay_native_param_str)}` + ); + break; + default: + router.push(`${data.data.alipay_h5_param_str}`); + break; + } } catch (error) { console.error(error); } finally { @@ -116,28 +128,6 @@ export default function Pay() { } }; - //跳转联系客服 - const handleContact = () => { - if (navigator.userAgent.includes("FromWebview")) { - window.ReactNativeWebView.postMessage( - JSON.stringify({ - type: "NAVIGATE", - data: { - page: "MessageDetail", - params: { - mid: 1, - }, - }, - }) - ); - } else { - Toast.show({ - content: "请下载app联系客服充值", - }); - } - document.getElementById("manual_pay_modal").close(); - }; - const PriceItem = ({ item }) => { const handleClickPrice = (item) => { setSelectedPrice(item); @@ -263,20 +253,12 @@ export default function Pay() {
- -
-

- 人工充值 -

-

- 请联系人工客服进行充值,单笔金额不低于500人民币 -

-
- -
- -
-
-
-
); } diff --git a/app/vip/page.jsx b/app/vip/page.jsx index 4dbe61b..0774abd 100644 --- a/app/vip/page.jsx +++ b/app/vip/page.jsx @@ -66,13 +66,13 @@ export default function Vip() { //创建充值订单 const [isLoading, setIsLoading] = useState(false); - const createOrder = async () => { + const createOrder = async (type = "alipay_h5") => { setIsLoading(true); const base = webviewBaseRequest(); const body = { ...base, product_id: "membership", - pay_type: "alipay_h5", + pay_type: type, from: "app", }; const signature = generateSignature(body); @@ -88,13 +88,26 @@ export default function Vip() { } ); const data = await response.json(); + console.log(data); if (data.ret === -1) { Toast.show({ content: data.msg, }); return; } - router.push(`${data.data.alipay_h5_param_str}`); + switch (type) { + case "alipay_h5": + router.push(`${data.data.alipay_h5_param_str}`); + break; + case "wxpay_native": + router.push( + `/pay/${encodeURIComponent(data.data.wxpay_native_param_str)}` + ); + break; + default: + router.push(`${data.data.alipay_h5_param_str}`); + break; + } } catch (error) { console.error(error); } finally { @@ -102,27 +115,6 @@ export default function Vip() { } }; - //跳转联系客服 - const handleContact = () => { - if (navigator.userAgent.includes("FromWebview")) { - window.ReactNativeWebView.postMessage( - JSON.stringify({ - type: "NAVIGATE", - data: { - page: "MessageDetail", - params: { - mid: 1, - }, - }, - }) - ); - } else { - Toast.show({ - content: "请下载app联系客服充值", - }); - } - }; - if (isFetching) { return (
@@ -228,23 +220,32 @@ 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" + > + +

+ 支付宝支付 +

+
-
- -

- 联系人工充值 -

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

+ 微信支付 +

+

-- 2.41.0