hejianhao
2026-03-13 ac3ff28a6530344f37820acb42f70f5ea5d448a6
fix(robotaxi): 修复订单状态判断和立即呼叫按钮禁用逻辑

- 修正行程状态数组,移除状态3以正确显示车辆图片
- 重构立即呼叫按钮禁用样式,使用遮罩层替代类名切换
- 添加订单激活状态检查,在页面初始化时获取最新起终点
- 增加呼叫提交状态防止重复点击,优化错误处理和用户提示
4个文件已修改
90 ■■■■■ 已修改文件
src/pages/robotaxi/home/index.tsx 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/robotaxi/pages/begin-route/components/css-folder/release-route.less 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/robotaxi/pages/begin-route/components/release-route.tsx 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/robotaxi/pages/begin-route/index.tsx 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/robotaxi/home/index.tsx
@@ -1209,7 +1209,7 @@
                  </View>
                }
                {
                  [3, 4, 5, 6, 7, 8].includes(tripStatus) &&
                  [4, 5, 6, 7, 8].includes(tripStatus) &&
                  <View className="order-status-left">
                    {
                      orderData.vehiclePictures ?
src/robotaxi/pages/begin-route/components/css-folder/release-route.less
@@ -212,8 +212,12 @@
            }
        }
        .confirm-btn {
        .confirm-btn-wrapper {
            position: relative;
            margin-top: 64px;
            height: 88px;
        }
        .confirm-btn {
            height: 88px;
            display: flex;
            justify-content: center;
@@ -224,10 +228,14 @@
            letter-spacing: normal;
            color: #FFFFFF;
        }
        .confirm-btn-disabled {
            background: #C0C6D4;
            color: rgba(255, 255, 255, 0.9);
            pointer-events: none;
        .confirm-btn-mask {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            border-radius: 16px;
            background: rgba(255, 255, 255, 0.4);
        }
    }
}
src/robotaxi/pages/begin-route/components/release-route.tsx
@@ -78,7 +78,10 @@
                        </View>
                    </View>
                </View>
                <View onClick={() => !isCallDisabled && callImmediately()} className={`confirm-btn${isCallDisabled ? ' confirm-btn-disabled' : ''}`}>立即呼叫</View>
                <View className="confirm-btn-wrapper">
                    <View onClick={() => !isCallDisabled && callImmediately()} className="confirm-btn">立即呼叫</View>
                    {isCallDisabled && <View className="confirm-btn-mask" />}
                </View>
            </View>
        </View>
    )
src/robotaxi/pages/begin-route/index.tsx
@@ -42,6 +42,7 @@
  queryOrderRoute,
  endOrder,
} from '../../../robotaxi/api/begin-route';
import { getOrderActive } from '../../../robotaxi/api/home';
import { getOrderDetail } from '../../../robotaxi/api/order';
import { getOrderDistance } from '../../api/select-map-site';
import { checkOtp } from '../../../utils/tools';
@@ -77,6 +78,7 @@
  const carMarkerInitialized = useRef(false);
  const [fareEstimate, setFareEstimate] = useState<any>({}); // 预估费用信息
  const [routeAndFareError, setRouteAndFareError] = useState(false);
  const [callSubmitting, setCallSubmitting] = useState(false);
  const [vehicleLocation, setVehicleLocation] = useState<{ latitude: number, longitude: number } | null>(null);
  const [vehicleDirection, setVehicleDirection] = useState<number | null>(null);
  const [routeDistance, setRouteDistance] = useState<{ value: number; unit: 'km' | 'm' } | null>(null); // 路线距离
