| | |
| | | import { useEffect } from 'react'; |
| | | import { getOrderDetail } from '../../../api/order'; |
| | | import { parseLocationCoordinateString } from '../../../../utils/Robotaxi-public-method'; |
| | | import { TripStatus } from '../../../constants/trip-status'; |
| | | import { TripStatus, CancelType } from '../../../constants/trip-status'; |
| | | |
| | | type Deps = { |
| | | /** 等待计时开始 key */ |
| | |
| | | elapsedSeconds: number; |
| | | /** 等待秒数设置 */ |
| | | setElapsedSeconds: (value: number) => void; |
| | | /** 设置纬度 */ |
| | | setLatitude: (value: number) => void; |
| | | /** 设置经度 */ |
| | | setLongitude: (value: number) => void; |
| | | /** 设置步行点 */ |
| | | setWalkingPoints: (value: any[]) => void; |
| | | /** 设置步行时长 */ |
| | |
| | | /** 设置路线时长 */ |
| | | setRouteDuration: (value: any) => void; |
| | | /** 设置取消类型 */ |
| | | setCancelType: (value: number) => void; |
| | | setCancelType: (value: CancelType) => void; |
| | | /** 设置取消弹窗 */ |
| | | setShowCancelPopup: (value: boolean) => void; |
| | | /** 显示乘客须知 */ |
| | |
| | | * 启动等待计时。 |
| | | */ |
| | | const startWaitingTimer = () => { |
| | | const s = Taro.getStorageSync('startSite'); |
| | | const hasPlannedRoute = Array.isArray(deps.routePoints) && deps.routePoints.length > 0; |
| | | if (!hasPlannedRoute && s && s.latitude && s.longitude) { |
| | | deps.setLatitude(s.latitude); |
| | | deps.setLongitude(s.longitude); |
| | | } |
| | | const cachedStartAt = Number(Taro.getStorageSync(deps.waitingTimerStartKey)); |
| | | const cachedElapsed = Number(Taro.getStorageSync(deps.waitingTimerElapsedKey)); |
| | | let startAt = cachedStartAt; |
| | |
| | | deps.requoteTriggeredRef.current = false; |
| | | deps.setWalkingPoints([]); |
| | | deps.setWalkingTime(0); |
| | | const e = Taro.getStorageSync('endSite'); |
| | | if (e && e.latitude && e.longitude) { |
| | | deps.setLatitude(e.latitude); |
| | | deps.setLongitude(e.longitude); |
| | | } |
| | | deps.setElapsedSeconds(0); |
| | | clearWaitingTimerStorage(); |
| | | } else if ([TripStatus.TripFinished, TripStatus.PaymentSuccess].includes(deps.tripStatus)) { |