fix(订单中心):首页附近景区列表数据逻辑优化,删除用户为直接删除数据逻辑优化

This commit is contained in:
2025-07-29 12:08:44 +08:00
parent 50941cd1c1
commit b3589ff75d
10 changed files with 425 additions and 11 deletions
@@ -4,6 +4,7 @@ import {
ProFormText,
ProFormSelect,
ProFormTextArea,
ProFormDigit,
} from '@ant-design/pro-components';
import React from 'react';
@@ -30,6 +31,14 @@ const UpdateForm: React.FC<UpdateFormProps> = ({
const formRules = {
required: { required: true, message: '此项为必填项' },
phone: { pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号' },
longitude: {
pattern: /^-?((1[0-7][0-9]|[1-9]?[0-9])\.\d{1,6}|180\.0{1,6})$/,
message: '经度范围应在-180到180之间,最多6位小数'
},
latitude: {
pattern: /^-?([1-8]?[0-9]\.\d{1,6}|90\.0{1,6})$/,
message: '纬度范围应在-90到90之间,最多6位小数'
},
};
return (
@@ -79,6 +88,35 @@ const UpdateForm: React.FC<UpdateFormProps> = ({
/>
</ProForm.Group>
<ProForm.Group>
<ProFormDigit
name="longitude"
label="经度"
width="md"
rules={[formRules.longitude]}
placeholder="请输入经度(-180到180)"
fieldProps={{
precision: 6,
min: -180,
max: 180,
}}
tooltip="经度范围:-180到180,用于附近景区查询功能"
/>
<ProFormDigit
name="latitude"
label="纬度"
width="md"
rules={[formRules.latitude]}
placeholder="请输入纬度(-90到90)"
fieldProps={{
precision: 6,
min: -90,
max: 90,
}}
tooltip="纬度范围:-90到90,用于附近景区查询功能"
/>
</ProForm.Group>
<ProForm.Group>
<ProFormText
name="tenantId"
@@ -10,8 +10,9 @@ import {
ProFormSelect,
ProFormTextArea,
ProTable,
ProFormDigit,
} from '@ant-design/pro-components';
import { Typography, message, Popconfirm, Button, Space } from 'antd';
import { Typography, message, Popconfirm, Button, Space, Tag } from 'antd';
import React, { useRef, useState, useCallback } from 'react';
const { Link } = Typography;
@@ -142,6 +143,22 @@ const TableList: React.FC = () => {
dataIndex: 'tourismPhone',
copyable: true,
},
{
title: '经纬度',
dataIndex: 'location',
hideInSearch: true,
render: (_, record) => {
const hasLocation = record.longitude && record.latitude;
return hasLocation ? (
<Space direction="vertical" size="small">
<Tag color="blue">经度: {record.longitude}</Tag>
<Tag color="green">纬度: {record.latitude}</Tag>
</Space>
) : (
<Tag color="red">未设置</Tag>
);
},
},
{
title: '租户ID',
dataIndex: 'tenantId',
@@ -192,6 +209,14 @@ const TableList: React.FC = () => {
const formRules = {
required: { required: true, message: '此项为必填项' },
phone: { pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号' },
longitude: {
pattern: /^-?((1[0-7][0-9]|[1-9]?[0-9])\.\d{1,6}|180\.0{1,6})$/,
message: '经度范围应在-180到180之间,最多6位小数'
},
latitude: {
pattern: /^-?([1-8]?[0-9]\.\d{1,6}|90\.0{1,6})$/,
message: '纬度范围应在-90到90之间,最多6位小数'
},
};
return (
@@ -265,6 +290,35 @@ const TableList: React.FC = () => {
/>
</ProForm.Group>
<ProForm.Group>
<ProFormDigit
name="longitude"
label="经度"
width="md"
rules={[formRules.longitude]}
placeholder="请输入经度(-180到180)"
fieldProps={{
precision: 6,
min: -180,
max: 180,
}}
tooltip="经度范围:-180到180,用于附近景区查询功能"
/>
<ProFormDigit
name="latitude"
label="纬度"
width="md"
rules={[formRules.latitude]}
placeholder="请输入纬度(-90到90)"
fieldProps={{
precision: 6,
min: -90,
max: 90,
}}
tooltip="纬度范围:-90到90,用于附近景区查询功能"
/>
</ProForm.Group>
<ProForm.Group>
<ProFormText
name="tenantId"
@@ -33,12 +33,20 @@ declare namespace ORDERS {
tourismNo: string;
tourismAddress: string;
tourismPhone: string;
longitude?: number; // 经度
latitude?: number; // 纬度
createTime?: string;
status: number;
tenantId?: string;
updateTime?: string;
}
type TourismWithDistance = Tourism & {
distance?: number; // 距离(公里)
distanceDesc?: string; // 距离描述
orderShowImageUrl?: string; // 景区订单展示图片URL
}
type TourismFile = {
id: number;
tourismId: string;