feat(ops): v4.0.4 开发任务多行与版本状态同步、合伙人/门店删除、账单合伙人列
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Link, useNavigate } from 'react-router-dom';
|
||||
import {
|
||||
Alert,
|
||||
Button,
|
||||
@@ -127,6 +127,7 @@ function formatApiError(err: unknown): string | null {
|
||||
}
|
||||
|
||||
export default function CityPartnersPage() {
|
||||
const navigate = useNavigate();
|
||||
const [filterForm] = Form.useForm();
|
||||
const [editForm] = Form.useForm();
|
||||
const [createForm] = Form.useForm();
|
||||
@@ -234,6 +235,30 @@ export default function CityPartnersPage() {
|
||||
void reload();
|
||||
}
|
||||
|
||||
async function deletePartner(row: { id: string; storeCount?: number }) {
|
||||
if ((row.storeCount ?? 0) > 0) {
|
||||
Modal.warning({
|
||||
title: '请先删除门店',
|
||||
content: `该城市合伙人下还有 ${row.storeCount} 家门店,请先删除门店后再删除合伙人。`,
|
||||
okText: '查看门店',
|
||||
onOk: () => navigate(`/stores?partnerId=${row.id}`),
|
||||
});
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await request(`/admin/partners/${row.id}`, { method: 'DELETE' });
|
||||
message.success('城市合伙人已删除');
|
||||
if (detail?.id === row.id) {
|
||||
setDrawerOpen(false);
|
||||
setDetail(null);
|
||||
}
|
||||
void reload();
|
||||
} catch (e) {
|
||||
const msg = formatApiError(e);
|
||||
if (msg) message.error(msg);
|
||||
}
|
||||
}
|
||||
|
||||
async function deleteSubAccount(subId: string, parentId: string) {
|
||||
await request(`/admin/partner-accounts/${subId}`, { method: 'DELETE' });
|
||||
message.success('子账号已删除');
|
||||
@@ -352,12 +377,25 @@ export default function CityPartnersPage() {
|
||||
{ title: '创建', dataIndex: 'createdAt', width: 150, render: fmtTime },
|
||||
{
|
||||
title: '操作',
|
||||
width: 80,
|
||||
width: 140,
|
||||
fixed: 'right',
|
||||
render: (_, row) => (
|
||||
<Button type="link" size="small" onClick={() => void openPartner(row.id)}>
|
||||
管理
|
||||
</Button>
|
||||
<Space size={0}>
|
||||
<Button type="link" size="small" onClick={() => void openPartner(row.id)}>
|
||||
管理
|
||||
</Button>
|
||||
<Popconfirm
|
||||
title="确认删除该城市合伙人?"
|
||||
description="若有门店需先删除门店;账号下有订单或核销单将禁止删除。"
|
||||
okText="删除"
|
||||
okButtonProps={{ danger: true }}
|
||||
onConfirm={() => void deletePartner(row)}
|
||||
>
|
||||
<Button type="link" size="small" danger>
|
||||
删除
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
];
|
||||
@@ -491,9 +529,22 @@ export default function CityPartnersPage() {
|
||||
open={drawerOpen}
|
||||
onClose={() => setDrawerOpen(false)}
|
||||
extra={
|
||||
<Button type="primary" onClick={() => void savePartner()}>
|
||||
保存
|
||||
</Button>
|
||||
<Space>
|
||||
{detail ? (
|
||||
<Popconfirm
|
||||
title="确认删除该城市合伙人?"
|
||||
description="若有门店需先删除门店;账号下有订单或核销单将禁止删除。"
|
||||
okText="删除"
|
||||
okButtonProps={{ danger: true }}
|
||||
onConfirm={() => void deletePartner(detail)}
|
||||
>
|
||||
<Button danger>删除</Button>
|
||||
</Popconfirm>
|
||||
) : null}
|
||||
<Button type="primary" onClick={() => void savePartner()}>
|
||||
保存
|
||||
</Button>
|
||||
</Space>
|
||||
}
|
||||
>
|
||||
{detail && (
|
||||
|
||||
Reference in New Issue
Block a user