Merge branch 'feature_v1.0' of http://gitlab.xiaopeng.local:18080/robotaxi1/xp-robotaxi-miniprogram into feature_v1.0
| | |
| | | <View |
| | | className={`car-card-temp-title ${ |
| | | tripData?.tripStatus === TripStatus.InService |
| | | || tripData?.tripStatus === TripStatus.ArrivedDestination |
| | | || tripData?.tripStatus >= TripStatus.ArrivedDestination |
| | | ? 'disabled-text' |
| | | : '' |
| | | }`} |
| | |
| | | </View> |
| | | </View> |
| | | {(tripData?.tripStatus === TripStatus.InService |
| | | || tripData?.tripStatus === TripStatus.ArrivedDestination) |
| | | || tripData?.tripStatus >= TripStatus.ArrivedDestination) |
| | | && tripData?.boardingTime && ( |
| | | <View className='car-card-temp-time disabled-text'> |
| | | {tripData.boardingTime} 上车 |
| | |
| | | <View className='dot end'></View> |
| | | <View |
| | | className={`car-card-temp-title ${ |
| | | tripData?.tripStatus === TripStatus.ArrivedDestination |
| | | tripData?.tripStatus >= TripStatus.ArrivedDestination |
| | | ? 'disabled-text' |
| | | : '' |
| | | }`} |
| | |
| | | 终点:{tripData?.endPointName} |
| | | </View> |
| | | </View> |
| | | {tripData?.tripStatus === TripStatus.ArrivedDestination |
| | | {tripData?.tripStatus >= TripStatus.ArrivedDestination |
| | | && tripData?.getoffTime && ( |
| | | <View className='car-card-temp-time disabled-text'> |
| | | {tripData.getoffTime} 到达 |
| | |
| | | import Taro from '@tarojs/taro'; |
| | | import { useEffect, useRef } from 'react'; |
| | | import { mapOrderStatusToTripStatus } from '../../../../utils/Robotaxi-public-method'; |
| | | import { shareQueryOrderInfo, shareQueryOrderRoute } from '../../../api/begin-route'; |
| | | import { queryOrderTrajectory, shareQueryOrderInfo, shareQueryOrderRoute } from '../../../api/begin-route'; |
| | | import { normalizeDistanceKm, normalizeDurationSeconds } from '../../../utils/format'; |
| | | import { TripStatus } from '../../begin-route/constants/trip-status'; |
| | | |
| | |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 已到达目的地后切换为订单轨迹接口,确保能拿到完整行程轨迹。 |
| | | */ |
| | | const requestShareRouteByStatus = (targetStatus: TripStatus) => { |
| | | if (targetStatus >= TripStatus.ArrivedDestination) { |
| | | return queryOrderTrajectory({ |
| | | orderId: deps.orderId, |
| | | routeType: 2, |
| | | }); |
| | | } |
| | | return shareQueryOrderRoute(deps.orderId); |
| | | }; |
| | | |
| | | useEffect(() => { |
| | | tripStatusRef.current = deps.tripStatus; |
| | | }, [deps.tripStatus]); |
| | |
| | | |
| | | const fetchShareTripData = async () => { |
| | | try { |
| | | if (tripStatusRef.current > TripStatus.ArrivedDestination) { |
| | | if (tripStatusRef.current > TripStatus.PaymentSuccess) { |
| | | stopPolling(); |
| | | return; |
| | | } |
| | | const routeResponse = await shareQueryOrderRoute(deps.orderId); |
| | | let routeResponse = await requestShareRouteByStatus(tripStatusRef.current); |
| | | if (cancelled) return; |
| | | const routeStatus = resolveRouteOrderStatus(routeResponse); |
| | | const shouldFetchInfo = routeStatus !== null && routeStatus !== infoStatusRef.current; |
| | |
| | | mappedStatus = infoState.mappedStatus; |
| | | nextStartSite = infoState.nextStartSite; |
| | | nextEndSite = infoState.nextEndSite; |
| | | |
| | | // 状态刚切到“已到达目的地”时,需要补拉完整轨迹,不能继续使用分享中的实时路线接口。 |
| | | if (mappedStatus >= TripStatus.ArrivedDestination) { |
| | | routeResponse = await requestShareRouteByStatus(mappedStatus); |
| | | if (cancelled) return; |
| | | } |
| | | } |
| | | |
| | | if (mappedStatus > TripStatus.ArrivedDestination) { |
| | | if (mappedStatus > TripStatus.PaymentSuccess) { |
| | | stopPolling(); |
| | | return; |
| | | } |
| | |
| | | fetchInitialShareInfo() |
| | | .then((infoState) => { |
| | | if (!infoState || cancelled) return; |
| | | if (infoState.mappedStatus > TripStatus.ArrivedDestination) return; |
| | | fetchShareTripData(); |
| | | timer = setInterval(fetchShareTripData, 10000); |
| | | if (infoState.mappedStatus < TripStatus.ArrivedDestination) { |
| | | timer = setInterval(fetchShareTripData, 10000); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | handleFetchError(error); |
| | |
| | | } |
| | | |
| | | .car-card-temp-time { |
| | | min-width: 120px; |
| | | font-size: 24px; |
| | | line-height: 40px; |
| | | color: rgba(0, 0, 0, 0.9); |
| | |
| | | [TripStatus.VehicleApproaching]: { showPickup: true, showDropoff: false, showCar: true, showRoute: true, showWalking: false, viewport: 'route', translateCar: true }, |
| | | [TripStatus.VehicleArrivedPickup]: { showPickup: true, showDropoff: false, showCar: true, showRoute: false, showWalking: false, viewport: 'car_user', translateCar: true }, |
| | | [TripStatus.InService]: { showPickup: false, showDropoff: true, showCar: true, showRoute: true, showWalking: false, viewport: 'route', translateCar: true }, |
| | | [TripStatus.ArrivedDestination]: { showPickup: false, showDropoff: true, showCar: false, showRoute: false, showWalking: false, viewport: 'dropoff', translateCar: false }, |
| | | [TripStatus.ArrivedDestination]: { showPickup: false, showDropoff: true, showCar: false, showRoute: true, showWalking: false, viewport: 'dropoff', translateCar: false }, |
| | | [TripStatus.TripFinished]: { showPickup: true, showDropoff: true, showCar: false, showRoute: true, showWalking: false, viewport: 'order_detail', translateCar: false }, |
| | | [TripStatus.PaymentSuccess]: { showPickup: true, showDropoff: true, showCar: false, showRoute: true, showWalking: false, viewport: 'order_detail', translateCar: false }, |
| | | [TripStatus.CancelOnlyPickup]: { showPickup: true, showDropoff: false, showCar: false, showRoute: false, showWalking: false, viewport: 'pickup', translateCar: false }, |