Please enter the commit message for your changes. Lines starting
with '#' will be ignored, and an empty message aborts the commit. On branch develop Your branch is up to date with 'goflyapp/develop'. Changes to be committed: modified: zlt-business/file-center/src/main/resources/bootstrap.yml modified: zlt-web/react-web/src/main/frontend/src/config/auth.ts new file: zlt-web/react-web/src/main/frontend/src/pages/orders/Order/components/DetailModal.tsx modified: zlt-web/react-web/src/main/frontend/src/pages/orders/Order/index.tsx modified: zlt-web/react-web/src/main/frontend/src/services/orders/api.ts modified: zlt-web/react-web/src/main/frontend/src/services/orders/typings.d.ts
This commit is contained in:
@@ -4,10 +4,10 @@ server:
|
|||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: file-center
|
name: file-center
|
||||||
cloud:
|
# cloud:
|
||||||
nacos:
|
# nacos:
|
||||||
discovery:
|
# discovery:
|
||||||
ip: 119.45.169.13
|
# ip: 119.45.169.13
|
||||||
servlet:
|
servlet:
|
||||||
multipart:
|
multipart:
|
||||||
max-file-size: 20MB
|
max-file-size: 20MB
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export const AUTH_CONFIG = {
|
export const AUTH_CONFIG = {
|
||||||
// basicToken: 'Basic d2ViQXBwOndlYkFwcA==',
|
basicToken: 'Basic d2ViQXBwOndlYkFwcA==',
|
||||||
basicToken: 'Basic Z2ZhcHA6SWtpbmd0ZWNAMjAyMA==', // 备用token
|
// basicToken: 'Basic Z2ZhcHA6SWtpbmd0ZWNAMjAyMA==', // 备用token
|
||||||
};
|
};
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Modal, Descriptions, Tag, Image, Space } from 'antd';
|
||||||
|
import { STATUS_CONFIG } from '../constants';
|
||||||
|
|
||||||
|
interface DetailModalProps {
|
||||||
|
visible: boolean;
|
||||||
|
onClose: () => void;
|
||||||
|
data?: API.OrderDetail;
|
||||||
|
loading?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const DetailModal: React.FC<DetailModalProps> = ({ visible, onClose, data, loading }) => {
|
||||||
|
if (!data) return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
title="订单详情"
|
||||||
|
open={visible}
|
||||||
|
onCancel={onClose}
|
||||||
|
footer={null}
|
||||||
|
width={800}
|
||||||
|
destroyOnClose
|
||||||
|
>
|
||||||
|
<Descriptions column={2} bordered>
|
||||||
|
<Descriptions.Item label="订单编号">{data.orderNo}</Descriptions.Item>
|
||||||
|
<Descriptions.Item label="订单状态">
|
||||||
|
<Tag color={STATUS_CONFIG[data.orderStatus]?.color}>
|
||||||
|
{STATUS_CONFIG[data.orderStatus]?.text}
|
||||||
|
</Tag>
|
||||||
|
</Descriptions.Item>
|
||||||
|
<Descriptions.Item label="订单金额">¥{data.orderAmount}</Descriptions.Item>
|
||||||
|
<Descriptions.Item label="设备编号">{data.deviceSn}</Descriptions.Item>
|
||||||
|
<Descriptions.Item label="创建时间" span={2}>
|
||||||
|
{data.createTime}
|
||||||
|
</Descriptions.Item>
|
||||||
|
|
||||||
|
<Descriptions.Item label="景区名称" span={2}>
|
||||||
|
{data.tourism.tourismName}
|
||||||
|
</Descriptions.Item>
|
||||||
|
<Descriptions.Item label="景区地址" span={2}>
|
||||||
|
{data.tourism.tourismAddress}
|
||||||
|
</Descriptions.Item>
|
||||||
|
<Descriptions.Item label="景区描述" span={2}>
|
||||||
|
<div style={{ whiteSpace: 'pre-line' }}>{data.tourism.tourismDesc}</div>
|
||||||
|
</Descriptions.Item>
|
||||||
|
|
||||||
|
{(data.queueCount !== undefined || data.estimatedTime !== undefined) && (
|
||||||
|
<Descriptions.Item label="排队信息" span={2}>
|
||||||
|
{data.queueCount !== undefined && `前方排队人数:${data.queueCount} 人`}
|
||||||
|
{data.estimatedTime !== undefined && `,预计等待时间:${data.estimatedTime} 分钟`}
|
||||||
|
</Descriptions.Item>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{data.files && data.files.length > 0 && (
|
||||||
|
<Descriptions.Item label="相关文件" span={2}>
|
||||||
|
<Space wrap>
|
||||||
|
{data.files.map((file, index) => (
|
||||||
|
file.contentType.startsWith('image/') ? (
|
||||||
|
<Image
|
||||||
|
key={index}
|
||||||
|
src={file.viewUrl}
|
||||||
|
width={200}
|
||||||
|
height={150}
|
||||||
|
style={{ objectFit: 'cover' }}
|
||||||
|
/>
|
||||||
|
) : file.contentType.startsWith('video/') ? (
|
||||||
|
<video
|
||||||
|
key={index}
|
||||||
|
src={file.url}
|
||||||
|
controls
|
||||||
|
style={{ width: 200, height: 150 }}
|
||||||
|
poster={file.viewUrl}
|
||||||
|
/>
|
||||||
|
) : null
|
||||||
|
))}
|
||||||
|
</Space>
|
||||||
|
</Descriptions.Item>
|
||||||
|
)}
|
||||||
|
</Descriptions>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default DetailModal;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { order, updateOrder } from '@/services/orders/api';
|
import { order, updateOrder, getOrderDetail } from '@/services/orders/api';
|
||||||
import type { ActionType, ProColumns } from '@ant-design/pro-components';
|
import type { ActionType, ProColumns } from '@ant-design/pro-components';
|
||||||
import {
|
import {
|
||||||
PageContainer,
|
PageContainer,
|
||||||
@@ -11,6 +11,7 @@ import { Typography, Space, Tag, message } from 'antd';
|
|||||||
import React, { useRef, useState, useCallback } from 'react';
|
import React, { useRef, useState, useCallback } from 'react';
|
||||||
import { STATUS_CONFIG, STATUS_OPTIONS } from './constants';
|
import { STATUS_CONFIG, STATUS_OPTIONS } from './constants';
|
||||||
import UpdateForm from './components/UpdateForm';
|
import UpdateForm from './components/UpdateForm';
|
||||||
|
import DetailModal from './components/DetailModal';
|
||||||
|
|
||||||
const { Link } = Typography;
|
const { Link } = Typography;
|
||||||
|
|
||||||
@@ -19,6 +20,9 @@ const TableList: React.FC = () => {
|
|||||||
const [params, setParams] = useState<Record<string, string | number>>({});
|
const [params, setParams] = useState<Record<string, string | number>>({});
|
||||||
const [updateModalVisible, setUpdateModalVisible] = useState<boolean>(false);
|
const [updateModalVisible, setUpdateModalVisible] = useState<boolean>(false);
|
||||||
const [currentRow, setCurrentRow] = useState<ORDERS.Order>();
|
const [currentRow, setCurrentRow] = useState<ORDERS.Order>();
|
||||||
|
const [detailModalVisible, setDetailModalVisible] = useState<boolean>(false);
|
||||||
|
const [detailData, setDetailData] = useState<API.OrderDetail>();
|
||||||
|
const [detailLoading, setDetailLoading] = useState<boolean>(false);
|
||||||
|
|
||||||
// 渲染状态标签
|
// 渲染状态标签
|
||||||
const renderStatus = useCallback((status: number) => {
|
const renderStatus = useCallback((status: number) => {
|
||||||
@@ -51,6 +55,27 @@ const TableList: React.FC = () => {
|
|||||||
}
|
}
|
||||||
}, [currentRow]);
|
}, [currentRow]);
|
||||||
|
|
||||||
|
// 获取订单详情
|
||||||
|
const handleViewDetail = async (orderNo: string) => {
|
||||||
|
setDetailModalVisible(true);
|
||||||
|
setDetailLoading(true);
|
||||||
|
try {
|
||||||
|
const response = await getOrderDetail(orderNo);
|
||||||
|
if (response.resp_code === 0) {
|
||||||
|
setDetailData(response.data);
|
||||||
|
} else {
|
||||||
|
message.error(response.resp_msg || '获取详情失败');
|
||||||
|
setDetailModalVisible(false);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取详情错误:', error);
|
||||||
|
message.error('获取详情失败,请稍后重试');
|
||||||
|
setDetailModalVisible(false);
|
||||||
|
} finally {
|
||||||
|
setDetailLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const columns: ProColumns<ORDERS.Order>[] = [
|
const columns: ProColumns<ORDERS.Order>[] = [
|
||||||
{
|
{
|
||||||
dataIndex: 'index',
|
dataIndex: 'index',
|
||||||
@@ -106,9 +131,14 @@ const TableList: React.FC = () => {
|
|||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
key: 'action',
|
key: 'action',
|
||||||
width: 80,
|
width: 120,
|
||||||
render: (_, record) => (
|
render: (_, record) => (
|
||||||
<Space>
|
<Space>
|
||||||
|
<Link
|
||||||
|
onClick={() => handleViewDetail(record.orderNo)}
|
||||||
|
>
|
||||||
|
查看
|
||||||
|
</Link>
|
||||||
<Link
|
<Link
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setCurrentRow(record);
|
setCurrentRow(record);
|
||||||
@@ -199,6 +229,16 @@ const TableList: React.FC = () => {
|
|||||||
updateModalVisible={updateModalVisible}
|
updateModalVisible={updateModalVisible}
|
||||||
values={currentRow}
|
values={currentRow}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<DetailModal
|
||||||
|
visible={detailModalVisible}
|
||||||
|
onClose={() => {
|
||||||
|
setDetailModalVisible(false);
|
||||||
|
setDetailData(undefined);
|
||||||
|
}}
|
||||||
|
data={detailData}
|
||||||
|
loading={detailLoading}
|
||||||
|
/>
|
||||||
</PageContainer>
|
</PageContainer>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -165,3 +165,10 @@ export async function getTourismList(params: {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 获取订单详情 */
|
||||||
|
export async function getOrderDetail(orderNo: string) {
|
||||||
|
return request<API.Response<API.OrderDetail>>(`/api-order/detail/${orderNo}`, {
|
||||||
|
method: 'GET',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -99,12 +99,41 @@ declare namespace API {
|
|||||||
interface Tourism {
|
interface Tourism {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
|
tourismName: string;
|
||||||
|
tourismAddress: string;
|
||||||
|
tourismDesc: string;
|
||||||
// ... 其他景区相关字段
|
// ... 其他景区相关字段
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Response<T> {
|
interface Response<T = any> {
|
||||||
|
data: T;
|
||||||
resp_code: number;
|
resp_code: number;
|
||||||
resp_msg: string;
|
resp_msg: string;
|
||||||
data: T;
|
}
|
||||||
|
|
||||||
|
interface FileInfo {
|
||||||
|
url: string;
|
||||||
|
contentType: string;
|
||||||
|
viewUrl: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface OrderDetail {
|
||||||
|
orderNo: string;
|
||||||
|
orderStatus: number;
|
||||||
|
orderAmount: string;
|
||||||
|
createTime: string;
|
||||||
|
deviceSn: string;
|
||||||
|
tourism: {
|
||||||
|
tourismName: string;
|
||||||
|
tourismAddress: string;
|
||||||
|
tourismDesc: string;
|
||||||
|
};
|
||||||
|
files: {
|
||||||
|
url: string;
|
||||||
|
contentType: string;
|
||||||
|
viewUrl: string;
|
||||||
|
}[];
|
||||||
|
queueCount?: number;
|
||||||
|
estimatedTime?: number;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user