@@ -774,6 +776,9 @@
  useEffect(() => {
    Taro.setStorageSync('tripStatus', tripStatus);
    tripStatusRef.current = tripStatus;
    if (tripStatus === 1) {
      setCallSubmitting(false);
    }
    let timer: any = null;
    let requoteTimer: any = null;
    // tripStatus=1:开启发布行程停留计时,用于10分钟后提示需重新估价
@@ -1152,13 +1157,8 @@
    const s = Taro.getStorageSync('startSite');
    const e = Taro.getStorageSync('endSite');
    const cachedOrderId = Taro.getStorageSync('orderId');
    const cachedTripStatus = Number(Taro.getStorageSync('tripStatus')) || tripStatus;
    if (s) {
      setStartSite(s);
    }
    if (e) {
      setEndSite(e);
    }
    const cachedTripStatusStorage = Taro.getStorageSync('tripStatus');
    const cachedTripStatus = Number(cachedTripStatusStorage) || tripStatus;
    if (cachedOrderId) {
      setOrderId(cachedOrderId);
      queryVehicleByOrderId({ orderId: cachedOrderId })
@@ -1166,6 +1166,42 @@
          setVehicleInfo(res);
        })
        .catch(() => { });
    }
    if (cachedTripStatusStorage) {
      getOrderActive()
        .then((res: any) => {
          if (!res) {
            return;
          }
          const nextStartSite = {
            id: res.startPointId || '',
            name: res.startPointName || '',
            latitude: res.startLat || 0,
            longitude: res.startLon || 0,
            electronicAreaId: res.xpElectronicFenceAreaId || '',
            time: res.startParkingTimeLimit || 0,
          };
          const nextEndSite = {
            id: res.endPointId || '',
            name: res.endPointName || '',
            latitude: res.endLat || 0,
            longitude: res.endLon || 0,
            electronicAreaId: res.xpElectronicFenceAreaId || '',
            time: res.endParkingTimeLimit || 0,
          };
          Taro.setStorageSync('startSite', nextStartSite);
          Taro.setStorageSync('endSite', nextEndSite);
          setStartSite(nextStartSite);
          setEndSite(nextEndSite);
        })
        .catch(() => { });
    } else {
      if (s) {
        setStartSite(s);
      }
      if (e) {
        setEndSite(e);
      }
    }
    if (cachedOrderId && [4, 5, 6, 7, 8].includes(cachedTripStatus)) {
      requestOrderRoute(cachedOrderId, cachedTripStatus);
@@ -1242,8 +1278,13 @@
  // 立即呼叫
  const callImmediately = debounce(async () => {
    if (callSubmitting) {
      return;
    }
    setCallSubmitting(true);
    const otp = await checkOtp(false);
    if (!otp) {
      setCallSubmitting(false);
      jumpTo({ url: '/pages/user/login?hideBack=1' });
      return
    }
@@ -1252,9 +1293,11 @@
        title: '请选择站点',
        icon: 'none',
      })
      setCallSubmitting(false);
      return
    }
    if (routeAndFareError) {
      setCallSubmitting(false);
      return
    }
    const s = Taro.getStorageSync('startSite');
@@ -1263,6 +1306,7 @@
        title: '请先选择起终点',
        icon: 'none',
      })
      setCallSubmitting(false);
      return
    }
    let maxDistance = distanceConfig?.maxDistance;
@@ -1289,6 +1333,7 @@
        if (distance > maxDistance) {
          setTipType('2');
          setShowTipPopup(true);
          setCallSubmitting(false);
          return;
        }
      } catch { }
@@ -1298,6 +1343,7 @@
      if (distance < minDistance) {
        setTipType('1');
        setShowTipPopup(true);
        setCallSubmitting(false);
        return;
      }
    }
@@ -1332,6 +1378,7 @@
      }
      Taro.setStorageSync('orderId', res?.orderId || '');
    } catch (error) {
      setCallSubmitting(false);
      return
    }
    setTripStatus(2);
@@ -1371,7 +1418,7 @@
        setCancelType(4);
      } catch (error) {
        Taro.showToast({
          title: '取消失败,请重试',
          title: '取消订单失败,请重试',
          icon: 'none',
        });
        return;
@@ -1690,7 +1737,7 @@
                  fareEstimate={fareEstimate}
                  handleOpenPassengerNotice={handleOpenPassengerNotice}
                  walkingTime={walkingTime}
                  isCallDisabled={routeAndFareError}
                  isCallDisabled={routeAndFareError || callSubmitting}
                />
              }
              {/* 发布中弹窗 */}