Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 43de361e61 | |||
| b1511ecb92 | |||
| fed8ff3d3a | |||
| 0b548a2764 | |||
| 30f8d649cb | |||
| f4da71e952 |
@@ -46,6 +46,78 @@ body,
|
|||||||
text-overflow: clip;
|
text-overflow: clip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 拖表头分割线改列宽 */
|
||||||
|
.admin-layout .ant-table-thead > tr > th.admin-th-resizable {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-col-resize-handle {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: 10px;
|
||||||
|
cursor: col-resize;
|
||||||
|
z-index: 3;
|
||||||
|
user-select: none;
|
||||||
|
touch-action: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-col-resize-handle:hover,
|
||||||
|
.admin-col-resizing .admin-col-resize-handle {
|
||||||
|
background: rgba(22, 119, 255, 0.18);
|
||||||
|
}
|
||||||
|
|
||||||
|
body.admin-col-resizing,
|
||||||
|
body.admin-col-resizing * {
|
||||||
|
cursor: col-resize !important;
|
||||||
|
user-select: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 列表页顶栏:标题左、主操作右、列设置最右 */
|
||||||
|
.admin-list-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 16px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-list-header-left {
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-list-header-desc {
|
||||||
|
margin-top: 4px;
|
||||||
|
color: rgba(0, 0, 0, 0.45);
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-list-header-right {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 8px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-list-settings-slot {
|
||||||
|
display: inline-flex;
|
||||||
|
margin-left: auto;
|
||||||
|
order: 99;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-list-settings-btn.ant-btn {
|
||||||
|
color: rgba(0, 0, 0, 0.55);
|
||||||
|
padding-inline: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-list-settings-btn.ant-btn:hover {
|
||||||
|
color: rgba(0, 0, 0, 0.88);
|
||||||
|
}
|
||||||
|
|
||||||
/* 操作列保持可见 */
|
/* 操作列保持可见 */
|
||||||
.admin-layout .ant-table-cell:has(.ant-btn),
|
.admin-layout .ant-table-cell:has(.ant-btn),
|
||||||
.ant-drawer .ant-table-cell:has(.ant-btn),
|
.ant-drawer .ant-table-cell:has(.ant-btn),
|
||||||
@@ -81,6 +153,23 @@ body,
|
|||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.admin-primary-link {
|
||||||
|
display: inline;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
border: 0;
|
||||||
|
background: none;
|
||||||
|
font: inherit;
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: underline;
|
||||||
|
text-underline-offset: 3px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-primary-link:hover {
|
||||||
|
color: #1677ff;
|
||||||
|
}
|
||||||
|
|
||||||
.admin-table-nowrap .ant-table-cell,
|
.admin-table-nowrap .ant-table-cell,
|
||||||
.admin-table-nowrap .ant-table-cell-ellipsis {
|
.admin-table-nowrap .ant-table-cell-ellipsis {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import type { ReactNode } from 'react';
|
||||||
|
import { Space, Typography } from 'antd';
|
||||||
|
|
||||||
|
/** 列表页顶栏:标题在左,主操作在右,列设置永远最右 */
|
||||||
|
export function AdminListHeader({
|
||||||
|
title,
|
||||||
|
description,
|
||||||
|
actions,
|
||||||
|
settings,
|
||||||
|
}: {
|
||||||
|
title?: ReactNode;
|
||||||
|
description?: ReactNode;
|
||||||
|
actions?: ReactNode;
|
||||||
|
settings?: ReactNode;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<div className="admin-list-header">
|
||||||
|
<div className="admin-list-header-left">
|
||||||
|
{title == null || title === '' ? null : typeof title === 'string' || typeof title === 'number' ? (
|
||||||
|
<Typography.Title level={4} style={{ margin: 0 }}>
|
||||||
|
{title}
|
||||||
|
</Typography.Title>
|
||||||
|
) : (
|
||||||
|
title
|
||||||
|
)}
|
||||||
|
{description ? (
|
||||||
|
<div className="admin-list-header-desc">{description}</div>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
<div className="admin-list-header-right">
|
||||||
|
{actions ? <Space wrap>{actions}</Space> : null}
|
||||||
|
{settings}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import type { MouseEvent, ReactNode } from 'react';
|
||||||
|
|
||||||
|
/** HQ 主列表主展示列:下划线,点击进入编辑或详情 */
|
||||||
|
export function AdminPrimaryLink({
|
||||||
|
children,
|
||||||
|
onClick,
|
||||||
|
}: {
|
||||||
|
children?: ReactNode;
|
||||||
|
onClick: (e?: MouseEvent) => void;
|
||||||
|
}) {
|
||||||
|
const empty = children == null || children === '';
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="admin-primary-link"
|
||||||
|
onClick={(e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
onClick(e);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{empty ? '—' : children}
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -35,7 +35,11 @@ export function ListColumnPrefsProvider({
|
|||||||
`/admin/me/list-columns/${listKey}`,
|
`/admin/me/list-columns/${listKey}`,
|
||||||
{
|
{
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
body: JSON.stringify(next ? { order: next.order, hidden: next.hidden } : { reset: true }),
|
body: JSON.stringify(
|
||||||
|
next
|
||||||
|
? { order: next.order, hidden: next.hidden, widths: next.widths }
|
||||||
|
: { reset: true },
|
||||||
|
),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
setPrefs(res.listColumnPrefs ?? {});
|
setPrefs(res.listColumnPrefs ?? {});
|
||||||
|
|||||||
@@ -202,6 +202,7 @@ export type AdminOrderRow = {
|
|||||||
productName?: string;
|
productName?: string;
|
||||||
productSpec?: string;
|
productSpec?: string;
|
||||||
quantity?: number;
|
quantity?: number;
|
||||||
|
saleUnit?: string;
|
||||||
receiverName: string;
|
receiverName: string;
|
||||||
receiverPhone: string;
|
receiverPhone: string;
|
||||||
receiverProvince?: string;
|
receiverProvince?: string;
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
import type { MouseEvent, ReactNode } from 'react';
|
||||||
|
import type { ColumnType } from 'antd/es/table';
|
||||||
|
|
||||||
|
export const MIN_COL_WIDTH = 48;
|
||||||
|
export const MAX_COL_WIDTH = 960;
|
||||||
|
|
||||||
|
export function clampColWidth(n: number): number {
|
||||||
|
return Math.min(MAX_COL_WIDTH, Math.max(MIN_COL_WIDTH, Math.round(n)));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function beginColumnResize(
|
||||||
|
e: MouseEvent,
|
||||||
|
startWidth: number,
|
||||||
|
onMove: (width: number) => void,
|
||||||
|
onEnd: (width: number) => void,
|
||||||
|
) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
const startX = e.clientX;
|
||||||
|
let latest = clampColWidth(startWidth);
|
||||||
|
let moved = false;
|
||||||
|
document.body.classList.add('admin-col-resizing');
|
||||||
|
|
||||||
|
const onMouseMove = (ev: globalThis.MouseEvent) => {
|
||||||
|
moved = true;
|
||||||
|
latest = clampColWidth(startWidth + ev.clientX - startX);
|
||||||
|
onMove(latest);
|
||||||
|
};
|
||||||
|
const onMouseUp = () => {
|
||||||
|
document.removeEventListener('mousemove', onMouseMove);
|
||||||
|
document.removeEventListener('mouseup', onMouseUp);
|
||||||
|
document.body.classList.remove('admin-col-resizing');
|
||||||
|
if (moved) onEnd(latest);
|
||||||
|
};
|
||||||
|
document.addEventListener('mousemove', onMouseMove);
|
||||||
|
document.addEventListener('mouseup', onMouseUp);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function withResizeTitle<T>(
|
||||||
|
title: ColumnType<T>['title'],
|
||||||
|
onMouseDown: (e: MouseEvent) => void,
|
||||||
|
): ColumnType<T>['title'] {
|
||||||
|
const handle: ReactNode = (
|
||||||
|
<span
|
||||||
|
role="separator"
|
||||||
|
aria-orientation="vertical"
|
||||||
|
aria-label="拖动调整列宽"
|
||||||
|
className="admin-col-resize-handle"
|
||||||
|
onClick={(ev) => ev.stopPropagation()}
|
||||||
|
onMouseDown={onMouseDown}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
if (typeof title === 'function') {
|
||||||
|
return (props) => (
|
||||||
|
<>
|
||||||
|
{title(props)}
|
||||||
|
{handle}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{title}
|
||||||
|
{handle}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -7,6 +7,12 @@ export const DELIVERY_PROVIDER_LABELS: Record<string, string> = {
|
|||||||
MANUAL: '手动',
|
MANUAL: '手动',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const DELIVERY_TYPE_LABELS: Record<string, string> = {
|
||||||
|
LOCAL: '同城',
|
||||||
|
CROSS_CITY: '跨城',
|
||||||
|
ON_SITE_PICKUP: '现场提货',
|
||||||
|
};
|
||||||
|
|
||||||
export const ORDER_STATUS_LABELS: Record<string, string> = {
|
export const ORDER_STATUS_LABELS: Record<string, string> = {
|
||||||
PENDING_PAY: '待付款',
|
PENDING_PAY: '待付款',
|
||||||
PENDING_SHIP: '待发货',
|
PENDING_SHIP: '待发货',
|
||||||
|
|||||||
@@ -55,7 +55,20 @@ export function applyColumnPrefs<T>(
|
|||||||
const visible = new Set(visibleColumnKeys(defaultKeys, pref));
|
const visible = new Set(visibleColumnKeys(defaultKeys, pref));
|
||||||
const orderedKeys = mergeColumnOrder(defaultKeys, pref).filter((k) => visible.has(k));
|
const orderedKeys = mergeColumnOrder(defaultKeys, pref).filter((k) => visible.has(k));
|
||||||
const byKey = new Map(configurable.map((c) => [c.key, c.col]));
|
const byKey = new Map(configurable.map((c) => [c.key, c.col]));
|
||||||
return [...orderedKeys.map((k) => byKey.get(k)!).filter(Boolean), ...actions.map((c) => c.col)];
|
return [
|
||||||
|
...orderedKeys
|
||||||
|
.map((k) => {
|
||||||
|
const col = byKey.get(k);
|
||||||
|
if (!col) return null;
|
||||||
|
const w = pref?.widths?.[k];
|
||||||
|
return w != null ? { ...col, width: w } : col;
|
||||||
|
})
|
||||||
|
.filter((c): c is ColumnType<T> => !!c),
|
||||||
|
...actions.map((c) => {
|
||||||
|
const w = pref?.widths?.[c.key];
|
||||||
|
return w != null ? { ...c.col, width: w } : c.col;
|
||||||
|
}),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ListColumnSettingItem = {
|
export type ListColumnSettingItem = {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useMemo, useState } from 'react';
|
import { useCallback, useMemo, useRef, useState } from 'react';
|
||||||
import { Button, message } from 'antd';
|
import { Button, message } from 'antd';
|
||||||
import { SettingOutlined } from '@ant-design/icons';
|
import { SettingOutlined } from '@ant-design/icons';
|
||||||
import type { ColumnsType, ColumnType } from 'antd/es/table';
|
import type { ColumnsType, ColumnType } from 'antd/es/table';
|
||||||
@@ -9,9 +9,11 @@ import {
|
|||||||
ACTIONS_COLUMN_KEY,
|
ACTIONS_COLUMN_KEY,
|
||||||
SERIAL_COLUMN_KEY,
|
SERIAL_COLUMN_KEY,
|
||||||
applyColumnPrefs,
|
applyColumnPrefs,
|
||||||
|
columnKey,
|
||||||
settingItems,
|
settingItems,
|
||||||
type ListColumnSettingItem,
|
type ListColumnSettingItem,
|
||||||
} from './list-column-prefs';
|
} from './list-column-prefs';
|
||||||
|
import { beginColumnResize, withResizeTitle } from './column-resize';
|
||||||
|
|
||||||
type Options = {
|
type Options = {
|
||||||
page?: number;
|
page?: number;
|
||||||
@@ -27,7 +29,13 @@ export function useAdminListColumns<T>(
|
|||||||
const { prefs, save } = useListColumnPrefs();
|
const { prefs, save } = useListColumnPrefs();
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
const [saving, setSaving] = useState(false);
|
const [saving, setSaving] = useState(false);
|
||||||
|
const [localWidths, setLocalWidths] = useState<Record<string, number>>({});
|
||||||
const pref = prefs[listKey];
|
const pref = prefs[listKey];
|
||||||
|
const prefRef = useRef(pref);
|
||||||
|
prefRef.current = pref;
|
||||||
|
const localWidthsRef = useRef(localWidths);
|
||||||
|
localWidthsRef.current = localWidths;
|
||||||
|
const itemsRef = useRef<ListColumnSettingItem[]>([]);
|
||||||
|
|
||||||
const configured = useMemo(
|
const configured = useMemo(
|
||||||
() => applyColumnPrefs(allColumns as ColumnType<T>[], pref),
|
() => applyColumnPrefs(allColumns as ColumnType<T>[], pref),
|
||||||
@@ -38,6 +46,7 @@ export function useAdminListColumns<T>(
|
|||||||
() => settingItems(allColumns as ColumnType<T>[], pref),
|
() => settingItems(allColumns as ColumnType<T>[], pref),
|
||||||
[allColumns, pref],
|
[allColumns, pref],
|
||||||
);
|
);
|
||||||
|
itemsRef.current = items;
|
||||||
|
|
||||||
const serialCol: ColumnType<T> = useMemo(
|
const serialCol: ColumnType<T> = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
@@ -50,42 +59,105 @@ export function useAdminListColumns<T>(
|
|||||||
[page, pageSize],
|
[page, pageSize],
|
||||||
);
|
);
|
||||||
|
|
||||||
const columns = useMemo<ColumnsType<T>>(
|
const persistPref = useCallback(
|
||||||
() => [
|
async (next: { order: string[]; hidden: string[]; widths?: Record<string, number> } | null) => {
|
||||||
|
if (!next) {
|
||||||
|
setLocalWidths({});
|
||||||
|
await save(listKey, null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await save(listKey, next);
|
||||||
|
},
|
||||||
|
[listKey, save],
|
||||||
|
);
|
||||||
|
|
||||||
|
const persist = useCallback(
|
||||||
|
async (next: ListColumnSettingItem[] | null) => {
|
||||||
|
setSaving(true);
|
||||||
|
try {
|
||||||
|
if (!next) {
|
||||||
|
await persistPref(null);
|
||||||
|
} else {
|
||||||
|
const widths = { ...(prefRef.current?.widths ?? {}), ...localWidthsRef.current };
|
||||||
|
await persistPref({
|
||||||
|
order: next.map((i) => i.key),
|
||||||
|
hidden: next.filter((i) => !i.visible).map((i) => i.key),
|
||||||
|
...(Object.keys(widths).length ? { widths } : {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
setOpen(false);
|
||||||
|
message.success(next ? '列设置已保存' : '已恢复默认列');
|
||||||
|
} catch (e) {
|
||||||
|
message.error(e instanceof Error ? e.message : '保存失败');
|
||||||
|
} finally {
|
||||||
|
setSaving(false);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[persistPref],
|
||||||
|
);
|
||||||
|
|
||||||
|
const persistWidth = useCallback(
|
||||||
|
async (key: string, width: number) => {
|
||||||
|
const current = prefRef.current;
|
||||||
|
const prevW = current?.widths?.[key];
|
||||||
|
if (prevW === width) return;
|
||||||
|
const order = current?.order?.length ? current.order : itemsRef.current.map((i) => i.key);
|
||||||
|
const hidden = current?.hidden ?? [];
|
||||||
|
const widths = { ...(current?.widths ?? {}), ...localWidthsRef.current, [key]: width };
|
||||||
|
try {
|
||||||
|
await persistPref({ order, hidden, widths });
|
||||||
|
} catch (e) {
|
||||||
|
message.error(e instanceof Error ? e.message : '列宽保存失败');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[persistPref],
|
||||||
|
);
|
||||||
|
|
||||||
|
const columns = useMemo<ColumnsType<T>>(() => {
|
||||||
|
const merged: ColumnType<T>[] = [
|
||||||
serialCol,
|
serialCol,
|
||||||
...configured.map((col) =>
|
...configured.map((col) =>
|
||||||
col.title === '操作' || col.key === ACTIONS_COLUMN_KEY || col.key === 'actions'
|
col.title === '操作' || col.key === ACTIONS_COLUMN_KEY || col.key === 'actions'
|
||||||
? { ...col, key: col.key ?? ACTIONS_COLUMN_KEY }
|
? { ...col, key: col.key ?? ACTIONS_COLUMN_KEY }
|
||||||
: col,
|
: col,
|
||||||
),
|
),
|
||||||
],
|
];
|
||||||
[configured, serialCol],
|
const widths = { ...(pref?.widths ?? {}), ...localWidths };
|
||||||
);
|
return merged.map((col, i) => {
|
||||||
|
const key = columnKey(col, i);
|
||||||
async function persist(next: ListColumnSettingItem[] | null) {
|
const width = widths[key] ?? (typeof col.width === 'number' ? col.width : undefined);
|
||||||
setSaving(true);
|
const prevHeader = col.onHeaderCell;
|
||||||
try {
|
return {
|
||||||
if (!next) {
|
...col,
|
||||||
await save(listKey, null);
|
key,
|
||||||
} else {
|
width,
|
||||||
await save(listKey, {
|
title: withResizeTitle(col.title, (e) => {
|
||||||
order: next.map((i) => i.key),
|
const th = (e.currentTarget as HTMLElement).closest('th');
|
||||||
hidden: next.filter((i) => !i.visible).map((i) => i.key),
|
const startWidth = width ?? th?.getBoundingClientRect().width ?? 120;
|
||||||
});
|
beginColumnResize(
|
||||||
}
|
e,
|
||||||
setOpen(false);
|
startWidth,
|
||||||
message.success(next ? '列设置已保存' : '已恢复默认列');
|
(next) => setLocalWidths((prev) => ({ ...prev, [key]: next })),
|
||||||
} catch (e) {
|
(next) => void persistWidth(key, next),
|
||||||
message.error(e instanceof Error ? e.message : '保存失败');
|
);
|
||||||
} finally {
|
}),
|
||||||
setSaving(false);
|
onHeaderCell: (column) => {
|
||||||
}
|
const extra = typeof prevHeader === 'function' ? prevHeader(column) : {};
|
||||||
}
|
return {
|
||||||
|
...extra,
|
||||||
|
className: [extra.className, 'admin-th-resizable'].filter(Boolean).join(' '),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}, [configured, serialCol, pref?.widths, localWidths, persistWidth]);
|
||||||
|
|
||||||
const settingsButton = (
|
const settingsButton = (
|
||||||
<Button icon={<SettingOutlined />} onClick={() => setOpen(true)}>
|
<span className="admin-list-settings-slot">
|
||||||
列设置
|
<Button type="text" icon={<SettingOutlined />} className="admin-list-settings-btn" onClick={() => setOpen(true)}>
|
||||||
</Button>
|
列设置
|
||||||
|
</Button>
|
||||||
|
</span>
|
||||||
);
|
);
|
||||||
|
|
||||||
const settingsModal = (
|
const settingsModal = (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Descriptions,
|
Descriptions,
|
||||||
@@ -9,6 +10,7 @@ import {
|
|||||||
Modal,
|
Modal,
|
||||||
Popconfirm,
|
Popconfirm,
|
||||||
Select,
|
Select,
|
||||||
|
Space,
|
||||||
Table,
|
Table,
|
||||||
Tag,
|
Tag,
|
||||||
Typography,
|
Typography,
|
||||||
@@ -17,11 +19,23 @@ import {
|
|||||||
import type { ColumnsType } from 'antd/es/table';
|
import type { ColumnsType } from 'antd/es/table';
|
||||||
import type { AdminBenefitGrantRequest } from '@dukang/shared-types';
|
import type { AdminBenefitGrantRequest } from '@dukang/shared-types';
|
||||||
import { request } from '../lib/api';
|
import { request } from '../lib/api';
|
||||||
import { COUPON_STATUS_LABELS, fmtTime } from '../lib/constants';
|
import { COUPON_STATUS_LABELS, DELIVERY_TYPE_LABELS, fmtTime } from '../lib/constants';
|
||||||
import RedeemRecordDetailDescriptions from '../components/RedeemRecordDetailDescriptions';
|
import RedeemRecordDetailDescriptions from '../components/RedeemRecordDetailDescriptions';
|
||||||
import { useAdminList } from '../lib/useAdminList';
|
import { useAdminList } from '../lib/useAdminList';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
|
||||||
|
type CouponOrder = {
|
||||||
|
id?: string;
|
||||||
|
orderNo?: string;
|
||||||
|
productName?: string | null;
|
||||||
|
productSpec?: string | null;
|
||||||
|
quantity?: number | null;
|
||||||
|
saleUnit?: string | null;
|
||||||
|
deliveryType?: string | null;
|
||||||
|
payAmount?: number | string | null;
|
||||||
|
};
|
||||||
|
|
||||||
type Row = {
|
type Row = {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -32,10 +46,43 @@ type Row = {
|
|||||||
status: string;
|
status: string;
|
||||||
sourceProduct: string;
|
sourceProduct: string;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
user?: { userNo: string; phone: string | null };
|
user?: { id?: string; userNo: string; phone: string | null };
|
||||||
order?: { orderNo: string } | null;
|
order?: CouponOrder | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function saleUnitLabel(unit?: string | null) {
|
||||||
|
if (unit === 'BOX') return '箱';
|
||||||
|
if (unit === 'BOTTLE') return '瓶';
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatPayAmount(v?: number | string | null) {
|
||||||
|
if (v == null || v === '') return '';
|
||||||
|
const n = Number(v);
|
||||||
|
return Number.isFinite(n) ? `¥${n.toFixed(2)}` : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 来源:有订单时展示商品名、规格、数量、配送方式、金额;手动发放沿用 sourceProduct */
|
||||||
|
function formatCouponSource(row: { sourceProduct?: string; order?: CouponOrder | null }) {
|
||||||
|
const order = row.order;
|
||||||
|
if (!order?.orderNo && !order?.productName) {
|
||||||
|
return row.sourceProduct || '—';
|
||||||
|
}
|
||||||
|
const unit = saleUnitLabel(order.saleUnit);
|
||||||
|
const qty =
|
||||||
|
order.quantity != null ? `${order.quantity}${unit}` : '';
|
||||||
|
const delivery = DELIVERY_TYPE_LABELS[order.deliveryType ?? ''] || order.deliveryType || '';
|
||||||
|
const amount = formatPayAmount(order.payAmount);
|
||||||
|
const parts = [
|
||||||
|
order.productName || row.sourceProduct,
|
||||||
|
order.productSpec,
|
||||||
|
qty,
|
||||||
|
delivery,
|
||||||
|
amount,
|
||||||
|
].filter((p) => p != null && String(p).trim() !== '');
|
||||||
|
return parts.join(' / ') || row.sourceProduct || '—';
|
||||||
|
}
|
||||||
|
|
||||||
type CouponRedeemRecord = {
|
type CouponRedeemRecord = {
|
||||||
id: string;
|
id: string;
|
||||||
redeemNo: string;
|
redeemNo: string;
|
||||||
@@ -60,11 +107,10 @@ type CouponRedeemSummary = {
|
|||||||
type CouponDetail = Row & {
|
type CouponDetail = Row & {
|
||||||
redeemSummary?: CouponRedeemSummary | null;
|
redeemSummary?: CouponRedeemSummary | null;
|
||||||
redeemRecords?: CouponRedeemRecord[];
|
redeemRecords?: CouponRedeemRecord[];
|
||||||
user?: { userNo?: string; phone?: string | null };
|
|
||||||
order?: { orderNo?: string } | null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function BenefitCouponsPage() {
|
export default function BenefitCouponsPage() {
|
||||||
|
const navigate = useNavigate();
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [grantForm] = Form.useForm<AdminBenefitGrantRequest>();
|
const [grantForm] = Form.useForm<AdminBenefitGrantRequest>();
|
||||||
const [filters, setFilters] = useState<Record<string, string>>({});
|
const [filters, setFilters] = useState<Record<string, string>>({});
|
||||||
@@ -102,20 +148,61 @@ export default function BenefitCouponsPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const baseColumns: ColumnsType<Row> = [
|
const baseColumns: ColumnsType<Row> = [
|
||||||
{ title: '券号', dataIndex: 'couponNo', width: 200, ellipsis: false },
|
{
|
||||||
{ title: '用户', dataIndex: ['user', 'userNo'], width: 120, ellipsis: false },
|
title: '券号',
|
||||||
|
dataIndex: 'couponNo',
|
||||||
|
width: 200,
|
||||||
|
ellipsis: false,
|
||||||
|
render: (v, row) => (
|
||||||
|
<AdminPrimaryLink
|
||||||
|
onClick={async () => {
|
||||||
|
setDetail(await request(`/admin/benefit/coupons/${row.id}`));
|
||||||
|
setDrawerOpen(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{v}
|
||||||
|
</AdminPrimaryLink>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '用户',
|
||||||
|
dataIndex: ['user', 'userNo'],
|
||||||
|
width: 120,
|
||||||
|
ellipsis: false,
|
||||||
|
render: (v: string | undefined, row) =>
|
||||||
|
row.user?.id ? (
|
||||||
|
<AdminPrimaryLink onClick={() => navigate('/users', { state: { openUserId: String(row.user!.id) } })}>
|
||||||
|
{v}
|
||||||
|
</AdminPrimaryLink>
|
||||||
|
) : (
|
||||||
|
v || '—'
|
||||||
|
),
|
||||||
|
},
|
||||||
{ title: '手机号', dataIndex: ['user', 'phone'], width: 120, render: (v) => v || '—' },
|
{ title: '手机号', dataIndex: ['user', 'phone'], width: 120, render: (v) => v || '—' },
|
||||||
{
|
{
|
||||||
title: '订单',
|
title: '订单',
|
||||||
dataIndex: ['order', 'orderNo'],
|
dataIndex: ['order', 'orderNo'],
|
||||||
width: 180,
|
width: 180,
|
||||||
ellipsis: false,
|
ellipsis: false,
|
||||||
render: (v) => v || '—',
|
render: (v: string | undefined) =>
|
||||||
|
v ? (
|
||||||
|
<AdminPrimaryLink onClick={() => navigate(`/orders?orderNo=${encodeURIComponent(v)}`)}>
|
||||||
|
{v}
|
||||||
|
</AdminPrimaryLink>
|
||||||
|
) : (
|
||||||
|
'—'
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{ title: '总额', dataIndex: 'totalAmount', width: 80, render: (v) => `¥${v}` },
|
{ title: '总额', dataIndex: 'totalAmount', width: 80, render: (v) => `¥${v}` },
|
||||||
{ title: '余额', dataIndex: 'balance', width: 80, render: (v) => `¥${v}` },
|
{ title: '余额', dataIndex: 'balance', width: 80, render: (v) => `¥${v}` },
|
||||||
{ title: '状态', dataIndex: 'status', width: 90, render: (s) => <Tag>{COUPON_STATUS_LABELS[s] || s}</Tag> },
|
{ title: '状态', dataIndex: 'status', width: 90, render: (s) => <Tag>{COUPON_STATUS_LABELS[s] || s}</Tag> },
|
||||||
{ title: '来源', dataIndex: 'sourceProduct' },
|
{
|
||||||
|
title: '来源',
|
||||||
|
dataIndex: 'sourceProduct',
|
||||||
|
width: 360,
|
||||||
|
ellipsis: false,
|
||||||
|
render: (_: string, row) => formatCouponSource(row),
|
||||||
|
},
|
||||||
{ title: '创建', dataIndex: 'createdAt', width: 160, render: fmtTime },
|
{ title: '创建', dataIndex: 'createdAt', width: 160, render: fmtTime },
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
@@ -162,17 +249,15 @@ export default function BenefitCouponsPage() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 16 }}>
|
<AdminListHeader
|
||||||
<Typography.Title level={4} style={{ margin: 0 }}>
|
title="好客权益券"
|
||||||
好客权益券
|
settings={settingsButton}
|
||||||
</Typography.Title>
|
actions={
|
||||||
<Space>
|
|
||||||
{settingsButton}
|
|
||||||
<Button type="primary" onClick={() => setGrantOpen(true)}>
|
<Button type="primary" onClick={() => setGrantOpen(true)}>
|
||||||
手动发放
|
手动发放
|
||||||
</Button>
|
</Button>
|
||||||
</Space>
|
}
|
||||||
</div>
|
/>
|
||||||
|
|
||||||
<Form form={form} layout="inline" style={{ marginBottom: 16 }} onFinish={(v) => { setFilters(v); setPage(1); }}>
|
<Form form={form} layout="inline" style={{ marginBottom: 16 }} onFinish={(v) => { setFilters(v); setPage(1); }}>
|
||||||
<Form.Item name="couponNo" label="券号">
|
<Form.Item name="couponNo" label="券号">
|
||||||
@@ -276,15 +361,37 @@ export default function BenefitCouponsPage() {
|
|||||||
<>
|
<>
|
||||||
<Descriptions column={1} bordered size="small">
|
<Descriptions column={1} bordered size="small">
|
||||||
<Descriptions.Item label="券号">{detail.couponNo}</Descriptions.Item>
|
<Descriptions.Item label="券号">{detail.couponNo}</Descriptions.Item>
|
||||||
<Descriptions.Item label="用户">{detail.user?.userNo ?? '—'}</Descriptions.Item>
|
<Descriptions.Item label="用户">
|
||||||
|
{detail.user?.id ? (
|
||||||
|
<AdminPrimaryLink
|
||||||
|
onClick={() => navigate('/users', { state: { openUserId: String(detail.user!.id) } })}
|
||||||
|
>
|
||||||
|
{detail.user?.userNo}
|
||||||
|
</AdminPrimaryLink>
|
||||||
|
) : (
|
||||||
|
(detail.user?.userNo ?? '—')
|
||||||
|
)}
|
||||||
|
</Descriptions.Item>
|
||||||
<Descriptions.Item label="手机号">{detail.user?.phone ?? '—'}</Descriptions.Item>
|
<Descriptions.Item label="手机号">{detail.user?.phone ?? '—'}</Descriptions.Item>
|
||||||
<Descriptions.Item label="关联订单">{detail.order?.orderNo ?? '—'}</Descriptions.Item>
|
<Descriptions.Item label="关联订单">
|
||||||
|
{detail.order?.orderNo ? (
|
||||||
|
<AdminPrimaryLink
|
||||||
|
onClick={() =>
|
||||||
|
navigate(`/orders?orderNo=${encodeURIComponent(detail.order!.orderNo!)}`)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{detail.order.orderNo}
|
||||||
|
</AdminPrimaryLink>
|
||||||
|
) : (
|
||||||
|
'—'
|
||||||
|
)}
|
||||||
|
</Descriptions.Item>
|
||||||
<Descriptions.Item label="总额">¥{Number(detail.totalAmount).toFixed(2)}</Descriptions.Item>
|
<Descriptions.Item label="总额">¥{Number(detail.totalAmount).toFixed(2)}</Descriptions.Item>
|
||||||
<Descriptions.Item label="余额">¥{Number(detail.balance).toFixed(2)}</Descriptions.Item>
|
<Descriptions.Item label="余额">¥{Number(detail.balance).toFixed(2)}</Descriptions.Item>
|
||||||
<Descriptions.Item label="状态">
|
<Descriptions.Item label="状态">
|
||||||
{COUPON_STATUS_LABELS[detail.status] || detail.status}
|
{COUPON_STATUS_LABELS[detail.status] || detail.status}
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
<Descriptions.Item label="来源">{detail.sourceProduct}</Descriptions.Item>
|
<Descriptions.Item label="来源">{formatCouponSource(detail)}</Descriptions.Item>
|
||||||
</Descriptions>
|
</Descriptions>
|
||||||
|
|
||||||
<Typography.Title level={5} style={{ marginTop: 16, marginBottom: 8 }}>
|
<Typography.Title level={5} style={{ marginTop: 16, marginBottom: 8 }}>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import type { ColumnsType } from 'antd/es/table';
|
|||||||
import { LEDGER_TYPE_LABELS, fmtTime } from '../lib/constants';
|
import { LEDGER_TYPE_LABELS, fmtTime } from '../lib/constants';
|
||||||
import { useAdminList } from '../lib/useAdminList';
|
import { useAdminList } from '../lib/useAdminList';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
|
||||||
|
|
||||||
type Row = {
|
type Row = {
|
||||||
@@ -41,8 +42,7 @@ export default function BenefitLedgersPage() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<Typography.Title level={4}>权益流水</Typography.Title>
|
<AdminListHeader title="权益流水" settings={settingsButton} />
|
||||||
{settingsButton}
|
|
||||||
<Form form={form} layout="inline" style={{ marginBottom: 16 }} onFinish={(v) => { setFilters(v); setPage(1); }}>
|
<Form form={form} layout="inline" style={{ marginBottom: 16 }} onFinish={(v) => { setFilters(v); setPage(1); }}>
|
||||||
<Form.Item name="userId" label="用户ID"><Input allowClear /></Form.Item>
|
<Form.Item name="userId" label="用户ID"><Input allowClear /></Form.Item>
|
||||||
<Form.Item name="couponId" label="券ID"><Input allowClear /></Form.Item>
|
<Form.Item name="couponId" label="券ID"><Input allowClear /></Form.Item>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,6 @@ import {
|
|||||||
Switch,
|
Switch,
|
||||||
Table,
|
Table,
|
||||||
Tag,
|
Tag,
|
||||||
Typography,
|
|
||||||
message,
|
message,
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
import type { ColumnsType } from 'antd/es/table';
|
import type { ColumnsType } from 'antd/es/table';
|
||||||
@@ -31,6 +30,8 @@ import { request, type Paginated } from '../lib/api';
|
|||||||
import { ADMIN_OPTIONS_PAGE_SIZE, fmtTime } from '../lib/constants';
|
import { ADMIN_OPTIONS_PAGE_SIZE, fmtTime } from '../lib/constants';
|
||||||
import { useAdminList } from '../lib/useAdminList';
|
import { useAdminList } from '../lib/useAdminList';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
|
||||||
|
|
||||||
type Row = {
|
type Row = {
|
||||||
@@ -232,7 +233,14 @@ export default function CityWarehousesPage() {
|
|||||||
</span>
|
</span>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{ title: '仓库', dataIndex: 'name', width: 140 },
|
{
|
||||||
|
title: '仓库',
|
||||||
|
dataIndex: 'name',
|
||||||
|
width: 140,
|
||||||
|
render: (v, row) => (
|
||||||
|
<AdminPrimaryLink onClick={() => void openEdit(row)}>{v}</AdminPrimaryLink>
|
||||||
|
),
|
||||||
|
},
|
||||||
{ title: '地址', dataIndex: 'address', width: 180 },
|
{ title: '地址', dataIndex: 'address', width: 180 },
|
||||||
{ title: '联系人', dataIndex: 'contactName', width: 90 },
|
{ title: '联系人', dataIndex: 'contactName', width: 90 },
|
||||||
{ title: '电话', dataIndex: 'contactPhone', width: 120 },
|
{ title: '电话', dataIndex: 'contactPhone', width: 120 },
|
||||||
@@ -308,27 +316,29 @@ export default function CityWarehousesPage() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<Space style={{ marginBottom: 16, width: '100%', justifyContent: 'space-between' }}>
|
<AdminListHeader
|
||||||
<Typography.Title level={4} style={{ margin: 0 }}>仓库</Typography.Title>
|
title="仓库"
|
||||||
{settingsButton}
|
settings={settingsButton}
|
||||||
<Button
|
actions={
|
||||||
type="primary"
|
<Button
|
||||||
onClick={() => {
|
type="primary"
|
||||||
createForm.resetFields();
|
onClick={() => {
|
||||||
setCreateManagerType(WarehouseManagerType.HQ);
|
createForm.resetFields();
|
||||||
setCreateCityId(undefined);
|
setCreateManagerType(WarehouseManagerType.HQ);
|
||||||
setCreateFulfillmentMode(WarehouseFulfillmentMode.MANUAL);
|
setCreateCityId(undefined);
|
||||||
createForm.setFieldsValue({
|
setCreateFulfillmentMode(WarehouseFulfillmentMode.MANUAL);
|
||||||
managerType: WarehouseManagerType.HQ,
|
createForm.setFieldsValue({
|
||||||
status: WarehouseStatus.ACTIVE,
|
managerType: WarehouseManagerType.HQ,
|
||||||
fulfillmentMode: WarehouseFulfillmentMode.MANUAL,
|
status: WarehouseStatus.ACTIVE,
|
||||||
});
|
fulfillmentMode: WarehouseFulfillmentMode.MANUAL,
|
||||||
setCreateOpen(true);
|
});
|
||||||
}}
|
setCreateOpen(true);
|
||||||
>
|
}}
|
||||||
新增仓库
|
>
|
||||||
</Button>
|
新增仓库
|
||||||
</Space>
|
</Button>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
<Alert
|
<Alert
|
||||||
type="info"
|
type="info"
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import { request } from '../lib/api';
|
|||||||
import { ORDER_STATUS_LABELS, fmtTime } from '../lib/constants';
|
import { ORDER_STATUS_LABELS, fmtTime } from '../lib/constants';
|
||||||
import { useAdminList } from '../lib/useAdminList';
|
import { useAdminList } from '../lib/useAdminList';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
|
||||||
|
|
||||||
type Row = {
|
type Row = {
|
||||||
@@ -17,6 +19,8 @@ type Row = {
|
|||||||
trackingNo: string | null;
|
trackingNo: string | null;
|
||||||
providerOrderNo: string | null;
|
providerOrderNo: string | null;
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
|
/** 当次应付物流费 */
|
||||||
|
logisticsFee?: number | null;
|
||||||
order?: {
|
order?: {
|
||||||
id: string;
|
id: string;
|
||||||
orderNo: string;
|
orderNo: string;
|
||||||
@@ -62,9 +66,31 @@ export default function DeliveriesPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const baseColumns: ColumnsType<Row> = [
|
const baseColumns: ColumnsType<Row> = [
|
||||||
{ title: '订单号', dataIndex: ['order', 'orderNo'], width: 170 },
|
{
|
||||||
|
title: '订单号',
|
||||||
|
dataIndex: ['order', 'orderNo'],
|
||||||
|
width: 170,
|
||||||
|
render: (v, row) => (
|
||||||
|
<AdminPrimaryLink
|
||||||
|
onClick={async () => {
|
||||||
|
const d = await request<Row>(`/admin/deliveries/${row.id}`);
|
||||||
|
setDetail(d);
|
||||||
|
editForm.setFieldsValue({ provider: d.provider, trackingNo: d.trackingNo, providerOrderNo: d.providerOrderNo });
|
||||||
|
setDrawerOpen(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{v}
|
||||||
|
</AdminPrimaryLink>
|
||||||
|
),
|
||||||
|
},
|
||||||
{ title: 'provider', dataIndex: 'provider', width: 90 },
|
{ title: 'provider', dataIndex: 'provider', width: 90 },
|
||||||
{ title: '运单号', dataIndex: 'trackingNo', width: 140, render: (v) => v || '—' },
|
{ title: '运单号', dataIndex: 'trackingNo', width: 140, render: (v) => v || '—' },
|
||||||
|
{
|
||||||
|
title: '运费',
|
||||||
|
dataIndex: 'logisticsFee',
|
||||||
|
width: 90,
|
||||||
|
render: (v: number | null | undefined) => (v == null ? '—' : `¥${Number(v).toFixed(2)}`),
|
||||||
|
},
|
||||||
{ title: '第三方单号', dataIndex: 'providerOrderNo', width: 140, render: (v) => v || '—' },
|
{ title: '第三方单号', dataIndex: 'providerOrderNo', width: 140, render: (v) => v || '—' },
|
||||||
{ title: '订单状态', dataIndex: ['order', 'status'], width: 100, render: (s) => ORDER_STATUS_LABELS[s] || s },
|
{ title: '订单状态', dataIndex: ['order', 'status'], width: 100, render: (s) => ORDER_STATUS_LABELS[s] || s },
|
||||||
{ title: '收货人', dataIndex: ['order', 'receiverName'], width: 90 },
|
{ title: '收货人', dataIndex: ['order', 'receiverName'], width: 90 },
|
||||||
@@ -90,8 +116,7 @@ export default function DeliveriesPage() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<Typography.Title level={4}>快递/配送单</Typography.Title>
|
<AdminListHeader title="快递/配送单" settings={settingsButton} />
|
||||||
{settingsButton}
|
|
||||||
<Form form={form} layout="inline" style={{ marginBottom: 16 }} onFinish={(v) => { setFilters(v); setPage(1); }}>
|
<Form form={form} layout="inline" style={{ marginBottom: 16 }} onFinish={(v) => { setFilters(v); setPage(1); }}>
|
||||||
<Form.Item name="orderNo" label="订单号"><Input allowClear /></Form.Item>
|
<Form.Item name="orderNo" label="订单号"><Input allowClear /></Form.Item>
|
||||||
<Form.Item name="provider" label="provider"><Input allowClear placeholder="MOCK" /></Form.Item>
|
<Form.Item name="provider" label="provider"><Input allowClear placeholder="MOCK" /></Form.Item>
|
||||||
@@ -119,6 +144,9 @@ export default function DeliveriesPage() {
|
|||||||
<Descriptions column={1} bordered size="small" style={{ marginBottom: 16 }}>
|
<Descriptions column={1} bordered size="small" style={{ marginBottom: 16 }}>
|
||||||
<Descriptions.Item label="订单">{detail.order?.orderNo}</Descriptions.Item>
|
<Descriptions.Item label="订单">{detail.order?.orderNo}</Descriptions.Item>
|
||||||
<Descriptions.Item label="收货">{detail.order?.receiverName} {detail.order?.receiverPhone}</Descriptions.Item>
|
<Descriptions.Item label="收货">{detail.order?.receiverName} {detail.order?.receiverPhone}</Descriptions.Item>
|
||||||
|
<Descriptions.Item label="运费">
|
||||||
|
{detail.logisticsFee == null ? '—' : `¥${Number(detail.logisticsFee).toFixed(2)}`}
|
||||||
|
</Descriptions.Item>
|
||||||
</Descriptions>
|
</Descriptions>
|
||||||
<Form form={editForm} layout="vertical">
|
<Form form={editForm} layout="vertical">
|
||||||
<Form.Item name="provider" label="provider" rules={[{ required: true }]}><Input /></Form.Item>
|
<Form.Item name="provider" label="provider" rules={[{ required: true }]}><Input /></Form.Item>
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ import { downloadBase64File } from '../lib/exportExcel';
|
|||||||
import { useAdminList } from '../lib/useAdminList';
|
import { useAdminList } from '../lib/useAdminList';
|
||||||
import OssUpload from '../components/OssUpload';
|
import OssUpload from '../components/OssUpload';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
|
||||||
|
|
||||||
const TYPE_OPTIONS = (Object.keys(DEV_PLAN_TASK_TYPE_LABELS) as DevPlanTaskTypeDto[]).map((v) => ({
|
const TYPE_OPTIONS = (Object.keys(DEV_PLAN_TASK_TYPE_LABELS) as DevPlanTaskTypeDto[]).map((v) => ({
|
||||||
@@ -243,7 +245,14 @@ export default function DevPlanTasksPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const baseColumns: ColumnsType<DevPlanTaskDto> = [
|
const baseColumns: ColumnsType<DevPlanTaskDto> = [
|
||||||
{ title: '任务号', dataIndex: 'taskNo', width: 160 },
|
{
|
||||||
|
title: '任务号',
|
||||||
|
dataIndex: 'taskNo',
|
||||||
|
width: 160,
|
||||||
|
render: (v, row) => (
|
||||||
|
<AdminPrimaryLink onClick={() => openEdit(row)}>{v}</AdminPrimaryLink>
|
||||||
|
),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '类型',
|
title: '类型',
|
||||||
dataIndex: 'type',
|
dataIndex: 'type',
|
||||||
@@ -301,40 +310,40 @@ export default function DevPlanTasksPage() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 16 }}>
|
<AdminListHeader
|
||||||
<Typography.Title level={4} style={{ margin: 0 }}>
|
title="开发计划 · 任务列表"
|
||||||
开发计划 · 任务列表
|
settings={settingsButton}
|
||||||
</Typography.Title>
|
actions={
|
||||||
{settingsButton}
|
<>
|
||||||
<Space wrap>
|
<Select
|
||||||
<Select
|
value={exportFormat}
|
||||||
value={exportFormat}
|
style={{ width: 120 }}
|
||||||
style={{ width: 120 }}
|
onChange={setExportFormat}
|
||||||
onChange={setExportFormat}
|
options={[
|
||||||
options={[
|
{ value: 'markdown', label: 'Markdown' },
|
||||||
{ value: 'markdown', label: 'Markdown' },
|
{ value: 'docx', label: 'Word' },
|
||||||
{ value: 'docx', label: 'Word' },
|
{ value: 'xlsx', label: 'Excel' },
|
||||||
{ value: 'xlsx', label: 'Excel' },
|
{ value: 'pdf', label: 'PDF' },
|
||||||
{ value: 'pdf', label: 'PDF' },
|
]}
|
||||||
]}
|
/>
|
||||||
/>
|
<Button loading={exporting} disabled={!selectedRowKeys.length} onClick={() => void exportTasks('selected')}>
|
||||||
<Button loading={exporting} disabled={!selectedRowKeys.length} onClick={() => void exportTasks('selected')}>
|
导出已勾选
|
||||||
导出已勾选
|
</Button>
|
||||||
</Button>
|
<Button loading={exporting} onClick={() => void exportTasks('filter')}>
|
||||||
<Button loading={exporting} onClick={() => void exportTasks('filter')}>
|
导出全部筛选
|
||||||
导出全部筛选
|
</Button>
|
||||||
</Button>
|
<Button disabled={!selectedRowKeys.length} onClick={openBatchEdit}>
|
||||||
<Button disabled={!selectedRowKeys.length} onClick={openBatchEdit}>
|
批量编辑
|
||||||
批量编辑
|
</Button>
|
||||||
</Button>
|
<Button disabled={!selectedRowKeys.length} onClick={openDispatch}>
|
||||||
<Button disabled={!selectedRowKeys.length} onClick={openDispatch}>
|
评审
|
||||||
评审
|
</Button>
|
||||||
</Button>
|
<Button type="primary" onClick={openCreate}>
|
||||||
<Button type="primary" onClick={openCreate}>
|
新建任务
|
||||||
新建任务
|
</Button>
|
||||||
</Button>
|
</>
|
||||||
</Space>
|
}
|
||||||
</div>
|
/>
|
||||||
|
|
||||||
<Form
|
<Form
|
||||||
layout="inline"
|
layout="inline"
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import {
|
|||||||
Space,
|
Space,
|
||||||
Table,
|
Table,
|
||||||
Tag,
|
Tag,
|
||||||
Typography,
|
|
||||||
message,
|
message,
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
import type { ColumnsType } from 'antd/es/table';
|
import type { ColumnsType } from 'antd/es/table';
|
||||||
@@ -23,6 +22,8 @@ import { request } from '../lib/api';
|
|||||||
import { fmtTime } from '../lib/constants';
|
import { fmtTime } from '../lib/constants';
|
||||||
import { useAdminList } from '../lib/useAdminList';
|
import { useAdminList } from '../lib/useAdminList';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -122,7 +123,9 @@ export default function DevPlanVersionsPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const baseColumns: ColumnsType<DevPlanVersionDto> = [
|
const baseColumns: ColumnsType<DevPlanVersionDto> = [
|
||||||
{ title: '版本号', dataIndex: 'versionNo', width: 120 },
|
{ title: '版本号', dataIndex: 'versionNo', width: 120, render: (v, row) => (
|
||||||
|
<AdminPrimaryLink onClick={() => void openEdit(row)}>{v}</AdminPrimaryLink>
|
||||||
|
) },
|
||||||
{
|
{
|
||||||
title: '状态',
|
title: '状态',
|
||||||
dataIndex: 'status',
|
dataIndex: 'status',
|
||||||
@@ -165,15 +168,15 @@ export default function DevPlanVersionsPage() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 16 }}>
|
<AdminListHeader
|
||||||
<Typography.Title level={4} style={{ margin: 0 }}>
|
title="开发计划 · 版本列表"
|
||||||
开发计划 · 版本列表
|
settings={settingsButton}
|
||||||
</Typography.Title>
|
actions={
|
||||||
{settingsButton}
|
<Button type="primary" onClick={openCreate}>
|
||||||
<Button type="primary" onClick={openCreate}>
|
新建版本
|
||||||
新建版本
|
</Button>
|
||||||
</Button>
|
}
|
||||||
</div>
|
/>
|
||||||
|
|
||||||
<Form
|
<Form
|
||||||
layout="inline"
|
layout="inline"
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import type { ColumnsType } from 'antd/es/table';
|
|||||||
import { request } from '../lib/api';
|
import { request } from '../lib/api';
|
||||||
import { fmtTime } from '../lib/constants';
|
import { fmtTime } from '../lib/constants';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
|
||||||
|
|
||||||
type Row = {
|
type Row = {
|
||||||
@@ -59,7 +60,20 @@ export default function DomainEventsPage() {
|
|||||||
|
|
||||||
const baseColumns: ColumnsType<Row> = [
|
const baseColumns: ColumnsType<Row> = [
|
||||||
{ title: '时间', dataIndex: 'createdAt', width: 170, render: (v) => fmtTime(v) },
|
{ title: '时间', dataIndex: 'createdAt', width: 170, render: (v) => fmtTime(v) },
|
||||||
{ title: '类型', dataIndex: 'eventType', width: 130, render: (v) => <Tag>{v}</Tag> },
|
{
|
||||||
|
title: '类型',
|
||||||
|
dataIndex: 'eventType',
|
||||||
|
width: 130,
|
||||||
|
render: (v, r) => (
|
||||||
|
<AdminPrimaryLink
|
||||||
|
onClick={async () => {
|
||||||
|
setDetail(await request<Row>(`/admin/logs/domain-events/${r.id}`));
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Tag>{v}</Tag>
|
||||||
|
</AdminPrimaryLink>
|
||||||
|
),
|
||||||
|
},
|
||||||
{ title: '关联', render: (_, r) => `${r.refType} #${r.refId}` },
|
{ title: '关联', render: (_, r) => `${r.refType} #${r.refId}` },
|
||||||
{ title: '状态', dataIndex: 'status', width: 100 },
|
{ title: '状态', dataIndex: 'status', width: 100 },
|
||||||
{ title: '摘要', render: (_, r) => r.param1 || r.remark || '—' },
|
{ title: '摘要', render: (_, r) => r.param1 || r.remark || '—' },
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import {
|
|||||||
Space,
|
Space,
|
||||||
Table,
|
Table,
|
||||||
Tag,
|
Tag,
|
||||||
Typography,
|
|
||||||
message,
|
message,
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
import type { ColumnsType } from 'antd/es/table';
|
import type { ColumnsType } from 'antd/es/table';
|
||||||
@@ -29,6 +28,8 @@ import {
|
|||||||
import { request } from '../lib/api';
|
import { request } from '../lib/api';
|
||||||
import { fmtTime } from '../lib/constants';
|
import { fmtTime } from '../lib/constants';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
|
||||||
|
|
||||||
const TYPE_OPTIONS = Object.entries(FULFILLMENT_PROVIDER_TYPE_LABELS).map(([value, label]) => ({
|
const TYPE_OPTIONS = Object.entries(FULFILLMENT_PROVIDER_TYPE_LABELS).map(([value, label]) => ({
|
||||||
@@ -177,7 +178,13 @@ export default function FulfillmentProvidersPage() {
|
|||||||
|
|
||||||
const baseColumns: ColumnsType<FulfillmentProviderDto> = [
|
const baseColumns: ColumnsType<FulfillmentProviderDto> = [
|
||||||
{ title: '编码', dataIndex: 'code', width: 100 },
|
{ title: '编码', dataIndex: 'code', width: 100 },
|
||||||
{ title: '名称', dataIndex: 'name' },
|
{
|
||||||
|
title: '名称',
|
||||||
|
dataIndex: 'name',
|
||||||
|
render: (v, row) => (
|
||||||
|
<AdminPrimaryLink onClick={() => openEdit(row)}>{v}</AdminPrimaryLink>
|
||||||
|
),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '类型',
|
title: '类型',
|
||||||
dataIndex: 'type',
|
dataIndex: 'type',
|
||||||
@@ -240,20 +247,16 @@ export default function FulfillmentProvidersPage() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<Space style={{ marginBottom: 16, width: '100%', justifyContent: 'space-between' }}>
|
<AdminListHeader
|
||||||
<div>
|
title="仓配管理"
|
||||||
<Typography.Title level={4} style={{ margin: 0 }}>
|
description="注册承运商接口凭证,并配置物流对账用的银行账户、结算方式与计价标准"
|
||||||
仓配管理
|
settings={settingsButton}
|
||||||
</Typography.Title>
|
actions={
|
||||||
{settingsButton}
|
<Button type="primary" onClick={openCreate}>
|
||||||
<Typography.Text type="secondary">
|
注册承运商
|
||||||
注册承运商接口凭证,并配置物流对账用的银行账户、结算方式与计价标准
|
</Button>
|
||||||
</Typography.Text>
|
}
|
||||||
</div>
|
/>
|
||||||
<Button type="primary" onClick={openCreate}>
|
|
||||||
注册承运商
|
|
||||||
</Button>
|
|
||||||
</Space>
|
|
||||||
|
|
||||||
<Alert
|
<Alert
|
||||||
type="info"
|
type="info"
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import { request, type HqProfile, type Paginated } from '../lib/api';
|
|||||||
import { ACCOUNT_STATUS_LABELS, ADMIN_OPTIONS_PAGE_SIZE, fmtTime } from '../lib/constants';
|
import { ACCOUNT_STATUS_LABELS, ADMIN_OPTIONS_PAGE_SIZE, fmtTime } from '../lib/constants';
|
||||||
import { useAdminList } from '../lib/useAdminList';
|
import { useAdminList } from '../lib/useAdminList';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
|
||||||
|
|
||||||
type Row = {
|
type Row = {
|
||||||
@@ -69,7 +71,31 @@ export default function HqAccountsPage() {
|
|||||||
const cityOptions = cities.map((c) => ({ value: c.id, label: c.name }));
|
const cityOptions = cities.map((c) => ({ value: c.id, label: c.name }));
|
||||||
|
|
||||||
const baseColumns: ColumnsType<Row> = [
|
const baseColumns: ColumnsType<Row> = [
|
||||||
{ title: '姓名', dataIndex: 'name' },
|
{
|
||||||
|
title: '姓名',
|
||||||
|
dataIndex: 'name',
|
||||||
|
render: (v, row) =>
|
||||||
|
isSuperAdmin ? (
|
||||||
|
<AdminPrimaryLink
|
||||||
|
onClick={() => {
|
||||||
|
setDetail(row);
|
||||||
|
editForm.setFieldsValue({
|
||||||
|
name: row.name,
|
||||||
|
phone: row.phone,
|
||||||
|
loginName: row.loginName,
|
||||||
|
adminRole: row.adminRole,
|
||||||
|
status: row.status,
|
||||||
|
cityIds: row.cityIds ?? [],
|
||||||
|
});
|
||||||
|
setDrawerOpen(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{v}
|
||||||
|
</AdminPrimaryLink>
|
||||||
|
) : (
|
||||||
|
v
|
||||||
|
),
|
||||||
|
},
|
||||||
{ title: '用户名', dataIndex: 'loginName', width: 120, render: (v) => v || '—' },
|
{ title: '用户名', dataIndex: 'loginName', width: 120, render: (v) => v || '—' },
|
||||||
{ title: '手机', dataIndex: 'phone', width: 130 },
|
{ title: '手机', dataIndex: 'phone', width: 130 },
|
||||||
{
|
{
|
||||||
@@ -120,22 +146,24 @@ export default function HqAccountsPage() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<Space style={{ marginBottom: 16, width: '100%', justifyContent: 'space-between' }}>
|
<AdminListHeader
|
||||||
<Typography.Title level={4} style={{ margin: 0 }}>HQ 账户</Typography.Title>
|
title="HQ 账户"
|
||||||
{settingsButton}
|
settings={settingsButton}
|
||||||
{isSuperAdmin && (
|
actions={
|
||||||
<Button
|
isSuperAdmin ? (
|
||||||
type="primary"
|
<Button
|
||||||
onClick={() => {
|
type="primary"
|
||||||
createForm.resetFields();
|
onClick={() => {
|
||||||
createForm.setFieldsValue({ credentialType: 'phone', adminRole: 'OPS', cityIds: [] });
|
createForm.resetFields();
|
||||||
setCreateOpen(true);
|
createForm.setFieldsValue({ credentialType: 'phone', adminRole: 'OPS', cityIds: [] });
|
||||||
}}
|
setCreateOpen(true);
|
||||||
>
|
}}
|
||||||
新建账户
|
>
|
||||||
</Button>
|
新建账户
|
||||||
)}
|
</Button>
|
||||||
</Space>
|
) : null
|
||||||
|
}
|
||||||
|
/>
|
||||||
<Form form={form} layout="inline" style={{ marginBottom: 16 }} onFinish={(v) => { setFilters(v); setPage(1); }}>
|
<Form form={form} layout="inline" style={{ marginBottom: 16 }} onFinish={(v) => { setFilters(v); setPage(1); }}>
|
||||||
<Form.Item name="phone" label="手机"><Input allowClear /></Form.Item>
|
<Form.Item name="phone" label="手机"><Input allowClear /></Form.Item>
|
||||||
<Form.Item name="adminRole" label="角色">
|
<Form.Item name="adminRole" label="角色">
|
||||||
|
|||||||
@@ -1,204 +1,216 @@
|
|||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import {
|
import {
|
||||||
Button, Descriptions, Drawer, Form, Input, Select, Space, Table, Tag, Typography,
|
Button, Descriptions, Drawer, Form, Input, Select, Space, Table, Tag, Typography,
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
import type { ColumnsType } from 'antd/es/table';
|
import type { ColumnsType } from 'antd/es/table';
|
||||||
import { useSearchParams } from 'react-router-dom';
|
import { useSearchParams } from 'react-router-dom';
|
||||||
import { request } from '../lib/api';
|
import { request } from '../lib/api';
|
||||||
import { AdminCellLine } from '../components/AdminCellLine';
|
import { AdminCellLine } from '../components/AdminCellLine';
|
||||||
import { fmtTime } from '../lib/constants';
|
import { fmtTime } from '../lib/constants';
|
||||||
import { HQ_OPERATION_ACTION_OPTIONS, resolveHqOperationLabel } from '../lib/hq-log';
|
import { HQ_OPERATION_ACTION_OPTIONS, resolveHqOperationLabel } from '../lib/hq-log';
|
||||||
import { useAdminList } from '../lib/useAdminList';
|
import { useAdminList } from '../lib/useAdminList';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
type Row = {
|
|
||||||
id: string;
|
|
||||||
hqAccountId: string | null;
|
type Row = {
|
||||||
hqName: string | null;
|
id: string;
|
||||||
hqPhone: string | null;
|
hqAccountId: string | null;
|
||||||
hqRole: string | null;
|
hqName: string | null;
|
||||||
action: string | null;
|
hqPhone: string | null;
|
||||||
actionLabel: string;
|
hqRole: string | null;
|
||||||
refType: string | null;
|
action: string | null;
|
||||||
refId: string | null;
|
actionLabel: string;
|
||||||
status: string | null;
|
refType: string | null;
|
||||||
remark: string | null;
|
refId: string | null;
|
||||||
detail: Record<string, unknown> | null;
|
status: string | null;
|
||||||
createdAt: string;
|
remark: string | null;
|
||||||
};
|
detail: Record<string, unknown> | null;
|
||||||
|
createdAt: string;
|
||||||
export default function HqLogsPage() {
|
};
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
|
||||||
const [form] = Form.useForm();
|
export default function HqLogsPage() {
|
||||||
const [filters, setFilters] = useState<Record<string, string>>(() => ({
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
hqAccountId: searchParams.get('hqAccountId') ?? '',
|
const [form] = Form.useForm();
|
||||||
action: searchParams.get('action') ?? '',
|
const [filters, setFilters] = useState<Record<string, string>>(() => ({
|
||||||
refType: searchParams.get('refType') ?? '',
|
hqAccountId: searchParams.get('hqAccountId') ?? '',
|
||||||
}));
|
action: searchParams.get('action') ?? '',
|
||||||
const { data, loading, page, pageSize, setPage, setPageSize, reload } = useAdminList<Row>(
|
refType: searchParams.get('refType') ?? '',
|
||||||
'/admin/logs/hq',
|
}));
|
||||||
() => {
|
const { data, loading, page, pageSize, setPage, setPageSize, reload } = useAdminList<Row>(
|
||||||
const qs = new URLSearchParams();
|
'/admin/logs/hq',
|
||||||
if (filters.hqAccountId) qs.set('hqAccountId', filters.hqAccountId);
|
() => {
|
||||||
if (filters.action) qs.set('action', filters.action);
|
const qs = new URLSearchParams();
|
||||||
if (filters.refType) qs.set('refType', filters.refType);
|
if (filters.hqAccountId) qs.set('hqAccountId', filters.hqAccountId);
|
||||||
return qs;
|
if (filters.action) qs.set('action', filters.action);
|
||||||
},
|
if (filters.refType) qs.set('refType', filters.refType);
|
||||||
[filters],
|
return qs;
|
||||||
);
|
},
|
||||||
const [detail, setDetail] = useState<Row | null>(null);
|
[filters],
|
||||||
const [drawerOpen, setDrawerOpen] = useState(false);
|
);
|
||||||
|
const [detail, setDetail] = useState<Row | null>(null);
|
||||||
useEffect(() => {
|
const [drawerOpen, setDrawerOpen] = useState(false);
|
||||||
form.setFieldsValue(filters);
|
|
||||||
}, [form, filters]);
|
useEffect(() => {
|
||||||
|
form.setFieldsValue(filters);
|
||||||
const baseColumns: ColumnsType<Row> = [
|
}, [form, filters]);
|
||||||
{ title: '时间', dataIndex: 'createdAt', width: 160, render: fmtTime },
|
|
||||||
{
|
const baseColumns: ColumnsType<Row> = [
|
||||||
title: '操作人',
|
{ title: '时间', dataIndex: 'createdAt', width: 160, render: fmtTime },
|
||||||
width: 200,
|
{
|
||||||
|
title: '操作人',
|
||||||
render: (_, r) => (
|
width: 200,
|
||||||
<AdminCellLine
|
render: (_, r) => (
|
||||||
primary={r.hqName}
|
<AdminCellLine
|
||||||
secondary={[r.hqPhone, r.hqAccountId ? `#${r.hqAccountId}` : ''].filter(Boolean).join(' ') || null}
|
primary={r.hqName}
|
||||||
/>
|
secondary={[r.hqPhone, r.hqAccountId ? `#${r.hqAccountId}` : ''].filter(Boolean).join(' ') || null}
|
||||||
),
|
/>
|
||||||
},
|
),
|
||||||
{
|
},
|
||||||
title: '行为',
|
{
|
||||||
dataIndex: 'actionLabel',
|
title: '行为',
|
||||||
width: 160,
|
dataIndex: 'actionLabel',
|
||||||
render: (v, r) => <Tag color="blue">{v || resolveHqOperationLabel(r.action)}</Tag>,
|
width: 160,
|
||||||
},
|
render: (v, r) => (
|
||||||
{ title: '对象类型', dataIndex: 'refType', width: 120, render: (v) => v || '—' },
|
<AdminPrimaryLink
|
||||||
{ title: '对象 ID', dataIndex: 'refId', width: 100, render: (v) => v || '—' },
|
onClick={async () => {
|
||||||
{
|
const res = await request<Row>(`/admin/logs/hq/${r.id}`);
|
||||||
title: '操作',
|
setDetail(res);
|
||||||
width: 80,
|
setDrawerOpen(true);
|
||||||
render: (_, row) => (
|
}}
|
||||||
<Button
|
>
|
||||||
type="link"
|
<Tag color="blue">{v || resolveHqOperationLabel(r.action)}</Tag>
|
||||||
size="small"
|
</AdminPrimaryLink>
|
||||||
onClick={async () => {
|
),
|
||||||
const res = await request<Row>(`/admin/logs/hq/${row.id}`);
|
},
|
||||||
setDetail(res);
|
{ title: '对象类型', dataIndex: 'refType', width: 120, render: (v) => v || '—' },
|
||||||
setDrawerOpen(true);
|
{ title: '对象 ID', dataIndex: 'refId', width: 100, render: (v) => v || '—' },
|
||||||
}}
|
{
|
||||||
>
|
title: '操作',
|
||||||
详情
|
width: 80,
|
||||||
</Button>
|
render: (_, row) => (
|
||||||
),
|
<Button
|
||||||
},
|
type="link"
|
||||||
];
|
size="small"
|
||||||
|
onClick={async () => {
|
||||||
|
const res = await request<Row>(`/admin/logs/hq/${row.id}`);
|
||||||
|
setDetail(res);
|
||||||
|
setDrawerOpen(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
详情
|
||||||
|
</Button>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
const { columns, settingsButton, settingsModal } = useAdminListColumns('logs-hq', baseColumns, { page, pageSize });
|
const { columns, settingsButton, settingsModal } = useAdminListColumns('logs-hq', baseColumns, { page, pageSize });
|
||||||
|
|
||||||
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div>
|
{settingsModal}
|
||||||
{settingsModal}
|
<AdminListHeader
|
||||||
<Typography.Title level={4}>HQ 操作日志</Typography.Title>
|
title="HQ 操作日志"
|
||||||
{settingsButton}
|
settings={settingsButton}
|
||||||
<Typography.Paragraph type="secondary">
|
description="记录总部后台写操作(开城、订单、用户、权限、合伙人等),仅追加不删除。"
|
||||||
记录总部后台写操作(开城、订单、用户、权限、合伙人等),仅追加不删除。
|
/>
|
||||||
</Typography.Paragraph>
|
|
||||||
|
<Form
|
||||||
<Form
|
form={form}
|
||||||
form={form}
|
layout="inline"
|
||||||
layout="inline"
|
style={{ marginBottom: 16 }}
|
||||||
style={{ marginBottom: 16 }}
|
onFinish={(values) => {
|
||||||
onFinish={(values) => {
|
setFilters(values);
|
||||||
setFilters(values);
|
setPage(1);
|
||||||
setPage(1);
|
const qs = new URLSearchParams();
|
||||||
const qs = new URLSearchParams();
|
if (values.hqAccountId) qs.set('hqAccountId', values.hqAccountId);
|
||||||
if (values.hqAccountId) qs.set('hqAccountId', values.hqAccountId);
|
if (values.action) qs.set('action', values.action);
|
||||||
if (values.action) qs.set('action', values.action);
|
if (values.refType) qs.set('refType', values.refType);
|
||||||
if (values.refType) qs.set('refType', values.refType);
|
setSearchParams(qs);
|
||||||
setSearchParams(qs);
|
}}
|
||||||
}}
|
>
|
||||||
>
|
<Form.Item name="hqAccountId" label="HQ 账户 ID">
|
||||||
<Form.Item name="hqAccountId" label="HQ 账户 ID">
|
<Input allowClear style={{ width: 140 }} />
|
||||||
<Input allowClear style={{ width: 140 }} />
|
</Form.Item>
|
||||||
</Form.Item>
|
<Form.Item name="action" label="行为">
|
||||||
<Form.Item name="action" label="行为">
|
<Select
|
||||||
<Select
|
allowClear
|
||||||
allowClear
|
showSearch
|
||||||
showSearch
|
optionFilterProp="label"
|
||||||
optionFilterProp="label"
|
style={{ width: 180 }}
|
||||||
style={{ width: 180 }}
|
options={HQ_OPERATION_ACTION_OPTIONS.map((o) => ({ value: o.value, label: o.label }))}
|
||||||
options={HQ_OPERATION_ACTION_OPTIONS.map((o) => ({ value: o.value, label: o.label }))}
|
/>
|
||||||
/>
|
</Form.Item>
|
||||||
</Form.Item>
|
<Form.Item name="refType" label="对象类型">
|
||||||
<Form.Item name="refType" label="对象类型">
|
<Input allowClear placeholder="ORDER / USER / CITY..." style={{ width: 140 }} />
|
||||||
<Input allowClear placeholder="ORDER / USER / CITY..." style={{ width: 140 }} />
|
</Form.Item>
|
||||||
</Form.Item>
|
<Form.Item>
|
||||||
<Form.Item>
|
<Space>
|
||||||
<Space>
|
<Button type="primary" htmlType="submit">查询</Button>
|
||||||
<Button type="primary" htmlType="submit">查询</Button>
|
<Button onClick={() => {
|
||||||
<Button onClick={() => {
|
form.resetFields();
|
||||||
form.resetFields();
|
setFilters({ hqAccountId: '', action: '', refType: '' });
|
||||||
setFilters({ hqAccountId: '', action: '', refType: '' });
|
setSearchParams({});
|
||||||
setSearchParams({});
|
setPage(1);
|
||||||
setPage(1);
|
void reload();
|
||||||
void reload();
|
}}
|
||||||
}}
|
>
|
||||||
>
|
重置
|
||||||
重置
|
</Button>
|
||||||
</Button>
|
</Space>
|
||||||
</Space>
|
</Form.Item>
|
||||||
</Form.Item>
|
</Form>
|
||||||
</Form>
|
|
||||||
|
<Table
|
||||||
<Table
|
rowKey="id"
|
||||||
rowKey="id"
|
loading={loading}
|
||||||
loading={loading}
|
columns={columns}
|
||||||
columns={columns}
|
dataSource={data?.items ?? []}
|
||||||
dataSource={data?.items ?? []}
|
scroll={{ x: 'max-content' }}
|
||||||
scroll={{ x: 'max-content' }}
|
pagination={{
|
||||||
pagination={{
|
current: page,
|
||||||
current: page,
|
pageSize,
|
||||||
pageSize,
|
total: data?.total ?? 0,
|
||||||
total: data?.total ?? 0,
|
showSizeChanger: true,
|
||||||
showSizeChanger: true,
|
onChange: (p, ps) => {
|
||||||
onChange: (p, ps) => {
|
setPage(p);
|
||||||
setPage(p);
|
setPageSize(ps);
|
||||||
setPageSize(ps);
|
},
|
||||||
},
|
}}
|
||||||
}}
|
/>
|
||||||
/>
|
|
||||||
|
<Drawer title="操作详情" width={640} open={drawerOpen} onClose={() => setDrawerOpen(false)}>
|
||||||
<Drawer title="操作详情" width={640} open={drawerOpen} onClose={() => setDrawerOpen(false)}>
|
{detail && (
|
||||||
{detail && (
|
<>
|
||||||
<>
|
<Descriptions column={1} bordered size="small">
|
||||||
<Descriptions column={1} bordered size="small">
|
<Descriptions.Item label="日志 ID">{detail.id}</Descriptions.Item>
|
||||||
<Descriptions.Item label="日志 ID">{detail.id}</Descriptions.Item>
|
<Descriptions.Item label="时间">{fmtTime(detail.createdAt)}</Descriptions.Item>
|
||||||
<Descriptions.Item label="时间">{fmtTime(detail.createdAt)}</Descriptions.Item>
|
<Descriptions.Item label="操作人">
|
||||||
<Descriptions.Item label="操作人">
|
<AdminCellLine
|
||||||
<AdminCellLine
|
primary={detail.hqName}
|
||||||
primary={detail.hqName}
|
secondary={[detail.hqPhone, detail.hqAccountId ? `ID:${detail.hqAccountId}` : ''].filter(Boolean).join(' ') || null}
|
||||||
secondary={[detail.hqPhone, detail.hqAccountId ? `ID:${detail.hqAccountId}` : ''].filter(Boolean).join(' ') || null}
|
/>
|
||||||
/>
|
</Descriptions.Item>
|
||||||
</Descriptions.Item>
|
<Descriptions.Item label="角色">{detail.hqRole || '—'}</Descriptions.Item>
|
||||||
<Descriptions.Item label="角色">{detail.hqRole || '—'}</Descriptions.Item>
|
<Descriptions.Item label="行为">
|
||||||
<Descriptions.Item label="行为">
|
{detail.actionLabel || resolveHqOperationLabel(detail.action)}
|
||||||
{detail.actionLabel || resolveHqOperationLabel(detail.action)}
|
</Descriptions.Item>
|
||||||
</Descriptions.Item>
|
<Descriptions.Item label="对象">{detail.refType} / {detail.refId}</Descriptions.Item>
|
||||||
<Descriptions.Item label="对象">{detail.refType} / {detail.refId}</Descriptions.Item>
|
<Descriptions.Item label="状态">{detail.status || '—'}</Descriptions.Item>
|
||||||
<Descriptions.Item label="状态">{detail.status || '—'}</Descriptions.Item>
|
<Descriptions.Item label="备注">{detail.remark || '—'}</Descriptions.Item>
|
||||||
<Descriptions.Item label="备注">{detail.remark || '—'}</Descriptions.Item>
|
</Descriptions>
|
||||||
</Descriptions>
|
<Typography.Title level={5} style={{ marginTop: 16 }}>请求/响应快照</Typography.Title>
|
||||||
<Typography.Title level={5} style={{ marginTop: 16 }}>请求/响应快照</Typography.Title>
|
<pre style={{
|
||||||
<pre style={{
|
margin: 0, padding: 12, background: '#f5f5f5', borderRadius: 4,
|
||||||
margin: 0, padding: 12, background: '#f5f5f5', borderRadius: 4,
|
maxHeight: 400, overflow: 'auto', fontSize: 12,
|
||||||
maxHeight: 400, overflow: 'auto', fontSize: 12,
|
}}
|
||||||
}}
|
>
|
||||||
>
|
{JSON.stringify(detail.detail, null, 2)}
|
||||||
{JSON.stringify(detail.detail, null, 2)}
|
</pre>
|
||||||
</pre>
|
</>
|
||||||
</>
|
)}
|
||||||
)}
|
</Drawer>
|
||||||
</Drawer>
|
</div>
|
||||||
</div>
|
);
|
||||||
);
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import {
|
|||||||
Space,
|
Space,
|
||||||
Table,
|
Table,
|
||||||
Tag,
|
Tag,
|
||||||
Typography,
|
|
||||||
Upload,
|
Upload,
|
||||||
message,
|
message,
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
@@ -31,6 +30,8 @@ import { fmtTime } from '../lib/constants';
|
|||||||
import { useAdminList } from '../lib/useAdminList';
|
import { useAdminList } from '../lib/useAdminList';
|
||||||
import { uploadFileToOss } from '../lib/upload';
|
import { uploadFileToOss } from '../lib/upload';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
|
||||||
|
|
||||||
type Row = {
|
type Row = {
|
||||||
@@ -204,7 +205,13 @@ export default function InvoicesPage() {
|
|||||||
? INVOICE_CATEGORY_LABELS[r.invoiceCategory] ?? r.invoiceCategory
|
? INVOICE_CATEGORY_LABELS[r.invoiceCategory] ?? r.invoiceCategory
|
||||||
: '—',
|
: '—',
|
||||||
},
|
},
|
||||||
{ title: '名称', dataIndex: 'titleName' },
|
{
|
||||||
|
title: '名称',
|
||||||
|
dataIndex: 'titleName',
|
||||||
|
render: (v, row) => (
|
||||||
|
<AdminPrimaryLink onClick={() => openDetail(row.id)}>{v}</AdminPrimaryLink>
|
||||||
|
),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '状态',
|
title: '状态',
|
||||||
width: 110,
|
width: 110,
|
||||||
@@ -234,32 +241,25 @@ export default function InvoicesPage() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<div
|
<AdminListHeader
|
||||||
style={{
|
title="发票管理"
|
||||||
display: 'flex',
|
settings={settingsButton}
|
||||||
justifyContent: 'space-between',
|
actions={
|
||||||
alignItems: 'center',
|
<Button
|
||||||
marginBottom: 16,
|
type="primary"
|
||||||
}}
|
onClick={() => {
|
||||||
>
|
createForm.setFieldsValue({
|
||||||
<Typography.Title level={4} style={{ margin: 0 }}>
|
titleType: 'PERSONAL',
|
||||||
发票管理
|
invoiceKind: 'NORMAL',
|
||||||
</Typography.Title>
|
invoiceCategory: 'LIQUOR',
|
||||||
{settingsButton}
|
});
|
||||||
<Button
|
setCreateOpen(true);
|
||||||
type="primary"
|
}}
|
||||||
onClick={() => {
|
>
|
||||||
createForm.setFieldsValue({
|
创建发票申请
|
||||||
titleType: 'PERSONAL',
|
</Button>
|
||||||
invoiceKind: 'NORMAL',
|
}
|
||||||
invoiceCategory: 'LIQUOR',
|
/>
|
||||||
});
|
|
||||||
setCreateOpen(true);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
创建发票申请
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
<Form
|
<Form
|
||||||
form={filterForm}
|
form={filterForm}
|
||||||
layout="inline"
|
layout="inline"
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ import { fmtTime } from '../lib/constants';
|
|||||||
import { useAdminList } from '../lib/useAdminList';
|
import { useAdminList } from '../lib/useAdminList';
|
||||||
import { uploadFileToOss } from '../lib/upload';
|
import { uploadFileToOss } from '../lib/upload';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
|
||||||
|
|
||||||
type FormValues = {
|
type FormValues = {
|
||||||
@@ -127,7 +129,13 @@ export default function KnowledgeBasesPage() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const baseColumns: ColumnsType<KnowledgeBaseDto> = [
|
const baseColumns: ColumnsType<KnowledgeBaseDto> = [
|
||||||
{ title: '名称', dataIndex: 'name' },
|
{
|
||||||
|
title: '名称',
|
||||||
|
dataIndex: 'name',
|
||||||
|
render: (v, row) => (
|
||||||
|
<AdminPrimaryLink onClick={() => openEdit(row)}>{v}</AdminPrimaryLink>
|
||||||
|
),
|
||||||
|
},
|
||||||
{ title: '说明', dataIndex: 'description' },
|
{ title: '说明', dataIndex: 'description' },
|
||||||
{ title: '文档数', dataIndex: 'documentCount', width: 90 },
|
{ title: '文档数', dataIndex: 'documentCount', width: 90 },
|
||||||
{
|
{
|
||||||
@@ -257,15 +265,11 @@ export default function KnowledgeBasesPage() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<Space style={{ marginBottom: 16 }} wrap>
|
<AdminListHeader
|
||||||
<Typography.Title level={4} style={{ margin: 0 }}>
|
title="知识库"
|
||||||
知识库
|
settings={settingsButton}
|
||||||
</Typography.Title>
|
description="支持粘贴文本或上传 .txt/.md;可绑定到企微机器人供 AI 检索"
|
||||||
{settingsButton}
|
/>
|
||||||
<Typography.Text type="secondary">
|
|
||||||
支持粘贴文本或上传 .txt/.md;可绑定到企微机器人供 AI 检索
|
|
||||||
</Typography.Text>
|
|
||||||
</Space>
|
|
||||||
|
|
||||||
<Form
|
<Form
|
||||||
form={filterForm}
|
form={filterForm}
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ import { request } from '../lib/api';
|
|||||||
import { fmtTime } from '../lib/constants';
|
import { fmtTime } from '../lib/constants';
|
||||||
import { useAdminList } from '../lib/useAdminList';
|
import { useAdminList } from '../lib/useAdminList';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
|
||||||
|
|
||||||
type FormValues = {
|
type FormValues = {
|
||||||
@@ -156,7 +158,13 @@ export default function LlmConfigsPage() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const baseColumns: ColumnsType<LlmApiConfigDto> = [
|
const baseColumns: ColumnsType<LlmApiConfigDto> = [
|
||||||
{ title: '名称', dataIndex: 'name' },
|
{
|
||||||
|
title: '名称',
|
||||||
|
dataIndex: 'name',
|
||||||
|
render: (v, row) => (
|
||||||
|
<AdminPrimaryLink onClick={() => openEdit(row)}>{v}</AdminPrimaryLink>
|
||||||
|
),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '提供商',
|
title: '提供商',
|
||||||
dataIndex: 'provider',
|
dataIndex: 'provider',
|
||||||
@@ -264,15 +272,11 @@ export default function LlmConfigsPage() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<Space style={{ marginBottom: 16 }} wrap>
|
<AdminListHeader
|
||||||
<Typography.Title level={4} style={{ margin: 0 }}>
|
title="语言模型配置"
|
||||||
语言模型配置
|
settings={settingsButton}
|
||||||
</Typography.Title>
|
description="非超管仅可见自己创建的配置,且创建后只能改是否生效"
|
||||||
{settingsButton}
|
/>
|
||||||
<Typography.Text type="secondary">
|
|
||||||
非超管仅可见自己创建的配置,且创建后只能改是否生效
|
|
||||||
</Typography.Text>
|
|
||||||
</Space>
|
|
||||||
|
|
||||||
<Form
|
<Form
|
||||||
form={filterForm}
|
form={filterForm}
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ import { downloadExcelCsv } from '../lib/exportExcel';
|
|||||||
import { request } from '../lib/api';
|
import { request } from '../lib/api';
|
||||||
import { useAdminList } from '../lib/useAdminList';
|
import { useAdminList } from '../lib/useAdminList';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
|
||||||
type BillRow = {
|
type BillRow = {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -246,7 +248,14 @@ export default function LogisticsBillsPage() {
|
|||||||
const selectedAmount = selectedRows.reduce((s, r) => s + Number(r.logisticsAmount), 0);
|
const selectedAmount = selectedRows.reduce((s, r) => s + Number(r.logisticsAmount), 0);
|
||||||
|
|
||||||
const billColumns: ColumnsType<BillRow> = [
|
const billColumns: ColumnsType<BillRow> = [
|
||||||
{ title: '账单号', dataIndex: 'billNo', width: 170 },
|
{
|
||||||
|
title: '账单号',
|
||||||
|
dataIndex: 'billNo',
|
||||||
|
width: 170,
|
||||||
|
render: (v, row) => (
|
||||||
|
<AdminPrimaryLink onClick={() => void openDetail(row.id)}>{v}</AdminPrimaryLink>
|
||||||
|
),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '承运商',
|
title: '承运商',
|
||||||
width: 140,
|
width: 140,
|
||||||
@@ -397,15 +406,11 @@ export default function LogisticsBillsPage() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<Space direction="vertical" size={0} style={{ marginBottom: 16 }}>
|
<AdminListHeader
|
||||||
<Typography.Title level={4} style={{ margin: 0 }}>
|
title="物流对账"
|
||||||
物流对账
|
settings={settingsButton}
|
||||||
</Typography.Title>
|
description="按快递承运商汇总月度物流费;计价与银行账户在「仓配管理」配置。前期充值扣款,后期可切挂账月结。"
|
||||||
{settingsButton}
|
/>
|
||||||
<Typography.Text type="secondary">
|
|
||||||
按快递承运商汇总月度物流费;计价与银行账户在「仓配管理」配置。前期充值扣款,后期可切挂账月结。
|
|
||||||
</Typography.Text>
|
|
||||||
</Space>
|
|
||||||
|
|
||||||
<Tabs
|
<Tabs
|
||||||
items={[
|
items={[
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { Link, useSearchParams } from 'react-router-dom';
|
import { Link, useNavigate, useSearchParams } from 'react-router-dom';
|
||||||
import {
|
import {
|
||||||
Alert,
|
Alert,
|
||||||
Button,
|
Button,
|
||||||
@@ -27,10 +27,13 @@ import dayjs, { type Dayjs } from 'dayjs';
|
|||||||
import { ORDER_TYPE_LABELS } from '@dukang/shared-types';
|
import { ORDER_TYPE_LABELS } from '@dukang/shared-types';
|
||||||
import { request, type AdminOrderItem, type AdminOrderRow, type HqProfile, type Paginated } from '../lib/api';
|
import { request, type AdminOrderItem, type AdminOrderRow, type HqProfile, type Paginated } from '../lib/api';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
import { downloadBase64File } from '../lib/exportExcel';
|
import { downloadBase64File } from '../lib/exportExcel';
|
||||||
import {
|
import {
|
||||||
ADMIN_OPTIONS_PAGE_SIZE,
|
ADMIN_OPTIONS_PAGE_SIZE,
|
||||||
DELIVERY_PROVIDER_LABELS,
|
DELIVERY_PROVIDER_LABELS,
|
||||||
|
DELIVERY_TYPE_LABELS,
|
||||||
ORDER_STATUS_COLORS,
|
ORDER_STATUS_COLORS,
|
||||||
ORDER_STATUS_LABELS,
|
ORDER_STATUS_LABELS,
|
||||||
ORDER_STATUS_OPERATOR_LABELS,
|
ORDER_STATUS_OPERATOR_LABELS,
|
||||||
@@ -142,7 +145,7 @@ type OrderExportFormat = 'xlsx' | 'pdf';
|
|||||||
|
|
||||||
type OrderExportFilters = {
|
type OrderExportFilters = {
|
||||||
orderNo?: string;
|
orderNo?: string;
|
||||||
status?: string;
|
status?: string | string[];
|
||||||
orderType?: string;
|
orderType?: string;
|
||||||
cityId?: string;
|
cityId?: string;
|
||||||
receiverPhone?: string;
|
receiverPhone?: string;
|
||||||
@@ -217,6 +220,12 @@ function formatBenefitBrief(row: AdminOrderRow) {
|
|||||||
return '—';
|
return '—';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function selectedStatuses(status: unknown): string[] {
|
||||||
|
if (Array.isArray(status)) return status.filter((s): s is string => Boolean(s));
|
||||||
|
if (typeof status === 'string' && status) return [status];
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
function buildExportPayload(
|
function buildExportPayload(
|
||||||
scope: OrderExportScope,
|
scope: OrderExportScope,
|
||||||
format: OrderExportFormat,
|
format: OrderExportFormat,
|
||||||
@@ -229,7 +238,8 @@ function buildExportPayload(
|
|||||||
return payload;
|
return payload;
|
||||||
}
|
}
|
||||||
if (filters.orderNo) payload.orderNo = filters.orderNo;
|
if (filters.orderNo) payload.orderNo = filters.orderNo;
|
||||||
if (filters.status) payload.status = filters.status;
|
const statuses = selectedStatuses(filters.status);
|
||||||
|
if (statuses.length) payload.status = statuses;
|
||||||
if (filters.orderType) payload.orderType = filters.orderType;
|
if (filters.orderType) payload.orderType = filters.orderType;
|
||||||
if (filters.cityId) payload.cityId = filters.cityId;
|
if (filters.cityId) payload.cityId = filters.cityId;
|
||||||
if (filters.receiverPhone) payload.receiverPhone = filters.receiverPhone;
|
if (filters.receiverPhone) payload.receiverPhone = filters.receiverPhone;
|
||||||
@@ -273,6 +283,7 @@ function warehouseToDefaults(wh: WarehouseOption, base?: ShipDefaults | null): S
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function OrdersPage() {
|
export default function OrdersPage() {
|
||||||
|
const navigate = useNavigate();
|
||||||
const [searchParams] = useSearchParams();
|
const [searchParams] = useSearchParams();
|
||||||
const initialOrderNo = searchParams.get('orderNo')?.trim() || '';
|
const initialOrderNo = searchParams.get('orderNo')?.trim() || '';
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
@@ -354,7 +365,7 @@ export default function OrdersPage() {
|
|||||||
const qs = new URLSearchParams({ page: String(page), pageSize: String(pageSize) });
|
const qs = new URLSearchParams({ page: String(page), pageSize: String(pageSize) });
|
||||||
if (initialOrderNo) qs.set('orderNo', initialOrderNo);
|
if (initialOrderNo) qs.set('orderNo', initialOrderNo);
|
||||||
if (values.orderNo) qs.set('orderNo', values.orderNo);
|
if (values.orderNo) qs.set('orderNo', values.orderNo);
|
||||||
if (values.status) qs.set('status', values.status);
|
for (const status of selectedStatuses(values.status)) qs.append('status', status);
|
||||||
if (values.orderType) qs.set('orderType', values.orderType);
|
if (values.orderType) qs.set('orderType', values.orderType);
|
||||||
if (values.cityId) qs.set('cityId', values.cityId);
|
if (values.cityId) qs.set('cityId', values.cityId);
|
||||||
if (values.receiverPhone) qs.set('receiverPhone', values.receiverPhone);
|
if (values.receiverPhone) qs.set('receiverPhone', values.receiverPhone);
|
||||||
@@ -593,63 +604,98 @@ export default function OrdersPage() {
|
|||||||
|
|
||||||
const baseColumns: ColumnsType<AdminOrderRow> = [
|
const baseColumns: ColumnsType<AdminOrderRow> = [
|
||||||
{
|
{
|
||||||
title: '商品',
|
title: '订单号',
|
||||||
width: 240,
|
dataIndex: 'orderNo',
|
||||||
render: (_, row) => (
|
width: 180,
|
||||||
<div>
|
render: (v, row) => (
|
||||||
<Space size={4} wrap>
|
<Space size={4}>
|
||||||
<span>{row.productName || '—'}</span>
|
<AdminPrimaryLink onClick={() => openDetail(row.id)}>{v}</AdminPrimaryLink>
|
||||||
{row.isTest ? <Tag color="orange">测试</Tag> : null}
|
{row.isTest ? <Tag color="orange">测试</Tag> : null}
|
||||||
{row.fulfillmentHold ? <Tag color="orange">大单</Tag> : null}
|
</Space>
|
||||||
{row.orderType === 'PROXY' || row.isProxyOrder ? (
|
|
||||||
<Tag color="purple">代下单</Tag>
|
|
||||||
) : null}
|
|
||||||
</Space>
|
|
||||||
<div>
|
|
||||||
<Typography.Text type="secondary" style={{ fontSize: 12 }}>
|
|
||||||
{[row.productSpec, row.quantity != null ? `×${row.quantity}` : null]
|
|
||||||
.filter(Boolean)
|
|
||||||
.join(' ')}
|
|
||||||
</Typography.Text>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '状态 / 实付',
|
title: '用户',
|
||||||
width: 130,
|
key: 'user',
|
||||||
|
width: 120,
|
||||||
|
render: (_, row) =>
|
||||||
|
row.user?.id ? (
|
||||||
|
<AdminPrimaryLink onClick={() => navigate('/users', { state: { openUserId: String(row.user!.id) } })}>
|
||||||
|
{row.user.userNo}
|
||||||
|
</AdminPrimaryLink>
|
||||||
|
) : (
|
||||||
|
(row.user?.userNo || '—')
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '商品',
|
||||||
|
key: 'productName',
|
||||||
|
width: 180,
|
||||||
render: (_, row) => (
|
render: (_, row) => (
|
||||||
<div>
|
<Space size={4} wrap>
|
||||||
<Tag color={ORDER_STATUS_COLORS[row.status] || 'default'}>
|
<span>{row.productName || '—'}</span>
|
||||||
{ORDER_STATUS_LABELS[row.status] || row.status}
|
{row.fulfillmentHold ? <Tag color="orange">大单</Tag> : null}
|
||||||
</Tag>
|
{row.orderType === 'PROXY' || row.isProxyOrder ? (
|
||||||
<div>¥{row.payAmount}</div>
|
<Tag color="purple">代下单</Tag>
|
||||||
</div>
|
) : null}
|
||||||
|
</Space>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: '规格',
|
||||||
|
dataIndex: 'productSpec',
|
||||||
|
width: 140,
|
||||||
|
render: (v: string | undefined) => v || '—',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '数量',
|
||||||
|
dataIndex: 'quantity',
|
||||||
|
width: 80,
|
||||||
|
render: (v: number | undefined, row) =>
|
||||||
|
v == null ? '—' : `${v}${row.saleUnit === 'BOX' ? '箱' : '瓶'}`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '配送方式',
|
||||||
|
dataIndex: 'deliveryType',
|
||||||
|
width: 100,
|
||||||
|
render: (v: string | undefined) => DELIVERY_TYPE_LABELS[v ?? ''] || v || '—',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '状态',
|
||||||
|
dataIndex: 'status',
|
||||||
|
width: 100,
|
||||||
|
render: (s: string) => (
|
||||||
|
<Tag color={ORDER_STATUS_COLORS[s] || 'default'}>{ORDER_STATUS_LABELS[s] || s}</Tag>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '实付',
|
||||||
|
dataIndex: 'payAmount',
|
||||||
|
width: 90,
|
||||||
|
render: (v: number) => `¥${v}`,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '好客权益',
|
title: '好客权益',
|
||||||
width: 200,
|
width: 200,
|
||||||
render: (_, row) => formatBenefitBrief(row),
|
render: (_, row) => formatBenefitBrief(row),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '收货信息',
|
title: '收货人',
|
||||||
width: 240,
|
dataIndex: 'receiverName',
|
||||||
render: (_, row) => {
|
width: 90,
|
||||||
const address = formatReceiverAddress(row);
|
render: (v: string | undefined) => v || '—',
|
||||||
return (
|
},
|
||||||
<div>
|
{
|
||||||
<div>
|
title: '电话',
|
||||||
{row.receiverName || '—'} {row.receiverPhone || ''}
|
dataIndex: 'receiverPhone',
|
||||||
</div>
|
width: 120,
|
||||||
{address ? (
|
render: (v: string | undefined) => v || '—',
|
||||||
<Typography.Text type="secondary" style={{ fontSize: 12 }}>
|
},
|
||||||
{address}
|
{
|
||||||
</Typography.Text>
|
title: '地址',
|
||||||
) : null}
|
key: 'receiverAddress',
|
||||||
</div>
|
width: 260,
|
||||||
);
|
render: (_, row) => formatReceiverAddress(row) || '—',
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '下单时间',
|
title: '下单时间',
|
||||||
@@ -695,18 +741,20 @@ export default function OrdersPage() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<Space style={{ marginBottom: 20, width: '100%', justifyContent: 'space-between' }}>
|
<AdminListHeader
|
||||||
<Typography.Title level={4} style={{ margin: 0 }}>订单监控</Typography.Title>
|
title="订单监控"
|
||||||
<Space size={12}>
|
settings={settingsButton}
|
||||||
{settingsButton}
|
actions={
|
||||||
<Button onClick={() => window.open('/orders/big-screen', 'dukang-big-screen')}>大屏</Button>
|
<>
|
||||||
{canProxyOrder ? (
|
<Button onClick={() => window.open('/orders/big-screen', 'dukang-big-screen')}>大屏</Button>
|
||||||
<Button type="primary" onClick={() => setProxyOpen(true)}>
|
{canProxyOrder ? (
|
||||||
代下单
|
<Button type="primary" onClick={() => setProxyOpen(true)}>
|
||||||
</Button>
|
代下单
|
||||||
) : null}
|
</Button>
|
||||||
</Space>
|
) : null}
|
||||||
</Space>
|
</>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
{!canDeleteOrders && profile ? (
|
{!canDeleteOrders && profile ? (
|
||||||
<Alert
|
<Alert
|
||||||
@@ -744,10 +792,12 @@ export default function OrdersPage() {
|
|||||||
</Space>
|
</Space>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
<Col xs={12} sm={6} md={5} lg={3}>
|
<Col xs={24} sm={12} md={8} lg={6}>
|
||||||
<Form.Item name="status" label="状态" style={{ marginBottom: 12 }}>
|
<Form.Item name="status" label="状态" style={{ marginBottom: 12 }}>
|
||||||
<Select
|
<Select
|
||||||
|
mode="multiple"
|
||||||
allowClear
|
allowClear
|
||||||
|
maxTagCount="responsive"
|
||||||
placeholder="全部"
|
placeholder="全部"
|
||||||
options={Object.entries(ORDER_STATUS_LABELS).map(([value, label]) => ({ value, label }))}
|
options={Object.entries(ORDER_STATUS_LABELS).map(([value, label]) => ({ value, label }))}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -5,9 +5,10 @@ import {
|
|||||||
import type { ColumnsType } from 'antd/es/table';
|
import type { ColumnsType } from 'antd/es/table';
|
||||||
import { PARTNER_PERMISSION_KEYS, PARTNER_PERMISSION_LABELS, PARTNER_STAFF_ROLE_LABELS, type PartnerPermissionKey } from '@dukang/shared-types';
|
import { PARTNER_PERMISSION_KEYS, PARTNER_PERMISSION_LABELS, PARTNER_STAFF_ROLE_LABELS, type PartnerPermissionKey } from '@dukang/shared-types';
|
||||||
import { request, type Paginated } from '../lib/api';
|
import { request, type Paginated } from '../lib/api';
|
||||||
import { AdminCellLine } from '../components/AdminCellLine';
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
import { ACCOUNT_STATUS_LABELS, ADMIN_OPTIONS_PAGE_SIZE, ORDER_STATUS_LABELS, PARTNER_BILL_STATUS_LABELS, fmtTime } from '../lib/constants';
|
import { ACCOUNT_STATUS_LABELS, ADMIN_OPTIONS_PAGE_SIZE, ORDER_STATUS_LABELS, PARTNER_BILL_STATUS_LABELS, fmtTime } from '../lib/constants';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
|
||||||
|
|
||||||
type PartnerOption = { id: string; companyName: string };
|
type PartnerOption = { id: string; companyName: string };
|
||||||
@@ -176,14 +177,13 @@ export default function PartnerAccountsPage() {
|
|||||||
title: '姓名 / 类型',
|
title: '姓名 / 类型',
|
||||||
width: 200,
|
width: 200,
|
||||||
render: (_, row) => (
|
render: (_, row) => (
|
||||||
<AdminCellLine
|
<span className="admin-cell-line">
|
||||||
primary={row.name}
|
<AdminPrimaryLink onClick={() => void openAccount(row.id)}>{row.name}</AdminPrimaryLink>
|
||||||
secondary={
|
<span className="admin-cell-line-secondary">
|
||||||
row.parentAccountId
|
{' · '}
|
||||||
? `子账号 · ${staffRoleLabel(row.staffRole)}`
|
{row.parentAccountId ? `子账号 · ${staffRoleLabel(row.staffRole)}` : '主账号'}
|
||||||
: '主账号'
|
</span>
|
||||||
}
|
</span>
|
||||||
/>
|
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{ title: '手机', dataIndex: 'phone', width: 120 },
|
{ title: '手机', dataIndex: 'phone', width: 120 },
|
||||||
@@ -262,15 +262,11 @@ export default function PartnerAccountsPage() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<Space style={{ marginBottom: 16, width: '100%', justifyContent: 'space-between' }}>
|
<AdminListHeader
|
||||||
<div>
|
title="合伙人子账号"
|
||||||
<Typography.Title level={4} style={{ margin: 0 }}>合伙人子账号</Typography.Title>
|
settings={settingsButton}
|
||||||
{settingsButton}
|
description="主账号在「开城合伙人」创建;此处仅管理子账号树与权限"
|
||||||
<Typography.Text type="secondary">
|
/>
|
||||||
主账号在「开城合伙人」创建;此处仅管理子账号树与权限
|
|
||||||
</Typography.Text>
|
|
||||||
</div>
|
|
||||||
</Space>
|
|
||||||
<Form
|
<Form
|
||||||
form={form}
|
form={form}
|
||||||
layout="inline"
|
layout="inline"
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,237 +1,250 @@
|
|||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { Button, Descriptions, Drawer, Form, Input, Segmented, Space, Table, Tag, Typography } from 'antd';
|
import { Button, Descriptions, Drawer, Form, Input, Segmented, Space, Table, Tag, Typography } from 'antd';
|
||||||
import type { ColumnsType } from 'antd/es/table';
|
import type { ColumnsType } from 'antd/es/table';
|
||||||
import { useSearchParams } from 'react-router-dom';
|
import { useSearchParams } from 'react-router-dom';
|
||||||
import {
|
import {
|
||||||
PARTNER_LOG_CATEGORY_OPTIONS,
|
PARTNER_LOG_CATEGORY_OPTIONS,
|
||||||
PARTNER_LOG_CATEGORY_LABELS,
|
PARTNER_LOG_CATEGORY_LABELS,
|
||||||
PARTNER_STAFF_ROLE_LABELS,
|
PARTNER_STAFF_ROLE_LABELS,
|
||||||
resolvePartnerLogCategory,
|
resolvePartnerLogCategory,
|
||||||
type PartnerLogCategory,
|
type PartnerLogCategory,
|
||||||
type PartnerStaffRole,
|
type PartnerStaffRole,
|
||||||
} from '@dukang/shared-types';
|
} from '@dukang/shared-types';
|
||||||
import { request } from '../lib/api';
|
import { request } from '../lib/api';
|
||||||
import { AdminCellLine } from '../components/AdminCellLine';
|
import { AdminCellLine } from '../components/AdminCellLine';
|
||||||
import { fmtTime } from '../lib/constants';
|
import { fmtTime } from '../lib/constants';
|
||||||
import { useAdminList } from '../lib/useAdminList';
|
import { useAdminList } from '../lib/useAdminList';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
type Row = {
|
|
||||||
id: string;
|
|
||||||
partnerId: string;
|
type Row = {
|
||||||
partnerAccountId: string | null;
|
id: string;
|
||||||
accountName: string | null;
|
partnerId: string;
|
||||||
accountPhone: string | null;
|
partnerAccountId: string | null;
|
||||||
companyName: string | null;
|
accountName: string | null;
|
||||||
isSubAccount?: boolean;
|
accountPhone: string | null;
|
||||||
staffRole?: string | null;
|
companyName: string | null;
|
||||||
category: PartnerLogCategory | null;
|
isSubAccount?: boolean;
|
||||||
eventName: string;
|
staffRole?: string | null;
|
||||||
clientApp: string | null;
|
category: PartnerLogCategory | null;
|
||||||
refType: string | null;
|
eventName: string;
|
||||||
refId: string | null;
|
clientApp: string | null;
|
||||||
extraJson: Record<string, unknown> | null;
|
refType: string | null;
|
||||||
createdAt: string;
|
refId: string | null;
|
||||||
};
|
extraJson: Record<string, unknown> | null;
|
||||||
|
createdAt: string;
|
||||||
function summarizeExtra(json: Record<string, unknown> | null) {
|
};
|
||||||
if (!json) return '—';
|
|
||||||
const text = JSON.stringify(json);
|
function summarizeExtra(json: Record<string, unknown> | null) {
|
||||||
return text.length > 80 ? `${text.slice(0, 80)}…` : text;
|
if (!json) return '—';
|
||||||
}
|
const text = JSON.stringify(json);
|
||||||
|
return text.length > 80 ? `${text.slice(0, 80)}…` : text;
|
||||||
export default function PartnerLogsPage() {
|
}
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
|
||||||
const [form] = Form.useForm();
|
export default function PartnerLogsPage() {
|
||||||
const [category, setCategory] = useState(searchParams.get('category') ?? '');
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
const [filters, setFilters] = useState<Record<string, string>>(() => ({
|
const [form] = Form.useForm();
|
||||||
partnerId: searchParams.get('partnerId') ?? '',
|
const [category, setCategory] = useState(searchParams.get('category') ?? '');
|
||||||
partnerAccountId: searchParams.get('partnerAccountId') ?? '',
|
const [filters, setFilters] = useState<Record<string, string>>(() => ({
|
||||||
phone: searchParams.get('phone') ?? '',
|
partnerId: searchParams.get('partnerId') ?? '',
|
||||||
companyName: searchParams.get('companyName') ?? '',
|
partnerAccountId: searchParams.get('partnerAccountId') ?? '',
|
||||||
eventName: searchParams.get('eventName') ?? '',
|
phone: searchParams.get('phone') ?? '',
|
||||||
}));
|
companyName: searchParams.get('companyName') ?? '',
|
||||||
const { data, loading, page, pageSize, setPage, setPageSize } = useAdminList<Row>(
|
eventName: searchParams.get('eventName') ?? '',
|
||||||
'/admin/logs/partners',
|
}));
|
||||||
() => {
|
const { data, loading, page, pageSize, setPage, setPageSize } = useAdminList<Row>(
|
||||||
const qs = new URLSearchParams();
|
'/admin/logs/partners',
|
||||||
if (filters.partnerId) qs.set('partnerId', filters.partnerId);
|
() => {
|
||||||
if (filters.partnerAccountId) qs.set('partnerAccountId', filters.partnerAccountId);
|
const qs = new URLSearchParams();
|
||||||
if (filters.phone) qs.set('phone', filters.phone);
|
if (filters.partnerId) qs.set('partnerId', filters.partnerId);
|
||||||
if (filters.companyName) qs.set('companyName', filters.companyName);
|
if (filters.partnerAccountId) qs.set('partnerAccountId', filters.partnerAccountId);
|
||||||
if (filters.eventName) qs.set('eventName', filters.eventName);
|
if (filters.phone) qs.set('phone', filters.phone);
|
||||||
if (category) qs.set('category', category);
|
if (filters.companyName) qs.set('companyName', filters.companyName);
|
||||||
return qs;
|
if (filters.eventName) qs.set('eventName', filters.eventName);
|
||||||
},
|
if (category) qs.set('category', category);
|
||||||
[filters, category],
|
return qs;
|
||||||
);
|
},
|
||||||
const [detail, setDetail] = useState<Record<string, unknown> | null>(null);
|
[filters, category],
|
||||||
const [drawerOpen, setDrawerOpen] = useState(false);
|
);
|
||||||
|
const [detail, setDetail] = useState<Record<string, unknown> | null>(null);
|
||||||
useEffect(() => {
|
const [drawerOpen, setDrawerOpen] = useState(false);
|
||||||
form.setFieldsValue(filters);
|
|
||||||
}, [form, filters]);
|
useEffect(() => {
|
||||||
|
form.setFieldsValue(filters);
|
||||||
const baseColumns: ColumnsType<Row> = [
|
}, [form, filters]);
|
||||||
{ title: '时间', dataIndex: 'createdAt', width: 160, render: fmtTime },
|
|
||||||
{
|
const baseColumns: ColumnsType<Row> = [
|
||||||
title: '合伙人',
|
{ title: '时间', dataIndex: 'createdAt', width: 160, render: fmtTime },
|
||||||
width: 180,
|
{
|
||||||
|
title: '合伙人',
|
||||||
render: (_, r) => (
|
width: 180,
|
||||||
r.isSubAccount ? (
|
render: (_, r) => (
|
||||||
<Tag color="blue">子账号</Tag>
|
r.isSubAccount ? (
|
||||||
) : (
|
<Tag color="blue">子账号</Tag>
|
||||||
<AdminCellLine primary={r.companyName} secondary={r.partnerId} />
|
) : (
|
||||||
)
|
<AdminCellLine primary={r.companyName} secondary={r.partnerId} />
|
||||||
),
|
)
|
||||||
},
|
),
|
||||||
{
|
},
|
||||||
title: '账号',
|
{
|
||||||
width: 150,
|
title: '账号',
|
||||||
|
width: 150,
|
||||||
render: (_, r) => (
|
render: (_, r) => (
|
||||||
<AdminCellLine
|
<AdminCellLine
|
||||||
primary={r.accountName}
|
primary={r.accountName}
|
||||||
secondary={
|
secondary={
|
||||||
r.isSubAccount && r.staffRole
|
r.isSubAccount && r.staffRole
|
||||||
? `${r.accountPhone || ''} · ${PARTNER_STAFF_ROLE_LABELS[r.staffRole as PartnerStaffRole] || r.staffRole}`
|
? `${r.accountPhone || ''} · ${PARTNER_STAFF_ROLE_LABELS[r.staffRole as PartnerStaffRole] || r.staffRole}`
|
||||||
: r.accountPhone || r.partnerAccountId
|
: r.accountPhone || r.partnerAccountId
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '分类',
|
title: '分类',
|
||||||
dataIndex: 'category',
|
dataIndex: 'category',
|
||||||
width: 100,
|
width: 100,
|
||||||
render: (v: PartnerLogCategory | null, r) => (
|
render: (v: PartnerLogCategory | null, r) => (
|
||||||
<Tag>{PARTNER_LOG_CATEGORY_LABELS[v ?? ''] || resolvePartnerLogCategory(r.eventName) || '其他'}</Tag>
|
<Tag>{PARTNER_LOG_CATEGORY_LABELS[v ?? ''] || resolvePartnerLogCategory(r.eventName) || '其他'}</Tag>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{ title: '事件', dataIndex: 'eventName', width: 180 },
|
{
|
||||||
{
|
title: '事件',
|
||||||
title: '关联',
|
dataIndex: 'eventName',
|
||||||
width: 120,
|
width: 180,
|
||||||
render: (_, r) => (r.refType && r.refId ? `${r.refType}#${r.refId}` : '—'),
|
render: (v, row) => (
|
||||||
},
|
<AdminPrimaryLink
|
||||||
{
|
onClick={async () => {
|
||||||
title: '摘要',
|
setDetail(await request(`/admin/logs/partners/${row.id}`));
|
||||||
|
setDrawerOpen(true);
|
||||||
render: (_, r) => summarizeExtra(r.extraJson),
|
}}
|
||||||
},
|
>
|
||||||
{
|
{v}
|
||||||
title: '操作',
|
</AdminPrimaryLink>
|
||||||
width: 80,
|
),
|
||||||
render: (_, row) => (
|
},
|
||||||
<Button
|
{
|
||||||
type="link"
|
title: '关联',
|
||||||
size="small"
|
width: 120,
|
||||||
onClick={async () => {
|
render: (_, r) => (r.refType && r.refId ? `${r.refType}#${r.refId}` : '—'),
|
||||||
setDetail(await request(`/admin/logs/partners/${row.id}`));
|
},
|
||||||
setDrawerOpen(true);
|
{
|
||||||
}}
|
title: '摘要',
|
||||||
>
|
render: (_, r) => summarizeExtra(r.extraJson),
|
||||||
详情
|
},
|
||||||
</Button>
|
{
|
||||||
),
|
title: '操作',
|
||||||
|
width: 80,
|
||||||
|
render: (_, row) => (
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
size="small"
|
||||||
|
onClick={async () => {
|
||||||
|
setDetail(await request(`/admin/logs/partners/${row.id}`));
|
||||||
|
setDrawerOpen(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
详情
|
||||||
|
</Button>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
const { columns, settingsButton, settingsModal } = useAdminListColumns('logs-partners', baseColumns, { page, pageSize });
|
const { columns, settingsButton, settingsModal } = useAdminListColumns('logs-partners', baseColumns, { page, pageSize });
|
||||||
|
|
||||||
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
{settingsModal}
|
||||||
return (
|
<AdminListHeader title="合伙人日志" settings={settingsButton} />
|
||||||
<div>
|
<Segmented
|
||||||
{settingsModal}
|
options={PARTNER_LOG_CATEGORY_OPTIONS.map((o) => ({ value: o.value, label: o.label }))}
|
||||||
<Typography.Title level={4} style={{ marginBottom: 16 }}>
|
value={category}
|
||||||
合伙人日志
|
onChange={(v) => {
|
||||||
</Typography.Title>
|
setCategory(String(v));
|
||||||
{settingsButton}
|
setPage(1);
|
||||||
<Segmented
|
setSearchParams((prev) => {
|
||||||
options={PARTNER_LOG_CATEGORY_OPTIONS.map((o) => ({ value: o.value, label: o.label }))}
|
const next = new URLSearchParams(prev);
|
||||||
value={category}
|
if (v) next.set('category', String(v));
|
||||||
onChange={(v) => {
|
else next.delete('category');
|
||||||
setCategory(String(v));
|
return next;
|
||||||
setPage(1);
|
});
|
||||||
setSearchParams((prev) => {
|
}}
|
||||||
const next = new URLSearchParams(prev);
|
style={{ marginBottom: 16 }}
|
||||||
if (v) next.set('category', String(v));
|
/>
|
||||||
else next.delete('category');
|
<Form
|
||||||
return next;
|
form={form}
|
||||||
});
|
layout="inline"
|
||||||
}}
|
style={{ marginBottom: 16, flexWrap: 'wrap', gap: 8 }}
|
||||||
style={{ marginBottom: 16 }}
|
onFinish={(values) => {
|
||||||
/>
|
setFilters(values);
|
||||||
<Form
|
setPage(1);
|
||||||
form={form}
|
}}
|
||||||
layout="inline"
|
>
|
||||||
style={{ marginBottom: 16, flexWrap: 'wrap', gap: 8 }}
|
<Form.Item name="phone" label="手机号">
|
||||||
onFinish={(values) => {
|
<Input placeholder="账号手机号" allowClear style={{ width: 140 }} />
|
||||||
setFilters(values);
|
</Form.Item>
|
||||||
setPage(1);
|
<Form.Item name="companyName" label="公司">
|
||||||
}}
|
<Input placeholder="合伙人公司" allowClear style={{ width: 140 }} />
|
||||||
>
|
</Form.Item>
|
||||||
<Form.Item name="phone" label="手机号">
|
<Form.Item name="partnerId" label="合伙人ID">
|
||||||
<Input placeholder="账号手机号" allowClear style={{ width: 140 }} />
|
<Input placeholder="partnerId" allowClear style={{ width: 120 }} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="companyName" label="公司">
|
<Form.Item name="eventName" label="事件名">
|
||||||
<Input placeholder="合伙人公司" allowClear style={{ width: 140 }} />
|
<Input placeholder="partner_sms_login" allowClear style={{ width: 160 }} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="partnerId" label="合伙人ID">
|
<Form.Item>
|
||||||
<Input placeholder="partnerId" allowClear style={{ width: 120 }} />
|
<Space>
|
||||||
</Form.Item>
|
<Button type="primary" htmlType="submit">
|
||||||
<Form.Item name="eventName" label="事件名">
|
查询
|
||||||
<Input placeholder="partner_sms_login" allowClear style={{ width: 160 }} />
|
</Button>
|
||||||
</Form.Item>
|
<Button
|
||||||
<Form.Item>
|
onClick={() => {
|
||||||
<Space>
|
form.resetFields();
|
||||||
<Button type="primary" htmlType="submit">
|
setFilters({
|
||||||
查询
|
partnerId: '',
|
||||||
</Button>
|
partnerAccountId: '',
|
||||||
<Button
|
phone: '',
|
||||||
onClick={() => {
|
companyName: '',
|
||||||
form.resetFields();
|
eventName: '',
|
||||||
setFilters({
|
});
|
||||||
partnerId: '',
|
setPage(1);
|
||||||
partnerAccountId: '',
|
}}
|
||||||
phone: '',
|
>
|
||||||
companyName: '',
|
重置
|
||||||
eventName: '',
|
</Button>
|
||||||
});
|
</Space>
|
||||||
setPage(1);
|
</Form.Item>
|
||||||
}}
|
</Form>
|
||||||
>
|
<Table
|
||||||
重置
|
rowKey="id"
|
||||||
</Button>
|
loading={loading}
|
||||||
</Space>
|
columns={columns}
|
||||||
</Form.Item>
|
dataSource={data?.items ?? []}
|
||||||
</Form>
|
pagination={{
|
||||||
<Table
|
current: page,
|
||||||
rowKey="id"
|
pageSize,
|
||||||
loading={loading}
|
total: data?.total ?? 0,
|
||||||
columns={columns}
|
showSizeChanger: true,
|
||||||
dataSource={data?.items ?? []}
|
onChange: (p, ps) => {
|
||||||
pagination={{
|
setPage(p);
|
||||||
current: page,
|
setPageSize(ps);
|
||||||
pageSize,
|
},
|
||||||
total: data?.total ?? 0,
|
}}
|
||||||
showSizeChanger: true,
|
scroll={{ x: 'max-content' }}
|
||||||
onChange: (p, ps) => {
|
/>
|
||||||
setPage(p);
|
<Drawer title="日志详情" open={drawerOpen} onClose={() => setDrawerOpen(false)} width={520}>
|
||||||
setPageSize(ps);
|
{detail && (
|
||||||
},
|
<Descriptions column={1} bordered size="small">
|
||||||
}}
|
{Object.entries(detail).map(([k, v]) => (
|
||||||
scroll={{ x: 'max-content' }}
|
<Descriptions.Item key={k} label={k}>
|
||||||
/>
|
{typeof v === 'object' ? JSON.stringify(v, null, 2) : String(v ?? '—')}
|
||||||
<Drawer title="日志详情" open={drawerOpen} onClose={() => setDrawerOpen(false)} width={520}>
|
</Descriptions.Item>
|
||||||
{detail && (
|
))}
|
||||||
<Descriptions column={1} bordered size="small">
|
</Descriptions>
|
||||||
{Object.entries(detail).map(([k, v]) => (
|
)}
|
||||||
<Descriptions.Item key={k} label={k}>
|
</Drawer>
|
||||||
{typeof v === 'object' ? JSON.stringify(v, null, 2) : String(v ?? '—')}
|
</div>
|
||||||
</Descriptions.Item>
|
);
|
||||||
))}
|
}
|
||||||
</Descriptions>
|
|
||||||
)}
|
|
||||||
</Drawer>
|
|
||||||
|
|||||||
@@ -1,410 +1,420 @@
|
|||||||
import { useCallback, useEffect, useState } from 'react';
|
import { useCallback, useEffect, useState } from 'react';
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Drawer,
|
Drawer,
|
||||||
Form,
|
Form,
|
||||||
Input,
|
Input,
|
||||||
InputNumber,
|
InputNumber,
|
||||||
Modal,
|
Modal,
|
||||||
Select,
|
Select,
|
||||||
Space,
|
Space,
|
||||||
Table,
|
Table,
|
||||||
Tabs,
|
Tabs,
|
||||||
Tag,
|
Tag,
|
||||||
Typography,
|
Typography,
|
||||||
message,
|
message,
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
import type { ColumnsType } from 'antd/es/table';
|
import type { ColumnsType } from 'antd/es/table';
|
||||||
import {
|
import {
|
||||||
CITY_PARTNER_SCOPE_LABELS,
|
CITY_PARTNER_SCOPE_LABELS,
|
||||||
CityPartnerScopeType,
|
CityPartnerScopeType,
|
||||||
PARTNER_PERMISSION_KEYS,
|
PARTNER_PERMISSION_KEYS,
|
||||||
PARTNER_PERMISSION_LABELS,
|
PARTNER_PERMISSION_LABELS,
|
||||||
type PartnerPermissionKey,
|
type PartnerPermissionKey,
|
||||||
} from '@dukang/shared-types';
|
} from '@dukang/shared-types';
|
||||||
import { request, type Paginated } from '../lib/api';
|
import { request, type Paginated } from '../lib/api';
|
||||||
import { districtCodeLabel, formatDistrictLabels } from '../lib/china-region';
|
import { districtCodeLabel, formatDistrictLabels } from '../lib/china-region';
|
||||||
import { ADMIN_OPTIONS_PAGE_SIZE, fmtTime } from '../lib/constants';
|
import { ADMIN_OPTIONS_PAGE_SIZE, fmtTime } from '../lib/constants';
|
||||||
import { useAdminList } from '../lib/useAdminList';
|
import { useAdminList } from '../lib/useAdminList';
|
||||||
import CityDistrictMultiSelect from '../components/CityDistrictMultiSelect';
|
import CityDistrictMultiSelect from '../components/CityDistrictMultiSelect';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
type Row = {
|
|
||||||
id: string;
|
|
||||||
companyName: string;
|
type Row = {
|
||||||
phone: string;
|
id: string;
|
||||||
name: string;
|
companyName: string;
|
||||||
contactPhone?: string | null;
|
phone: string;
|
||||||
cityId?: string | null;
|
name: string;
|
||||||
cityName?: string | null;
|
contactPhone?: string | null;
|
||||||
scopeType?: string;
|
cityId?: string | null;
|
||||||
districtCodes?: string[] | null;
|
cityName?: string | null;
|
||||||
orderCommissionRate?: number;
|
scopeType?: string;
|
||||||
redeemCommissionRate?: number;
|
districtCodes?: string[] | null;
|
||||||
storeCount: number;
|
orderCommissionRate?: number;
|
||||||
accountCount: number;
|
redeemCommissionRate?: number;
|
||||||
createdAt: string;
|
storeCount: number;
|
||||||
};
|
accountCount: number;
|
||||||
|
createdAt: string;
|
||||||
type PartnerDetail = Row & {
|
};
|
||||||
address?: string;
|
|
||||||
districtCodes?: string[] | null;
|
type PartnerDetail = Row & {
|
||||||
bindingStatus?: string;
|
address?: string;
|
||||||
bankAccountName?: string | null;
|
districtCodes?: string[] | null;
|
||||||
bankAccountNo?: string | null;
|
bindingStatus?: string;
|
||||||
bankBranch?: string | null;
|
bankAccountName?: string | null;
|
||||||
managedWarehouseId?: string | null;
|
bankAccountNo?: string | null;
|
||||||
children?: Array<{
|
bankBranch?: string | null;
|
||||||
id: string;
|
managedWarehouseId?: string | null;
|
||||||
phone: string;
|
children?: Array<{
|
||||||
name: string;
|
id: string;
|
||||||
staffRole?: string;
|
phone: string;
|
||||||
permissions?: string[];
|
name: string;
|
||||||
status: string;
|
staffRole?: string;
|
||||||
}>;
|
permissions?: string[];
|
||||||
};
|
status: string;
|
||||||
|
}>;
|
||||||
type CityOption = { id: string; name: string; code: string };
|
};
|
||||||
type WarehouseOption = { id: string; name: string };
|
|
||||||
|
type CityOption = { id: string; name: string; code: string };
|
||||||
const SCOPE_OPTIONS = Object.entries(CITY_PARTNER_SCOPE_LABELS).map(([value, label]) => ({ value, label }));
|
type WarehouseOption = { id: string; name: string };
|
||||||
const PERM_OPTIONS = PARTNER_PERMISSION_KEYS.map((k: PartnerPermissionKey) => ({ value: k, label: PARTNER_PERMISSION_LABELS[k] }));
|
|
||||||
|
const SCOPE_OPTIONS = Object.entries(CITY_PARTNER_SCOPE_LABELS).map(([value, label]) => ({ value, label }));
|
||||||
function flattenDistrictCodes(values: string[] | string[][] | undefined): string[] {
|
const PERM_OPTIONS = PARTNER_PERMISSION_KEYS.map((k: PartnerPermissionKey) => ({ value: k, label: PARTNER_PERMISSION_LABELS[k] }));
|
||||||
if (!values?.length) return [];
|
|
||||||
if (Array.isArray(values[0])) {
|
function flattenDistrictCodes(values: string[] | string[][] | undefined): string[] {
|
||||||
return (values as string[][]).map((path) => path[path.length - 1]).filter(Boolean);
|
if (!values?.length) return [];
|
||||||
}
|
if (Array.isArray(values[0])) {
|
||||||
return values as string[];
|
return (values as string[][]).map((path) => path[path.length - 1]).filter(Boolean);
|
||||||
}
|
}
|
||||||
|
return values as string[];
|
||||||
export default function PartnersPage() {
|
}
|
||||||
const [form] = Form.useForm();
|
|
||||||
const [editForm] = Form.useForm();
|
export default function PartnersPage() {
|
||||||
const [createForm] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [subForm] = Form.useForm();
|
const [editForm] = Form.useForm();
|
||||||
const [filters, setFilters] = useState<Record<string, string>>({});
|
const [createForm] = Form.useForm();
|
||||||
const { data, loading, page, pageSize, setPage, setPageSize, reload } = useAdminList<Row>(
|
const [subForm] = Form.useForm();
|
||||||
'/admin/partners',
|
const [filters, setFilters] = useState<Record<string, string>>({});
|
||||||
() => {
|
const { data, loading, page, pageSize, setPage, setPageSize, reload } = useAdminList<Row>(
|
||||||
const qs = new URLSearchParams();
|
'/admin/partners',
|
||||||
if (filters.companyName) qs.set('companyName', filters.companyName);
|
() => {
|
||||||
if (filters.contactPhone) qs.set('contactPhone', filters.contactPhone);
|
const qs = new URLSearchParams();
|
||||||
return qs;
|
if (filters.companyName) qs.set('companyName', filters.companyName);
|
||||||
},
|
if (filters.contactPhone) qs.set('contactPhone', filters.contactPhone);
|
||||||
[filters],
|
return qs;
|
||||||
);
|
},
|
||||||
const [detail, setDetail] = useState<PartnerDetail | null>(null);
|
[filters],
|
||||||
const [drawerOpen, setDrawerOpen] = useState(false);
|
);
|
||||||
const [createOpen, setCreateOpen] = useState(false);
|
const [detail, setDetail] = useState<PartnerDetail | null>(null);
|
||||||
const [subOpen, setSubOpen] = useState(false);
|
const [drawerOpen, setDrawerOpen] = useState(false);
|
||||||
const [cities, setCities] = useState<CityOption[]>([]);
|
const [createOpen, setCreateOpen] = useState(false);
|
||||||
const [warehouses, setWarehouses] = useState<WarehouseOption[]>([]);
|
const [subOpen, setSubOpen] = useState(false);
|
||||||
const [createScopeType, setCreateScopeType] = useState<CityPartnerScopeType>(CityPartnerScopeType.CITY_WIDE);
|
const [cities, setCities] = useState<CityOption[]>([]);
|
||||||
const [editScopeType, setEditScopeType] = useState<CityPartnerScopeType>(CityPartnerScopeType.CITY_WIDE);
|
const [warehouses, setWarehouses] = useState<WarehouseOption[]>([]);
|
||||||
const [createCityId, setCreateCityId] = useState<string | undefined>();
|
const [createScopeType, setCreateScopeType] = useState<CityPartnerScopeType>(CityPartnerScopeType.CITY_WIDE);
|
||||||
|
const [editScopeType, setEditScopeType] = useState<CityPartnerScopeType>(CityPartnerScopeType.CITY_WIDE);
|
||||||
const createCityCode = createCityId ? cities.find((c) => c.id === createCityId)?.code : undefined;
|
const [createCityId, setCreateCityId] = useState<string | undefined>();
|
||||||
const editCityCode = detail?.cityId ? cities.find((c) => c.id === detail.cityId)?.code : undefined;
|
|
||||||
|
const createCityCode = createCityId ? cities.find((c) => c.id === createCityId)?.code : undefined;
|
||||||
function formatApiError(err: unknown): string | null {
|
const editCityCode = detail?.cityId ? cities.find((c) => c.id === detail.cityId)?.code : undefined;
|
||||||
if (err && typeof err === 'object' && 'errorFields' in err) return null;
|
|
||||||
if (!(err instanceof Error)) return '操作失败';
|
function formatApiError(err: unknown): string | null {
|
||||||
return err.message.replace(/\b(\d{6})\b/g, (code) => {
|
if (err && typeof err === 'object' && 'errorFields' in err) return null;
|
||||||
const label = districtCodeLabel(code);
|
if (!(err instanceof Error)) return '操作失败';
|
||||||
return label !== code ? `${label}(${code})` : code;
|
return err.message.replace(/\b(\d{6})\b/g, (code) => {
|
||||||
});
|
const label = districtCodeLabel(code);
|
||||||
}
|
return label !== code ? `${label}(${code})` : code;
|
||||||
|
});
|
||||||
const loadCities = useCallback(async () => {
|
}
|
||||||
const res = await request<Paginated<CityOption>>(`/admin/cities?pageSize=${ADMIN_OPTIONS_PAGE_SIZE}`);
|
|
||||||
setCities(res.items);
|
const loadCities = useCallback(async () => {
|
||||||
}, []);
|
const res = await request<Paginated<CityOption>>(`/admin/cities?pageSize=${ADMIN_OPTIONS_PAGE_SIZE}`);
|
||||||
|
setCities(res.items);
|
||||||
const loadWarehouses = useCallback(async (cityId: string) => {
|
}, []);
|
||||||
const rows = await request<WarehouseOption[]>(`/admin/cities/${cityId}/warehouses`);
|
|
||||||
setWarehouses(rows.map((w) => ({ id: w.id, name: (w as { name: string }).name })));
|
const loadWarehouses = useCallback(async (cityId: string) => {
|
||||||
}, []);
|
const rows = await request<WarehouseOption[]>(`/admin/cities/${cityId}/warehouses`);
|
||||||
|
setWarehouses(rows.map((w) => ({ id: w.id, name: (w as { name: string }).name })));
|
||||||
useEffect(() => {
|
}, []);
|
||||||
void loadCities();
|
|
||||||
}, [loadCities]);
|
useEffect(() => {
|
||||||
|
void loadCities();
|
||||||
async function openPartner(id: string) {
|
}, [loadCities]);
|
||||||
const d = await request<PartnerDetail>(`/admin/partners/${id}`);
|
|
||||||
setDetail(d);
|
async function openPartner(id: string) {
|
||||||
setEditScopeType((d.scopeType as CityPartnerScopeType) || CityPartnerScopeType.CITY_WIDE);
|
const d = await request<PartnerDetail>(`/admin/partners/${id}`);
|
||||||
if (d.cityId) await loadWarehouses(d.cityId);
|
setDetail(d);
|
||||||
editForm.setFieldsValue({
|
setEditScopeType((d.scopeType as CityPartnerScopeType) || CityPartnerScopeType.CITY_WIDE);
|
||||||
name: d.name,
|
if (d.cityId) await loadWarehouses(d.cityId);
|
||||||
phone: d.phone,
|
editForm.setFieldsValue({
|
||||||
companyName: d.companyName,
|
name: d.name,
|
||||||
contactPhone: d.contactPhone ?? d.phone,
|
phone: d.phone,
|
||||||
address: d.address ?? '',
|
companyName: d.companyName,
|
||||||
scopeType: d.scopeType,
|
contactPhone: d.contactPhone ?? d.phone,
|
||||||
districtCodes: d.districtCodes ?? [],
|
address: d.address ?? '',
|
||||||
orderCommissionRate: (d.orderCommissionRate ?? 0) * 100,
|
scopeType: d.scopeType,
|
||||||
redeemCommissionRate: (d.redeemCommissionRate ?? 0.03) * 100,
|
districtCodes: d.districtCodes ?? [],
|
||||||
bindingStatus: d.bindingStatus,
|
orderCommissionRate: (d.orderCommissionRate ?? 0) * 100,
|
||||||
managedWarehouseId: d.managedWarehouseId,
|
redeemCommissionRate: (d.redeemCommissionRate ?? 0.03) * 100,
|
||||||
bankAccountName: d.bankAccountName ?? '',
|
bindingStatus: d.bindingStatus,
|
||||||
bankAccountNo: d.bankAccountNo ?? '',
|
managedWarehouseId: d.managedWarehouseId,
|
||||||
bankBranch: d.bankBranch ?? '',
|
bankAccountName: d.bankAccountName ?? '',
|
||||||
});
|
bankAccountNo: d.bankAccountNo ?? '',
|
||||||
setDrawerOpen(true);
|
bankBranch: d.bankBranch ?? '',
|
||||||
}
|
});
|
||||||
|
setDrawerOpen(true);
|
||||||
async function savePartner() {
|
}
|
||||||
if (!detail) return;
|
|
||||||
try {
|
async function savePartner() {
|
||||||
const v = await editForm.validateFields();
|
if (!detail) return;
|
||||||
const body = {
|
try {
|
||||||
...v,
|
const v = await editForm.validateFields();
|
||||||
orderCommissionRate: Number(v.orderCommissionRate ?? 0) / 100,
|
const body = {
|
||||||
redeemCommissionRate: Number(v.redeemCommissionRate ?? 3) / 100,
|
...v,
|
||||||
districtCodes: editScopeType === CityPartnerScopeType.DISTRICT ? flattenDistrictCodes(v.districtCodes) : undefined,
|
orderCommissionRate: Number(v.orderCommissionRate ?? 0) / 100,
|
||||||
};
|
redeemCommissionRate: Number(v.redeemCommissionRate ?? 3) / 100,
|
||||||
await request(`/admin/partners/${detail.id}`, { method: 'PUT', body: JSON.stringify(body) });
|
districtCodes: editScopeType === CityPartnerScopeType.DISTRICT ? flattenDistrictCodes(v.districtCodes) : undefined,
|
||||||
message.success('已保存');
|
};
|
||||||
setDrawerOpen(false);
|
await request(`/admin/partners/${detail.id}`, { method: 'PUT', body: JSON.stringify(body) });
|
||||||
void reload();
|
message.success('已保存');
|
||||||
} catch (e) {
|
setDrawerOpen(false);
|
||||||
const msg = formatApiError(e);
|
void reload();
|
||||||
if (msg) message.error(msg);
|
} catch (e) {
|
||||||
}
|
const msg = formatApiError(e);
|
||||||
}
|
if (msg) message.error(msg);
|
||||||
|
}
|
||||||
const baseColumns: ColumnsType<Row> = [
|
}
|
||||||
{ title: '城市', dataIndex: 'cityName', width: 100 },
|
|
||||||
{
|
const baseColumns: ColumnsType<Row> = [
|
||||||
title: '区县',
|
{ title: '城市', dataIndex: 'cityName', width: 100 },
|
||||||
dataIndex: 'districtCodes',
|
{
|
||||||
width: 160,
|
title: '区县',
|
||||||
|
dataIndex: 'districtCodes',
|
||||||
render: (codes: string[] | null | undefined, row) =>
|
width: 160,
|
||||||
row.scopeType === CityPartnerScopeType.CITY_WIDE ? '全城' : formatDistrictLabels(codes),
|
render: (codes: string[] | null | undefined, row) =>
|
||||||
},
|
row.scopeType === CityPartnerScopeType.CITY_WIDE ? '全城' : formatDistrictLabels(codes),
|
||||||
{ title: '公司名', dataIndex: 'companyName' },
|
},
|
||||||
{ title: '主账号', dataIndex: 'phone', width: 130 },
|
{
|
||||||
{
|
title: '公司名',
|
||||||
title: '管辖',
|
dataIndex: 'companyName',
|
||||||
dataIndex: 'scopeType',
|
render: (v, row) => (
|
||||||
width: 100,
|
<AdminPrimaryLink onClick={() => void openPartner(row.id)}>{v}</AdminPrimaryLink>
|
||||||
render: (v) => (v ? CITY_PARTNER_SCOPE_LABELS[v as keyof typeof CITY_PARTNER_SCOPE_LABELS] || v : '—'),
|
),
|
||||||
},
|
},
|
||||||
{ title: '门店', dataIndex: 'storeCount', width: 70 },
|
{ title: '主账号', dataIndex: 'phone', width: 130 },
|
||||||
{ title: '子账号', dataIndex: 'accountCount', width: 80, render: (n) => Math.max(0, n - 1) },
|
{
|
||||||
{ title: '创建', dataIndex: 'createdAt', width: 160, render: fmtTime },
|
title: '管辖',
|
||||||
{
|
dataIndex: 'scopeType',
|
||||||
title: '操作',
|
width: 100,
|
||||||
width: 120,
|
render: (v) => (v ? CITY_PARTNER_SCOPE_LABELS[v as keyof typeof CITY_PARTNER_SCOPE_LABELS] || v : '—'),
|
||||||
render: (_, row) => (
|
},
|
||||||
<Button type="link" size="small" onClick={() => void openPartner(row.id)}>
|
{ title: '门店', dataIndex: 'storeCount', width: 70 },
|
||||||
管理
|
{ title: '子账号', dataIndex: 'accountCount', width: 80, render: (n) => Math.max(0, n - 1) },
|
||||||
</Button>
|
{ title: '创建', dataIndex: 'createdAt', width: 160, render: fmtTime },
|
||||||
),
|
{
|
||||||
},
|
title: '操作',
|
||||||
];
|
width: 120,
|
||||||
|
render: (_, row) => (
|
||||||
|
<Button type="link" size="small" onClick={() => void openPartner(row.id)}>
|
||||||
|
管理
|
||||||
|
</Button>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
const { columns, settingsButton, settingsModal } = useAdminListColumns('partners', baseColumns, { page, pageSize });
|
const { columns, settingsButton, settingsModal } = useAdminListColumns('partners', baseColumns, { page, pageSize });
|
||||||
|
|
||||||
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div>
|
{settingsModal}
|
||||||
{settingsModal}
|
<AdminListHeader
|
||||||
<Space style={{ marginBottom: 16, width: '100%', justifyContent: 'space-between' }}>
|
title="开城合伙人"
|
||||||
<Typography.Title level={4} style={{ margin: 0 }}>开城合伙人</Typography.Title>
|
settings={settingsButton}
|
||||||
{settingsButton}
|
actions={
|
||||||
<Button type="primary" onClick={() => { setCreateOpen(true); createForm.resetFields(); setCreateScopeType(CityPartnerScopeType.CITY_WIDE); }}>
|
<Button type="primary" onClick={() => { setCreateOpen(true); createForm.resetFields(); setCreateScopeType(CityPartnerScopeType.CITY_WIDE); }}>
|
||||||
新建城市合伙人
|
新建城市合伙人
|
||||||
</Button>
|
</Button>
|
||||||
</Space>
|
}
|
||||||
<Form form={form} layout="inline" style={{ marginBottom: 16 }} onFinish={(v) => { setFilters(v); setPage(1); }}>
|
/>
|
||||||
<Form.Item name="companyName" label="公司"><Input allowClear /></Form.Item>
|
<Form form={form} layout="inline" style={{ marginBottom: 16 }} onFinish={(v) => { setFilters(v); setPage(1); }}>
|
||||||
<Form.Item name="contactPhone" label="电话"><Input allowClear /></Form.Item>
|
<Form.Item name="companyName" label="公司"><Input allowClear /></Form.Item>
|
||||||
<Form.Item><Button type="primary" htmlType="submit">查询</Button></Form.Item>
|
<Form.Item name="contactPhone" label="电话"><Input allowClear /></Form.Item>
|
||||||
</Form>
|
<Form.Item><Button type="primary" htmlType="submit">查询</Button></Form.Item>
|
||||||
<Table
|
</Form>
|
||||||
rowKey="id"
|
<Table
|
||||||
className="admin-table-nowrap"
|
rowKey="id"
|
||||||
loading={loading}
|
className="admin-table-nowrap"
|
||||||
columns={columns}
|
loading={loading}
|
||||||
dataSource={data?.items ?? []}
|
columns={columns}
|
||||||
pagination={{
|
dataSource={data?.items ?? []}
|
||||||
current: page,
|
pagination={{
|
||||||
pageSize,
|
current: page,
|
||||||
total: data?.total ?? 0,
|
pageSize,
|
||||||
showSizeChanger: true,
|
total: data?.total ?? 0,
|
||||||
onChange: (p, ps) => { setPage(p); setPageSize(ps); },
|
showSizeChanger: true,
|
||||||
}}
|
onChange: (p, ps) => { setPage(p); setPageSize(ps); },
|
||||||
/>
|
}}
|
||||||
|
/>
|
||||||
<Drawer
|
|
||||||
title="城市合伙人"
|
<Drawer
|
||||||
width={640}
|
title="城市合伙人"
|
||||||
open={drawerOpen}
|
width={640}
|
||||||
onClose={() => setDrawerOpen(false)}
|
open={drawerOpen}
|
||||||
extra={<Button type="primary" onClick={() => void savePartner()}>保存</Button>}
|
onClose={() => setDrawerOpen(false)}
|
||||||
>
|
extra={<Button type="primary" onClick={() => void savePartner()}>保存</Button>}
|
||||||
{detail && (
|
>
|
||||||
<Tabs
|
{detail && (
|
||||||
items={[
|
<Tabs
|
||||||
{
|
items={[
|
||||||
key: 'info',
|
{
|
||||||
label: '基本信息',
|
key: 'info',
|
||||||
children: (
|
label: '基本信息',
|
||||||
<Form form={editForm} layout="vertical">
|
children: (
|
||||||
<Form.Item name="companyName" label="公司名"><Input placeholder="选填" /></Form.Item>
|
<Form form={editForm} layout="vertical">
|
||||||
<Form.Item name="name" label="主账号姓名" rules={[{ required: true }]}><Input /></Form.Item>
|
<Form.Item name="companyName" label="公司名"><Input placeholder="选填" /></Form.Item>
|
||||||
<Form.Item name="phone" label="登录手机号" rules={[{ required: true }]}><Input /></Form.Item>
|
<Form.Item name="name" label="主账号姓名" rules={[{ required: true }]}><Input /></Form.Item>
|
||||||
<Form.Item name="contactPhone" label="业务联系电话"><Input /></Form.Item>
|
<Form.Item name="phone" label="登录手机号" rules={[{ required: true }]}><Input /></Form.Item>
|
||||||
<Form.Item name="address" label="地址"><Input placeholder="选填" /></Form.Item>
|
<Form.Item name="contactPhone" label="业务联系电话"><Input /></Form.Item>
|
||||||
<Form.Item name="scopeType" label="管辖类型" rules={[{ required: true }]}>
|
<Form.Item name="address" label="地址"><Input placeholder="选填" /></Form.Item>
|
||||||
<Select options={SCOPE_OPTIONS} onChange={(v) => setEditScopeType(v)} />
|
<Form.Item name="scopeType" label="管辖类型" rules={[{ required: true }]}>
|
||||||
</Form.Item>
|
<Select options={SCOPE_OPTIONS} onChange={(v) => setEditScopeType(v)} />
|
||||||
{editScopeType === CityPartnerScopeType.DISTRICT && (
|
</Form.Item>
|
||||||
<Form.Item
|
{editScopeType === CityPartnerScopeType.DISTRICT && (
|
||||||
name="districtCodes"
|
<Form.Item
|
||||||
label="区县"
|
name="districtCodes"
|
||||||
extra="仅作标识,可多选当前城市下的区县(不做互斥)"
|
label="区县"
|
||||||
>
|
extra="仅作标识,可多选当前城市下的区县(不做互斥)"
|
||||||
<CityDistrictMultiSelect cityCode={editCityCode} />
|
>
|
||||||
</Form.Item>
|
<CityDistrictMultiSelect cityCode={editCityCode} />
|
||||||
)}
|
</Form.Item>
|
||||||
<Space style={{ width: '100%' }} size="large">
|
)}
|
||||||
<Form.Item name="orderCommissionRate" label="订单佣金 %"><InputNumber min={0} max={100} precision={2} /></Form.Item>
|
<Space style={{ width: '100%' }} size="large">
|
||||||
<Form.Item name="redeemCommissionRate" label="核销佣金 %"><InputNumber min={0} max={100} precision={2} /></Form.Item>
|
<Form.Item name="orderCommissionRate" label="订单佣金 %"><InputNumber min={0} max={100} precision={2} /></Form.Item>
|
||||||
</Space>
|
<Form.Item name="redeemCommissionRate" label="核销佣金 %"><InputNumber min={0} max={100} precision={2} /></Form.Item>
|
||||||
<Form.Item name="managedWarehouseId" label="管仓仓库">
|
</Space>
|
||||||
<Select allowClear options={warehouses.map((w) => ({ value: w.id, label: w.name }))} />
|
<Form.Item name="managedWarehouseId" label="管仓仓库">
|
||||||
</Form.Item>
|
<Select allowClear options={warehouses.map((w) => ({ value: w.id, label: w.name }))} />
|
||||||
<Form.Item name="bankAccountName" label="户名"><Input /></Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="bankAccountNo" label="账号"><Input /></Form.Item>
|
<Form.Item name="bankAccountName" label="户名"><Input /></Form.Item>
|
||||||
<Form.Item name="bankBranch" label="开户行"><Input /></Form.Item>
|
<Form.Item name="bankAccountNo" label="账号"><Input /></Form.Item>
|
||||||
</Form>
|
<Form.Item name="bankBranch" label="开户行"><Input /></Form.Item>
|
||||||
),
|
</Form>
|
||||||
},
|
),
|
||||||
{
|
},
|
||||||
key: 'staff',
|
{
|
||||||
label: '子账号',
|
key: 'staff',
|
||||||
children: (
|
label: '子账号',
|
||||||
<>
|
children: (
|
||||||
<Button type="primary" style={{ marginBottom: 12 }} onClick={() => { subForm.resetFields(); setSubOpen(true); }}>
|
<>
|
||||||
添加子账号
|
<Button type="primary" style={{ marginBottom: 12 }} onClick={() => { subForm.resetFields(); setSubOpen(true); }}>
|
||||||
</Button>
|
添加子账号
|
||||||
<Table
|
</Button>
|
||||||
size="small"
|
<Table
|
||||||
rowKey="id"
|
size="small"
|
||||||
pagination={false}
|
rowKey="id"
|
||||||
dataSource={detail.children ?? []}
|
pagination={false}
|
||||||
columns={[
|
dataSource={detail.children ?? []}
|
||||||
{ title: '姓名', dataIndex: 'name' },
|
columns={[
|
||||||
{ title: '手机', dataIndex: 'phone' },
|
{ title: '姓名', dataIndex: 'name' },
|
||||||
{ title: '状态', dataIndex: 'status', render: (s) => <Tag>{s}</Tag> },
|
{ title: '手机', dataIndex: 'phone' },
|
||||||
{
|
{ title: '状态', dataIndex: 'status', render: (s) => <Tag>{s}</Tag> },
|
||||||
title: '权限',
|
{
|
||||||
dataIndex: 'permissions',
|
title: '权限',
|
||||||
render: (p: string[] | undefined) => p?.map((k) => PARTNER_PERMISSION_LABELS[k as keyof typeof PARTNER_PERMISSION_LABELS] || k).join('、') || '—',
|
dataIndex: 'permissions',
|
||||||
},
|
render: (p: string[] | undefined) => p?.map((k) => PARTNER_PERMISSION_LABELS[k as keyof typeof PARTNER_PERMISSION_LABELS] || k).join('、') || '—',
|
||||||
]}
|
},
|
||||||
/>
|
]}
|
||||||
</>
|
/>
|
||||||
),
|
</>
|
||||||
},
|
),
|
||||||
]}
|
},
|
||||||
/>
|
]}
|
||||||
)}
|
/>
|
||||||
</Drawer>
|
)}
|
||||||
|
</Drawer>
|
||||||
<Modal
|
|
||||||
title="新建城市合伙人"
|
<Modal
|
||||||
open={createOpen}
|
title="新建城市合伙人"
|
||||||
width={560}
|
open={createOpen}
|
||||||
onCancel={() => setCreateOpen(false)}
|
width={560}
|
||||||
onOk={async () => {
|
onCancel={() => setCreateOpen(false)}
|
||||||
try {
|
onOk={async () => {
|
||||||
const v = await createForm.validateFields();
|
try {
|
||||||
await request('/admin/partners', {
|
const v = await createForm.validateFields();
|
||||||
method: 'POST',
|
await request('/admin/partners', {
|
||||||
body: JSON.stringify({
|
method: 'POST',
|
||||||
...v,
|
body: JSON.stringify({
|
||||||
orderCommissionRate: Number(v.orderCommissionRate ?? 0) / 100,
|
...v,
|
||||||
redeemCommissionRate: Number(v.redeemCommissionRate ?? 3) / 100,
|
orderCommissionRate: Number(v.orderCommissionRate ?? 0) / 100,
|
||||||
districtCodes: createScopeType === CityPartnerScopeType.DISTRICT ? flattenDistrictCodes(v.districtCodes) : undefined,
|
redeemCommissionRate: Number(v.redeemCommissionRate ?? 3) / 100,
|
||||||
}),
|
districtCodes: createScopeType === CityPartnerScopeType.DISTRICT ? flattenDistrictCodes(v.districtCodes) : undefined,
|
||||||
});
|
}),
|
||||||
message.success('已创建');
|
});
|
||||||
setCreateOpen(false);
|
message.success('已创建');
|
||||||
createForm.resetFields();
|
setCreateOpen(false);
|
||||||
void reload();
|
createForm.resetFields();
|
||||||
} catch (e) {
|
void reload();
|
||||||
const msg = formatApiError(e);
|
} catch (e) {
|
||||||
if (msg) message.error(msg);
|
const msg = formatApiError(e);
|
||||||
}
|
if (msg) message.error(msg);
|
||||||
}}
|
}
|
||||||
>
|
}}
|
||||||
<Form form={createForm} layout="vertical" initialValues={{ orderCommissionRate: 0, redeemCommissionRate: 3, scopeType: CityPartnerScopeType.CITY_WIDE }}>
|
>
|
||||||
<Form.Item name="cityId" label="开城城市" rules={[{ required: true }]}>
|
<Form form={createForm} layout="vertical" initialValues={{ orderCommissionRate: 0, redeemCommissionRate: 3, scopeType: CityPartnerScopeType.CITY_WIDE }}>
|
||||||
<Select
|
<Form.Item name="cityId" label="开城城市" rules={[{ required: true }]}>
|
||||||
options={cities.map((c) => ({ value: c.id, label: `${c.name} (${c.code})` }))}
|
<Select
|
||||||
onChange={(id) => {
|
options={cities.map((c) => ({ value: c.id, label: `${c.name} (${c.code})` }))}
|
||||||
setCreateCityId(id);
|
onChange={(id) => {
|
||||||
createForm.setFieldsValue({ districtCodes: undefined });
|
setCreateCityId(id);
|
||||||
void loadWarehouses(id);
|
createForm.setFieldsValue({ districtCodes: undefined });
|
||||||
}}
|
void loadWarehouses(id);
|
||||||
/>
|
}}
|
||||||
</Form.Item>
|
/>
|
||||||
<Form.Item name="companyName" label="公司名"><Input placeholder="选填" /></Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="name" label="主账号姓名" rules={[{ required: true }]}><Input /></Form.Item>
|
<Form.Item name="companyName" label="公司名"><Input placeholder="选填" /></Form.Item>
|
||||||
<Form.Item name="phone" label="登录手机号" rules={[{ required: true }]}><Input /></Form.Item>
|
<Form.Item name="name" label="主账号姓名" rules={[{ required: true }]}><Input /></Form.Item>
|
||||||
<Form.Item name="address" label="地址"><Input placeholder="选填" /></Form.Item>
|
<Form.Item name="phone" label="登录手机号" rules={[{ required: true }]}><Input /></Form.Item>
|
||||||
<Form.Item name="scopeType" label="管辖类型" rules={[{ required: true }]}>
|
<Form.Item name="address" label="地址"><Input placeholder="选填" /></Form.Item>
|
||||||
<Select options={SCOPE_OPTIONS} onChange={(v) => setCreateScopeType(v)} />
|
<Form.Item name="scopeType" label="管辖类型" rules={[{ required: true }]}>
|
||||||
</Form.Item>
|
<Select options={SCOPE_OPTIONS} onChange={(v) => setCreateScopeType(v)} />
|
||||||
{createScopeType === CityPartnerScopeType.DISTRICT && (
|
</Form.Item>
|
||||||
<Form.Item
|
{createScopeType === CityPartnerScopeType.DISTRICT && (
|
||||||
name="districtCodes"
|
<Form.Item
|
||||||
label="区县"
|
name="districtCodes"
|
||||||
extra="选填;仅作标识,可多选当前城市下的区县(不做互斥)"
|
label="区县"
|
||||||
>
|
extra="选填;仅作标识,可多选当前城市下的区县(不做互斥)"
|
||||||
<CityDistrictMultiSelect cityCode={createCityCode} />
|
>
|
||||||
</Form.Item>
|
<CityDistrictMultiSelect cityCode={createCityCode} />
|
||||||
)}
|
</Form.Item>
|
||||||
<Space style={{ width: '100%' }} size="large">
|
)}
|
||||||
<Form.Item name="orderCommissionRate" label="订单佣金 %"><InputNumber min={0} max={100} precision={2} /></Form.Item>
|
<Space style={{ width: '100%' }} size="large">
|
||||||
<Form.Item name="redeemCommissionRate" label="核销佣金 %"><InputNumber min={0} max={100} precision={2} /></Form.Item>
|
<Form.Item name="orderCommissionRate" label="订单佣金 %"><InputNumber min={0} max={100} precision={2} /></Form.Item>
|
||||||
</Space>
|
<Form.Item name="redeemCommissionRate" label="核销佣金 %"><InputNumber min={0} max={100} precision={2} /></Form.Item>
|
||||||
{createCityId && (
|
</Space>
|
||||||
<Form.Item name="managedWarehouseId" label="管仓仓库(可选)">
|
{createCityId && (
|
||||||
<Select allowClear options={warehouses.map((w) => ({ value: w.id, label: w.name }))} />
|
<Form.Item name="managedWarehouseId" label="管仓仓库(可选)">
|
||||||
</Form.Item>
|
<Select allowClear options={warehouses.map((w) => ({ value: w.id, label: w.name }))} />
|
||||||
)}
|
</Form.Item>
|
||||||
</Form>
|
)}
|
||||||
</Modal>
|
</Form>
|
||||||
|
</Modal>
|
||||||
<Modal
|
|
||||||
title="添加子账号"
|
<Modal
|
||||||
open={subOpen}
|
title="添加子账号"
|
||||||
onCancel={() => setSubOpen(false)}
|
open={subOpen}
|
||||||
onOk={async () => {
|
onCancel={() => setSubOpen(false)}
|
||||||
if (!detail) return;
|
onOk={async () => {
|
||||||
const v = await subForm.validateFields();
|
if (!detail) return;
|
||||||
await request('/admin/partner-accounts', {
|
const v = await subForm.validateFields();
|
||||||
method: 'POST',
|
await request('/admin/partner-accounts', {
|
||||||
body: JSON.stringify({ ...v, parentAccountId: detail.id }),
|
method: 'POST',
|
||||||
});
|
body: JSON.stringify({ ...v, parentAccountId: detail.id }),
|
||||||
message.success('已创建');
|
});
|
||||||
setSubOpen(false);
|
message.success('已创建');
|
||||||
void openPartner(detail.id);
|
setSubOpen(false);
|
||||||
}}
|
void openPartner(detail.id);
|
||||||
>
|
}}
|
||||||
<Form form={subForm} layout="vertical">
|
>
|
||||||
<Form.Item name="name" label="姓名" rules={[{ required: true }]}><Input /></Form.Item>
|
<Form form={subForm} layout="vertical">
|
||||||
<Form.Item name="phone" label="手机号" rules={[{ required: true }]}><Input /></Form.Item>
|
<Form.Item name="name" label="姓名" rules={[{ required: true }]}><Input /></Form.Item>
|
||||||
<Form.Item name="permissions" label="权限">
|
<Form.Item name="phone" label="手机号" rules={[{ required: true }]}><Input /></Form.Item>
|
||||||
<Select mode="multiple" options={PERM_OPTIONS} />
|
<Form.Item name="permissions" label="权限">
|
||||||
</Form.Item>
|
<Select mode="multiple" options={PERM_OPTIONS} />
|
||||||
</Form>
|
</Form.Item>
|
||||||
</Modal>
|
</Form>
|
||||||
</div>
|
</Modal>
|
||||||
);
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,271 +1,279 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Descriptions,
|
Descriptions,
|
||||||
Drawer,
|
Drawer,
|
||||||
Form,
|
Form,
|
||||||
Image,
|
Image,
|
||||||
Input,
|
Input,
|
||||||
Modal,
|
Modal,
|
||||||
Select,
|
Select,
|
||||||
Space,
|
Space,
|
||||||
Table,
|
Table,
|
||||||
Tag,
|
Tag,
|
||||||
Typography,
|
Typography,
|
||||||
message,
|
message,
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
import type { ColumnsType } from 'antd/es/table';
|
import type { ColumnsType } from 'antd/es/table';
|
||||||
import {
|
import {
|
||||||
REDEEM_PENDING_STATUS_LABELS,
|
REDEEM_PENDING_STATUS_LABELS,
|
||||||
type RedeemPendingItem,
|
type RedeemPendingItem,
|
||||||
type RedeemPendingStatus,
|
type RedeemPendingStatus,
|
||||||
} from '@dukang/shared-types';
|
} from '@dukang/shared-types';
|
||||||
import { request } from '../lib/api';
|
import { request } from '../lib/api';
|
||||||
import { fmtTime } from '../lib/constants';
|
import { fmtTime } from '../lib/constants';
|
||||||
import { useAdminList } from '../lib/useAdminList';
|
import { useAdminList } from '../lib/useAdminList';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
const STATUS_COLOR: Record<RedeemPendingStatus, string> = {
|
|
||||||
PENDING: 'orange',
|
|
||||||
COMPLETED: 'green',
|
const STATUS_COLOR: Record<RedeemPendingStatus, string> = {
|
||||||
REJECTED: 'default',
|
PENDING: 'orange',
|
||||||
};
|
COMPLETED: 'green',
|
||||||
|
REJECTED: 'default',
|
||||||
export default function PendingRedeemPage() {
|
};
|
||||||
const [form] = Form.useForm();
|
|
||||||
const [filters, setFilters] = useState<Record<string, string>>({});
|
export default function PendingRedeemPage() {
|
||||||
const { data, loading, page, pageSize, setPage, setPageSize, reload } = useAdminList<RedeemPendingItem>(
|
const [form] = Form.useForm();
|
||||||
'/admin/redeem-pending',
|
const [filters, setFilters] = useState<Record<string, string>>({});
|
||||||
() => {
|
const { data, loading, page, pageSize, setPage, setPageSize, reload } = useAdminList<RedeemPendingItem>(
|
||||||
const qs = new URLSearchParams();
|
'/admin/redeem-pending',
|
||||||
if (filters.status) qs.set('status', filters.status);
|
() => {
|
||||||
if (filters.pendingNo) qs.set('pendingNo', filters.pendingNo);
|
const qs = new URLSearchParams();
|
||||||
if (filters.redeemToken) qs.set('redeemToken', filters.redeemToken);
|
if (filters.status) qs.set('status', filters.status);
|
||||||
if (filters.storeId) qs.set('storeId', filters.storeId);
|
if (filters.pendingNo) qs.set('pendingNo', filters.pendingNo);
|
||||||
return qs;
|
if (filters.redeemToken) qs.set('redeemToken', filters.redeemToken);
|
||||||
},
|
if (filters.storeId) qs.set('storeId', filters.storeId);
|
||||||
[filters],
|
return qs;
|
||||||
);
|
},
|
||||||
const [detail, setDetail] = useState<RedeemPendingItem | null>(null);
|
[filters],
|
||||||
const [drawerOpen, setDrawerOpen] = useState(false);
|
);
|
||||||
const [acting, setActing] = useState(false);
|
const [detail, setDetail] = useState<RedeemPendingItem | null>(null);
|
||||||
const [rejectOpen, setRejectOpen] = useState(false);
|
const [drawerOpen, setDrawerOpen] = useState(false);
|
||||||
const [rejectReason, setRejectReason] = useState('');
|
const [acting, setActing] = useState(false);
|
||||||
|
const [rejectOpen, setRejectOpen] = useState(false);
|
||||||
async function openDetail(id: string) {
|
const [rejectReason, setRejectReason] = useState('');
|
||||||
const res = await request<RedeemPendingItem>(`/admin/redeem-pending/${id}`);
|
|
||||||
setDetail(res);
|
async function openDetail(id: string) {
|
||||||
setDrawerOpen(true);
|
const res = await request<RedeemPendingItem>(`/admin/redeem-pending/${id}`);
|
||||||
}
|
setDetail(res);
|
||||||
|
setDrawerOpen(true);
|
||||||
async function complete() {
|
}
|
||||||
if (!detail) return;
|
|
||||||
setActing(true);
|
async function complete() {
|
||||||
try {
|
if (!detail) return;
|
||||||
await request(`/admin/redeem-pending/${detail.id}/complete`, { method: 'POST', body: '{}' });
|
setActing(true);
|
||||||
message.success('已补核销');
|
try {
|
||||||
setDrawerOpen(false);
|
await request(`/admin/redeem-pending/${detail.id}/complete`, { method: 'POST', body: '{}' });
|
||||||
void reload();
|
message.success('已补核销');
|
||||||
} catch (e) {
|
setDrawerOpen(false);
|
||||||
message.error(e instanceof Error ? e.message : '补核销失败');
|
void reload();
|
||||||
} finally {
|
} catch (e) {
|
||||||
setActing(false);
|
message.error(e instanceof Error ? e.message : '补核销失败');
|
||||||
}
|
} finally {
|
||||||
}
|
setActing(false);
|
||||||
|
}
|
||||||
async function reject() {
|
}
|
||||||
if (!detail || !rejectReason.trim()) {
|
|
||||||
message.error('请填写驳回原因');
|
async function reject() {
|
||||||
return;
|
if (!detail || !rejectReason.trim()) {
|
||||||
}
|
message.error('请填写驳回原因');
|
||||||
setActing(true);
|
return;
|
||||||
try {
|
}
|
||||||
await request(`/admin/redeem-pending/${detail.id}/reject`, {
|
setActing(true);
|
||||||
method: 'POST',
|
try {
|
||||||
body: JSON.stringify({ reason: rejectReason.trim() }),
|
await request(`/admin/redeem-pending/${detail.id}/reject`, {
|
||||||
});
|
method: 'POST',
|
||||||
message.success('已驳回');
|
body: JSON.stringify({ reason: rejectReason.trim() }),
|
||||||
setRejectOpen(false);
|
});
|
||||||
setDrawerOpen(false);
|
message.success('已驳回');
|
||||||
void reload();
|
setRejectOpen(false);
|
||||||
} catch (e) {
|
setDrawerOpen(false);
|
||||||
message.error(e instanceof Error ? e.message : '驳回失败');
|
void reload();
|
||||||
} finally {
|
} catch (e) {
|
||||||
setActing(false);
|
message.error(e instanceof Error ? e.message : '驳回失败');
|
||||||
}
|
} finally {
|
||||||
}
|
setActing(false);
|
||||||
|
}
|
||||||
const baseColumns: ColumnsType<RedeemPendingItem> = [
|
}
|
||||||
{ title: '待处理单号', dataIndex: 'pendingNo', width: 170 },
|
|
||||||
{
|
const baseColumns: ColumnsType<RedeemPendingItem> = [
|
||||||
title: '核销码 ID',
|
{
|
||||||
dataIndex: 'redeemToken',
|
title: '待处理单号',
|
||||||
width: 160,
|
dataIndex: 'pendingNo',
|
||||||
|
width: 170,
|
||||||
render: (v: string) => <Typography.Text copyable={{ text: v }}>{v.slice(0, 8)}…</Typography.Text>,
|
render: (v, row) => (
|
||||||
},
|
<AdminPrimaryLink onClick={() => void openDetail(row.id)}>{v}</AdminPrimaryLink>
|
||||||
{ title: '门店', dataIndex: ['store', 'name'], width: 140, render: (_, row) => row.store?.name || '—' },
|
),
|
||||||
{
|
},
|
||||||
title: '用户',
|
{
|
||||||
width: 120,
|
title: '核销码 ID',
|
||||||
render: (_, row) => row.user?.userNo || row.user?.phone || '—',
|
dataIndex: 'redeemToken',
|
||||||
},
|
width: 160,
|
||||||
{ title: '金额', dataIndex: 'amount', width: 90, render: (v) => `¥${v}` },
|
render: (v: string) => <Typography.Text copyable={{ text: v }}>{v.slice(0, 8)}…</Typography.Text>,
|
||||||
{ title: '失败次数', dataIndex: 'failCount', width: 90 },
|
},
|
||||||
{
|
{ title: '门店', dataIndex: ['store', 'name'], width: 140, render: (_, row) => row.store?.name || '—' },
|
||||||
title: '状态',
|
{
|
||||||
dataIndex: 'status',
|
title: '用户',
|
||||||
width: 100,
|
width: 120,
|
||||||
render: (s: RedeemPendingStatus) => (
|
render: (_, row) => row.user?.userNo || row.user?.phone || '—',
|
||||||
<Tag color={STATUS_COLOR[s]}>{REDEEM_PENDING_STATUS_LABELS[s] || s}</Tag>
|
},
|
||||||
),
|
{ title: '金额', dataIndex: 'amount', width: 90, render: (v) => `¥${v}` },
|
||||||
},
|
{ title: '失败次数', dataIndex: 'failCount', width: 90 },
|
||||||
{ title: '提交时间', dataIndex: 'createdAt', width: 160, render: fmtTime },
|
{
|
||||||
{
|
title: '状态',
|
||||||
title: '操作',
|
dataIndex: 'status',
|
||||||
width: 80,
|
width: 100,
|
||||||
fixed: 'right',
|
render: (s: RedeemPendingStatus) => (
|
||||||
render: (_, row) => (
|
<Tag color={STATUS_COLOR[s]}>{REDEEM_PENDING_STATUS_LABELS[s] || s}</Tag>
|
||||||
<Button type="link" size="small" onClick={() => void openDetail(row.id)}>
|
),
|
||||||
详情
|
},
|
||||||
</Button>
|
{ title: '提交时间', dataIndex: 'createdAt', width: 160, render: fmtTime },
|
||||||
),
|
{
|
||||||
},
|
title: '操作',
|
||||||
];
|
width: 80,
|
||||||
|
fixed: 'right',
|
||||||
|
render: (_, row) => (
|
||||||
|
<Button type="link" size="small" onClick={() => void openDetail(row.id)}>
|
||||||
|
详情
|
||||||
|
</Button>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
const { columns, settingsButton, settingsModal } = useAdminListColumns('redeem-pending', baseColumns, { page, pageSize });
|
const { columns, settingsButton, settingsModal } = useAdminListColumns('redeem-pending', baseColumns, { page, pageSize });
|
||||||
|
|
||||||
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div>
|
{settingsModal}
|
||||||
{settingsModal}
|
<AdminListHeader title="待处理核销(弱网兜底)" settings={settingsButton} />
|
||||||
<Typography.Title level={4}>待处理核销(弱网兜底)</Typography.Title>
|
<Form
|
||||||
{settingsButton}
|
form={form}
|
||||||
<Form
|
layout="inline"
|
||||||
form={form}
|
style={{ marginBottom: 16 }}
|
||||||
layout="inline"
|
onFinish={(v) => {
|
||||||
style={{ marginBottom: 16 }}
|
setFilters(v);
|
||||||
onFinish={(v) => {
|
setPage(1);
|
||||||
setFilters(v);
|
}}
|
||||||
setPage(1);
|
>
|
||||||
}}
|
<Form.Item name="pendingNo" label="待处理单号">
|
||||||
>
|
<Input allowClear />
|
||||||
<Form.Item name="pendingNo" label="待处理单号">
|
</Form.Item>
|
||||||
<Input allowClear />
|
<Form.Item name="redeemToken" label="核销码 ID">
|
||||||
</Form.Item>
|
<Input allowClear />
|
||||||
<Form.Item name="redeemToken" label="核销码 ID">
|
</Form.Item>
|
||||||
<Input allowClear />
|
<Form.Item name="storeId" label="门店 ID">
|
||||||
</Form.Item>
|
<Input allowClear />
|
||||||
<Form.Item name="storeId" label="门店 ID">
|
</Form.Item>
|
||||||
<Input allowClear />
|
<Form.Item name="status" label="状态">
|
||||||
</Form.Item>
|
<Select
|
||||||
<Form.Item name="status" label="状态">
|
allowClear
|
||||||
<Select
|
style={{ width: 120 }}
|
||||||
allowClear
|
options={Object.entries(REDEEM_PENDING_STATUS_LABELS).map(([value, label]) => ({
|
||||||
style={{ width: 120 }}
|
value,
|
||||||
options={Object.entries(REDEEM_PENDING_STATUS_LABELS).map(([value, label]) => ({
|
label,
|
||||||
value,
|
}))}
|
||||||
label,
|
/>
|
||||||
}))}
|
</Form.Item>
|
||||||
/>
|
<Form.Item>
|
||||||
</Form.Item>
|
<Button type="primary" htmlType="submit">
|
||||||
<Form.Item>
|
查询
|
||||||
<Button type="primary" htmlType="submit">
|
</Button>
|
||||||
查询
|
</Form.Item>
|
||||||
</Button>
|
</Form>
|
||||||
</Form.Item>
|
|
||||||
</Form>
|
<Table
|
||||||
|
rowKey="id"
|
||||||
<Table
|
loading={loading}
|
||||||
rowKey="id"
|
columns={columns}
|
||||||
loading={loading}
|
dataSource={data?.items ?? []}
|
||||||
columns={columns}
|
scroll={{ x: 'max-content' }}
|
||||||
dataSource={data?.items ?? []}
|
pagination={{
|
||||||
scroll={{ x: 'max-content' }}
|
current: page,
|
||||||
pagination={{
|
pageSize,
|
||||||
current: page,
|
total: data?.total ?? 0,
|
||||||
pageSize,
|
showSizeChanger: true,
|
||||||
total: data?.total ?? 0,
|
onChange: (p, ps) => {
|
||||||
showSizeChanger: true,
|
setPage(p);
|
||||||
onChange: (p, ps) => {
|
setPageSize(ps);
|
||||||
setPage(p);
|
},
|
||||||
setPageSize(ps);
|
}}
|
||||||
},
|
/>
|
||||||
}}
|
|
||||||
/>
|
<Drawer
|
||||||
|
title="待处理核销详情"
|
||||||
<Drawer
|
width={560}
|
||||||
title="待处理核销详情"
|
open={drawerOpen}
|
||||||
width={560}
|
onClose={() => setDrawerOpen(false)}
|
||||||
open={drawerOpen}
|
extra={
|
||||||
onClose={() => setDrawerOpen(false)}
|
detail?.status === 'PENDING' && (
|
||||||
extra={
|
<Space>
|
||||||
detail?.status === 'PENDING' && (
|
<Button danger onClick={() => { setRejectReason(''); setRejectOpen(true); }}>
|
||||||
<Space>
|
驳回
|
||||||
<Button danger onClick={() => { setRejectReason(''); setRejectOpen(true); }}>
|
</Button>
|
||||||
驳回
|
<Button type="primary" loading={acting} onClick={() => void complete()}>
|
||||||
</Button>
|
人工补核销
|
||||||
<Button type="primary" loading={acting} onClick={() => void complete()}>
|
</Button>
|
||||||
人工补核销
|
</Space>
|
||||||
</Button>
|
)
|
||||||
</Space>
|
}
|
||||||
)
|
>
|
||||||
}
|
{detail && (
|
||||||
>
|
<>
|
||||||
{detail && (
|
{detail.photoUrl && (
|
||||||
<>
|
<div style={{ textAlign: 'center', marginBottom: 16 }}>
|
||||||
{detail.photoUrl && (
|
<Image src={detail.photoUrl} alt="核销码照片" style={{ maxHeight: 280 }} />
|
||||||
<div style={{ textAlign: 'center', marginBottom: 16 }}>
|
</div>
|
||||||
<Image src={detail.photoUrl} alt="核销码照片" style={{ maxHeight: 280 }} />
|
)}
|
||||||
</div>
|
<Descriptions column={1} bordered size="small">
|
||||||
)}
|
<Descriptions.Item label="待处理单号">{detail.pendingNo}</Descriptions.Item>
|
||||||
<Descriptions column={1} bordered size="small">
|
<Descriptions.Item label="核销码 ID">
|
||||||
<Descriptions.Item label="待处理单号">{detail.pendingNo}</Descriptions.Item>
|
<Typography.Text copyable>{detail.redeemToken}</Typography.Text>
|
||||||
<Descriptions.Item label="核销码 ID">
|
</Descriptions.Item>
|
||||||
<Typography.Text copyable>{detail.redeemToken}</Typography.Text>
|
<Descriptions.Item label="状态">
|
||||||
</Descriptions.Item>
|
<Tag color={STATUS_COLOR[detail.status]}>
|
||||||
<Descriptions.Item label="状态">
|
{REDEEM_PENDING_STATUS_LABELS[detail.status]}
|
||||||
<Tag color={STATUS_COLOR[detail.status]}>
|
</Tag>
|
||||||
{REDEEM_PENDING_STATUS_LABELS[detail.status]}
|
</Descriptions.Item>
|
||||||
</Tag>
|
<Descriptions.Item label="金额">¥{detail.amount}</Descriptions.Item>
|
||||||
</Descriptions.Item>
|
<Descriptions.Item label="类型">{detail.redeemType}</Descriptions.Item>
|
||||||
<Descriptions.Item label="金额">¥{detail.amount}</Descriptions.Item>
|
<Descriptions.Item label="失败次数">{detail.failCount}</Descriptions.Item>
|
||||||
<Descriptions.Item label="类型">{detail.redeemType}</Descriptions.Item>
|
<Descriptions.Item label="门店">
|
||||||
<Descriptions.Item label="失败次数">{detail.failCount}</Descriptions.Item>
|
{detail.store?.name || '—'}({detail.store?.id})
|
||||||
<Descriptions.Item label="门店">
|
</Descriptions.Item>
|
||||||
{detail.store?.name || '—'}({detail.store?.id})
|
<Descriptions.Item label="用户">
|
||||||
</Descriptions.Item>
|
{detail.user?.userNo || '—'} / {detail.user?.phone || '无手机'}
|
||||||
<Descriptions.Item label="用户">
|
</Descriptions.Item>
|
||||||
{detail.user?.userNo || '—'} / {detail.user?.phone || '无手机'}
|
<Descriptions.Item label="关联核销单">
|
||||||
</Descriptions.Item>
|
{detail.redeemRecord?.redeemNo || '—'}
|
||||||
<Descriptions.Item label="关联核销单">
|
</Descriptions.Item>
|
||||||
{detail.redeemRecord?.redeemNo || '—'}
|
<Descriptions.Item label="驳回原因">{detail.rejectReason || '—'}</Descriptions.Item>
|
||||||
</Descriptions.Item>
|
<Descriptions.Item label="备注">{detail.remark || '—'}</Descriptions.Item>
|
||||||
<Descriptions.Item label="驳回原因">{detail.rejectReason || '—'}</Descriptions.Item>
|
<Descriptions.Item label="提交时间">{fmtTime(detail.createdAt)}</Descriptions.Item>
|
||||||
<Descriptions.Item label="备注">{detail.remark || '—'}</Descriptions.Item>
|
<Descriptions.Item label="处理时间">
|
||||||
<Descriptions.Item label="提交时间">{fmtTime(detail.createdAt)}</Descriptions.Item>
|
{detail.processedAt ? fmtTime(detail.processedAt) : '—'}
|
||||||
<Descriptions.Item label="处理时间">
|
</Descriptions.Item>
|
||||||
{detail.processedAt ? fmtTime(detail.processedAt) : '—'}
|
</Descriptions>
|
||||||
</Descriptions.Item>
|
</>
|
||||||
</Descriptions>
|
)}
|
||||||
</>
|
</Drawer>
|
||||||
)}
|
|
||||||
</Drawer>
|
<Modal
|
||||||
|
title="驳回待处理单"
|
||||||
<Modal
|
open={rejectOpen}
|
||||||
title="驳回待处理单"
|
okText="确认驳回"
|
||||||
open={rejectOpen}
|
okButtonProps={{ danger: true, loading: acting, disabled: !rejectReason.trim() }}
|
||||||
okText="确认驳回"
|
onOk={() => void reject()}
|
||||||
okButtonProps={{ danger: true, loading: acting, disabled: !rejectReason.trim() }}
|
onCancel={() => setRejectOpen(false)}
|
||||||
onOk={() => void reject()}
|
>
|
||||||
onCancel={() => setRejectOpen(false)}
|
<Input.TextArea
|
||||||
>
|
rows={3}
|
||||||
<Input.TextArea
|
placeholder="请填写驳回原因"
|
||||||
rows={3}
|
value={rejectReason}
|
||||||
placeholder="请填写驳回原因"
|
onChange={(e) => setRejectReason(e.target.value)}
|
||||||
value={rejectReason}
|
/>
|
||||||
onChange={(e) => setRejectReason(e.target.value)}
|
</Modal>
|
||||||
/>
|
</div>
|
||||||
</Modal>
|
);
|
||||||
</div>
|
}
|
||||||
);
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import DetailImageUrlList from '../components/DetailImageUrlList';
|
|||||||
import type { ProductDetailTemplateDto } from '../lib/product-detail-templates';
|
import type { ProductDetailTemplateDto } from '../lib/product-detail-templates';
|
||||||
import { TEMPLATE_MAX_DETAIL_IMAGES } from '../lib/product-detail-templates';
|
import { TEMPLATE_MAX_DETAIL_IMAGES } from '../lib/product-detail-templates';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
|
||||||
|
|
||||||
type Row = ProductDetailTemplateDto;
|
type Row = ProductDetailTemplateDto;
|
||||||
@@ -140,7 +141,23 @@ export default function ProductDetailTemplatesPage() {
|
|||||||
|
|
||||||
const baseColumns: ColumnsType<Row> = [
|
const baseColumns: ColumnsType<Row> = [
|
||||||
{ title: '编码', dataIndex: 'code', width: 120 },
|
{ title: '编码', dataIndex: 'code', width: 120 },
|
||||||
{ title: '名称', dataIndex: 'name', width: 120 },
|
{
|
||||||
|
title: '名称',
|
||||||
|
dataIndex: 'name',
|
||||||
|
width: 120,
|
||||||
|
render: (v, row) => (
|
||||||
|
<AdminPrimaryLink
|
||||||
|
onClick={async () => {
|
||||||
|
const d = await request<Record<string, unknown>>(`/admin/product-detail-templates/${row.id}`);
|
||||||
|
setDetail(d);
|
||||||
|
editForm.setFieldsValue(mapToForm(d));
|
||||||
|
setDrawerOpen(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{v}
|
||||||
|
</AdminPrimaryLink>
|
||||||
|
),
|
||||||
|
},
|
||||||
{ title: '说明', dataIndex: 'description', width: 200 },
|
{ title: '说明', dataIndex: 'description', width: 200 },
|
||||||
{ title: '香型', dataIndex: 'aromaType', width: 90, render: (v) => (v ? AROMA_TYPE_LABELS[v] || v : '—') },
|
{ title: '香型', dataIndex: 'aromaType', width: 90, render: (v) => (v ? AROMA_TYPE_LABELS[v] || v : '—') },
|
||||||
{ title: '详情图', dataIndex: 'detailImageUrls', width: 80, render: (v: string[] | undefined) => v?.length ?? 0 },
|
{ title: '详情图', dataIndex: 'detailImageUrls', width: 80, render: (v: string[] | undefined) => v?.length ?? 0 },
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ import ProductDetailTemplatePicker from '../components/ProductDetailTemplatePick
|
|||||||
import ProductSpecsEditor from '../components/ProductSpecsEditor';
|
import ProductSpecsEditor from '../components/ProductSpecsEditor';
|
||||||
import type { FormInstance } from 'antd/es/form';
|
import type { FormInstance } from 'antd/es/form';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
|
||||||
|
|
||||||
type ProductDetailContentDto = {
|
type ProductDetailContentDto = {
|
||||||
@@ -391,7 +393,14 @@ export default function ProductsPage() {
|
|||||||
|
|
||||||
const baseColumns: ColumnsType<Row> = useMemo(() => [
|
const baseColumns: ColumnsType<Row> = useMemo(() => [
|
||||||
{ title: '香型', dataIndex: 'aromaType', width: 80, render: (v) => AROMA_TYPE_LABELS[v] || v },
|
{ title: '香型', dataIndex: 'aromaType', width: 80, render: (v) => AROMA_TYPE_LABELS[v] || v },
|
||||||
{ title: '品名', dataIndex: 'name', width: 200 },
|
{ title: '品名', dataIndex: 'name', width: 200, render: (v, row) => (
|
||||||
|
<AdminPrimaryLink onClick={async () => {
|
||||||
|
const d = await request<Record<string, unknown>>(`/admin/products/${row.id}`);
|
||||||
|
setDetail(d);
|
||||||
|
editForm.setFieldsValue(mapDetailToForm(d));
|
||||||
|
setDrawerOpen(true);
|
||||||
|
}}>{v}</AdminPrimaryLink>
|
||||||
|
) },
|
||||||
{
|
{
|
||||||
title: '累计销售',
|
title: '累计销售',
|
||||||
dataIndex: 'soldBottles',
|
dataIndex: 'soldBottles',
|
||||||
@@ -502,11 +511,11 @@ export default function ProductsPage() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<Space style={{ marginBottom: 16, width: '100%', justifyContent: 'space-between' }}>
|
<AdminListHeader
|
||||||
<Typography.Title level={4} style={{ margin: 0 }}>商品管理</Typography.Title>
|
title="商品管理"
|
||||||
{settingsButton}
|
settings={settingsButton}
|
||||||
<Button type="primary" onClick={() => setCreateOpen(true)}>新建商品</Button>
|
actions={<Button type="primary" onClick={() => setCreateOpen(true)}>新建商品</Button>}
|
||||||
</Space>
|
/>
|
||||||
<Form form={form} layout="inline" style={{ marginBottom: 16 }} onFinish={(v) => { setFilters(v); setPage(1); }}>
|
<Form form={form} layout="inline" style={{ marginBottom: 16 }} onFinish={(v) => { setFilters(v); setPage(1); }}>
|
||||||
<Form.Item name="name" label="名称">
|
<Form.Item name="name" label="名称">
|
||||||
<Input allowClear placeholder="名称 / SKU / 69 码" style={{ width: 200 }} />
|
<Input allowClear placeholder="名称 / SKU / 69 码" style={{ width: 200 }} />
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ import { request } from '../lib/api';
|
|||||||
import { fmtTime } from '../lib/constants';
|
import { fmtTime } from '../lib/constants';
|
||||||
import { useAdminList } from '../lib/useAdminList';
|
import { useAdminList } from '../lib/useAdminList';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
|
||||||
|
|
||||||
type Row = PromoCodeItem;
|
type Row = PromoCodeItem;
|
||||||
@@ -77,7 +79,14 @@ export default function PromoCodesPage() {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const baseColumns: ColumnsType<Row> = [
|
const baseColumns: ColumnsType<Row> = [
|
||||||
{ title: '名称', dataIndex: 'name', width: 160 },
|
{
|
||||||
|
title: '名称',
|
||||||
|
dataIndex: 'name',
|
||||||
|
width: 160,
|
||||||
|
render: (v, row) => (
|
||||||
|
<AdminPrimaryLink onClick={() => navigate(`/promo-codes/${row.id}`)}>{v}</AdminPrimaryLink>
|
||||||
|
),
|
||||||
|
},
|
||||||
{ title: '码值', dataIndex: 'code', width: 110 },
|
{ title: '码值', dataIndex: 'code', width: 110 },
|
||||||
{
|
{
|
||||||
title: '场景',
|
title: '场景',
|
||||||
@@ -167,11 +176,11 @@ export default function PromoCodesPage() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 16 }}>
|
<AdminListHeader
|
||||||
<Typography.Title level={4} style={{ margin: 0 }}>推广码管理</Typography.Title>
|
title="推广码管理"
|
||||||
{settingsButton}
|
settings={settingsButton}
|
||||||
<Button type="primary" onClick={() => setCreateOpen(true)}>创建推广码</Button>
|
actions={<Button type="primary" onClick={() => setCreateOpen(true)}>创建推广码</Button>}
|
||||||
</div>
|
/>
|
||||||
|
|
||||||
<Form
|
<Form
|
||||||
form={filterForm}
|
form={filterForm}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import { request } from '../lib/api';
|
|||||||
import { fmtTime } from '../lib/constants';
|
import { fmtTime } from '../lib/constants';
|
||||||
import { useAdminList } from '../lib/useAdminList';
|
import { useAdminList } from '../lib/useAdminList';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
|
||||||
|
|
||||||
type Row = {
|
type Row = {
|
||||||
@@ -84,7 +86,7 @@ export default function RedeemRecordsPage() {
|
|||||||
width: 200,
|
width: 200,
|
||||||
render: (v, row) => (
|
render: (v, row) => (
|
||||||
<span>
|
<span>
|
||||||
{v}
|
<AdminPrimaryLink onClick={() => void openDetail(row.id)}>{v}</AdminPrimaryLink>
|
||||||
{row.isTest ? (
|
{row.isTest ? (
|
||||||
<Tag color="orange" style={{ marginLeft: 6 }}>
|
<Tag color="orange" style={{ marginLeft: 6 }}>
|
||||||
测试
|
测试
|
||||||
@@ -140,8 +142,7 @@ export default function RedeemRecordsPage() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<Typography.Title level={4}>核销记录</Typography.Title>
|
<AdminListHeader title="核销记录" settings={settingsButton} />
|
||||||
{settingsButton}
|
|
||||||
<Form
|
<Form
|
||||||
form={form}
|
form={form}
|
||||||
layout="inline"
|
layout="inline"
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import {
|
|||||||
} from '../lib/constants';
|
} from '../lib/constants';
|
||||||
import OssUpload from '../components/OssUpload';
|
import OssUpload from '../components/OssUpload';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
|
||||||
|
|
||||||
type Row = {
|
type Row = {
|
||||||
@@ -121,15 +122,11 @@ export default function ResourcesPage() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<Space style={{ marginBottom: 16, width: '100%', justifyContent: 'space-between' }}>
|
<AdminListHeader
|
||||||
<Typography.Title level={4} style={{ margin: 0 }}>
|
title="OSS 资源库"
|
||||||
OSS 资源库
|
settings={settingsButton}
|
||||||
</Typography.Title>
|
actions={<Button type="primary" onClick={() => setCreateOpen(true)}>登记资源</Button>}
|
||||||
{settingsButton}
|
/>
|
||||||
<Button type="primary" onClick={() => setCreateOpen(true)}>
|
|
||||||
登记资源
|
|
||||||
</Button>
|
|
||||||
</Space>
|
|
||||||
<Form
|
<Form
|
||||||
form={form}
|
form={form}
|
||||||
layout="inline"
|
layout="inline"
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import { request, type Paginated } from '../lib/api';
|
|||||||
import { ACCOUNT_STATUS_LABELS, ADMIN_OPTIONS_PAGE_SIZE, STORE_STATUS_LABELS, fmtTime } from '../lib/constants';
|
import { ACCOUNT_STATUS_LABELS, ADMIN_OPTIONS_PAGE_SIZE, STORE_STATUS_LABELS, fmtTime } from '../lib/constants';
|
||||||
import { useAdminList } from '../lib/useAdminList';
|
import { useAdminList } from '../lib/useAdminList';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
|
||||||
|
|
||||||
type StoreBrief = { id: string; name: string; status: string; cityName?: string };
|
type StoreBrief = { id: string; name: string; status: string; cityName?: string };
|
||||||
@@ -83,7 +85,14 @@ export default function StoreAccountsPage() {
|
|||||||
width: 120,
|
width: 120,
|
||||||
render: (v, row) => (
|
render: (v, row) => (
|
||||||
<Space size={4}>
|
<Space size={4}>
|
||||||
<span>{v}</span>
|
<AdminPrimaryLink
|
||||||
|
onClick={async () => {
|
||||||
|
setDetail(await request(`/admin/store-accounts/${row.id}`));
|
||||||
|
setDrawerOpen(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{v}
|
||||||
|
</AdminPrimaryLink>
|
||||||
{row.isTest ? <Tag color="orange">测试</Tag> : null}
|
{row.isTest ? <Tag color="orange">测试</Tag> : null}
|
||||||
</Space>
|
</Space>
|
||||||
),
|
),
|
||||||
@@ -145,24 +154,22 @@ export default function StoreAccountsPage() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<Space style={{ marginBottom: 16, width: '100%', justifyContent: 'space-between' }}>
|
<AdminListHeader
|
||||||
<Space direction="vertical" size={0}>
|
title="门店账户"
|
||||||
<Typography.Title level={4} style={{ margin: 0 }}>门店账户</Typography.Title>
|
settings={settingsButton}
|
||||||
{settingsButton}
|
description="主账号可绑定多家门店;收款信息挂在主账号;「新建账户」用于补录无主账号门店"
|
||||||
<Typography.Text type="secondary">
|
actions={
|
||||||
主账号可绑定多家门店;收款信息挂在主账号;「新建账户」用于补录无主账号门店
|
<Button
|
||||||
</Typography.Text>
|
type="primary"
|
||||||
</Space>
|
onClick={() => {
|
||||||
<Button
|
void loadStores();
|
||||||
type="primary"
|
setCreateOpen(true);
|
||||||
onClick={() => {
|
}}
|
||||||
void loadStores();
|
>
|
||||||
setCreateOpen(true);
|
新建账户
|
||||||
}}
|
</Button>
|
||||||
>
|
}
|
||||||
新建账户
|
/>
|
||||||
</Button>
|
|
||||||
</Space>
|
|
||||||
<Form
|
<Form
|
||||||
form={form}
|
form={form}
|
||||||
layout="inline"
|
layout="inline"
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,8 @@ import {
|
|||||||
import type { ColumnsType } from 'antd/es/table';
|
import type { ColumnsType } from 'antd/es/table';
|
||||||
import { request, type HqProfile } from '../lib/api';
|
import { request, type HqProfile } from '../lib/api';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
|
||||||
|
|
||||||
type CategoryNode = {
|
type CategoryNode = {
|
||||||
@@ -130,7 +132,7 @@ export default function StoreCategoriesPage() {
|
|||||||
render: (name, row) => (
|
render: (name, row) => (
|
||||||
<span style={{ paddingLeft: row.level === 2 ? 24 : 0 }}>
|
<span style={{ paddingLeft: row.level === 2 ? 24 : 0 }}>
|
||||||
{row.level === 2 ? `${row.parentName || ''} / ` : ''}
|
{row.level === 2 ? `${row.parentName || ''} / ` : ''}
|
||||||
{name}
|
<AdminPrimaryLink onClick={() => openEdit(row)}>{name}</AdminPrimaryLink>
|
||||||
</span>
|
</span>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
@@ -178,27 +180,27 @@ export default function StoreCategoriesPage() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<Space style={{ marginBottom: 16, width: '100%', justifyContent: 'space-between' }}>
|
<AdminListHeader
|
||||||
<Space direction="vertical" size={0}>
|
title="门店分类"
|
||||||
<Typography.Title level={4} style={{ margin: 0 }}>门店分类</Typography.Title>
|
settings={settingsButton}
|
||||||
{settingsButton}
|
description="两级分类:一级(餐饮/住宿/娱乐)→ 二级业态,供合伙人开店选择"
|
||||||
<Typography.Text type="secondary">两级分类:一级(餐饮/住宿/娱乐)→ 二级业态,供合伙人开店选择</Typography.Text>
|
actions={
|
||||||
</Space>
|
<>
|
||||||
<Space>
|
{canDelete ? (
|
||||||
{canDelete ? (
|
<Button
|
||||||
<Button
|
onClick={async () => {
|
||||||
onClick={async () => {
|
await request('/admin/store-categories/ensure-defaults', { method: 'POST' });
|
||||||
await request('/admin/store-categories/ensure-defaults', { method: 'POST' });
|
message.success('已同步默认分类');
|
||||||
message.success('已同步默认分类');
|
void reload();
|
||||||
void reload();
|
}}
|
||||||
}}
|
>
|
||||||
>
|
同步默认分类
|
||||||
同步默认分类
|
</Button>
|
||||||
</Button>
|
) : null}
|
||||||
) : null}
|
<Button type="primary" onClick={() => openCreate()}>新增一级</Button>
|
||||||
<Button type="primary" onClick={() => openCreate()}>新增一级</Button>
|
</>
|
||||||
</Space>
|
}
|
||||||
</Space>
|
/>
|
||||||
|
|
||||||
<Table
|
<Table
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import { AdminCellLine } from '../components/AdminCellLine';
|
|||||||
import { fmtTime } from '../lib/constants';
|
import { fmtTime } from '../lib/constants';
|
||||||
import { useAdminList } from '../lib/useAdminList';
|
import { useAdminList } from '../lib/useAdminList';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
|
||||||
|
|
||||||
type Row = {
|
type Row = {
|
||||||
@@ -103,7 +105,23 @@ export default function StoreLogsPage() {
|
|||||||
<Tag>{STORE_LOG_CATEGORY_LABELS[v ?? ''] || resolveStoreLogCategory(r.eventName) || '其他'}</Tag>
|
<Tag>{STORE_LOG_CATEGORY_LABELS[v ?? ''] || resolveStoreLogCategory(r.eventName) || '其他'}</Tag>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{ title: '事件', dataIndex: 'eventName', width: 160 },
|
{
|
||||||
|
title: '事件',
|
||||||
|
dataIndex: 'eventName',
|
||||||
|
width: 160,
|
||||||
|
render: (v, row) => (
|
||||||
|
<AdminPrimaryLink
|
||||||
|
onClick={async () => {
|
||||||
|
const parsed = parseCompositeId(row.id);
|
||||||
|
if (!parsed) return;
|
||||||
|
setDetail(await request(`/admin/logs/stores/${parsed.source}/${parsed.rawId}`));
|
||||||
|
setDrawerOpen(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{v}
|
||||||
|
</AdminPrimaryLink>
|
||||||
|
),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '来源', dataIndex: 'source', width: 100,
|
title: '来源', dataIndex: 'source', width: 100,
|
||||||
render: (v: Row['source']) => SOURCE_LABELS[v] || v,
|
render: (v: Row['source']) => SOURCE_LABELS[v] || v,
|
||||||
@@ -134,11 +152,11 @@ export default function StoreLogsPage() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<Typography.Title level={4}>商户日志</Typography.Title>
|
<AdminListHeader
|
||||||
{settingsButton}
|
title="商户日志"
|
||||||
<Typography.Paragraph type="secondary" style={{ marginTop: -8 }}>
|
settings={settingsButton}
|
||||||
门店登录、微信授权、核销、打款与营业状态等操作记录;历史核销/打款数据来自业务表归档。
|
description="门店登录、微信授权、核销、打款与营业状态等操作记录;历史核销/打款数据来自业务表归档。"
|
||||||
</Typography.Paragraph>
|
/>
|
||||||
<Segmented
|
<Segmented
|
||||||
style={{ marginBottom: 16 }}
|
style={{ marginBottom: 16 }}
|
||||||
options={STORE_LOG_CATEGORY_OPTIONS.map((o) => ({ value: o.value, label: o.label }))}
|
options={STORE_LOG_CATEGORY_OPTIONS.map((o) => ({ value: o.value, label: o.label }))}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import { ADMIN_OPTIONS_PAGE_SIZE, MEDIA_TYPE_LABELS, fmtTime } from '../lib/cons
|
|||||||
import { useAdminList } from '../lib/useAdminList';
|
import { useAdminList } from '../lib/useAdminList';
|
||||||
import OssUpload from '../components/OssUpload';
|
import OssUpload from '../components/OssUpload';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
|
||||||
|
|
||||||
type Row = {
|
type Row = {
|
||||||
@@ -43,7 +45,22 @@ export default function StoreMediaPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const baseColumns: ColumnsType<Row> = [
|
const baseColumns: ColumnsType<Row> = [
|
||||||
{ title: '门店', dataIndex: ['store', 'name'], width: 140 },
|
{
|
||||||
|
title: '门店',
|
||||||
|
dataIndex: ['store', 'name'],
|
||||||
|
width: 140,
|
||||||
|
render: (v, row) => (
|
||||||
|
<AdminPrimaryLink
|
||||||
|
onClick={() => {
|
||||||
|
setEditing(row);
|
||||||
|
editForm.setFieldsValue(row);
|
||||||
|
setEditOpen(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{v}
|
||||||
|
</AdminPrimaryLink>
|
||||||
|
),
|
||||||
|
},
|
||||||
{ title: '类型', dataIndex: 'mediaType', width: 80, render: (t) => <Tag>{MEDIA_TYPE_LABELS[t] || t}</Tag> },
|
{ title: '类型', dataIndex: 'mediaType', width: 80, render: (t) => <Tag>{MEDIA_TYPE_LABELS[t] || t}</Tag> },
|
||||||
{
|
{
|
||||||
title: '预览', dataIndex: 'url', width: 100,
|
title: '预览', dataIndex: 'url', width: 100,
|
||||||
@@ -80,11 +97,11 @@ export default function StoreMediaPage() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<Space style={{ marginBottom: 16, width: '100%', justifyContent: 'space-between' }}>
|
<AdminListHeader
|
||||||
<Typography.Title level={4} style={{ margin: 0 }}>门店资源</Typography.Title>
|
title="门店资源"
|
||||||
{settingsButton}
|
settings={settingsButton}
|
||||||
<Button type="primary" onClick={() => { void loadStores(); setCreateOpen(true); }}>新增资源</Button>
|
actions={<Button type="primary" onClick={() => { void loadStores(); setCreateOpen(true); }}>新增资源</Button>}
|
||||||
</Space>
|
/>
|
||||||
<Form form={form} layout="inline" style={{ marginBottom: 16 }} onFinish={(v) => { setFilters(v); setPage(1); }}>
|
<Form form={form} layout="inline" style={{ marginBottom: 16 }} onFinish={(v) => { setFilters(v); setPage(1); }}>
|
||||||
<Form.Item name="storeId" label="门店ID"><Input allowClear /></Form.Item>
|
<Form.Item name="storeId" label="门店ID"><Input allowClear /></Form.Item>
|
||||||
<Form.Item name="mediaType" label="类型">
|
<Form.Item name="mediaType" label="类型">
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ import { notifyPackageAuditChanged } from '../lib/admin-events';
|
|||||||
import { fmtTime } from '../lib/constants';
|
import { fmtTime } from '../lib/constants';
|
||||||
import StorePackageAuditPanel from '../components/StorePackageAuditPanel';
|
import StorePackageAuditPanel from '../components/StorePackageAuditPanel';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
|
||||||
const HQ_PACKAGE_STATUS_LABELS: Record<StorePackageChangeStatus, string> = {
|
const HQ_PACKAGE_STATUS_LABELS: Record<StorePackageChangeStatus, string> = {
|
||||||
PENDING: '待审核',
|
PENDING: '待审核',
|
||||||
@@ -199,7 +201,15 @@ function InfoChangeAuditPanel({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const columns: ColumnsType<StoreInfoChangeRequestDto> = [
|
const columns: ColumnsType<StoreInfoChangeRequestDto> = [
|
||||||
{ title: '门店', dataIndex: 'storeName', render: (_, row) => row.storeName || row.storeId },
|
{
|
||||||
|
title: '门店',
|
||||||
|
dataIndex: 'storeName',
|
||||||
|
render: (_, row) => (
|
||||||
|
<AdminPrimaryLink onClick={() => void openDetail(row.id)}>
|
||||||
|
{row.storeName || row.storeId}
|
||||||
|
</AdminPrimaryLink>
|
||||||
|
),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '状态',
|
title: '状态',
|
||||||
dataIndex: 'status',
|
dataIndex: 'status',
|
||||||
@@ -471,7 +481,15 @@ export default function StorePackageAuditsPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const baseColumns: ColumnsType<StorePackageChangeRequestDto> = [
|
const baseColumns: ColumnsType<StorePackageChangeRequestDto> = [
|
||||||
{ title: '门店', dataIndex: 'storeName', render: (_, row) => row.storeName || row.storeId },
|
{
|
||||||
|
title: '门店',
|
||||||
|
dataIndex: 'storeName',
|
||||||
|
render: (_, row) => (
|
||||||
|
<AdminPrimaryLink onClick={() => void openDetail(row.id)}>
|
||||||
|
{row.storeName || row.storeId}
|
||||||
|
</AdminPrimaryLink>
|
||||||
|
),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '状态',
|
title: '状态',
|
||||||
dataIndex: 'status',
|
dataIndex: 'status',
|
||||||
@@ -528,8 +546,7 @@ export default function StorePackageAuditsPage() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<Typography.Title level={4}>审核通知</Typography.Title>
|
<AdminListHeader title="审核通知" settings={settingsButton} />
|
||||||
{settingsButton}
|
|
||||||
<Tabs
|
<Tabs
|
||||||
activeKey={activeTab}
|
activeKey={activeTab}
|
||||||
onChange={setActiveTab}
|
onChange={setActiveTab}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { fmtTime, ADMIN_OPTIONS_PAGE_SIZE } from '../lib/constants';
|
|||||||
import { useAdminList } from '../lib/useAdminList';
|
import { useAdminList } from '../lib/useAdminList';
|
||||||
import { request, type Paginated } from '../lib/api';
|
import { request, type Paginated } from '../lib/api';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
|
||||||
|
|
||||||
type Row = {
|
type Row = {
|
||||||
@@ -69,10 +70,7 @@ export default function StoreRatingsPage() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<Typography.Title level={4} style={{ marginTop: 0 }}>
|
<AdminListHeader title="门店评价" settings={settingsButton} />
|
||||||
门店评价
|
|
||||||
</Typography.Title>
|
|
||||||
{settingsButton}
|
|
||||||
<Form
|
<Form
|
||||||
form={form}
|
form={form}
|
||||||
layout="inline"
|
layout="inline"
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ import { request, type Paginated } from '../lib/api';
|
|||||||
import { ADMIN_OPTIONS_PAGE_SIZE, fmtTime } from '../lib/constants';
|
import { ADMIN_OPTIONS_PAGE_SIZE, fmtTime } from '../lib/constants';
|
||||||
import { useAdminList } from '../lib/useAdminList';
|
import { useAdminList } from '../lib/useAdminList';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
|
||||||
|
|
||||||
type Row = {
|
type Row = {
|
||||||
@@ -156,7 +158,7 @@ export default function StoreWithdrawalsPage() {
|
|||||||
width: 180,
|
width: 180,
|
||||||
render: (v, row) => (
|
render: (v, row) => (
|
||||||
<Space>
|
<Space>
|
||||||
<Typography.Link onClick={() => void openDetail(row.id)}>{v}</Typography.Link>
|
<AdminPrimaryLink onClick={() => void openDetail(row.id)}>{v}</AdminPrimaryLink>
|
||||||
{row.overdue ? <Tag color="magenta">超时</Tag> : null}
|
{row.overdue ? <Tag color="magenta">超时</Tag> : null}
|
||||||
</Space>
|
</Space>
|
||||||
),
|
),
|
||||||
@@ -236,10 +238,7 @@ export default function StoreWithdrawalsPage() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<Typography.Title level={4} style={{ marginTop: 0 }}>
|
<AdminListHeader title="门店提现审" settings={settingsButton} />
|
||||||
门店提现审
|
|
||||||
</Typography.Title>
|
|
||||||
{settingsButton}
|
|
||||||
{overdueSummary ? (
|
{overdueSummary ? (
|
||||||
<Typography.Paragraph type="secondary">
|
<Typography.Paragraph type="secondary">
|
||||||
待审 {overdueSummary.pendingCount} 笔
|
待审 {overdueSummary.pendingCount} 笔
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ import {
|
|||||||
} from '../lib/storeCreate';
|
} from '../lib/storeCreate';
|
||||||
import { useAdminList } from '../lib/useAdminList';
|
import { useAdminList } from '../lib/useAdminList';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
import { resolveRegionBinding } from '../lib/china-region';
|
import { resolveRegionBinding } from '../lib/china-region';
|
||||||
import ChinaRegionCascader from '../components/ChinaRegionCascader';
|
import ChinaRegionCascader from '../components/ChinaRegionCascader';
|
||||||
import OssUpload from '../components/OssUpload';
|
import OssUpload from '../components/OssUpload';
|
||||||
@@ -739,7 +741,7 @@ export default function StoresPage() {
|
|||||||
const name = v || '—';
|
const name = v || '—';
|
||||||
return (
|
return (
|
||||||
<Space size={4} wrap={false}>
|
<Space size={4} wrap={false}>
|
||||||
<span>{name}</span>
|
<AdminPrimaryLink onClick={() => void openStoreDetail(row)}>{name === '—' ? '' : name}</AdminPrimaryLink>
|
||||||
{row.isTest ? <Tag color="orange">测试</Tag> : null}
|
{row.isTest ? <Tag color="orange">测试</Tag> : null}
|
||||||
</Space>
|
</Space>
|
||||||
);
|
);
|
||||||
@@ -872,16 +874,14 @@ export default function StoresPage() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<Space style={{ marginBottom: 16, width: '100%', justifyContent: 'space-between' }}>
|
<AdminListHeader
|
||||||
<Space direction="vertical" size={0}>
|
title="门店"
|
||||||
<Typography.Title level={4} style={{ margin: 0 }}>门店</Typography.Title>
|
settings={settingsButton}
|
||||||
<Typography.Text type="secondary">共 {data?.total ?? 0} 家门店(含合伙人录入)</Typography.Text>
|
description={`共 ${data?.total ?? 0} 家门店(含合伙人录入)`}
|
||||||
</Space>
|
actions={
|
||||||
<Space>
|
|
||||||
{settingsButton}
|
|
||||||
<Button type="primary" onClick={openCreateModal}>新建门店</Button>
|
<Button type="primary" onClick={openCreateModal}>新建门店</Button>
|
||||||
</Space>
|
}
|
||||||
</Space>
|
/>
|
||||||
<Form form={form} layout="inline" style={{ marginBottom: 16 }} onFinish={(v) => { setFilters(v); setPage(1); }}>
|
<Form form={form} layout="inline" style={{ marginBottom: 16 }} onFinish={(v) => { setFilters(v); setPage(1); }}>
|
||||||
<Form.Item name="name" label="名称"><Input allowClear /></Form.Item>
|
<Form.Item name="name" label="名称"><Input allowClear /></Form.Item>
|
||||||
<Form.Item name="phone" label="电话"><Input allowClear /></Form.Item>
|
<Form.Item name="phone" label="电话"><Input allowClear /></Form.Item>
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ import { fmtTime } from '../lib/constants';
|
|||||||
import { useAdminList } from '../lib/useAdminList';
|
import { useAdminList } from '../lib/useAdminList';
|
||||||
import OssUpload from '../components/OssUpload';
|
import OssUpload from '../components/OssUpload';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
|
||||||
|
|
||||||
const DISPATCH_WECOM_STORAGE_KEY = 'support_ticket_dispatch_wecom';
|
const DISPATCH_WECOM_STORAGE_KEY = 'support_ticket_dispatch_wecom';
|
||||||
@@ -505,7 +506,13 @@ export default function SupportTicketsPage() {
|
|||||||
</Space>
|
</Space>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{ title: '标题', dataIndex: 'title' },
|
{
|
||||||
|
title: '标题',
|
||||||
|
dataIndex: 'title',
|
||||||
|
render: (v, row) => (
|
||||||
|
<AdminPrimaryLink onClick={() => void openDetail(String(row.id))}>{v}</AdminPrimaryLink>
|
||||||
|
),
|
||||||
|
},
|
||||||
{ title: '创建人', dataIndex: 'creatorName', width: 100 },
|
{ title: '创建人', dataIndex: 'creatorName', width: 100 },
|
||||||
{ title: '时间', dataIndex: 'createdAt', width: 160, render: fmtTime },
|
{ title: '时间', dataIndex: 'createdAt', width: 160, render: fmtTime },
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ import type { ColumnsType } from 'antd/es/table';
|
|||||||
import { request, type Paginated } from '../lib/api';
|
import { request, type Paginated } from '../lib/api';
|
||||||
import { fmtTime } from '../lib/constants';
|
import { fmtTime } from '../lib/constants';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
|
||||||
const MOCK_KEYS = ['MOCK_SMS', 'MOCK_WECHAT', 'MOCK_PAY'] as const;
|
const MOCK_KEYS = ['MOCK_SMS', 'MOCK_WECHAT', 'MOCK_PAY'] as const;
|
||||||
|
|
||||||
@@ -254,7 +256,22 @@ export default function TestWhitelistPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const phoneColumns: ColumnsType<PhoneRow> = [
|
const phoneColumns: ColumnsType<PhoneRow> = [
|
||||||
{ title: '手机号', dataIndex: 'phone', width: 140 },
|
{
|
||||||
|
title: '手机号',
|
||||||
|
dataIndex: 'phone',
|
||||||
|
width: 140,
|
||||||
|
render: (v, row) => (
|
||||||
|
<AdminPrimaryLink
|
||||||
|
onClick={() => {
|
||||||
|
setEditRow(row);
|
||||||
|
editForm.setFieldsValue({ note: row.note ?? '' });
|
||||||
|
setEditOpen(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{v}
|
||||||
|
</AdminPrimaryLink>
|
||||||
|
),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '备注',
|
title: '备注',
|
||||||
dataIndex: 'note',
|
dataIndex: 'note',
|
||||||
@@ -394,10 +411,7 @@ export default function TestWhitelistPage() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<Typography.Title level={4} style={{ marginTop: 0 }}>
|
<AdminListHeader title="白名单管理" settings={settingsButton} />
|
||||||
白名单管理
|
|
||||||
</Typography.Title>
|
|
||||||
{settingsButton}
|
|
||||||
|
|
||||||
<Card size="small" loading={mockLoading} style={{ marginBottom: 16 }}>
|
<Card size="small" loading={mockLoading} style={{ marginBottom: 16 }}>
|
||||||
<Typography.Text type="secondary" style={{ display: 'block', marginBottom: 12 }}>
|
<Typography.Text type="secondary" style={{ display: 'block', marginBottom: 12 }}>
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import { request } from '../lib/api';
|
|||||||
import { fmtTime } from '../lib/constants';
|
import { fmtTime } from '../lib/constants';
|
||||||
import { useAdminList } from '../lib/useAdminList';
|
import { useAdminList } from '../lib/useAdminList';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
|
||||||
|
|
||||||
type Row = {
|
type Row = {
|
||||||
@@ -95,7 +97,21 @@ export default function ThirdPartyLogsPage() {
|
|||||||
title: '请求摘要',
|
title: '请求摘要',
|
||||||
render: (_, r) => summarizeJson(r.requestBody),
|
render: (_, r) => summarizeJson(r.requestBody),
|
||||||
},
|
},
|
||||||
{ title: '外部单号', dataIndex: 'externalNo', width: 140, render: (v) => v || '—' },
|
{
|
||||||
|
title: '外部单号',
|
||||||
|
dataIndex: 'externalNo',
|
||||||
|
width: 140,
|
||||||
|
render: (v, row) => (
|
||||||
|
<AdminPrimaryLink
|
||||||
|
onClick={async () => {
|
||||||
|
setDetail(await request(`/common/third-party-logs/${row.id}`));
|
||||||
|
setDrawerOpen(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{v}
|
||||||
|
</AdminPrimaryLink>
|
||||||
|
),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
width: 80,
|
width: 80,
|
||||||
@@ -122,8 +138,7 @@ export default function ThirdPartyLogsPage() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<Typography.Title level={4}>第三方日志</Typography.Title>
|
<AdminListHeader title="第三方日志" settings={settingsButton} />
|
||||||
{settingsButton}
|
|
||||||
<Form
|
<Form
|
||||||
layout="inline"
|
layout="inline"
|
||||||
style={{ marginBottom: 16 }}
|
style={{ marginBottom: 16 }}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import { request } from '../lib/api';
|
|||||||
import { fmtTime } from '../lib/constants';
|
import { fmtTime } from '../lib/constants';
|
||||||
import { useAdminList } from '../lib/useAdminList';
|
import { useAdminList } from '../lib/useAdminList';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
|
||||||
|
|
||||||
type Row = {
|
type Row = {
|
||||||
@@ -118,7 +119,21 @@ export default function TicketsPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const baseColumns: ColumnsType<Row> = [
|
const baseColumns: ColumnsType<Row> = [
|
||||||
{ title: '工单号', dataIndex: 'ticketNo', width: 180 },
|
{
|
||||||
|
title: '工单号',
|
||||||
|
dataIndex: 'ticketNo',
|
||||||
|
width: 180,
|
||||||
|
render: (v, row) => (
|
||||||
|
<AdminPrimaryLink
|
||||||
|
onClick={async () => {
|
||||||
|
setDetail(await request(`/admin/tickets/${row.id}`));
|
||||||
|
setDrawerOpen(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{v}
|
||||||
|
</AdminPrimaryLink>
|
||||||
|
),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '类型',
|
title: '类型',
|
||||||
dataIndex: 'ticketType',
|
dataIndex: 'ticketType',
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import { AdminCellLine } from '../components/AdminCellLine';
|
|||||||
import { fmtTime } from '../lib/constants';
|
import { fmtTime } from '../lib/constants';
|
||||||
import { useAdminList } from '../lib/useAdminList';
|
import { useAdminList } from '../lib/useAdminList';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
|
||||||
|
|
||||||
type Row = {
|
type Row = {
|
||||||
@@ -80,7 +82,21 @@ export default function UserLogsPage() {
|
|||||||
<Tag>{CATEGORY_LABELS[v ?? ''] || resolveUserLogCategory(r.eventName) || '其他'}</Tag>
|
<Tag>{CATEGORY_LABELS[v ?? ''] || resolveUserLogCategory(r.eventName) || '其他'}</Tag>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{ title: '事件', dataIndex: 'eventName', width: 160 },
|
{
|
||||||
|
title: '事件',
|
||||||
|
dataIndex: 'eventName',
|
||||||
|
width: 160,
|
||||||
|
render: (v, row) => (
|
||||||
|
<AdminPrimaryLink
|
||||||
|
onClick={async () => {
|
||||||
|
setDetail(await request(`/admin/logs/users/${row.id}`));
|
||||||
|
setDrawerOpen(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{v}
|
||||||
|
</AdminPrimaryLink>
|
||||||
|
),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '关联', width: 120,
|
title: '关联', width: 120,
|
||||||
render: (_, r) => (r.refType && r.refId ? `${r.refType}#${r.refId}` : '—'),
|
render: (_, r) => (r.refType && r.refId ? `${r.refType}#${r.refId}` : '—'),
|
||||||
@@ -105,8 +121,7 @@ export default function UserLogsPage() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<Typography.Title level={4}>用户日志</Typography.Title>
|
<AdminListHeader title="用户日志" settings={settingsButton} />
|
||||||
{settingsButton}
|
|
||||||
<Segmented
|
<Segmented
|
||||||
style={{ marginBottom: 16 }}
|
style={{ marginBottom: 16 }}
|
||||||
options={USER_LOG_CATEGORY_OPTIONS.map((o) => ({ value: o.value, label: o.label }))}
|
options={USER_LOG_CATEGORY_OPTIONS.map((o) => ({ value: o.value, label: o.label }))}
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ import type { ColumnsType } from 'antd/es/table';
|
|||||||
import { USER_SOURCE_TYPE_LABELS, resolveUserLogCategory, type UserSourceType } from '@dukang/shared-types';
|
import { USER_SOURCE_TYPE_LABELS, resolveUserLogCategory, type UserSourceType } from '@dukang/shared-types';
|
||||||
import { request, type AdminUserRow, type HqProfile, type Paginated } from '../lib/api';
|
import { request, type AdminUserRow, type HqProfile, type Paginated } from '../lib/api';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
import { ORDER_STATUS_LABELS, fmtTime, maskPhone } from '../lib/constants';
|
import { ORDER_STATUS_LABELS, fmtTime, maskPhone } from '../lib/constants';
|
||||||
|
|
||||||
type UserOrderRow = {
|
type UserOrderRow = {
|
||||||
@@ -332,7 +334,9 @@ export default function UsersPage() {
|
|||||||
title: '昵称',
|
title: '昵称',
|
||||||
dataIndex: 'nickname',
|
dataIndex: 'nickname',
|
||||||
width: 140,
|
width: 140,
|
||||||
render: (v: string | null) => v || '—',
|
render: (v: string | null, row) => (
|
||||||
|
<AdminPrimaryLink onClick={() => void openDetail(row.id)}>{v}</AdminPrimaryLink>
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '备注',
|
title: '备注',
|
||||||
@@ -478,21 +482,21 @@ export default function UsersPage() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<Space style={{ marginBottom: 16, width: '100%', justifyContent: 'space-between' }}>
|
<AdminListHeader
|
||||||
<Typography.Title level={4} style={{ margin: 0 }}>用户监控</Typography.Title>
|
title="用户监控"
|
||||||
<Space>
|
settings={settingsButton}
|
||||||
{settingsButton}
|
actions={
|
||||||
{canDeleteUsers ? (
|
canDeleteUsers ? (
|
||||||
<Button
|
<Button
|
||||||
danger
|
danger
|
||||||
disabled={!selectedRowKeys.length}
|
disabled={!selectedRowKeys.length}
|
||||||
onClick={() => void openBatchDeleteModal()}
|
onClick={() => void openBatchDeleteModal()}
|
||||||
>
|
>
|
||||||
批量删除{selectedRowKeys.length ? ` (${selectedRowKeys.length})` : ''}
|
批量删除{selectedRowKeys.length ? ` (${selectedRowKeys.length})` : ''}
|
||||||
</Button>
|
</Button>
|
||||||
) : null}
|
) : null
|
||||||
</Space>
|
}
|
||||||
</Space>
|
/>
|
||||||
<Form form={form} layout="inline" style={{ marginBottom: 16 }} onFinish={() => { setPage(1); void load(); }}>
|
<Form form={form} layout="inline" style={{ marginBottom: 16 }} onFinish={() => { setPage(1); void load(); }}>
|
||||||
<Form.Item name="phone" label="手机号">
|
<Form.Item name="phone" label="手机号">
|
||||||
<Input placeholder="模糊搜索" allowClear />
|
<Input placeholder="模糊搜索" allowClear />
|
||||||
|
|||||||
@@ -1,318 +1,322 @@
|
|||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import {
|
import {
|
||||||
Button, Descriptions, Drawer, Form, Input, Select, Space, Table, Tag, Typography,
|
Button, Descriptions, Drawer, Form, Input, Select, Space, Table, Tag, Typography,
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
import type { ColumnsType } from 'antd/es/table';
|
import type { ColumnsType } from 'antd/es/table';
|
||||||
import { request } from '../lib/api';
|
import { request } from '../lib/api';
|
||||||
import { AdminCellLine } from '../components/AdminCellLine';
|
import { AdminCellLine } from '../components/AdminCellLine';
|
||||||
import { fmtTime, maskPhone } from '../lib/constants';
|
import { fmtTime, maskPhone } from '../lib/constants';
|
||||||
import { useAdminList } from '../lib/useAdminList';
|
import { useAdminList } from '../lib/useAdminList';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
type ActorType = 'USER' | 'STORE' | 'PARTNER' | 'HQ';
|
|
||||||
|
|
||||||
type Identity = {
|
type ActorType = 'USER' | 'STORE' | 'PARTNER' | 'HQ';
|
||||||
actorType: ActorType;
|
|
||||||
actorId: string;
|
type Identity = {
|
||||||
phone: string | null;
|
actorType: ActorType;
|
||||||
name: string | null;
|
actorId: string;
|
||||||
wxOpenId: string;
|
phone: string | null;
|
||||||
wxUnionId: string | null;
|
name: string | null;
|
||||||
phoneVerified?: boolean;
|
wxOpenId: string;
|
||||||
refLabel: string | null;
|
wxUnionId: string | null;
|
||||||
refId: string | null;
|
phoneVerified?: boolean;
|
||||||
lastLoginAt: string | null;
|
refLabel: string | null;
|
||||||
status: string | number;
|
refId: string | null;
|
||||||
};
|
lastLoginAt: string | null;
|
||||||
|
status: string | number;
|
||||||
type GroupRow = {
|
};
|
||||||
groupKey: string;
|
|
||||||
unionId: string | null;
|
type GroupRow = {
|
||||||
identityCount: number;
|
groupKey: string;
|
||||||
actorTypes: ActorType[];
|
unionId: string | null;
|
||||||
multiRole: boolean;
|
identityCount: number;
|
||||||
primaryPhone: string | null;
|
actorTypes: ActorType[];
|
||||||
latestLoginAt: string | null;
|
multiRole: boolean;
|
||||||
identities: Identity[];
|
primaryPhone: string | null;
|
||||||
};
|
latestLoginAt: string | null;
|
||||||
|
identities: Identity[];
|
||||||
const ACTOR_TYPE_LABELS: Record<ActorType, string> = {
|
};
|
||||||
USER: 'C 端用户',
|
|
||||||
STORE: '门店账号',
|
const ACTOR_TYPE_LABELS: Record<ActorType, string> = {
|
||||||
PARTNER: '合伙人账号',
|
USER: 'C 端用户',
|
||||||
HQ: 'HQ 账号',
|
STORE: '门店账号',
|
||||||
};
|
PARTNER: '合伙人账号',
|
||||||
|
HQ: 'HQ 账号',
|
||||||
const ACTOR_TYPE_COLORS: Record<ActorType, string> = {
|
};
|
||||||
USER: 'blue',
|
|
||||||
STORE: 'green',
|
const ACTOR_TYPE_COLORS: Record<ActorType, string> = {
|
||||||
PARTNER: 'orange',
|
USER: 'blue',
|
||||||
HQ: 'purple',
|
STORE: 'green',
|
||||||
};
|
PARTNER: 'orange',
|
||||||
|
HQ: 'purple',
|
||||||
function renderActorTags(types: ActorType[]) {
|
};
|
||||||
return types.map((t) => (
|
|
||||||
<Tag key={t} color={ACTOR_TYPE_COLORS[t]}>
|
function renderActorTags(types: ActorType[]) {
|
||||||
{ACTOR_TYPE_LABELS[t]}
|
return types.map((t) => (
|
||||||
</Tag>
|
<Tag key={t} color={ACTOR_TYPE_COLORS[t]}>
|
||||||
));
|
{ACTOR_TYPE_LABELS[t]}
|
||||||
}
|
</Tag>
|
||||||
|
));
|
||||||
export default function WechatBindingsPage() {
|
}
|
||||||
const [form] = Form.useForm();
|
|
||||||
const [filters, setFilters] = useState<Record<string, string>>({
|
export default function WechatBindingsPage() {
|
||||||
actorType: '',
|
const [form] = Form.useForm();
|
||||||
phone: '',
|
const [filters, setFilters] = useState<Record<string, string>>({
|
||||||
unionId: '',
|
actorType: '',
|
||||||
openId: '',
|
phone: '',
|
||||||
});
|
unionId: '',
|
||||||
const { data, loading, page, pageSize, setPage, setPageSize, reload } = useAdminList<GroupRow>(
|
openId: '',
|
||||||
'/admin/wechat-bindings',
|
});
|
||||||
() => {
|
const { data, loading, page, pageSize, setPage, setPageSize, reload } = useAdminList<GroupRow>(
|
||||||
const qs = new URLSearchParams();
|
'/admin/wechat-bindings',
|
||||||
if (filters.actorType) qs.set('actorType', filters.actorType);
|
() => {
|
||||||
if (filters.phone) qs.set('phone', filters.phone);
|
const qs = new URLSearchParams();
|
||||||
if (filters.unionId) qs.set('unionId', filters.unionId);
|
if (filters.actorType) qs.set('actorType', filters.actorType);
|
||||||
if (filters.openId) qs.set('openId', filters.openId);
|
if (filters.phone) qs.set('phone', filters.phone);
|
||||||
return qs;
|
if (filters.unionId) qs.set('unionId', filters.unionId);
|
||||||
},
|
if (filters.openId) qs.set('openId', filters.openId);
|
||||||
[filters],
|
return qs;
|
||||||
);
|
},
|
||||||
const [detail, setDetail] = useState<GroupRow | null>(null);
|
[filters],
|
||||||
const [drawerOpen, setDrawerOpen] = useState(false);
|
);
|
||||||
|
const [detail, setDetail] = useState<GroupRow | null>(null);
|
||||||
useEffect(() => {
|
const [drawerOpen, setDrawerOpen] = useState(false);
|
||||||
form.setFieldsValue(filters);
|
|
||||||
}, [form, filters]);
|
useEffect(() => {
|
||||||
|
form.setFieldsValue(filters);
|
||||||
async function openDetail(row: GroupRow) {
|
}, [form, filters]);
|
||||||
const res = await request<GroupRow>(`/admin/wechat-bindings/${encodeURIComponent(row.groupKey)}`);
|
|
||||||
setDetail(res);
|
async function openDetail(row: GroupRow) {
|
||||||
setDrawerOpen(true);
|
const res = await request<GroupRow>(`/admin/wechat-bindings/${encodeURIComponent(row.groupKey)}`);
|
||||||
}
|
setDetail(res);
|
||||||
|
setDrawerOpen(true);
|
||||||
const baseColumns: ColumnsType<GroupRow> = [
|
}
|
||||||
{
|
|
||||||
title: 'unionId',
|
const baseColumns: ColumnsType<GroupRow> = [
|
||||||
dataIndex: 'unionId',
|
{
|
||||||
width: 180,
|
title: 'unionId',
|
||||||
|
dataIndex: 'unionId',
|
||||||
render: (v) => v || <Tag>无 unionId</Tag>,
|
width: 180,
|
||||||
},
|
render: (v) => v || <Tag>无 unionId</Tag>,
|
||||||
{
|
},
|
||||||
title: '身份数',
|
{
|
||||||
dataIndex: 'identityCount',
|
title: '身份数',
|
||||||
width: 90,
|
dataIndex: 'identityCount',
|
||||||
render: (v, r) => (
|
width: 90,
|
||||||
<Space size={4}>
|
render: (v, r) => (
|
||||||
<span>{v}</span>
|
<Space size={4}>
|
||||||
{r.multiRole ? <Tag color="red">一人多角色</Tag> : null}
|
<span>{v}</span>
|
||||||
</Space>
|
{r.multiRole ? <Tag color="red">一人多角色</Tag> : null}
|
||||||
),
|
</Space>
|
||||||
},
|
),
|
||||||
{
|
},
|
||||||
title: '端类型',
|
{
|
||||||
dataIndex: 'actorTypes',
|
title: '端类型',
|
||||||
width: 220,
|
dataIndex: 'actorTypes',
|
||||||
render: (types: ActorType[]) => renderActorTags(types),
|
width: 220,
|
||||||
},
|
render: (types: ActorType[]) => renderActorTags(types),
|
||||||
{
|
},
|
||||||
title: '手机号',
|
{
|
||||||
dataIndex: 'primaryPhone',
|
title: '手机号',
|
||||||
width: 140,
|
dataIndex: 'primaryPhone',
|
||||||
render: (v) => maskPhone(v),
|
width: 140,
|
||||||
},
|
render: (v, row) => (
|
||||||
{
|
<AdminPrimaryLink onClick={() => void openDetail(row)}>{maskPhone(v)}</AdminPrimaryLink>
|
||||||
title: '身份摘要',
|
),
|
||||||
|
},
|
||||||
render: (_, r) => (
|
{
|
||||||
<AdminCellLine
|
title: '身份摘要',
|
||||||
primary={r.identities.map((i) => ACTOR_TYPE_LABELS[i.actorType]).join(' / ')}
|
render: (_, r) => (
|
||||||
secondary={r.identities
|
<AdminCellLine
|
||||||
.map((i) => i.refLabel || i.name || (i.phone ? maskPhone(i.phone) : ''))
|
primary={r.identities.map((i) => ACTOR_TYPE_LABELS[i.actorType]).join(' / ')}
|
||||||
.filter(Boolean)
|
secondary={r.identities
|
||||||
.join(' · ')}
|
.map((i) => i.refLabel || i.name || (i.phone ? maskPhone(i.phone) : ''))
|
||||||
/>
|
.filter(Boolean)
|
||||||
),
|
.join(' · ')}
|
||||||
},
|
/>
|
||||||
{
|
),
|
||||||
title: '最近登录',
|
},
|
||||||
dataIndex: 'latestLoginAt',
|
{
|
||||||
width: 160,
|
title: '最近登录',
|
||||||
render: fmtTime,
|
dataIndex: 'latestLoginAt',
|
||||||
},
|
width: 160,
|
||||||
{
|
render: fmtTime,
|
||||||
title: '操作',
|
},
|
||||||
width: 80,
|
{
|
||||||
render: (_, row) => (
|
title: '操作',
|
||||||
<Button type="link" size="small" onClick={() => void openDetail(row)}>
|
width: 80,
|
||||||
详情
|
render: (_, row) => (
|
||||||
</Button>
|
<Button type="link" size="small" onClick={() => void openDetail(row)}>
|
||||||
),
|
详情
|
||||||
},
|
</Button>
|
||||||
];
|
),
|
||||||
|
},
|
||||||
const identityColumns: ColumnsType<Identity> = [
|
];
|
||||||
{
|
|
||||||
title: '端类型',
|
const identityColumns: ColumnsType<Identity> = [
|
||||||
dataIndex: 'actorType',
|
{
|
||||||
width: 120,
|
title: '端类型',
|
||||||
render: (t: ActorType) => <Tag color={ACTOR_TYPE_COLORS[t]}>{ACTOR_TYPE_LABELS[t]}</Tag>,
|
dataIndex: 'actorType',
|
||||||
},
|
width: 120,
|
||||||
{
|
render: (t: ActorType) => <Tag color={ACTOR_TYPE_COLORS[t]}>{ACTOR_TYPE_LABELS[t]}</Tag>,
|
||||||
title: '账号',
|
},
|
||||||
|
{
|
||||||
render: (_, r) => (
|
title: '账号',
|
||||||
<AdminCellLine
|
render: (_, r) => (
|
||||||
primary={r.name || '—'}
|
<AdminCellLine
|
||||||
secondary={[r.phone ? maskPhone(r.phone) : null, `#${r.actorId}`].filter(Boolean).join(' ')}
|
primary={r.name || '—'}
|
||||||
/>
|
secondary={[r.phone ? maskPhone(r.phone) : null, `#${r.actorId}`].filter(Boolean).join(' ')}
|
||||||
),
|
/>
|
||||||
},
|
),
|
||||||
{
|
},
|
||||||
title: '归属',
|
{
|
||||||
dataIndex: 'refLabel',
|
title: '归属',
|
||||||
width: 160,
|
dataIndex: 'refLabel',
|
||||||
|
width: 160,
|
||||||
render: (v, r) => (v ? `${v}${r.refId ? ` #${r.refId}` : ''}` : '—'),
|
render: (v, r) => (v ? `${v}${r.refId ? ` #${r.refId}` : ''}` : '—'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'wxOpenId',
|
title: 'wxOpenId',
|
||||||
dataIndex: 'wxOpenId',
|
dataIndex: 'wxOpenId',
|
||||||
width: 160,
|
width: 160,
|
||||||
|
},
|
||||||
},
|
{
|
||||||
{
|
title: '手机验证',
|
||||||
title: '手机验证',
|
width: 90,
|
||||||
width: 90,
|
render: (_, r) =>
|
||||||
render: (_, r) =>
|
r.actorType === 'USER' ? (
|
||||||
r.actorType === 'USER' ? (
|
r.phoneVerified ? <Tag color="blue">已验证</Tag> : <Tag>未验证</Tag>
|
||||||
r.phoneVerified ? <Tag color="blue">已验证</Tag> : <Tag>未验证</Tag>
|
) : (
|
||||||
) : (
|
'—'
|
||||||
'—'
|
),
|
||||||
),
|
},
|
||||||
},
|
{
|
||||||
{
|
title: '最近登录',
|
||||||
title: '最近登录',
|
dataIndex: 'lastLoginAt',
|
||||||
dataIndex: 'lastLoginAt',
|
width: 160,
|
||||||
width: 160,
|
render: fmtTime,
|
||||||
render: fmtTime,
|
},
|
||||||
},
|
{
|
||||||
{
|
title: '状态',
|
||||||
title: '状态',
|
dataIndex: 'status',
|
||||||
dataIndex: 'status',
|
width: 90,
|
||||||
|
render: (v) => String(v),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
const { columns, settingsButton, settingsModal } = useAdminListColumns('wechat-bindings', baseColumns, { page, pageSize });
|
const { columns, settingsButton, settingsModal } = useAdminListColumns('wechat-bindings', baseColumns, { page, pageSize });
|
||||||
|
|
||||||
},
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
{settingsModal}
|
||||||
const { columns, settingsButton, settingsModal } = useAdminListColumns('wechat-bindings', baseColumns, { page, pageSize });
|
<AdminListHeader
|
||||||
|
title="微信绑定总览"
|
||||||
return (
|
settings={settingsButton}
|
||||||
<div>
|
description="按 unionId 聚合展示已绑定微信的 C 端用户、门店账号、合伙人账号与 HQ 账号;无 unionId 时按单账号分组。"
|
||||||
{settingsModal}
|
/>
|
||||||
<Typography.Title level={4}>微信绑定总览</Typography.Title>
|
|
||||||
{settingsButton}
|
<Form
|
||||||
<Typography.Paragraph type="secondary">
|
form={form}
|
||||||
按 unionId 聚合展示已绑定微信的 C 端用户、门店账号、合伙人账号与 HQ 账号;无 unionId 时按单账号分组。
|
layout="inline"
|
||||||
</Typography.Paragraph>
|
style={{ marginBottom: 16 }}
|
||||||
|
onFinish={(values) => {
|
||||||
<Form
|
setPage(1);
|
||||||
form={form}
|
setFilters({
|
||||||
layout="inline"
|
actorType: values.actorType ?? '',
|
||||||
style={{ marginBottom: 16 }}
|
phone: values.phone?.trim() ?? '',
|
||||||
onFinish={(values) => {
|
unionId: values.unionId?.trim() ?? '',
|
||||||
setPage(1);
|
openId: values.openId?.trim() ?? '',
|
||||||
setFilters({
|
});
|
||||||
actorType: values.actorType ?? '',
|
}}
|
||||||
phone: values.phone?.trim() ?? '',
|
>
|
||||||
unionId: values.unionId?.trim() ?? '',
|
<Form.Item name="actorType" label="端类型">
|
||||||
openId: values.openId?.trim() ?? '',
|
<Select
|
||||||
});
|
allowClear
|
||||||
}}
|
placeholder="全部"
|
||||||
>
|
style={{ width: 140 }}
|
||||||
<Form.Item name="actorType" label="端类型">
|
options={[
|
||||||
<Select
|
{ value: 'USER', label: 'C 端用户' },
|
||||||
allowClear
|
{ value: 'STORE', label: '门店账号' },
|
||||||
placeholder="全部"
|
{ value: 'PARTNER', label: '合伙人账号' },
|
||||||
style={{ width: 140 }}
|
{ value: 'HQ', label: 'HQ 账号' },
|
||||||
options={[
|
]}
|
||||||
{ value: 'USER', label: 'C 端用户' },
|
/>
|
||||||
{ value: 'STORE', label: '门店账号' },
|
</Form.Item>
|
||||||
{ value: 'PARTNER', label: '合伙人账号' },
|
<Form.Item name="phone" label="手机号">
|
||||||
{ value: 'HQ', label: 'HQ 账号' },
|
<Input allowClear placeholder="模糊匹配" style={{ width: 140 }} />
|
||||||
]}
|
</Form.Item>
|
||||||
/>
|
<Form.Item name="unionId" label="unionId">
|
||||||
</Form.Item>
|
<Input allowClear placeholder="精确匹配" style={{ width: 180 }} />
|
||||||
<Form.Item name="phone" label="手机号">
|
</Form.Item>
|
||||||
<Input allowClear placeholder="模糊匹配" style={{ width: 140 }} />
|
<Form.Item name="openId" label="openId">
|
||||||
</Form.Item>
|
<Input allowClear placeholder="精确匹配" style={{ width: 180 }} />
|
||||||
<Form.Item name="unionId" label="unionId">
|
</Form.Item>
|
||||||
<Input allowClear placeholder="精确匹配" style={{ width: 180 }} />
|
<Form.Item>
|
||||||
</Form.Item>
|
<Space>
|
||||||
<Form.Item name="openId" label="openId">
|
<Button type="primary" htmlType="submit">
|
||||||
<Input allowClear placeholder="精确匹配" style={{ width: 180 }} />
|
查询
|
||||||
</Form.Item>
|
</Button>
|
||||||
<Form.Item>
|
<Button
|
||||||
<Space>
|
onClick={() => {
|
||||||
<Button type="primary" htmlType="submit">
|
form.resetFields();
|
||||||
查询
|
setPage(1);
|
||||||
</Button>
|
setFilters({ actorType: '', phone: '', unionId: '', openId: '' });
|
||||||
<Button
|
}}
|
||||||
onClick={() => {
|
>
|
||||||
form.resetFields();
|
重置
|
||||||
setPage(1);
|
</Button>
|
||||||
setFilters({ actorType: '', phone: '', unionId: '', openId: '' });
|
<Button onClick={() => void reload()}>刷新</Button>
|
||||||
}}
|
</Space>
|
||||||
>
|
</Form.Item>
|
||||||
重置
|
</Form>
|
||||||
</Button>
|
|
||||||
<Button onClick={() => void reload()}>刷新</Button>
|
<Table<GroupRow>
|
||||||
</Space>
|
rowKey="groupKey"
|
||||||
</Form.Item>
|
loading={loading}
|
||||||
</Form>
|
columns={columns}
|
||||||
|
dataSource={data?.items ?? []}
|
||||||
<Table<GroupRow>
|
pagination={{
|
||||||
rowKey="groupKey"
|
current: page,
|
||||||
loading={loading}
|
pageSize,
|
||||||
columns={columns}
|
total: data?.total ?? 0,
|
||||||
dataSource={data?.items ?? []}
|
showSizeChanger: true,
|
||||||
pagination={{
|
onChange: (p, ps) => {
|
||||||
current: page,
|
setPage(p);
|
||||||
pageSize,
|
setPageSize(ps);
|
||||||
total: data?.total ?? 0,
|
},
|
||||||
showSizeChanger: true,
|
}}
|
||||||
onChange: (p, ps) => {
|
/>
|
||||||
setPage(p);
|
|
||||||
setPageSize(ps);
|
<Drawer
|
||||||
},
|
title="微信绑定详情"
|
||||||
}}
|
width={960}
|
||||||
/>
|
open={drawerOpen}
|
||||||
|
onClose={() => setDrawerOpen(false)}
|
||||||
<Drawer
|
>
|
||||||
title="微信绑定详情"
|
{detail ? (
|
||||||
width={960}
|
<>
|
||||||
open={drawerOpen}
|
<Descriptions column={2} size="small" bordered style={{ marginBottom: 16 }}>
|
||||||
onClose={() => setDrawerOpen(false)}
|
<Descriptions.Item label="groupKey">{detail.groupKey}</Descriptions.Item>
|
||||||
>
|
<Descriptions.Item label="unionId">{detail.unionId || '—'}</Descriptions.Item>
|
||||||
{detail ? (
|
<Descriptions.Item label="身份数">{detail.identityCount}</Descriptions.Item>
|
||||||
<>
|
<Descriptions.Item label="端类型">{renderActorTags(detail.actorTypes)}</Descriptions.Item>
|
||||||
<Descriptions column={2} size="small" bordered style={{ marginBottom: 16 }}>
|
<Descriptions.Item label="一人多角色">
|
||||||
<Descriptions.Item label="groupKey">{detail.groupKey}</Descriptions.Item>
|
{detail.multiRole ? <Tag color="red">是</Tag> : <Tag>否</Tag>}
|
||||||
<Descriptions.Item label="unionId">{detail.unionId || '—'}</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
<Descriptions.Item label="身份数">{detail.identityCount}</Descriptions.Item>
|
<Descriptions.Item label="最近登录">{fmtTime(detail.latestLoginAt)}</Descriptions.Item>
|
||||||
<Descriptions.Item label="端类型">{renderActorTags(detail.actorTypes)}</Descriptions.Item>
|
</Descriptions>
|
||||||
<Descriptions.Item label="一人多角色">
|
<Table<Identity>
|
||||||
{detail.multiRole ? <Tag color="red">是</Tag> : <Tag>否</Tag>}
|
rowKey={(r) => `${r.actorType}-${r.actorId}`}
|
||||||
</Descriptions.Item>
|
size="small"
|
||||||
<Descriptions.Item label="最近登录">{fmtTime(detail.latestLoginAt)}</Descriptions.Item>
|
columns={identityColumns}
|
||||||
</Descriptions>
|
dataSource={detail.identities}
|
||||||
<Table<Identity>
|
pagination={false}
|
||||||
rowKey={(r) => `${r.actorType}-${r.actorId}`}
|
/>
|
||||||
size="small"
|
</>
|
||||||
columns={identityColumns}
|
) : null}
|
||||||
dataSource={detail.identities}
|
</Drawer>
|
||||||
pagination={false}
|
</div>
|
||||||
/>
|
);
|
||||||
</>
|
}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import { request } from '../lib/api';
|
|||||||
import { fmtTime } from '../lib/constants';
|
import { fmtTime } from '../lib/constants';
|
||||||
import type { WecomBotLogDto } from '@dukang/shared-types';
|
import type { WecomBotLogDto } from '@dukang/shared-types';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
|
||||||
|
|
||||||
export default function WecomBotLogsPage() {
|
export default function WecomBotLogsPage() {
|
||||||
@@ -28,7 +30,14 @@ export default function WecomBotLogsPage() {
|
|||||||
|
|
||||||
const baseColumns: ColumnsType<WecomBotLogDto> = [
|
const baseColumns: ColumnsType<WecomBotLogDto> = [
|
||||||
{ title: '时间', dataIndex: 'createdAt', width: 160, render: fmtTime },
|
{ title: '时间', dataIndex: 'createdAt', width: 160, render: fmtTime },
|
||||||
{ title: '机器人', dataIndex: 'botName', width: 120, render: (v, r) => v || r.botKey || '—' },
|
{
|
||||||
|
title: '机器人',
|
||||||
|
dataIndex: 'botName',
|
||||||
|
width: 120,
|
||||||
|
render: (v, r) => (
|
||||||
|
<AdminPrimaryLink onClick={() => setDetail(r)}>{v || r.botKey || ''}</AdminPrimaryLink>
|
||||||
|
),
|
||||||
|
},
|
||||||
{ title: '企微用户', dataIndex: 'wecomUserId', width: 120 },
|
{ title: '企微用户', dataIndex: 'wecomUserId', width: 120 },
|
||||||
{ title: '动作', dataIndex: 'action', width: 160 },
|
{ title: '动作', dataIndex: 'action', width: 160 },
|
||||||
{ title: '权限', dataIndex: 'permission', width: 140, render: (v) => v || '—' },
|
{ title: '权限', dataIndex: 'permission', width: 140, render: (v) => v || '—' },
|
||||||
@@ -56,11 +65,11 @@ export default function WecomBotLogsPage() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<Typography.Title level={4}>企微机器人日志</Typography.Title>
|
<AdminListHeader
|
||||||
{settingsButton}
|
title="企微机器人日志"
|
||||||
<Typography.Paragraph type="secondary">
|
settings={settingsButton}
|
||||||
记录机器人在企微内的查询与审批操作,含权限点、耗时与成败。
|
description="记录机器人在企微内的查询与审批操作,含权限点、耗时与成败。"
|
||||||
</Typography.Paragraph>
|
/>
|
||||||
|
|
||||||
<Form
|
<Form
|
||||||
form={form}
|
form={form}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import { fmtTime } from '../lib/constants';
|
|||||||
import { useAdminList } from '../lib/useAdminList';
|
import { useAdminList } from '../lib/useAdminList';
|
||||||
import OssUpload from '../components/OssUpload';
|
import OssUpload from '../components/OssUpload';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
|
||||||
|
|
||||||
type FormValues = {
|
type FormValues = {
|
||||||
@@ -293,7 +294,14 @@ export default function WecomBotsPage() {
|
|||||||
</Avatar>
|
</Avatar>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{ title: '名称', dataIndex: 'name', width: 140 },
|
{
|
||||||
|
title: '名称',
|
||||||
|
dataIndex: 'name',
|
||||||
|
width: 140,
|
||||||
|
render: (v, row) => (
|
||||||
|
<AdminPrimaryLink onClick={() => void openEdit(row)}>{v}</AdminPrimaryLink>
|
||||||
|
),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '角色',
|
title: '角色',
|
||||||
dataIndex: 'role',
|
dataIndex: 'role',
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ import { fmtTime } from '../lib/constants';
|
|||||||
import { useAdminList } from '../lib/useAdminList';
|
import { useAdminList } from '../lib/useAdminList';
|
||||||
import OssUpload from '../components/OssUpload';
|
import OssUpload from '../components/OssUpload';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
|
||||||
|
|
||||||
type FormValues = {
|
type FormValues = {
|
||||||
@@ -202,7 +204,7 @@ function PushRoutesTab() {
|
|||||||
render: (name: string, row) => (
|
render: (name: string, row) => (
|
||||||
<Space>
|
<Space>
|
||||||
<Avatar src={row.avatarUrl ?? undefined}>{name.slice(0, 1)}</Avatar>
|
<Avatar src={row.avatarUrl ?? undefined}>{name.slice(0, 1)}</Avatar>
|
||||||
<span>{name}</span>
|
<AdminPrimaryLink onClick={() => openEdit(row)}>{name}</AdminPrimaryLink>
|
||||||
</Space>
|
</Space>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
@@ -271,9 +273,15 @@ function PushRoutesTab() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<Typography.Paragraph type="secondary">
|
<AdminListHeader
|
||||||
配置群机器人 Webhook:按推送条件订阅业务通知 / 告警。运行时不再读取 .env 中的 Webhook URL。
|
settings={settingsButton}
|
||||||
</Typography.Paragraph>
|
description="配置群机器人 Webhook:按推送条件订阅业务通知 / 告警。运行时不再读取 .env 中的 Webhook URL。"
|
||||||
|
actions={
|
||||||
|
<Button type="primary" onClick={openCreate}>
|
||||||
|
新建推送
|
||||||
|
</Button>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
<Form
|
<Form
|
||||||
form={filterForm}
|
form={filterForm}
|
||||||
@@ -308,10 +316,6 @@ function PushRoutesTab() {
|
|||||||
>
|
>
|
||||||
重置
|
重置
|
||||||
</Button>
|
</Button>
|
||||||
<Button type="primary" onClick={openCreate}>
|
|
||||||
新建推送
|
|
||||||
</Button>
|
|
||||||
{settingsButton}
|
|
||||||
</Space>
|
</Space>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Form>
|
</Form>
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ import { downloadExcelCsv } from '../lib/exportExcel';
|
|||||||
import { request, type HqProfile } from '../lib/api';
|
import { request, type HqProfile } from '../lib/api';
|
||||||
import { useAdminList } from '../lib/useAdminList';
|
import { useAdminList } from '../lib/useAdminList';
|
||||||
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../lib/useAdminListColumns';
|
||||||
|
import { AdminListHeader } from '../components/AdminListHeader';
|
||||||
|
import { AdminPrimaryLink } from '../components/AdminPrimaryLink';
|
||||||
|
|
||||||
|
|
||||||
type Row = {
|
type Row = {
|
||||||
@@ -238,7 +240,14 @@ export default function WineryBillsPage() {
|
|||||||
const selectedAmount = selectedRows.reduce((s, r) => s + Number(r.wineryAmount), 0);
|
const selectedAmount = selectedRows.reduce((s, r) => s + Number(r.wineryAmount), 0);
|
||||||
|
|
||||||
const baseColumns: ColumnsType<Row> = [
|
const baseColumns: ColumnsType<Row> = [
|
||||||
{ title: '账单号', dataIndex: 'billNo', width: 170 },
|
{
|
||||||
|
title: '账单号',
|
||||||
|
dataIndex: 'billNo',
|
||||||
|
width: 170,
|
||||||
|
render: (v, row) => (
|
||||||
|
<AdminPrimaryLink onClick={() => void openDetail(row.id)}>{v}</AdminPrimaryLink>
|
||||||
|
),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '账单日',
|
title: '账单日',
|
||||||
dataIndex: 'billDate',
|
dataIndex: 'billDate',
|
||||||
@@ -297,31 +306,18 @@ export default function WineryBillsPage() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{settingsModal}
|
{settingsModal}
|
||||||
<div
|
<AdminListHeader
|
||||||
style={{
|
title="酒厂对账单"
|
||||||
display: 'flex',
|
settings={settingsButton}
|
||||||
justifyContent: 'space-between',
|
description={`T+3:每日 8:00 汇总 3 天前(自然日)已完成的同城/跨城订单(实付 × ${ratePct}%);未打款红色、已打款绿色、应付为 0 无需打款(灰),可展开订单明细`}
|
||||||
alignItems: 'flex-start',
|
actions={
|
||||||
marginBottom: 16,
|
canEditWineryBank ? (
|
||||||
gap: 16,
|
<Button type="default" onClick={() => void openBankModal()}>
|
||||||
}}
|
酒厂银行账户信息配置
|
||||||
>
|
</Button>
|
||||||
<Space direction="vertical" size={0}>
|
) : null
|
||||||
<Typography.Title level={4} style={{ margin: 0 }}>
|
}
|
||||||
酒厂对账单
|
/>
|
||||||
</Typography.Title>
|
|
||||||
{settingsButton}
|
|
||||||
<Typography.Text type="secondary">
|
|
||||||
T+3:每日 8:00 汇总 3 天前(自然日)已完成的同城/跨城订单(实付 × {ratePct}%);未打款红色、已打款绿色、应付为 0
|
|
||||||
无需打款(灰),可展开订单明细
|
|
||||||
</Typography.Text>
|
|
||||||
</Space>
|
|
||||||
{canEditWineryBank ? (
|
|
||||||
<Button type="default" onClick={() => void openBankModal()}>
|
|
||||||
酒厂银行账户信息配置
|
|
||||||
</Button>
|
|
||||||
) : null}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{summary && (
|
{summary && (
|
||||||
<Card size="small" style={{ marginBottom: 16 }}>
|
<Card size="small" style={{ marginBottom: 16 }}>
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import { fmtTime } from '../../lib/constants';
|
|||||||
import { useAdminList } from '../../lib/useAdminList';
|
import { useAdminList } from '../../lib/useAdminList';
|
||||||
import type { PromoCodeDetailContext } from './PromoCodeDetailLayout';
|
import type { PromoCodeDetailContext } from './PromoCodeDetailLayout';
|
||||||
import { useAdminListColumns } from '../../lib/useAdminListColumns';
|
import { useAdminListColumns } from '../../lib/useAdminListColumns';
|
||||||
|
import { AdminPrimaryLink } from '../../components/AdminPrimaryLink';
|
||||||
|
import { AdminListHeader } from '../../components/AdminListHeader';
|
||||||
|
|
||||||
|
|
||||||
export default function PromoCodeUsersPage() {
|
export default function PromoCodeUsersPage() {
|
||||||
@@ -25,7 +27,16 @@ export default function PromoCodeUsersPage() {
|
|||||||
|
|
||||||
const baseColumns: ColumnsType<PromoCodeAttributedUser> = [
|
const baseColumns: ColumnsType<PromoCodeAttributedUser> = [
|
||||||
{ title: '用户编号', dataIndex: 'userNo', width: 120 },
|
{ title: '用户编号', dataIndex: 'userNo', width: 120 },
|
||||||
{ title: '昵称', dataIndex: 'nickname', width: 100, render: (v) => v || '—' },
|
{
|
||||||
|
title: '昵称',
|
||||||
|
dataIndex: 'nickname',
|
||||||
|
width: 100,
|
||||||
|
render: (v, row) => (
|
||||||
|
<AdminPrimaryLink onClick={() => navigate('/users', { state: { openUserId: row.id } })}>
|
||||||
|
{v}
|
||||||
|
</AdminPrimaryLink>
|
||||||
|
),
|
||||||
|
},
|
||||||
{ title: '手机', dataIndex: 'phone', width: 120, render: (v) => v || '—' },
|
{ title: '手机', dataIndex: 'phone', width: 120, render: (v) => v || '—' },
|
||||||
{
|
{
|
||||||
title: '验手机',
|
title: '验手机',
|
||||||
@@ -74,20 +85,24 @@ export default function PromoCodeUsersPage() {
|
|||||||
const { columns, settingsButton, settingsModal } = useAdminListColumns('promo-code-users', baseColumns, { page, pageSize });
|
const { columns, settingsButton, settingsModal } = useAdminListColumns('promo-code-users', baseColumns, { page, pageSize });
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Table
|
<>
|
||||||
rowKey="id"
|
{settingsModal}
|
||||||
className="admin-table-nowrap"
|
<AdminListHeader settings={settingsButton} />
|
||||||
loading={loading}
|
<Table
|
||||||
columns={columns}
|
rowKey="id"
|
||||||
dataSource={data?.items ?? []}
|
className="admin-table-nowrap"
|
||||||
scroll={{ x: 'max-content' }}
|
loading={loading}
|
||||||
pagination={{
|
columns={columns}
|
||||||
current: page,
|
dataSource={data?.items ?? []}
|
||||||
pageSize,
|
scroll={{ x: 'max-content' }}
|
||||||
total: data?.total ?? 0,
|
pagination={{
|
||||||
showSizeChanger: true,
|
current: page,
|
||||||
onChange: (p, ps) => { setPage(p); setPageSize(ps); },
|
pageSize,
|
||||||
}}
|
total: data?.total ?? 0,
|
||||||
/>
|
showSizeChanger: true,
|
||||||
|
onChange: (p, ps) => { setPage(p); setPageSize(ps); },
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -28,7 +28,7 @@
|
|||||||
| 3.5.6 | 08-23 | HQ 任务导出;核销/财务银行信息;工单图片入任务;运营去调试;门店审核全屏 | [`v3.5.6`](./杜康好客-v3.5.6-开发文档.md) |
|
| 3.5.6 | 08-23 | HQ 任务导出;核销/财务银行信息;工单图片入任务;运营去调试;门店审核全屏 | [`v3.5.6`](./杜康好客-v3.5.6-开发文档.md) |
|
||||||
| 3.5.7 | 08-23 | 门店端核销记录时间显示秒;首页「今日核销金额」文案 | [`v3.5.7`](./杜康好客-v3.5.7-开发文档.md) |
|
| 3.5.7 | 08-23 | 门店端核销记录时间显示秒;首页「今日核销金额」文案 | [`v3.5.7`](./杜康好客-v3.5.7-开发文档.md) |
|
||||||
| 3.5.8 | 08-24 | HQ 单账号追加/撤销权限;运营改客服修复;城市门店服务+城市范围 | [`v3.5.8`](./杜康好客-v3.5.8-开发文档.md) |
|
| 3.5.8 | 08-24 | HQ 单账号追加/撤销权限;运营改客服修复;城市门店服务+城市范围 | [`v3.5.8`](./杜康好客-v3.5.8-开发文档.md) |
|
||||||
| 3.5.9 | 08-25 | 门店累计核销好客权益;HQ 表格去省略号;序号列 + 列设置;用户备注 / 手机号不脱敏 | [`v3.5.9`](./杜康好客-v3.5.9-开发文档.md) |
|
| 3.5.9 | 08-25 | 门店累计核销好客权益;HQ 表格去省略号;序号列 + 列设置 + 拖表头改列宽;用户备注 / 手机号不脱敏 | [`v3.5.9`](./杜康好客-v3.5.9-开发文档.md) |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@
|
|||||||
|
|
||||||
**HQ 订单导出**(`admin-web` 订单监控):
|
**HQ 订单导出**(`admin-web` 订单监控):
|
||||||
|
|
||||||
- 支持按筛选(下单日期、状态、类型、城市、配送、收货手机等)或勾选订单导出
|
- 支持按筛选(下单日期、状态可多选、类型、城市、配送、收货手机等)或勾选订单导出
|
||||||
- 格式:Excel(`.xlsx`)/ PDF(`.pdf`)
|
- 格式:Excel(`.xlsx`)/ PDF(`.pdf`)
|
||||||
- 单次上限 5000 条;按筛选且未指定日期时默认近 30 天
|
- 单次上限 5000 条;按筛选且未指定日期时默认近 30 天
|
||||||
- 权限:`orders`;操作审计 `ORDER_EXPORT`
|
- 权限:`orders`;操作审计 `ORDER_EXPORT`
|
||||||
@@ -137,7 +137,7 @@
|
|||||||
- **不**再因客户端 `validation_error` 自动创建技术支持工单。
|
- **不**再因客户端 `validation_error` 自动创建技术支持工单。
|
||||||
- 合伙人入驻提交前须展示 HQ 可配企微客服二维码,并确认已添加客服。
|
- 合伙人入驻提交前须展示 HQ 可配企微客服二维码,并确认已添加客服。
|
||||||
- HQ 门店列表:店名完整展示、操作列右固定、表过宽可横向滚动(v3.5.9 去掉省略号)。
|
- HQ 门店列表:店名完整展示、操作列右固定、表过宽可横向滚动(v3.5.9 去掉省略号)。
|
||||||
- HQ 主列表:最左序号;「列设置」控制显示列与顺序,偏好挂当前 HQ 账号。
|
- HQ 主列表:最左序号;「列设置」控制显示列与顺序;可拖表头分割线改列宽;主展示列下划线点击进编辑/详情;偏好挂当前 HQ 账号。
|
||||||
- 门店列表展示「累计核销好客权益」(该店核销券面额合计)。
|
- 门店列表展示「累计核销好客权益」(该店核销券面额合计)。
|
||||||
- HQ 用户列表:昵称只读;双击「备注」离开即保存(`hq_remark`);列表手机号不脱敏(详情仍脱敏)。
|
- HQ 用户列表:昵称只读;双击「备注」离开即保存(`hq_remark`);列表手机号不脱敏(详情仍脱敏)。
|
||||||
- 详 [`v3.4.16`](./杜康好客-v3.4.16-门店联系电话与体验优化.md)、[`v3.5.9`](./杜康好客-v3.5.9-开发文档.md)。
|
- 详 [`v3.4.16`](./杜康好客-v3.4.16-门店联系电话与体验优化.md)、[`v3.5.9`](./杜康好客-v3.5.9-开发文档.md)。
|
||||||
|
|||||||
@@ -67,7 +67,7 @@
|
|||||||
|
|
||||||
| 日期 | 说明 |
|
| 日期 | 说明 |
|
||||||
|------|------|
|
|------|------|
|
||||||
| 2026-08-25 | v3.5.9:门店列表累计核销好客权益;HQ 表格去省略号;主列表序号 + 列设置存 HQ 账号;用户列表备注(不改昵称)、手机号不脱敏 |
|
| 2026-08-25 | v3.5.9:门店列表累计核销好客权益;HQ 表格去省略号;主列表序号 + 列设置/列宽存 HQ 账号;用户列表备注(不改昵称)、手机号不脱敏;订单列表状态可多选 |
|
||||||
| 2026-08-24 | v3.5.8:HQ 单账号追加/撤销权限;运营改客服;城市门店服务与城市范围;分类删除权限与概览按权限/城市裁剪 |
|
| 2026-08-24 | v3.5.8:HQ 单账号追加/撤销权限;运营改客服;城市门店服务与城市范围;分类删除权限与概览按权限/城市裁剪 |
|
||||||
| 2026-08-23 | v3.5.7:门店核销记录时间显示秒;首页「今日到账金额」→「今日核销金额」 |
|
| 2026-08-23 | v3.5.7:门店核销记录时间显示秒;首页「今日到账金额」→「今日核销金额」 |
|
||||||
| 2026-08-23 | v3.5.6:开发计划任务导出;核销/财务银行信息与打款凭证;工单图片入任务;运营去调试;门店审核全屏 |
|
| 2026-08-23 | v3.5.6:开发计划任务导出;核销/财务银行信息与打款凭证;工单图片入任务;运营去调试;门店审核全屏 |
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
1. **门店列表**增加「累计核销好客权益」:该店历史核销券面额合计。
|
1. **门店列表**增加「累计核销好客权益」:该店历史核销券面额合计。
|
||||||
2. **全 HQ 表格**去掉 `...` 截断,长文本完整展示,横向滚动。
|
2. **全 HQ 表格**去掉 `...` 截断,长文本完整展示,横向滚动。
|
||||||
3. 每张 **主列表**:最左序号(跨页连续);「列设置」弹窗控制显示列与顺序,偏好存当前 HQ 账号。
|
3. 每张 **主列表**:最左序号(跨页连续);「列设置」弹窗控制显示列与顺序;可拖表头分割线改列宽。偏好(含列宽)存当前 HQ 账号。主展示列(名称 / 单号 / 昵称等)带下划线,点击进入编辑或详情。
|
||||||
4. **用户列表**:昵称只读(用户自己的);新增「备注」列,双击编辑 HQ 标记,离开即写入 `user_user.hq_remark`;手机号列表明文,不脱敏。
|
4. **用户列表**:昵称只读(用户自己的);新增「备注」列,双击编辑 HQ 标记,离开即写入 `user_user.hq_remark`;手机号列表明文,不脱敏。
|
||||||
|
|
||||||
**不做**:C 端 / 合伙人 / 门店端;详情 Drawer 内嵌表不加列设置。
|
**不做**:C 端 / 合伙人 / 门店端;详情 Drawer 内嵌表不加列设置。
|
||||||
@@ -38,10 +38,11 @@
|
|||||||
| 序号 | `(page-1)*pageSize+index+1`,锁定最左,不可隐藏 |
|
| 序号 | `(page-1)*pageSize+index+1`,锁定最左,不可隐藏 |
|
||||||
| 操作列 | 锁定最右,不可隐藏 |
|
| 操作列 | 锁定最右,不可隐藏 |
|
||||||
| 弹窗 | 勾选显示、拖拽/上下移排序、重置默认 |
|
| 弹窗 | 勾选显示、拖拽/上下移排序、重置默认 |
|
||||||
|
| 主列 | 名称/单号/昵称等下划线,点击同「编辑」或「详情」 |
|
||||||
| 存储 | `hq_account.list_column_prefs` JSON,按 `listKey` |
|
| 存储 | `hq_account.list_column_prefs` JSON,按 `listKey` |
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
{ stores: { order: ["name", "cityName"], hidden: ["intro"] } }
|
{ stores: { order: ["name", "cityName"], hidden: ["intro"], widths: { name: 180 } } }
|
||||||
```
|
```
|
||||||
|
|
||||||
新列按默认位置插入且默认显示;未知 key 忽略。重置即删除该 `listKey`。
|
新列按默认位置插入且默认显示;未知 key 忽略。重置即删除该 `listKey`。
|
||||||
@@ -113,7 +114,24 @@
|
|||||||
- [ ] HQ 主表长字段不再 `...`,可横向滑完
|
- [ ] HQ 主表长字段不再 `...`,可横向滑完
|
||||||
- [ ] 主列表最左序号跨页连续
|
- [ ] 主列表最左序号跨页连续
|
||||||
- [ ] 列设置可隐藏/排序;保存后刷新仍在;重置恢复默认
|
- [ ] 列设置可隐藏/排序;保存后刷新仍在;重置恢复默认
|
||||||
|
- [ ] 主展示列带下划线,点击进入对应编辑或详情
|
||||||
- [ ] 序号、操作列不能在弹窗关掉或拖走
|
- [ ] 序号、操作列不能在弹窗关掉或拖走
|
||||||
- [ ] 详情描述列表仍可省略
|
- [ ] 详情描述列表仍可省略
|
||||||
- [ ] 用户列表昵称只读;双击「备注」可改,离开编辑后 `user_user.hq_remark` 已更新;C 端看不到该字段
|
- [ ] 用户列表昵称只读;双击「备注」可改,离开编辑后 `user_user.hq_remark` 已更新;C 端看不到该字段
|
||||||
- [ ] 用户列表手机号完整可见(详情仍脱敏)
|
- [ ] 用户列表手机号完整可见(详情仍脱敏)
|
||||||
|
- [ ] 权益券列表:用户编号、订单号可点进对应用户/订单详情;来源含商品名、规格、数量、配送方式、实付金额
|
||||||
|
- [ ] 订单列表「状态」可多选;导出按所选状态过滤;不选即全部
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 10. 权益券列表快链与来源
|
||||||
|
|
||||||
|
- **用户**、**订单**列(及券详情)用主列下划线,分别打开用户详情抽屉、订单详情抽屉。
|
||||||
|
- **来源**:关联订单时拼 `商品名 / 规格 / 数量(瓶或箱) / 配送方式 / ¥实付`;无订单仍用 `sourceProduct`(如总部手动发放)。
|
||||||
|
- 列表接口 `order` 增补 `productName`、`productSpec`、`quantity`、`saleUnit`、`deliveryType`、`payAmount`。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 11. 订单列表状态多选
|
||||||
|
|
||||||
|
`GET /admin/orders` 与 `POST /admin/orders/export` 的 `status` 支持多值(重复 query、逗号串、JSON 数组均可)。列表筛选为多选;空 = 全部。单值旧链接仍可用。
|
||||||
|
|||||||
+1
-1
@@ -43,7 +43,7 @@ C 端购酒核销 · 门店扫码核销+打款 · 合伙人拓店履约 · WebAd
|
|||||||
|
|
||||||
**HQ 权限(v3.5.8)**:生效 =(角色 ∪ 追加)− 撤销。城市范围绑在账号上(空=全国;「城市门店服务」必须勾城)。门店 API 按 `cityIds` 强制过滤。城市门店服务可新增分类、不可删除;概览按权限与城市范围裁剪。
|
**HQ 权限(v3.5.8)**:生效 =(角色 ∪ 追加)− 撤销。城市范围绑在账号上(空=全国;「城市门店服务」必须勾城)。门店 API 按 `cityIds` 强制过滤。城市门店服务可新增分类、不可删除;概览按权限与城市范围裁剪。
|
||||||
|
|
||||||
**HQ 列表(v3.5.9)**:主表不省略号、可横滑;最左序号;列设置(显隐/顺序)存 `hq_account.list_column_prefs`。门店列表「累计核销好客权益」= 该店 `RedeemRecord.amount` 合计。用户列表昵称只读;双击「备注」离开即保存(`hq_remark`);列表手机号不脱敏。
|
**HQ 列表(v3.5.9)**:主表不省略号、可横滑;最左序号;列设置(显隐/顺序)与列宽(拖表头)存 `hq_account.list_column_prefs`。主展示列下划线,点击进编辑或详情。门店列表「累计核销好客权益」= 该店 `RedeemRecord.amount` 合计。用户列表昵称只读(点击进详情);双击「备注」离开即保存(`hq_remark`);列表手机号不脱敏。
|
||||||
|
|
||||||
## 5. 验收用例(必过)
|
## 5. 验收用例(必过)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -92,7 +92,7 @@
|
|||||||
| 交易 | 订单、权益券、核销记录、推广码+metrics |
|
| 交易 | 订单、权益券、核销记录、推广码+metrics |
|
||||||
| 财务 | 门店/合伙人/酒厂/物流账单;打款确认 |
|
| 财务 | 门店/合伙人/酒厂/物流账单;打款确认 |
|
||||||
| 工单 | 售后四类型 + 技术支持(ST) + 开发计划 |
|
| 工单 | 售后四类型 + 技术支持(ST) + 开发计划 |
|
||||||
| 系统 | 账号权限、客户端配置、企微机器人/消息推送;列表「列设置」按账号保存 |
|
| 系统 | 账号权限、客户端配置、企微机器人/消息推送;列表「列设置」与列宽按账号保存 |
|
||||||
| 日志 | HQ/用户/门店/合伙人/企微 |
|
| 日志 | HQ/用户/门店/合伙人/企微 |
|
||||||
|
|
||||||
## 6. 商品与模板
|
## 6. 商品与模板
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ export function isHqListColumnKey(value: string): value is HqListColumnKey {
|
|||||||
export type HqListColumnPref = {
|
export type HqListColumnPref = {
|
||||||
order: string[];
|
order: string[];
|
||||||
hidden: string[];
|
hidden: string[];
|
||||||
|
/** 列宽(px);未出现的 key 用列默认 width */
|
||||||
|
widths?: Record<string, number>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type HqListColumnPrefsMap = Partial<Record<HqListColumnKey, HqListColumnPref>>;
|
export type HqListColumnPrefsMap = Partial<Record<HqListColumnKey, HqListColumnPref>>;
|
||||||
@@ -68,4 +70,5 @@ export type SaveHqListColumnPrefsRequest = {
|
|||||||
reset?: boolean;
|
reset?: boolean;
|
||||||
order?: string[];
|
order?: string[];
|
||||||
hidden?: string[];
|
hidden?: string[];
|
||||||
|
widths?: Record<string, number>;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,6 +3,21 @@ export interface AdminListQuery {
|
|||||||
pageSize?: number;
|
pageSize?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** HQ 订单列表 / 导出筛选。`status` 可多选(单值仍兼容) */
|
||||||
|
export interface AdminOrdersListQuery extends AdminListQuery {
|
||||||
|
orderNo?: string;
|
||||||
|
status?: string | string[];
|
||||||
|
orderType?: string;
|
||||||
|
userId?: string;
|
||||||
|
cityId?: string;
|
||||||
|
receiverPhone?: string;
|
||||||
|
fulfillmentHold?: string | boolean;
|
||||||
|
createdFrom?: string;
|
||||||
|
createdTo?: string;
|
||||||
|
excludeTest?: boolean;
|
||||||
|
deliveryType?: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface UpdateAdminUserRequest {
|
export interface UpdateAdminUserRequest {
|
||||||
hqRemark: string;
|
hqRemark: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,15 +55,29 @@ type UserRow = Pick<
|
|||||||
avatar?: { url: string } | null;
|
avatar?: { url: string } | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function parseColumnWidths(raw: unknown): Record<string, number> | undefined {
|
||||||
|
if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return undefined;
|
||||||
|
const out: Record<string, number> = {};
|
||||||
|
for (const [key, value] of Object.entries(raw as Record<string, unknown>)) {
|
||||||
|
if (!key.trim()) continue;
|
||||||
|
const n = typeof value === 'number' ? value : Number(value);
|
||||||
|
if (!Number.isFinite(n)) continue;
|
||||||
|
out[key] = Math.min(960, Math.max(48, Math.round(n)));
|
||||||
|
}
|
||||||
|
return Object.keys(out).length ? out : undefined;
|
||||||
|
}
|
||||||
|
|
||||||
function parseListColumnPrefs(raw: unknown): HqListColumnPrefsMap {
|
function parseListColumnPrefs(raw: unknown): HqListColumnPrefsMap {
|
||||||
if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return {};
|
if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return {};
|
||||||
const out: HqListColumnPrefsMap = {};
|
const out: HqListColumnPrefsMap = {};
|
||||||
for (const [key, value] of Object.entries(raw as Record<string, unknown>)) {
|
for (const [key, value] of Object.entries(raw as Record<string, unknown>)) {
|
||||||
if (!isHqListColumnKey(key) || !value || typeof value !== 'object' || Array.isArray(value)) continue;
|
if (!isHqListColumnKey(key) || !value || typeof value !== 'object' || Array.isArray(value)) continue;
|
||||||
const row = value as { order?: unknown; hidden?: unknown };
|
const row = value as { order?: unknown; hidden?: unknown; widths?: unknown };
|
||||||
|
const widths = parseColumnWidths(row.widths);
|
||||||
out[key] = {
|
out[key] = {
|
||||||
order: Array.isArray(row.order) ? row.order.filter((v): v is string => typeof v === 'string') : [],
|
order: Array.isArray(row.order) ? row.order.filter((v): v is string => typeof v === 'string') : [],
|
||||||
hidden: Array.isArray(row.hidden) ? row.hidden.filter((v): v is string => typeof v === 'string') : [],
|
hidden: Array.isArray(row.hidden) ? row.hidden.filter((v): v is string => typeof v === 'string') : [],
|
||||||
|
...(widths ? { widths } : {}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
@@ -1238,7 +1252,7 @@ export class AuthService {
|
|||||||
actorType: string,
|
actorType: string,
|
||||||
actorId: bigint,
|
actorId: bigint,
|
||||||
listKey: string,
|
listKey: string,
|
||||||
dto: { reset?: boolean; order?: string[]; hidden?: string[] },
|
dto: { reset?: boolean; order?: string[]; hidden?: string[]; widths?: Record<string, number> },
|
||||||
) {
|
) {
|
||||||
if (actorType !== 'HQ') throw new ForbiddenException('仅总部账号可保存列表列设置');
|
if (actorType !== 'HQ') throw new ForbiddenException('仅总部账号可保存列表列设置');
|
||||||
if (!isHqListColumnKey(listKey)) throw new BadRequestException('未知列表');
|
if (!isHqListColumnKey(listKey)) throw new BadRequestException('未知列表');
|
||||||
@@ -1251,9 +1265,19 @@ export class AuthService {
|
|||||||
if (dto.reset) {
|
if (dto.reset) {
|
||||||
delete current[listKey];
|
delete current[listKey];
|
||||||
} else {
|
} else {
|
||||||
|
const prev = current[listKey];
|
||||||
|
const widths =
|
||||||
|
dto.widths !== undefined ? parseColumnWidths(dto.widths) : prev?.widths;
|
||||||
current[listKey] = {
|
current[listKey] = {
|
||||||
order: (dto.order ?? []).filter((k) => typeof k === 'string' && k.trim()),
|
order:
|
||||||
hidden: (dto.hidden ?? []).filter((k) => typeof k === 'string' && k.trim()),
|
dto.order !== undefined
|
||||||
|
? dto.order.filter((k) => typeof k === 'string' && k.trim())
|
||||||
|
: (prev?.order ?? []),
|
||||||
|
hidden:
|
||||||
|
dto.hidden !== undefined
|
||||||
|
? dto.hidden.filter((k) => typeof k === 'string' && k.trim())
|
||||||
|
: (prev?.hidden ?? []),
|
||||||
|
...(widths && Object.keys(widths).length ? { widths } : {}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const updated = await this.prisma.hqAccount.update({
|
const updated = await this.prisma.hqAccount.update({
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { IsArray, IsBoolean, IsIn, IsNotEmpty, IsOptional, IsString } from 'class-validator';
|
import { IsArray, IsBoolean, IsIn, IsNotEmpty, IsObject, IsOptional, IsString } from 'class-validator';
|
||||||
import { SmsScene } from '@dukang/shared-types';
|
import { SmsScene } from '@dukang/shared-types';
|
||||||
|
|
||||||
export class SendSmsDto {
|
export class SendSmsDto {
|
||||||
@@ -144,4 +144,8 @@ export class SaveHqListColumnPrefsDto {
|
|||||||
@IsArray()
|
@IsArray()
|
||||||
@IsString({ each: true })
|
@IsString({ each: true })
|
||||||
hidden?: string[];
|
hidden?: string[];
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsObject()
|
||||||
|
widths?: Record<string, number>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,20 @@ export class AdminBenefitService {
|
|||||||
take: pageSize,
|
take: pageSize,
|
||||||
include: {
|
include: {
|
||||||
user: { select: { id: true, userNo: true, phone: true, nickname: true } },
|
user: { select: { id: true, userNo: true, phone: true, nickname: true } },
|
||||||
order: { select: { id: true, orderNo: true, status: true } },
|
order: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
orderNo: true,
|
||||||
|
status: true,
|
||||||
|
productName: true,
|
||||||
|
productSpec: true,
|
||||||
|
quantity: true,
|
||||||
|
saleUnit: true,
|
||||||
|
deliveryType: true,
|
||||||
|
payAmount: true,
|
||||||
|
benefitAmount: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
this.prisma.benefitCoupon.count({ where }),
|
this.prisma.benefitCoupon.count({ where }),
|
||||||
@@ -46,7 +59,20 @@ export class AdminBenefitService {
|
|||||||
where: { id },
|
where: { id },
|
||||||
include: {
|
include: {
|
||||||
user: { select: { id: true, userNo: true, phone: true, nickname: true } },
|
user: { select: { id: true, userNo: true, phone: true, nickname: true } },
|
||||||
order: { select: { id: true, orderNo: true, status: true, payAmount: true } },
|
order: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
orderNo: true,
|
||||||
|
status: true,
|
||||||
|
payAmount: true,
|
||||||
|
productName: true,
|
||||||
|
productSpec: true,
|
||||||
|
quantity: true,
|
||||||
|
saleUnit: true,
|
||||||
|
deliveryType: true,
|
||||||
|
benefitAmount: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (!coupon) throw new NotFoundException('权益券不存在');
|
if (!coupon) throw new NotFoundException('权益券不存在');
|
||||||
|
|||||||
@@ -155,7 +155,9 @@ export class AdminOrdersService {
|
|||||||
const where: Prisma.OrderWhereInput = {};
|
const where: Prisma.OrderWhereInput = {};
|
||||||
|
|
||||||
if (query.orderNo) where.orderNo = { contains: query.orderNo };
|
if (query.orderNo) where.orderNo = { contains: query.orderNo };
|
||||||
if (query.status) where.status = query.status as Prisma.EnumOrderStatusFilter['equals'];
|
if (query.status?.length) {
|
||||||
|
where.status = { in: query.status as Prisma.EnumOrderStatusFilter['in'] };
|
||||||
|
}
|
||||||
if (query.orderType) where.orderType = query.orderType as Prisma.EnumOrderTypeFilter['equals'];
|
if (query.orderType) where.orderType = query.orderType as Prisma.EnumOrderTypeFilter['equals'];
|
||||||
if (query.userId) where.userId = BigInt(query.userId);
|
if (query.userId) where.userId = BigInt(query.userId);
|
||||||
if (query.cityId) where.cityId = BigInt(query.cityId);
|
if (query.cityId) where.cityId = BigInt(query.cityId);
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
|
import { OrderStatus } from '@dukang/shared-types';
|
||||||
import { Type, Transform } from 'class-transformer';
|
import { Type, Transform } from 'class-transformer';
|
||||||
import { IsArray, IsBoolean, IsIn, IsInt, IsOptional, IsString, Max, Min } from 'class-validator';
|
import { IsArray, IsBoolean, IsIn, IsInt, IsOptional, IsString, Max, Min } from 'class-validator';
|
||||||
|
|
||||||
|
const ORDER_STATUS_VALUES = Object.values(OrderStatus);
|
||||||
|
|
||||||
function toOptionalBoolean(value: unknown): boolean | undefined {
|
function toOptionalBoolean(value: unknown): boolean | undefined {
|
||||||
if (value === undefined || value === null || value === '') return undefined;
|
if (value === undefined || value === null || value === '') return undefined;
|
||||||
if (value === true || value === 'true' || value === '1' || value === 1) return true;
|
if (value === true || value === 'true' || value === '1' || value === 1) return true;
|
||||||
@@ -8,6 +11,19 @@ function toOptionalBoolean(value: unknown): boolean | undefined {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Query/body:单值、逗号串、重复 key、数组均可 → string[] */
|
||||||
|
function toOptionalStringList(value: unknown): string[] | undefined {
|
||||||
|
if (value === undefined || value === null || value === '') return undefined;
|
||||||
|
const raw = Array.isArray(value) ? value : [value];
|
||||||
|
const items = [...new Set(
|
||||||
|
raw
|
||||||
|
.flatMap((v) => String(v).split(','))
|
||||||
|
.map((s) => s.trim())
|
||||||
|
.filter(Boolean),
|
||||||
|
)];
|
||||||
|
return items.length ? items : undefined;
|
||||||
|
}
|
||||||
|
|
||||||
export class PaginationQueryDto {
|
export class PaginationQueryDto {
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@Type(() => Number)
|
@Type(() => Number)
|
||||||
@@ -57,9 +73,12 @@ export class AdminOrdersQueryDto extends PaginationQueryDto {
|
|||||||
@IsString()
|
@IsString()
|
||||||
orderNo?: string;
|
orderNo?: string;
|
||||||
|
|
||||||
|
/** 单值或多项:`?status=PENDING_PAY` / `?status=A&status=B` / `?status=A,B` */
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsString()
|
@Transform(({ value }) => toOptionalStringList(value))
|
||||||
status?: string;
|
@IsArray()
|
||||||
|
@IsIn(ORDER_STATUS_VALUES, { each: true })
|
||||||
|
status?: string[];
|
||||||
|
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsIn(['NORMAL', 'PROXY'])
|
@IsIn(['NORMAL', 'PROXY'])
|
||||||
@@ -117,8 +136,10 @@ export class AdminOrdersExportDto {
|
|||||||
orderNo?: string;
|
orderNo?: string;
|
||||||
|
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsString()
|
@Transform(({ value }) => toOptionalStringList(value))
|
||||||
status?: string;
|
@IsArray()
|
||||||
|
@IsIn(ORDER_STATUS_VALUES, { each: true })
|
||||||
|
status?: string[];
|
||||||
|
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsIn(['NORMAL', 'PROXY', 'RESHIPMENT'])
|
@IsIn(['NORMAL', 'PROXY', 'RESHIPMENT'])
|
||||||
|
|||||||
Reference in New Issue
Block a user