Merge branch 'develop' of https://gitee.com/L-Shilin/go-fly-platform-services into feature_dzc
# Conflicts: # zlt-config/src/main/resources/application-prod.properties
This commit is contained in:
@@ -43,10 +43,8 @@ interface Statistics {
|
||||
todayOrders: number;
|
||||
orderGrowth: number;
|
||||
completionRate: number;
|
||||
// 新增对账维度
|
||||
// 对账相关字段
|
||||
totalAmount: number; // 订单总金额(分)
|
||||
platformAmount: number; // 平台分账金额(分)
|
||||
tourismAmount: number; // 景区分账金额(分)
|
||||
refundAmount: number; // 退款金额(分)
|
||||
netIncome: number; // 净收入(分)
|
||||
};
|
||||
@@ -158,8 +156,12 @@ const Welcome: React.FC = () => {
|
||||
const chartStats = statistics.chartStats || {};
|
||||
const filterOptions = statistics.filterOptions || {};
|
||||
|
||||
// 动态分账金额计算
|
||||
// 使用后端返回的基础数据
|
||||
const totalAmount = orderStats.totalAmount || 0;
|
||||
const refundAmount = orderStats.refundAmount || 0;
|
||||
const netIncome = orderStats.netIncome || 0;
|
||||
|
||||
// 动态分账金额计算(基于净收入和分账比例)
|
||||
const platformAmount = Math.round(netIncome * platformRate);
|
||||
const tourismAmount = netIncome - platformAmount;
|
||||
|
||||
@@ -196,7 +198,7 @@ const Welcome: React.FC = () => {
|
||||
data: [
|
||||
{ type: '平台分账', value: platformAmount / 100 },
|
||||
{ type: '景区分账', value: tourismAmount / 100 },
|
||||
{ type: '退款金额', value: (orderStats.refundAmount || 0) / 100 },
|
||||
{ type: '退款金额', value: refundAmount / 100 },
|
||||
],
|
||||
xField: 'type',
|
||||
yField: 'value',
|
||||
@@ -211,6 +213,8 @@ const Welcome: React.FC = () => {
|
||||
|
||||
return (
|
||||
<PageContainer className={styles.container}>
|
||||
|
||||
|
||||
{/* 筛选条件 */}
|
||||
<Card style={{ marginBottom: 16 }}>
|
||||
<Space size="large">
|
||||
@@ -250,6 +254,7 @@ const Welcome: React.FC = () => {
|
||||
<span style={{ color: '#666', fontSize: '12px' }}>
|
||||
(当前:平台{Math.round(platformRate * 100)}% | 景区{Math.round((1 - platformRate) * 100)}%)
|
||||
</span>
|
||||
|
||||
{/* 快速选择常用分账比例 */}
|
||||
<Space size="small">
|
||||
<span style={{ color: '#666', fontSize: '12px' }}>快速选择:</span>
|
||||
@@ -381,6 +386,7 @@ const Welcome: React.FC = () => {
|
||||
status="active"
|
||||
format={(percent) => `分账率 ${percent?.toFixed(1)}%`}
|
||||
/>
|
||||
|
||||
</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',
|
||||
});
|
||||
}
|
||||
@@ -148,8 +148,6 @@ declare namespace ORDERS {
|
||||
completionRate: number;
|
||||
// 对账相关字段
|
||||
totalAmount: number; // 订单总金额(分)
|
||||
platformAmount: number; // 平台分账金额(分)
|
||||
tourismAmount: number; // 景区分账金额(分)
|
||||
refundAmount: number; // 退款金额(分)
|
||||
netIncome: number; // 净收入(分)
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user