上线微信h5支付

This commit is contained in:
yezian 2024-02-27 00:00:40 +08:00
parent 8abb5f337f
commit 1e6f1628b5
2 changed files with 12 additions and 6 deletions

View File

@ -97,12 +97,12 @@ export default function Pay() {
...base, ...base,
product_id: customCoin.selected ? "h5_custom_coin" : selectedPrice.id, product_id: customCoin.selected ? "h5_custom_coin" : selectedPrice.id,
custom_coins: customCoin.selected ? customCoin.num : 0, custom_coins: customCoin.selected ? customCoin.num : 0,
pay_type: base?.b_mid !== 153 ? type : "wxpay_h5", pay_type: type,
from: "app", from: "app",
}; };
//jsapi //jsapi
if (type === "wxpay_jsapi" && base?.b_mid !== 153) { if (type === "wxpay_jsapi") {
router.push(`/pay/${encodeURIComponent(JSON.stringify(body))}`); router.push(`/pay/${encodeURIComponent(JSON.stringify(body))}`);
return; return;
} }
@ -122,7 +122,6 @@ export default function Pay() {
} }
); );
const data = await response.json(); const data = await response.json();
console.log(JSON.stringify(body), data);
if (data.ret === -1) { if (data.ret === -1) {
Toast.show({ Toast.show({
content: data.msg, content: data.msg,
@ -133,7 +132,7 @@ export default function Pay() {
case "alipay_h5": case "alipay_h5":
router.push(`${data.data.alipay_h5_param_str}`); router.push(`${data.data.alipay_h5_param_str}`);
break; break;
case "wxpay_jsapi": case "wxpay_h5":
router.push( router.push(
`https://weixin.tiefen.fun/pay/wxpay_h5/${encodeURIComponent( `https://weixin.tiefen.fun/pay/wxpay_h5/${encodeURIComponent(
data.data.wxpay_h5_param_str data.data.wxpay_h5_param_str
@ -290,7 +289,7 @@ export default function Pay() {
</div> */} </div> */}
<div className="w-full px-2"> <div className="w-full px-2">
<button <button
onClick={() => createOrder("wxpay_jsapi")} onClick={() => createOrder("wxpay_h5")}
className="flex flex-row h-12 w-full items-center justify-center bg-primary rounded-full py-2" className="flex flex-row h-12 w-full items-center justify-center bg-primary rounded-full py-2"
> >
<svg viewBox="0 0 1228 1024" width="18" height="18"> <svg viewBox="0 0 1228 1024" width="18" height="18">

View File

@ -118,6 +118,13 @@ export default function Vip() {
case "alipay_h5": case "alipay_h5":
router.push(`${data.data.alipay_h5_param_str}`); router.push(`${data.data.alipay_h5_param_str}`);
break; break;
case "wxpay_h5":
router.push(
`https://weixin.tiefen.fun/pay/wxpay_h5/${encodeURIComponent(
data.data.wxpay_h5_param_str
)}`
);
break;
default: default:
router.push(`${data.data.alipay_h5_param_str}`); router.push(`${data.data.alipay_h5_param_str}`);
break; break;
@ -247,7 +254,7 @@ export default function Vip() {
</div> */} </div> */}
<div className="w-full px-2"> <div className="w-full px-2">
<div <div
onClick={() => createOrder("wxpay_jsapi")} onClick={() => createOrder("wxpay_h5")}
className="flex flex-row cursor-pointer gap-1.5 h-11 items-center justify-center bg-primary rounded-full" 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"> <svg viewBox="0 0 1228 1024" width="18" height="18">