| | |
| | | orderId?: string; |
| | | orderTrunkStatus?: boolean; |
| | | handleOpenOverRoutePopup?: () => void; |
| | | handleOpenAnnouncementsPopup?: () => void; |
| | | }; |
| | | |
| | | export default function DoorTrunkControl({ |
| | | tripStatus, |
| | | orderId, |
| | | orderTrunkStatus, |
| | | handleOpenOverRoutePopup, |
| | | handleOpenAnnouncementsPopup |
| | | handleOpenOverRoutePopup |
| | | }: Props) { |
| | | const [trunkStatus, setTrunkStatus] = useState(orderTrunkStatus); // 后备箱开关状态 |
| | | const [lockStatus, setLockStatus] = useState(false); // 车门解锁状态 |
| | | const trunkPollTimerRef = useRef<any>(null); // 后备箱状态轮询定时器 |
| | | const hasShownAnnouncementsRef = useRef(false); // 安全须知是否已展示 |
| | | |
| | | // 外部后备箱状态变化时同步本地状态 |
| | | useEffect(() => { |
| | |
| | | if (doorType === 'door') { |
| | | Taro.hideLoading(); |
| | | Taro.showToast({ title: '右侧车门已解锁', icon: 'none' }); |
| | | if (!hasShownAnnouncementsRef.current) { |
| | | handleOpenAnnouncementsPopup?.(); |
| | | hasShownAnnouncementsRef.current = true; |
| | | } |
| | | } |
| | | }).catch(() => { |
| | | Taro.hideLoading(); |