From 7a0f276a0aca28adf4a509463d2df480f22c5dce Mon Sep 17 00:00:00 2001
From: liaofang <790216520@qq.com>
Date: 星期五, 12 六月 2026 18:28:16 +0800
Subject: [PATCH] feat: 发单页增加搜索框可改出发到达点

---
 src/robotaxi/pages/select-map-site/hooks/use-select-map-site.ts        |   25 ++++++++++++
 src/robotaxi/pages/select-map-site/components/select-map-site-view.tsx |    8 ++++
 src/robotaxi/pages/select-map-site/index.tsx                           |   14 +++++++
 src/robotaxi/pages/select-map-site/index.less                          |   46 +++++++++++++++++++++++
 4 files changed, 92 insertions(+), 1 deletions(-)

diff --git a/src/robotaxi/pages/select-map-site/components/select-map-site-view.tsx b/src/robotaxi/pages/select-map-site/components/select-map-site-view.tsx
index 7e1fde5..8653a74 100644
--- a/src/robotaxi/pages/select-map-site/components/select-map-site-view.tsx
+++ b/src/robotaxi/pages/select-map-site/components/select-map-site-view.tsx
@@ -49,6 +49,7 @@
   handleCloseTipPopup: () => void;
   tipType: string;
   toPersonalCenter: () => void;
+  toSiteSearch: () => void;
 };
 
 /**
@@ -80,6 +81,13 @@
         <View onClick={deps.toBack} className="select-city">
           <Image className="select-city-icon" src={deps.backIcon} />
         </View>
+        {/* 搜索框 */}
+        <View onClick={deps.toSiteSearch} className="search-card">
+          <View className={`search-icon ${deps.pageType == 'end' ? 'end-icon' : ''}`}></View>
+          <View className="search-input-box">
+            <View className="search-input-placeholder">{deps.pageType == 'start' ? '请输入上车点' : '请输入目的地'}</View>
+          </View>
+        </View>
         {/* 地图浮层入口 */}
         <View className="map-entry">
           <Image onClick={deps.toPersonalCenter} className="map-entry-icon" src={deps.personalCenter} />
diff --git a/src/robotaxi/pages/select-map-site/hooks/use-select-map-site.ts b/src/robotaxi/pages/select-map-site/hooks/use-select-map-site.ts
index 255ab9b..a28c5cd 100644
--- a/src/robotaxi/pages/select-map-site/hooks/use-select-map-site.ts
+++ b/src/robotaxi/pages/select-map-site/hooks/use-select-map-site.ts
@@ -1,4 +1,4 @@
-import Taro from "@tarojs/taro";
+import Taro, { useDidShow } from "@tarojs/taro";
 import { useEffect } from 'react';
 import {
   buildStationMetaMap,
@@ -719,6 +719,29 @@
     return () => { cancelled = true; };
   }, []);
 
+  // 从 site-search 返回时同步已选择的站点
+  useDidShow(() => {
+    const pType = state.router.params.pageType || state.pageType || 'end';
+    let cachedSite: any = null;
+    if (pType === 'start') {
+      cachedSite = Taro.getStorageSync('startSite');
+    } else if (pType === 'end') {
+      cachedSite = Taro.getStorageSync('endSite');
+    }
+    if (cachedSite && cachedSite.latitude && cachedSite.longitude) {
+      const currentId = String(state.selectedSite?.pointId || state.selectedSite?.id || '');
+      const cachedId = String(cachedSite?.pointId || cachedSite?.id || '');
+      if (currentId !== cachedId) {
+        state.setLatitude(cachedSite.latitude);
+        state.setLongitude(cachedSite.longitude);
+        applySelectionBySite(cachedSite);
+        updateMapData(cachedSite.latitude, cachedSite.longitude).then(({ isInside }) => {
+          state.setRangeStatus(getRangeStatus(isInside, cachedSite));
+        });
+      }
+    }
+  });
+
   useSelectMapSiteWalkingRoute({
     pageType: state.pageType,
     userLatitude: state.userLatitude,
diff --git a/src/robotaxi/pages/select-map-site/index.less b/src/robotaxi/pages/select-map-site/index.less
index d7d6357..da9aabe 100644
--- a/src/robotaxi/pages/select-map-site/index.less
+++ b/src/robotaxi/pages/select-map-site/index.less
@@ -18,6 +18,52 @@
     }
 }
 
+.search-card {
+    position: fixed;
+    top: 180px;
+    left: 31px;
+    right: 150px;
+    display: flex;
+    align-items: center;
+    border-radius: 24px;
+    background: rgba(255, 255, 255, 0.95);
+    backdrop-filter: blur(40px);
+    box-sizing: border-box;
+    border: 2px solid #F1F1F1;
+    box-shadow: 0px 16px 60px 0px rgba(0, 0, 0, 0.05);
+    padding: 22px 36px 24px 32px;
+    z-index: 11;
+
+    .search-icon {
+        width: 10px;
+        height: 10px;
+        background: #768AFF;
+        border-radius: 50%;
+        margin-right: 16px;
+        flex-shrink: 0;
+    }
+
+    .end-icon {
+        background: #8BB654;
+    }
+
+    .search-input-box {
+        flex: 1;
+        display: flex;
+        align-items: center;
+
+        .search-input-placeholder {
+            flex: 1;
+            height: 40px;
+            font-size: 28px;
+            font-weight: normal;
+            line-height: 40px;
+            color: rgba(0, 0, 0, 0.3);
+            text-align: left;
+        }
+    }
+}
+
 .map-entry {
     position: fixed;
     top: 182px;
diff --git a/src/robotaxi/pages/select-map-site/index.tsx b/src/robotaxi/pages/select-map-site/index.tsx
index 8884601..b205692 100644
--- a/src/robotaxi/pages/select-map-site/index.tsx
+++ b/src/robotaxi/pages/select-map-site/index.tsx
@@ -1,3 +1,4 @@
+import Taro from '@tarojs/taro';
 import { useEffect, useRef } from 'react';
 import './index.less';
 import { reportEvent } from '../../../utils/Robotaxi-public-method';
@@ -91,6 +92,19 @@
       showTipPopup={selectMapSite.showTipPopup}
       handleCloseTipPopup={selectMapSite.handleCloseTipPopup}
       tipType={selectMapSite.tipType}
+      toSiteSearch={() => {
+        const lat = selectMapSite.latitude;
+        const lon = selectMapSite.longitude;
+        const electronicAreaId = selectMapSite.selectedSite?.electronicAreaId || '';
+        let url = '/robotaxi/pages/site-search/index?pageType=' + selectMapSite.pageType;
+        if (lat != null && lon != null) {
+          url += '&latitude=' + lat + '&longitude=' + lon;
+        }
+        if (electronicAreaId) {
+          url += '&electronicAreaId=' + electronicAreaId;
+        }
+        Taro.navigateTo({ url });
+      }}
     />
   );
 }

--
Gitblit v1.7.1