增加备用支付渠道;提现增加窗口期
This commit is contained in:
parent
68747ac67e
commit
4f97241268
122
app/pay/page.jsx
122
app/pay/page.jsx
|
@ -29,6 +29,9 @@ export default function Pay() {
|
|||
//选择任意金额充值
|
||||
const [customCoin, setCustomCoin] = useState({ selected: false, num: 1000 });
|
||||
|
||||
//备用支付渠道是否展示
|
||||
const [isBackupPaymentVisible, setIsBackupPaymentVisible] = useState(false);
|
||||
|
||||
//任意金额充值的金币数量
|
||||
const handleChangeCustomCoin = (e) => {
|
||||
let newValue = parseInt(e.target.value, 10);
|
||||
|
@ -42,6 +45,11 @@ export default function Pay() {
|
|||
}
|
||||
};
|
||||
|
||||
//备用支付渠道是否展示
|
||||
const handleBackupPaymentVisible = () => {
|
||||
setIsBackupPaymentVisible(true);
|
||||
};
|
||||
|
||||
//获取当前充值档位
|
||||
const [isFetching, setIsFetching] = useState(true);
|
||||
const getBase = useCallback(
|
||||
|
@ -171,6 +179,88 @@ export default function Pay() {
|
|||
}
|
||||
};
|
||||
|
||||
//创建备用充值订单
|
||||
const createBackupPaymentOrder = async (type = "alipay_h5") => {
|
||||
if (!selectedPrice.id && !customCoin.selected) {
|
||||
Toast.show({
|
||||
content: "请选择充值档位",
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (customCoin.selected && customCoin.num < 10) {
|
||||
Toast.show({
|
||||
content: "最低充值1元哦~",
|
||||
});
|
||||
return;
|
||||
}
|
||||
const webviewBase = webviewBaseRequest();
|
||||
const base = getBase(webviewBase);
|
||||
|
||||
const body = {
|
||||
...base,
|
||||
product_id: customCoin.selected ? "h5_custom_coin" : selectedPrice.id,
|
||||
custom_coins: customCoin.selected ? customCoin.num : 0,
|
||||
pay_type: type,
|
||||
redirect_url: type === "yeepay_wxpay_h5" ? window.location.href : "",
|
||||
from: searchParams.get("base") ? "web" : "app",
|
||||
ver: "aliv2",
|
||||
};
|
||||
|
||||
//如果是微信jsapi支付直接跳转到中间页
|
||||
if (type === "wxpay_jsapi") {
|
||||
router.push(`/pay/${encodeURIComponent(JSON.stringify(body))}`);
|
||||
return;
|
||||
}
|
||||
|
||||
setIsLoading(true);
|
||||
|
||||
const signature = generateSignature(body);
|
||||
try {
|
||||
const response = await fetch(
|
||||
`/api/vas/create_order?signature=${signature}`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(body),
|
||||
}
|
||||
);
|
||||
const data = await response.json();
|
||||
if (data.ret === -1) {
|
||||
Toast.show({
|
||||
content: data.msg,
|
||||
});
|
||||
return;
|
||||
}
|
||||
switch (type) {
|
||||
case "yeepay_alipay_h5":
|
||||
router.push(`${data.data.yeepay_alipay_h5_param_str}`);
|
||||
break;
|
||||
case "yeepay_wxpay_h5":
|
||||
router.push(`${data.data.yeepay_wxpay_h5_param_str}`);
|
||||
break;
|
||||
case "alipay_h5":
|
||||
router.push(`${data.data.alipay_h5_param_str}`);
|
||||
break;
|
||||
case "wxpay_h5":
|
||||
router.push(
|
||||
`https://shop.tiefen.fun/pay/wxpay_h5/${encodeURIComponent(
|
||||
data.data.wxpay_h5_param_str
|
||||
)}`
|
||||
);
|
||||
break;
|
||||
default:
|
||||
router.push(`${data.data.alipay_h5_param_str}`);
|
||||
break;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const PriceItem = ({ item }) => {
|
||||
const handleClickPrice = (item) => {
|
||||
setSelectedPrice(item);
|
||||
|
@ -315,7 +405,37 @@ export default function Pay() {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p className="text-secondary text-xs font-medium mt-4 text-center mb-1">
|
||||
{isBackupPaymentVisible ? (
|
||||
<div className="px-2 mt-4">
|
||||
<div
|
||||
onClick={() => createBackupPaymentOrder("alipay_h5")}
|
||||
className="flex flex-row cursor-pointer gap-1.5 h-11 items-center justify-center bg-primary rounded-full"
|
||||
>
|
||||
<img
|
||||
className="w-[22px]"
|
||||
src={
|
||||
process.env.NEXT_PUBLIC_CDN_URL +
|
||||
"/public/images/alipay.png"
|
||||
}
|
||||
alt=""
|
||||
/>
|
||||
<p className="text-white text-base font-medium whitespace-nowrap">
|
||||
【备用】支付宝支付
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<p className="text-secondary text-xs font-medium mt-4 text-center mb-1">
|
||||
若无法支付,请尝试
|
||||
<span
|
||||
className="link text-[#309EDC]"
|
||||
onClick={handleBackupPaymentVisible}
|
||||
>
|
||||
备用支付渠道
|
||||
</span>
|
||||
</p>
|
||||
)}
|
||||
<p className="text-secondary text-xs font-medium mt-2 text-center mb-1">
|
||||
确认购买即视为同意
|
||||
<Link
|
||||
className="link text-[#309EDC]"
|
||||
|
|
110
app/vip/page.jsx
110
app/vip/page.jsx
|
@ -15,6 +15,14 @@ export default function Vip() {
|
|||
const [name, setName] = useState("");
|
||||
const [isFetching, setIsFetching] = useState(true);
|
||||
|
||||
//备用支付渠道是否展示
|
||||
const [isBackupPaymentVisible, setIsBackupPaymentVisible] = useState(false);
|
||||
|
||||
//备用支付渠道是否展示
|
||||
const handleBackupPaymentVisible = () => {
|
||||
setIsBackupPaymentVisible(true);
|
||||
};
|
||||
|
||||
const getBase = useCallback(
|
||||
(webviewBase) => {
|
||||
let searchParamsObj = null;
|
||||
|
@ -141,6 +149,74 @@ export default function Vip() {
|
|||
}
|
||||
};
|
||||
|
||||
//创建备用充值订单
|
||||
const createBackupPaymentOrder = async (type = "alipay_h5") => {
|
||||
const webviewBase = webviewBaseRequest();
|
||||
let base = getBase(webviewBase);
|
||||
const body = {
|
||||
...base,
|
||||
product_id: "membership",
|
||||
pay_type: type,
|
||||
redirect_url: type === "yeepay_wxpay_h5" ? window.location.href : "",
|
||||
from: searchParams.get("base") ? "web" : "app",
|
||||
ver: "aliv2",
|
||||
};
|
||||
|
||||
//如果是微信jsapi支付直接跳转到中间页
|
||||
if (type === "wxpay_jsapi") {
|
||||
router.push(`/pay/${encodeURIComponent(JSON.stringify(body))}`);
|
||||
return;
|
||||
}
|
||||
|
||||
setIsLoading(true);
|
||||
|
||||
const signature = generateSignature(body);
|
||||
try {
|
||||
const response = await fetch(
|
||||
`/api/vas/create_order?signature=${signature}`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(body),
|
||||
}
|
||||
);
|
||||
const data = await response.json();
|
||||
if (data.ret === -1) {
|
||||
Toast.show({
|
||||
content: data.msg,
|
||||
});
|
||||
return;
|
||||
}
|
||||
switch (type) {
|
||||
case "yeepay_alipay_h5":
|
||||
router.push(`${data.data.yeepay_alipay_h5_param_str}`);
|
||||
break;
|
||||
case "yeepay_wxpay_h5":
|
||||
router.push(`${data.data.yeepay_wxpay_h5_param_str}`);
|
||||
break;
|
||||
case "alipay_h5":
|
||||
router.push(`${data.data.alipay_h5_param_str}`);
|
||||
break;
|
||||
case "wxpay_h5":
|
||||
router.push(
|
||||
`https://shop.tiefen.fun/pay/wxpay_h5/${encodeURIComponent(
|
||||
data.data.wxpay_h5_param_str
|
||||
)}`
|
||||
);
|
||||
break;
|
||||
default:
|
||||
router.push(`${data.data.alipay_h5_param_str}`);
|
||||
break;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
if (isFetching) {
|
||||
return (
|
||||
<section className="flex flex-1 justify-center container">
|
||||
|
@ -167,7 +243,7 @@ export default function Vip() {
|
|||
src={process.env.NEXT_PUBLIC_CDN_URL + "/public/images/viptitle.png"}
|
||||
alt=""
|
||||
/>
|
||||
<div className="flex flex-col px-4 pb-32">
|
||||
<div className="flex flex-col px-4 pb-48">
|
||||
{isVip ? (
|
||||
<div className="relative">
|
||||
<img
|
||||
|
@ -309,7 +385,37 @@ export default function Vip() {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p className="text-secondary text-xs font-medium mt-4 text-center mb-1">
|
||||
{isBackupPaymentVisible ? (
|
||||
<div className="px-2 mt-4">
|
||||
<div
|
||||
onClick={() => createBackupPaymentOrder("alipay_h5")}
|
||||
className="flex flex-row cursor-pointer gap-1.5 h-11 items-center justify-center bg-primary rounded-full"
|
||||
>
|
||||
<img
|
||||
className="w-[22px]"
|
||||
src={
|
||||
process.env.NEXT_PUBLIC_CDN_URL +
|
||||
"/public/images/alipay.png"
|
||||
}
|
||||
alt=""
|
||||
/>
|
||||
<p className="text-white text-base font-medium whitespace-nowrap">
|
||||
【备用】支付宝支付
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<p className="text-secondary text-xs font-medium mt-4 text-center mb-1">
|
||||
若无法支付,请尝试
|
||||
<span
|
||||
className="link text-[#309EDC]"
|
||||
onClick={handleBackupPaymentVisible}
|
||||
>
|
||||
备用支付渠道
|
||||
</span>
|
||||
</p>
|
||||
)}
|
||||
<p className="text-secondary text-xs font-medium mt-2 text-center mb-1">
|
||||
确认购买即视为同意
|
||||
<Link
|
||||
className="link text-[#309EDC]"
|
||||
|
|
|
@ -157,15 +157,24 @@ export default function WithDrawal() {
|
|||
...base,
|
||||
});
|
||||
try {
|
||||
await fetch(`/api/vas/withdraw_send_verifycode?signature=${signature}`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
...base,
|
||||
}),
|
||||
});
|
||||
const res = await fetch(
|
||||
`/api/vas/withdraw_send_verifycode?signature=${signature}`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
...base,
|
||||
}),
|
||||
}
|
||||
);
|
||||
const _data = await res.json();
|
||||
if (_data.ret === -1) {
|
||||
Toast.show({
|
||||
content: _data.msg,
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
@ -394,7 +403,10 @@ export default function WithDrawal() {
|
|||
3.单笔最低提现金额为100元(即1000钻石),若提现金额大于20000元(即200000钻石)请联系客服;
|
||||
</p>
|
||||
<p className="text-error text-sm">
|
||||
4.自助提现渠道每日只能提现一次,若有更多提现需求,请联系客服。
|
||||
4.提现窗口期为每日8点至22点,请在此时间段进行提现操作;
|
||||
</p>
|
||||
<p className="text-error text-sm">
|
||||
5.自助提现渠道每日只能提现一次,若有更多提现需求,请联系客服。
|
||||
</p>
|
||||
<dialog id="comfirm_modal" className="modal">
|
||||
<div className="modal-box bg-[#17161A]">
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
"use client";
|
||||
|
||||
import React, { useState, useEffect, useCallback } from "react";
|
||||
import Divider from "@/components/Divider";
|
||||
import Link from "next/link";
|
||||
import { Toast, Switch, Image } from "antd-mobile";
|
||||
import { generateSignature } from "@/utils/crypto";
|
||||
|
@ -15,6 +14,14 @@ export default function Pay({ params }) {
|
|||
//当前选购的商品数据
|
||||
const [data, setData] = useState({});
|
||||
|
||||
//备用支付渠道是否展示
|
||||
const [isBackupPaymentVisible, setIsBackupPaymentVisible] = useState(false);
|
||||
|
||||
//备用支付渠道是否展示
|
||||
const handleBackupPaymentVisible = () => {
|
||||
setIsBackupPaymentVisible(true);
|
||||
};
|
||||
|
||||
//超粉商品数据
|
||||
const [superfanshipData, setSuperfanshipData] = useState();
|
||||
const [isFetching, setIsFetching] = useState(true);
|
||||
|
@ -206,6 +213,68 @@ export default function Pay({ params }) {
|
|||
}
|
||||
};
|
||||
|
||||
//创建备用充值订单
|
||||
const createBackupPaymentOrder = async (type = "alipay_h5") => {
|
||||
const webviewBase = webviewBaseRequest();
|
||||
const base = getBase(webviewBase);
|
||||
const body = {
|
||||
...base,
|
||||
zid: parseInt(params.zid),
|
||||
moment_id: parseInt(params.moment_id),
|
||||
product_id: checked ? superId : params.product_id,
|
||||
pay_type: type,
|
||||
redirect_url: type === "yeepay_wxpay_h5" ? window.location.href : "",
|
||||
from: searchParams.get("base") ? "web" : "app",
|
||||
ver: "aliv2",
|
||||
};
|
||||
setIsLoading(true);
|
||||
const signature = generateSignature(body);
|
||||
try {
|
||||
const response = await fetch(
|
||||
`/api/zone/create_order?signature=${signature}`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(body),
|
||||
}
|
||||
);
|
||||
const data = await response.json();
|
||||
if (data.ret === -1) {
|
||||
Toast.show({
|
||||
content: data.msg,
|
||||
});
|
||||
return;
|
||||
}
|
||||
switch (type) {
|
||||
case "yeepay_alipay_h5":
|
||||
router.push(`${data.data.yeepay_alipay_h5_param_str}`);
|
||||
break;
|
||||
case "yeepay_wxpay_h5":
|
||||
router.push(`${data.data.yeepay_wxpay_h5_param_str}`);
|
||||
break;
|
||||
case "alipay_h5":
|
||||
router.push(`${data.data.alipay_h5_param_str}`);
|
||||
break;
|
||||
case "wxpay_h5":
|
||||
router.push(
|
||||
`https://shop.tiefen.fun/pay/wxpay_h5/${encodeURIComponent(
|
||||
data.data.wxpay_h5_param_str
|
||||
)}`
|
||||
);
|
||||
break;
|
||||
default:
|
||||
router.push(`${data.data.alipay_h5_param_str}`);
|
||||
break;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleSelectSuper = (it) => {
|
||||
selectedIndex = it.index;
|
||||
setSuperChecked({ ...it, selected: it.index });
|
||||
|
@ -313,17 +382,6 @@ export default function Pay({ params }) {
|
|||
: "/public/icon/superFan_price_select.png")
|
||||
}
|
||||
/>
|
||||
{/* <Radio
|
||||
checked={checked}
|
||||
onChange={() => setChecked(!checked)}
|
||||
></Radio> */}
|
||||
{/* <Switch
|
||||
checked={checked}
|
||||
onChange={() => setChecked(!checked)}
|
||||
style={{
|
||||
"--checked-color": "#FFE9AB",
|
||||
}}
|
||||
/> */}
|
||||
</div>
|
||||
)}
|
||||
{params.product_id === "h5_zone_superfanship" && (
|
||||
|
@ -479,7 +537,37 @@ export default function Pay({ params }) {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p className="text-secondary text-xs font-medium mt-4 text-center mb-1">
|
||||
{isBackupPaymentVisible ? (
|
||||
<div className="px-2 mt-4">
|
||||
<div
|
||||
onClick={() => createBackupPaymentOrder("alipay_h5")}
|
||||
className="flex flex-row cursor-pointer gap-1.5 h-11 items-center justify-center bg-primary rounded-full"
|
||||
>
|
||||
<img
|
||||
className="w-[22px]"
|
||||
src={
|
||||
process.env.NEXT_PUBLIC_CDN_URL +
|
||||
"/public/images/alipay.png"
|
||||
}
|
||||
alt=""
|
||||
/>
|
||||
<p className="text-white text-base font-medium whitespace-nowrap">
|
||||
【备用】支付宝支付
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<p className="text-secondary text-xs font-medium mt-4 text-center mb-1">
|
||||
若无法支付,请尝试
|
||||
<span
|
||||
className="link text-[#309EDC]"
|
||||
onClick={handleBackupPaymentVisible}
|
||||
>
|
||||
备用支付渠道
|
||||
</span>
|
||||
</p>
|
||||
)}
|
||||
<p className="text-secondary text-xs font-medium mt-2 text-center mb-1">
|
||||
确认购买即视为同意
|
||||
<Link
|
||||
className="link text-[#309EDC]"
|
||||
|
|
Loading…
Reference in New Issue