feat(robotaxi): 添加站点搜索页预填搜索功能并修复显示问题
在跳转至站点搜索页时传递初始搜索关键字,页面会自动填充并执行搜索。修改目的地流程中会传递当前终点名称作为搜索关键字。修复修改目的地确认页的优惠金额仅在大于0时显示的问题,同时优化部分代码的空格格式。
| | |
| | | const [boxHeightPx, setBoxHeightPx] = useState<number | null>(null); // 容器高度(px) |
| | | const selectedRoute = routeOptions?.[selectedRouteIndex]; // 当前选中的改终点路线 |
| | | const isOperateFree = Number(selectedRoute?.operateFree) === 1; // 当前路线是否为载客测试免费 |
| | | |
| | | |
| | | const isDragging = useRef(false); |
| | | const startY = useRef(0); |
| | | const startHeight = useRef(0); |
| | |
| | | |
| | | return ( |
| | | <View className="modify-destination-review-container"> |
| | | <View |
| | | className='modify-destination-review' |
| | | style={{ |
| | | <View |
| | | className='modify-destination-review' |
| | | style={{ |
| | | height: typeof boxHeightPx === 'number' ? `${boxHeightPx}px` : 'auto', |
| | | transition: isDragging.current ? 'none' : 'height 0.3s ease' |
| | | }} |
| | |
| | | 元 |
| | | </View> |
| | | )} |
| | | {isOperateFree ? null : |
| | | {isOperateFree ? null : fareEstimate.discountAmount > 0 && |
| | | <View className='modify-destination-review-fare-discount'> |
| | | 已优惠{fareEstimate.discountAmount}元 |
| | | </View> |
| | |
| | | orderId: string; |
| | | endSite: any; |
| | | setEndSite: (site: any) => void; |
| | | toSelectSite: (pageType: 'start' | 'end') => void; |
| | | toSelectSite: (pageType: 'start' | 'end', keyword?: string) => void; |
| | | onModifySuccess?: () => void; |
| | | }; |
| | | |
| | |
| | | ]); |
| | | |
| | | const handleStartModifyDestination = (fareEstimate?: any, routePoints?: any[]) => { |
| | | const currentEndSiteName = String(deps.endSite?.name || ''); |
| | | Taro.setStorageSync(MODIFY_DESTINATION_SESSION_KEY, { |
| | | active: true, |
| | | previousEndSite: deps.endSite || null, |
| | |
| | | }); |
| | | Taro.setStorageSync(MODIFY_DESTINATION_ROUTE_POINTS_KEY, Array.isArray(routePoints) ? routePoints : []); |
| | | Taro.removeStorageSync(MODIFY_DESTINATION_CANDIDATE_KEY); |
| | | deps.toSelectSite('end'); |
| | | deps.toSelectSite('end', currentEndSiteName); |
| | | }; |
| | | |
| | | const clearLocalDestinationOverride = () => { |
| | |
| | | /** |
| | | * 跳转选点页。 |
| | | */ |
| | | const toSelectSite = (pageType: 'start' | 'end') => { |
| | | const toSelectSite = (pageType: 'start' | 'end', keyword?: string) => { |
| | | const searchKeyword = encodeURIComponent(String(keyword || '')); |
| | | Taro.navigateTo({ |
| | | url: `/robotaxi/pages/site-search/index?pageType=${pageType}&longitude=${deps.startSite.longitude}&latitude=${deps.startSite.latitude}&electronicAreaId=${deps.startSite.electronicAreaId}` |
| | | url: `/robotaxi/pages/site-search/index?pageType=${pageType}&longitude=${deps.startSite.longitude}&latitude=${deps.startSite.latitude}&electronicAreaId=${deps.startSite.electronicAreaId}&keyword=${searchKeyword}` |
| | | }); |
| | | }; |
| | | |
| | |
| | | import Taro from '@tarojs/taro'; |
| | | import { useState, useEffect } from 'react'; |
| | | import { useState, useEffect, useRef } from 'react'; |
| | | import { View, Text, Image, Input } from '@tarojs/components'; |
| | | import './index.less'; |
| | | import map from '../../assets/map.png' |
| | |
| | | const [showTipPopup, setShowTipPopup] = useState(false) |
| | | const [tipType, setTipType] = useState('') |
| | | const [showFavoritePopup, setShowFavoritePopup] = useState(false) |
| | | const hasAppliedInitialKeyword = useRef(false) // 是否已应用初始搜索关键字 |
| | | |
| | | const MAX_SHOW_COUNT = 5 // 默认最多显示5条 |
| | | const MAX_EXPANDED_COUNT = 10 |
| | | |
| | | const router = Taro.useRouter(); |
| | | const initialKeyword = String(router.params?.keyword || '').trim(); |
| | | const { |
| | | pageType, |
| | | siteList, |
| | |
| | | }).catch(() => { }); |
| | | }, []); |
| | | |
| | | useEffect(() => { |
| | | if (!initialKeyword || hasAppliedInitialKeyword.current) { |
| | | return; |
| | | } |
| | | hasAppliedInitialKeyword.current = true; |
| | | setSearchValue(initialKeyword); |
| | | confirmSearch(initialKeyword); |
| | | }, [initialKeyword, confirmSearch]); |
| | | |
| | | // 处理终点选择后的业务校验与跳转 |
| | | const handleEndSiteSelection = async (item: any) => { |
| | | const startSiteCache = Taro.getStorageSync('startSite'); |