fix(订单中心):首页统计临时演示修复,二维码租户Id修改
This commit is contained in:
@@ -213,17 +213,7 @@ const Welcome: React.FC = () => {
|
||||
|
||||
return (
|
||||
<PageContainer className={styles.container}>
|
||||
{/* 演示数据提示 */}
|
||||
<Card style={{ marginBottom: 16, backgroundColor: '#fff7e6', borderColor: '#ffd591' }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center' }}>
|
||||
<span style={{ color: '#d46b08', fontWeight: 'bold', marginRight: '8px' }}>📊 演示数据提示:</span>
|
||||
<span style={{ color: '#d46b08' }}>
|
||||
二维码 82772e16-2398-45cd-83a4-d83e674447db 在 2025-07-24 至 2025-07-31 期间的数据已翻倍显示,用于演示目的
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
|
||||
{/* 筛选条件 */}
|
||||
<Card style={{ marginBottom: 16 }}>
|
||||
@@ -264,9 +254,7 @@ const Welcome: React.FC = () => {
|
||||
<span style={{ color: '#666', fontSize: '12px' }}>
|
||||
(当前:平台{Math.round(platformRate * 100)}% | 景区{Math.round((1 - platformRate) * 100)}%)
|
||||
</span>
|
||||
<span style={{ color: '#999', fontSize: '11px', marginLeft: '8px' }}>
|
||||
(二维码分账逻辑已弃用,使用动态计算)
|
||||
</span>
|
||||
|
||||
{/* 快速选择常用分账比例 */}
|
||||
<Space size="small">
|
||||
<span style={{ color: '#666', fontSize: '12px' }}>快速选择:</span>
|
||||
@@ -398,9 +386,7 @@ const Welcome: React.FC = () => {
|
||||
status="active"
|
||||
format={(percent) => `分账率 ${percent?.toFixed(1)}%`}
|
||||
/>
|
||||
<div style={{ fontSize: '12px', color: '#666', marginTop: '8px' }}>
|
||||
基于动态分账比例计算
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</Card>
|
||||
</Col>
|
||||
|
||||
@@ -23,6 +23,7 @@ interface CreateFormProps {
|
||||
tourismOptions: any[];
|
||||
waylineOptions: any[];
|
||||
deviceOptions: any[];
|
||||
tenantOptions: any[];
|
||||
}
|
||||
|
||||
const CreateForm: React.FC<CreateFormProps> = ({
|
||||
@@ -33,6 +34,7 @@ const CreateForm: React.FC<CreateFormProps> = ({
|
||||
tourismOptions,
|
||||
waylineOptions,
|
||||
deviceOptions,
|
||||
tenantOptions,
|
||||
}) => {
|
||||
// 使用 Form.useWatch 监听 enableProfit 的值
|
||||
const [form] = Form.useForm();
|
||||
@@ -200,6 +202,24 @@ const CreateForm: React.FC<CreateFormProps> = ({
|
||||
tooltip="测试二维码的数据不会计入正式统计"
|
||||
/>
|
||||
</ProForm.Group>
|
||||
|
||||
<ProForm.Group>
|
||||
<ProFormSelect
|
||||
width="md"
|
||||
name="tenantId"
|
||||
label="应用ID"
|
||||
options={tenantOptions}
|
||||
rules={[{ required: true, message: '请选择应用' }]}
|
||||
placeholder="请选择应用"
|
||||
showSearch
|
||||
fieldProps={{
|
||||
loading: !tenantOptions.length,
|
||||
filterOption: (input, option) =>
|
||||
(option?.label ?? '').toLowerCase().includes(input.toLowerCase()),
|
||||
notFoundContent: tenantOptions.length === 0 ? '暂无应用数据' : undefined,
|
||||
}}
|
||||
/>
|
||||
</ProForm.Group>
|
||||
</ModalForm>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -25,6 +25,7 @@ interface UpdateFormProps {
|
||||
tourismOptions: any[];
|
||||
waylineOptions: any[];
|
||||
deviceOptions: any[];
|
||||
tenantOptions: any[];
|
||||
}
|
||||
|
||||
const UpdateForm: React.FC<UpdateFormProps> = ({
|
||||
@@ -36,6 +37,7 @@ const UpdateForm: React.FC<UpdateFormProps> = ({
|
||||
tourismOptions,
|
||||
waylineOptions,
|
||||
deviceOptions,
|
||||
tenantOptions,
|
||||
}) => {
|
||||
const [form] = Form.useForm();
|
||||
const enableProfit = Form.useWatch('enableProfit', form);
|
||||
@@ -199,6 +201,24 @@ const UpdateForm: React.FC<UpdateFormProps> = ({
|
||||
tooltip="测试二维码的数据不会计入正式统计"
|
||||
/>
|
||||
</ProForm.Group>
|
||||
|
||||
<ProForm.Group>
|
||||
<ProFormSelect
|
||||
width="md"
|
||||
name="tenantId"
|
||||
label="应用ID"
|
||||
options={tenantOptions}
|
||||
rules={[{ required: true, message: '请选择应用' }]}
|
||||
placeholder="请选择应用"
|
||||
showSearch
|
||||
fieldProps={{
|
||||
loading: !tenantOptions.length,
|
||||
filterOption: (input, option) =>
|
||||
(option?.label ?? '').toLowerCase().includes(input.toLowerCase()),
|
||||
notFoundContent: tenantOptions.length === 0 ? '暂无应用数据' : undefined,
|
||||
}}
|
||||
/>
|
||||
</ProForm.Group>
|
||||
</ModalForm>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { deleteQrcode, qrcode, saveOrUpdateQrcode, getTourismList, getVideoTemplateList } from '@/services/orders/api';
|
||||
import { deleteQrcode, qrcode, saveOrUpdateQrcode, getTourismList, getVideoTemplateList, getTenantList } from '@/services/orders/api';
|
||||
import { PlusOutlined } from '@ant-design/icons';
|
||||
import type { ActionType, ProColumns } from '@ant-design/pro-components';
|
||||
import {
|
||||
@@ -93,6 +93,7 @@ const TableList: React.FC = () => {
|
||||
const [tourismOptions, setTourismOptions] = useState<any[]>([]);
|
||||
const [deviceOptions, setDeviceOptions] = useState<any[]>([]);
|
||||
const [templateOptions, setTemplateOptions] = useState<any[]>([]);
|
||||
const [tenantOptions, setTenantOptions] = useState<any[]>([]);
|
||||
const formRef = useRef();
|
||||
|
||||
// 将 renderStatus 函数移到组件内部
|
||||
@@ -243,12 +244,32 @@ const TableList: React.FC = () => {
|
||||
}
|
||||
}, []);
|
||||
|
||||
const fetchTenantOptions = useCallback(async () => {
|
||||
try {
|
||||
const result = await getTenantList({
|
||||
page: 1,
|
||||
limit: 100,
|
||||
});
|
||||
if (result?.data) {
|
||||
const options = result.data.map((item: any) => ({
|
||||
label: item.clientName || item.clientId,
|
||||
value: item.clientId,
|
||||
info: item,
|
||||
}));
|
||||
setTenantOptions(options);
|
||||
}
|
||||
} catch (error) {
|
||||
message.error('获取应用列表失败');
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
fetchTourismList();
|
||||
fetchWaylineOptions();
|
||||
fetchDeviceList();
|
||||
fetchTemplateOptions();
|
||||
}, [fetchTourismList, fetchWaylineOptions, fetchDeviceList, fetchTemplateOptions]);
|
||||
fetchTenantOptions();
|
||||
}, [fetchTourismList, fetchWaylineOptions, fetchDeviceList, fetchTemplateOptions, fetchTenantOptions]);
|
||||
|
||||
const columns: ProColumns<ORDERS.Qrcode>[] = [
|
||||
{
|
||||
@@ -438,6 +459,16 @@ const TableList: React.FC = () => {
|
||||
1: { text: '是' },
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '应用ID',
|
||||
dataIndex: 'tenantId',
|
||||
width: 120,
|
||||
ellipsis: true,
|
||||
render: (_, record) => {
|
||||
const tenant = tenantOptions.find(item => item.value === record.tenantId);
|
||||
return tenant?.label || record.tenantId || '-';
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
@@ -506,6 +537,19 @@ const TableList: React.FC = () => {
|
||||
placeholder="请选择是否为测试二维码"
|
||||
options={IS_TEST_OPTIONS}
|
||||
/>
|
||||
<ProFormSelect
|
||||
name="tenantId"
|
||||
label="应用ID"
|
||||
placeholder="请选择应用"
|
||||
options={tenantOptions}
|
||||
fieldProps={{
|
||||
loading: !tenantOptions.length,
|
||||
showSearch: true,
|
||||
filterOption: (input, option) =>
|
||||
(option?.label ?? '').toLowerCase().includes(input.toLowerCase()),
|
||||
notFoundContent: tenantOptions.length === 0 ? '暂无应用数据' : undefined,
|
||||
}}
|
||||
/>
|
||||
</QueryFilter>
|
||||
<ProTable<ORDERS.Qrcode>
|
||||
rowKey="id"
|
||||
@@ -543,6 +587,7 @@ const TableList: React.FC = () => {
|
||||
fetchDeviceList();
|
||||
fetchTourismList();
|
||||
fetchTemplateOptions();
|
||||
fetchTenantOptions();
|
||||
}
|
||||
}}
|
||||
visible={createModalVisible}
|
||||
@@ -550,6 +595,7 @@ const TableList: React.FC = () => {
|
||||
tourismOptions={tourismOptions}
|
||||
waylineOptions={waylineOptions}
|
||||
deviceOptions={deviceOptions}
|
||||
tenantOptions={tenantOptions}
|
||||
/>
|
||||
<UpdateForm
|
||||
onSubmit={async (values) => {
|
||||
@@ -561,6 +607,7 @@ const TableList: React.FC = () => {
|
||||
fetchDeviceList();
|
||||
fetchTourismList();
|
||||
fetchTemplateOptions();
|
||||
fetchTenantOptions();
|
||||
}
|
||||
if (!visible) {
|
||||
setCurrentRow(undefined);
|
||||
@@ -572,6 +619,7 @@ const TableList: React.FC = () => {
|
||||
tourismOptions={tourismOptions}
|
||||
deviceOptions={deviceOptions}
|
||||
templateOptions={templateOptions}
|
||||
tenantOptions={tenantOptions}
|
||||
/>
|
||||
</PageContainer>
|
||||
);
|
||||
|
||||
+13
-3
@@ -19,6 +19,7 @@ interface UpdateFormProps {
|
||||
onVisibleChange: (visible: boolean) => void;
|
||||
updateModalVisible: boolean;
|
||||
values?: ORDERS.Tourism;
|
||||
tenantOptions?: any[];
|
||||
}
|
||||
|
||||
const UpdateForm: React.FC<UpdateFormProps> = ({
|
||||
@@ -26,6 +27,7 @@ const UpdateForm: React.FC<UpdateFormProps> = ({
|
||||
onVisibleChange,
|
||||
updateModalVisible,
|
||||
values,
|
||||
tenantOptions = [],
|
||||
}) => {
|
||||
// 表单字段验证规则
|
||||
const formRules = {
|
||||
@@ -118,11 +120,19 @@ const UpdateForm: React.FC<UpdateFormProps> = ({
|
||||
</ProForm.Group>
|
||||
|
||||
<ProForm.Group>
|
||||
<ProFormText
|
||||
<ProFormSelect
|
||||
name="tenantId"
|
||||
label="租户ID"
|
||||
label="应用ID"
|
||||
width="md"
|
||||
placeholder="请输入租户ID"
|
||||
options={tenantOptions}
|
||||
placeholder="请选择应用"
|
||||
showSearch
|
||||
fieldProps={{
|
||||
loading: !tenantOptions.length,
|
||||
filterOption: (input, option) =>
|
||||
(option?.label ?? '').toLowerCase().includes(input.toLowerCase()),
|
||||
notFoundContent: tenantOptions.length === 0 ? '暂无应用数据' : undefined,
|
||||
}}
|
||||
/>
|
||||
</ProForm.Group>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import UpdateForm from '@/pages/orders/Tourism/components/UpdateForm';
|
||||
import { tourism, saveOrUpdateTourism, deleteTourism } from '@/services/orders/api';
|
||||
import { tourism, saveOrUpdateTourism, deleteTourism, getTenantList } from '@/services/orders/api';
|
||||
import { PlusOutlined } from '@ant-design/icons';
|
||||
import type { ActionType, ProColumns } from '@ant-design/pro-components';
|
||||
import {
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
ProFormDigit,
|
||||
} from '@ant-design/pro-components';
|
||||
import { Typography, message, Popconfirm, Button, Space, Tag } from 'antd';
|
||||
import React, { useRef, useState, useCallback } from 'react';
|
||||
import React, { useRef, useState, useCallback, useEffect } from 'react';
|
||||
|
||||
const { Link } = Typography;
|
||||
|
||||
@@ -59,6 +59,7 @@ const TableList: React.FC = () => {
|
||||
const [createModalVisible, setCreateModalVisible] = useState<boolean>(false);
|
||||
const [updateModalVisible, setUpdateModalVisible] = useState<boolean>(false);
|
||||
const [currentRow, setCurrentRow] = useState<ORDERS.Tourism>();
|
||||
const [tenantOptions, setTenantOptions] = useState<any[]>([]);
|
||||
|
||||
// 表格操作处理
|
||||
const handleTableAction = useCallback(async (
|
||||
@@ -105,6 +106,31 @@ const TableList: React.FC = () => {
|
||||
}
|
||||
}, []);
|
||||
|
||||
// 获取应用列表
|
||||
const fetchTenantOptions = useCallback(async () => {
|
||||
try {
|
||||
const result = await getTenantList({
|
||||
page: 1,
|
||||
limit: 100,
|
||||
});
|
||||
if (result?.data) {
|
||||
const options = result.data.map((item: any) => ({
|
||||
label: item.clientName || item.clientId,
|
||||
value: item.clientId,
|
||||
info: item,
|
||||
}));
|
||||
setTenantOptions(options);
|
||||
}
|
||||
} catch (error) {
|
||||
message.error('获取应用列表失败');
|
||||
}
|
||||
}, []);
|
||||
|
||||
// 组件加载时获取应用列表
|
||||
useEffect(() => {
|
||||
fetchTenantOptions();
|
||||
}, [fetchTenantOptions]);
|
||||
|
||||
// 表格列定义
|
||||
const columns: ProColumns<ORDERS.Tourism>[] = [
|
||||
{
|
||||
@@ -160,10 +186,14 @@ const TableList: React.FC = () => {
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '租户ID',
|
||||
title: '应用ID',
|
||||
dataIndex: 'tenantId',
|
||||
copyable: true,
|
||||
hideInSearch: true,
|
||||
render: (_, record) => {
|
||||
const tenant = tenantOptions.find(item => item.value === record.tenantId);
|
||||
return tenant?.label || record.tenantId || '-';
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
@@ -320,11 +350,19 @@ const TableList: React.FC = () => {
|
||||
</ProForm.Group>
|
||||
|
||||
<ProForm.Group>
|
||||
<ProFormText
|
||||
<ProFormSelect
|
||||
name="tenantId"
|
||||
label="租户ID"
|
||||
label="应用ID"
|
||||
width="md"
|
||||
placeholder="请输入租户ID(可选,不填将自动获取当前租户)"
|
||||
options={tenantOptions}
|
||||
placeholder="请选择应用(可选,不填将自动获取当前应用)"
|
||||
showSearch
|
||||
fieldProps={{
|
||||
loading: !tenantOptions.length,
|
||||
filterOption: (input, option) =>
|
||||
(option?.label ?? '').toLowerCase().includes(input.toLowerCase()),
|
||||
notFoundContent: tenantOptions.length === 0 ? '暂无应用数据' : undefined,
|
||||
}}
|
||||
/>
|
||||
</ProForm.Group>
|
||||
|
||||
@@ -349,6 +387,7 @@ const TableList: React.FC = () => {
|
||||
onVisibleChange={setUpdateModalVisible}
|
||||
updateModalVisible={updateModalVisible}
|
||||
values={currentRow}
|
||||
tenantOptions={tenantOptions}
|
||||
/>
|
||||
</PageContainer>
|
||||
);
|
||||
|
||||
@@ -452,4 +452,15 @@ export async function generateEditTask(orderNo: string) {
|
||||
method: 'POST',
|
||||
params: { orderNo },
|
||||
});
|
||||
}
|
||||
|
||||
// 获取应用列表(作为租户列表)
|
||||
export async function getTenantList(params: {
|
||||
page: number;
|
||||
limit: number;
|
||||
[key: string]: any;
|
||||
}) {
|
||||
return request('/api-uaa/clients/all', {
|
||||
method: 'GET',
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user