hejianhao
2026-03-12 7e14c7bbe8a33dbaed66d5b683d44c48f6c6193e
fix: 订单详情页状态为0时清除路线并优化解锁位置获取

- 订单状态为0(待接单)时,地图不显示路线
- 解锁车辆时优先使用实时定位,失败时回退到起点位置
- 修复订单详情页里程和时间显示为undefined的问题
2个文件已修改
32 ■■■■■ 已修改文件
src/robotaxi/pages/begin-route/components/calling-car.tsx 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/robotaxi/pages/order/detail/index.tsx 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/robotaxi/pages/begin-route/components/calling-car.tsx
@@ -374,14 +374,34 @@
    };
    // 处理解锁
    const handleUnlock = (doorType: 'door' | 'trunk', onSuccess?: () => void) => {
    const getUnlockLocationPayload = async () => {
        try {
            const location = await Taro.getLocation({ type: 'gcj02' });
            const longitude = Number(location?.longitude);
            const latitude = Number(location?.latitude);
            if (!Number.isNaN(longitude) && !Number.isNaN(latitude)) {
                return { longitude, latitude };
            }
        } catch (_) { }
        const startSite = Taro.getStorageSync('startSite') || {};
        const longitude = Number(startSite?.longitude);
        const latitude = Number(startSite?.latitude);
        if (!Number.isNaN(longitude) && !Number.isNaN(latitude)) {
            return { longitude, latitude };
        }
        return {};
    };
    const handleUnlock = async (doorType: 'door' | 'trunk', onSuccess?: () => void) => {
        const targetOrderId = orderId || Taro.getStorageSync('orderId');
        if (!targetOrderId) {
            return;
        }
        const locationPayload = await getUnlockLocationPayload();
        unlockVehicle({
            orderId: targetOrderId,
            doorType
            doorType,
            ...locationPayload
        }).then((res: any) => {
            const isFailure = res?.success === false || (typeof res?.code === 'number' && res.code !== 0);
            if (isFailure) {
src/robotaxi/pages/order/detail/index.tsx
@@ -90,7 +90,7 @@
  };
  const initMap = (data: OrderDetail) => {
    const { startLat, startLon, endLat, endLon, trajectories } = data;
    const { startLat, startLon, endLat, endLon, trajectories, status } = data;
    // 设置起点和终点标记
    const markerList = [
@@ -128,6 +128,10 @@
      setLatitude(center.latitude);
    }
    if (status === 0) {
      setPolyline([]);
      return;
    }
    const polylineData = [{
      points: routePath,
      color: '#6D7FD9',
@@ -270,7 +274,7 @@
        <View className='trip-line'>
          {
            orderData.status != 0 &&
            <View className='line-name'>全程{orderData.totalMileage || '-'}公里|{orderData.orderTime || '-'}分钟</View>
            <View className='line-name'>全程{orderData.totalMileage}公里|{orderData.orderTime}分钟</View>
          }
          <View className='line-address'>
            <View className='line-icon first-icon'></View>