小程序用户改用门店登录

This commit is contained in:
liu
2026-08-20 13:46:04 +08:00
parent 6d9f02d831
commit c1d490134e
251 changed files with 689 additions and 2727 deletions
+26 -11
View File
@@ -1,16 +1,30 @@
import React from 'react';
import React, { useEffect, useState } from 'react';
import { Tag, Typography } from 'antd';
import XinTable from '@/components/XinTable';
import type { XinTableColumn, XinTableProps } from '@/components/XinTable/typings.ts';
import type INotice from '@/domain/iNotice.ts';
import { NOTICE_READ_MAP, NOTICE_TYPE_MAP } from '@/domain/iNotice.ts';
import type IStore from '@/domain/iStore.ts';
import { getStoreOptions } from '@/api/customer/store.ts';
const { Title, Text } = Typography;
/**
* 通知管理(user_id=0 为全员广播)
* 通知管理(store_id=0 为全员广播)
*/
const NoticePage: React.FC = () => {
const [stores, setStores] = useState<IStore[]>([]);
useEffect(() => {
getStoreOptions().then((res) => setStores(res.data.data ?? []));
}, []);
const storeNameMap = new Map(stores.map((s) => [s.id, s.name]));
const storeOptions = [
{ label: '全员广播', value: 0 },
...stores.map((s) => ({ label: s.name ?? '', value: s.id ?? 0 })),
];
const columns: XinTableColumn<INotice>[] = [
{
title: 'ID',
@@ -48,21 +62,22 @@ const NoticePage: React.FC = () => {
},
{
title: '接收对象',
dataIndex: 'user_id',
valueType: 'digit',
hideInTable: false,
dataIndex: 'store_id',
valueType: 'select',
hideInSearch: true,
initialValue: 0,
fieldProps: {
min: 0,
precision: 0,
placeholder: '留空或 0 = 全员广播',
options: storeOptions,
showSearch: true,
optionFilterProp: 'label',
placeholder: '默认全员广播',
},
align: 'center',
render: (_, record) =>
record.user_id === 0 ? (
record.store_id === 0 ? (
<Tag color="gold">广</Tag>
) : (
<Tag>{`用户 #${record.user_id}`}</Tag>
<Tag>{storeNameMap.get(record.store_id) ?? `门店 #${record.store_id}`}</Tag>
),
},
{
@@ -119,7 +134,7 @@ const NoticePage: React.FC = () => {
<div className="mb-5">
<Title level={3}></Title>
<Text type="secondary">
0 广
广
</Text>
</div>
<XinTable<INotice> {...tableProps} />