功能:平台管理员删除商户账号

This commit is contained in:
yml2213
2026-08-13 14:35:30 +08:00
parent a637101ca8
commit 91c055c130
6 changed files with 99 additions and 0 deletions
+2
View File
@@ -181,6 +181,8 @@ export const deliveryApi = {
export const platformApi = {
merchantAccounts: (params?: Record<string, unknown>) =>
request.get('/platform/merchant-accounts', { params }).then((r) => r.data.data as PageResult<MerchantMemberGroup>),
deleteMerchantAccount: (userId: number) =>
request.delete(`/platform/merchant-accounts/${userId}`).then((r) => r.data.data),
merchants: (params?: Record<string, unknown>) =>
request.get('/platform/merchants', { params }).then((r) => r.data.data as PageResult<Merchant>),
createMerchant: (data: {
+22
View File
@@ -104,6 +104,16 @@ export default function PlatformUsers() {
}
}
const removeMerchantAccount = async (record: MerchantMember) => {
try {
await platformApi.deleteMerchantAccount(record.user_id)
message.success('商户账号已删除')
void loadMerchantAccounts()
} catch (e) {
message.error(e instanceof Error ? e.message : '删除失败')
}
}
const columns: ColumnsType<User> = [
{ title: '用户名', dataIndex: 'username', width: 260, render: (value) => <Typography.Text strong>{value}</Typography.Text> },
{ title: '昵称', dataIndex: 'nickname', width: 220, render: (value) => value || '-' },
@@ -128,6 +138,18 @@ export default function PlatformUsers() {
{ title: '昵称', dataIndex: ['user', 'nickname'], width: 220, render: (_, record) => record.user?.nickname || '-' },
{ title: '商户角色', dataIndex: 'role', width: 160, render: (role) => <Tag color="blue">{roleText(role)}</Tag> },
{ title: '成员状态', dataIndex: 'status', width: 130, render: (status) => status === 1 ? <Tag color="green"></Tag> : <Tag></Tag> },
{
title: '操作',
width: 120,
render: (_, record) => <Popconfirm
title={`确认删除商户账号「${record.user?.username || `#${record.user_id}`}」?`}
description="该账号会被永久删除,并移除其在所有商户下的成员关系。"
onConfirm={() => void removeMerchantAccount(record)}
okButtonProps={{ danger: true }}
>
<Button type="link" danger size="small" icon={<DeleteOutlined />}></Button>
</Popconfirm>,
},
]
const merchantColumns: ColumnsType<MerchantMemberGroup> = [