diff --git a/app/pay/[weixin]/page.jsx b/app/pay/[weixin]/page.jsx index 0ad3e9c..7fc3649 100644 --- a/app/pay/[weixin]/page.jsx +++ b/app/pay/[weixin]/page.jsx @@ -2,12 +2,9 @@ import React, { useState, useEffect } from "react"; import Image from "next/image"; -import { useRouter } from "next/navigation"; import webviewBaseRequest from "@/utils/webviewBaseRequest"; export default function Weixin({ params }) { - const router = useRouter(); - //生成二维码 const [qrcodeUrl, setQrcodeUrl] = useState(""); const [device, setDevice] = useState(0); diff --git a/app/pay/inweixin/[body]/page.jsx b/app/pay/inweixin/[body]/page.jsx index c03b3c1..2eff77d 100644 --- a/app/pay/inweixin/[body]/page.jsx +++ b/app/pay/inweixin/[body]/page.jsx @@ -12,6 +12,9 @@ export default function InWeixin({ params }) { //微信支付jsapi支付参数 const [jsapiParams, setJsapiParams] = useState(); + //用户支付成功 + const [success, setSuccess] = useState(false); + //获取微信支付jsapi支付参数 useEffect(() => { const createOrder = async () => { @@ -48,36 +51,6 @@ export default function InWeixin({ params }) { } }; createOrder(); - - // function onBridgeReady() { - // WeixinJSBridge.invoke( - // "getBrandWCPayRequest", - // { - // appId: "wxc28fd8aaf31984b6", //公众号ID,由商户传入 - // timeStamp: "1708438397", //时间戳,自1970年以来的秒数 - // nonceStr: "jXEwa7uEExqFjjlByZivG623Akbzg3Cv", //随机串 - // package: "prepay_id=wx2022131953635431d27a15e2c95e460000", - // signType: "RSA", //微信签名方式: - // paySign: - // "0rODbhGbNidvOcdyC3+JW5pP6DEd+DZZs0Zg3oMvbQ1pC857YvISgrS8QM2yEZpJFWCnjmUmjyQijp3ZxfV5kqr4x8+l+cmNlc87sDtkXhn/pUNMSKtdt+X9KmOrykBjsLj7hztaPoFSwkGYpxHUrxwiooW+y3to5QqD550CaER7XhAAK5knItPy6pa8rGtYPpEpCn8OkcHHVkuGAcawej1a6MGw2byEv2eRusr1VbUVWENgu557qBdGA2NHoOHfRL3n/goOvt1KXTYRtb+BkwsssHJQb8gyuz0qBR/aNFcSUBb4eSBenWAm1L+Wp/ndxLMkxr1ixQblwEJ9I2NPZw==", //微信签名 - // }, - // function (res) { - // if (res.err_msg == "get_brand_wcpay_request:ok") { - // return; - // } - // } - // ); - // } - // if (typeof WeixinJSBridge == "undefined") { - // if (document.addEventListener) { - // document.addEventListener("WeixinJSBridgeReady", onBridgeReady, false); - // } else if (document.attachEvent) { - // document.attachEvent("WeixinJSBridgeReady", onBridgeReady); - // document.attachEvent("onWeixinJSBridgeReady", onBridgeReady); - // } - // } else { - // onBridgeReady(); - // } }, []); //调起收银台 @@ -96,7 +69,7 @@ export default function InWeixin({ params }) { }, function (res) { if (res.err_msg == "get_brand_wcpay_request:ok") { - return; + setSuccess(true); } } ); @@ -128,7 +101,9 @@ export default function InWeixin({ params }) { fill="#5fc157" > -

正在跳转...

+

+ {success ? "充值成功,请返回APP查看结果" : "正在跳转..."} +

); diff --git a/app/pay/page.jsx b/app/pay/page.jsx index e7aad4d..7866f8f 100644 --- a/app/pay/page.jsx +++ b/app/pay/page.jsx @@ -132,11 +132,6 @@ export default function Pay() { 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; @@ -290,7 +285,7 @@ export default function Pay() {
createOrder("wxpay_jsapi")} className="flex flex-row cursor-pointer gap-1.5 h-11 items-center justify-center bg-[#2E2E2E] rounded-full" > - + + +

- 联系人工充值 + 微信支付