增加冻结提现功能
This commit is contained in:
parent
92d51ee114
commit
9b47ae8f94
|
@ -35,7 +35,7 @@ export default function Op() {
|
|||
checkToken();
|
||||
const b_mid = baseRequest().b_mid;
|
||||
setMid(b_mid);
|
||||
}, [location]);
|
||||
}, [location, navigate]);
|
||||
function getItem(label, key, icon, children, type) {
|
||||
return {
|
||||
key,
|
||||
|
@ -84,7 +84,7 @@ export default function Op() {
|
|||
]),
|
||||
getItem("社区治理", "communityManagement", <UsergroupAddOutlined />, [
|
||||
getItem("用户封禁", "blockUser"),
|
||||
// getItem("冻结提现", "blockWithdraw"),
|
||||
getItem("提现封禁", "withdrawFreeze"),
|
||||
]),
|
||||
getItem(
|
||||
"人工充值/提现",
|
||||
|
@ -137,6 +137,7 @@ export default function Op() {
|
|||
]),
|
||||
getItem("社区治理", "communityManagement", <UsergroupAddOutlined />, [
|
||||
getItem("用户封禁", "blockUser"),
|
||||
getItem("提现封禁", "withdrawFreeze"),
|
||||
]),
|
||||
getItem(
|
||||
"人工充值/提现",
|
||||
|
|
|
@ -0,0 +1,253 @@
|
|||
import React, { useState, useEffect } from "react";
|
||||
import { Form, Input, Button, Space, Table, message, Modal } from "antd";
|
||||
import baseRequest from "../../utils/baseRequest";
|
||||
|
||||
export default function WithdrawFreeze() {
|
||||
const [form] = Form.useForm();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [freezeList, setFreezeList] = useState([]);
|
||||
const [submitLoading, setSubmitLoading] = useState(false);
|
||||
const [unfreezeLoading, setUnfreezeLoading] = useState(false);
|
||||
const [modalVisible, setModalVisible] = useState(false);
|
||||
const [selectedUser, setSelectedUser] = useState(null);
|
||||
|
||||
// 获取冻结提现列表
|
||||
const fetchFreezeList = async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const base = baseRequest();
|
||||
const response = await fetch("/op/vas/get_withdraw_freeze_list", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({ ...base }),
|
||||
});
|
||||
const result = await response.json();
|
||||
if (result.ret === 1) {
|
||||
setFreezeList(result.data?.list || []);
|
||||
} else {
|
||||
message.error("获取冻结提现列表失败");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("获取冻结提现列表出错:", error);
|
||||
message.error("获取冻结提现列表出错");
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
// 添加冻结提现
|
||||
const handleAddFreeze = async (values) => {
|
||||
setSubmitLoading(true);
|
||||
try {
|
||||
const base = baseRequest();
|
||||
const response = await fetch("/op/vas/add_withdraw_freeze", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
...base,
|
||||
user_id: parseInt(values.user_id),
|
||||
}),
|
||||
});
|
||||
const result = await response.json();
|
||||
if (result.ret === 1) {
|
||||
message.success("添加冻结提现成功");
|
||||
form.resetFields();
|
||||
fetchFreezeList();
|
||||
} else {
|
||||
message.error("添加冻结提现失败");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("添加冻结提现出错:", error);
|
||||
message.error("添加冻结提现出错");
|
||||
} finally {
|
||||
setSubmitLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
// 显示解冻确认弹窗
|
||||
const showUnfreezeModal = (record) => {
|
||||
setSelectedUser(record);
|
||||
setModalVisible(true);
|
||||
};
|
||||
|
||||
// 解除冻结提现
|
||||
const handleUnfreeze = async () => {
|
||||
if (!selectedUser) return;
|
||||
setUnfreezeLoading(true);
|
||||
try {
|
||||
const base = baseRequest();
|
||||
const response = await fetch("/op/vas/del_withdraw_freeze", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
...base,
|
||||
user_id: parseInt(selectedUser.user_id),
|
||||
}),
|
||||
});
|
||||
const result = await response.json();
|
||||
if (result.ret === 1) {
|
||||
message.success("解除冻结提现成功");
|
||||
setModalVisible(false);
|
||||
fetchFreezeList();
|
||||
} else {
|
||||
message.error("解除冻结提现失败");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("解除冻结提现出错:", error);
|
||||
message.error("解除冻结提现出错");
|
||||
} finally {
|
||||
setUnfreezeLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
// 表格列定义
|
||||
const columns = [
|
||||
{
|
||||
title: "用户ID",
|
||||
dataIndex: "user_id",
|
||||
key: "user_id",
|
||||
},
|
||||
{
|
||||
title: "用户资料",
|
||||
dataIndex: "account",
|
||||
key: "account",
|
||||
render: (account) => (
|
||||
<div>
|
||||
{account ? (
|
||||
<>
|
||||
<img
|
||||
className="w-12 aspect-square rounded"
|
||||
src={account.avatar.images[0].urls[0]}
|
||||
alt="头像"
|
||||
/>
|
||||
<div>昵称: {account.name || "-"}</div>
|
||||
</>
|
||||
) : (
|
||||
"-"
|
||||
)}
|
||||
</div>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: "封禁时间",
|
||||
dataIndex: "ct",
|
||||
key: "ct",
|
||||
render: (text) => new Date(text * 1000).toLocaleString(),
|
||||
},
|
||||
{
|
||||
title: "操作人MID",
|
||||
dataIndex: "operator_mid",
|
||||
key: "operator_mid",
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
key: "action",
|
||||
render: (_, record) => (
|
||||
<Button type="primary" danger onClick={() => showUnfreezeModal(record)}>
|
||||
解除封禁
|
||||
</Button>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
// 组件挂载时获取冻结提现列表
|
||||
useEffect(() => {
|
||||
fetchFreezeList();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div style={{ padding: 20 }}>
|
||||
<h1>提现封禁管理</h1>
|
||||
|
||||
{/* 添加冻结提现表单 */}
|
||||
<div style={{ marginBottom: 20, padding: 20, border: "1px solid #eee" }}>
|
||||
<h2>添加提现封禁</h2>
|
||||
<Form
|
||||
form={form}
|
||||
onFinish={handleAddFreeze}
|
||||
layout="inline"
|
||||
style={{ marginTop: 20 }}
|
||||
>
|
||||
<Form.Item
|
||||
name="user_id"
|
||||
label="用户ID"
|
||||
rules={[
|
||||
{ required: true, message: "请输入用户ID" },
|
||||
{
|
||||
pattern: /^\d+$/,
|
||||
message: "用户ID必须为数字",
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input placeholder="请输入要封禁的用户ID" style={{ width: 250 }} />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item>
|
||||
<Button type="primary" htmlType="submit" loading={submitLoading}>
|
||||
添加封禁
|
||||
</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</div>
|
||||
|
||||
{/* 提现封禁列表 */}
|
||||
<div>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
justifyContent: "space-between",
|
||||
alignItems: "center",
|
||||
marginBottom: 16,
|
||||
}}
|
||||
>
|
||||
<h2>提现封禁列表</h2>
|
||||
<Button onClick={fetchFreezeList} loading={loading}>
|
||||
刷新列表
|
||||
</Button>
|
||||
</div>
|
||||
<Table
|
||||
columns={columns}
|
||||
dataSource={freezeList.map((item) => ({
|
||||
...item,
|
||||
key: item.user_id,
|
||||
}))}
|
||||
loading={loading}
|
||||
pagination={{ pageSize: 10 }}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* 解除封禁确认弹窗 */}
|
||||
<Modal
|
||||
title="确认解除提现封禁"
|
||||
open={modalVisible}
|
||||
onCancel={() => setModalVisible(false)}
|
||||
footer={[
|
||||
<Button key="cancel" onClick={() => setModalVisible(false)}>
|
||||
取消
|
||||
</Button>,
|
||||
<Button
|
||||
key="confirm"
|
||||
type="primary"
|
||||
danger
|
||||
loading={unfreezeLoading}
|
||||
onClick={handleUnfreeze}
|
||||
>
|
||||
确认解除
|
||||
</Button>,
|
||||
]}
|
||||
>
|
||||
<p>
|
||||
确定要解除
|
||||
<span className="text-red-500">{selectedUser?.account?.name}</span>
|
||||
的提现封禁吗?
|
||||
</p>
|
||||
</Modal>
|
||||
</div>
|
||||
);
|
||||
}
|
|
@ -38,6 +38,7 @@ import StreamerNickTextMachineReview from "../pages/StreamerNickTextMachineRevie
|
|||
import StreamerVideoMachineReview from "../pages/StreamerVideoMachineReview";
|
||||
import RollbackUserLeaveSpace from "../pages/RollbackUserLeaveSpace";
|
||||
import RollbackUserRefundSpaceStatus from "../pages/RollbackUserRefundSpaceStatus/index";
|
||||
import WithdrawFreeze from "../pages/WithdrawFreeze";
|
||||
|
||||
const routes = [
|
||||
{
|
||||
|
@ -200,6 +201,10 @@ const routes = [
|
|||
path: "rollbackUserRefundSpaceStatus/*",
|
||||
element: <RollbackUserRefundSpaceStatus />,
|
||||
},
|
||||
{
|
||||
path: "withdrawFreeze/*",
|
||||
element: <WithdrawFreeze />,
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue