卢春龙
2026-06-15 1ef36e2ea82313806ca6492d00d45434ed0a969d
Merge branch 'fix/modify-point' into 'feature_v1.0'

fix(temperature-control): 连环派单:当前车辆有一笔订单,第二个用户下连环单,车辆接单后,车的温度会被重新改为默认值23.5度

See merge request robotaxi1/xp-robotaxi-miniprogram!73
4个文件已修改
40 ■■■■■ 已修改文件
src/pages/robotaxi/home/hooks/use-navigation.ts 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/robotaxi/home/index.tsx 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/robotaxi/pages/begin-route/components/calling-car-modules/temperature-control.tsx 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/robotaxi/pages/site-search/hooks/use-site-search.ts 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/robotaxi/home/hooks/use-navigation.ts
@@ -36,6 +36,10 @@
  isLocationAuthDenied: boolean;
  /** 当前电子围栏 ID */
  electronicAreaId: string;
  /** 当前地图中心纬度 */
  latitude: number | null;
  /** 当前地图中心经度 */
  longitude: number | null;
  /** 当前选中站点 */
  currentSite: any;
  /** 首页确认上车点。 */
@@ -208,8 +212,22 @@
      return;
    }
    reportEditStationEvent(type);
    // 切换城市后 currentSite 会被清空(无经纬度),此时回退到当前地图中心坐标,
    // 避免传入 longitude=undefined/latitude=undefined 导致搜索页接口报“必须要传经纬度”。
    const siteLongitude = Number(deps.currentSite?.longitude);
    const siteLatitude = Number(deps.currentSite?.latitude);
    const hasValidSiteCoord = Number.isFinite(siteLongitude) && Number.isFinite(siteLatitude);
    const mapLongitude = Number(deps.longitude);
    const mapLatitude = Number(deps.latitude);
    const hasValidMapCoord = Number.isFinite(mapLongitude) && Number.isFinite(mapLatitude);
    const startLongitude = hasValidSiteCoord ? siteLongitude : (hasValidMapCoord ? mapLongitude : null);
    const startLatitude = hasValidSiteCoord ? siteLatitude : (hasValidMapCoord ? mapLatitude : null);
    if (startLongitude === null || startLatitude === null) {
      Taro.showToast({ title: '请先移动到运营区内', icon: 'none' });
      return;
    }
    Taro.navigateTo({
      url: `/robotaxi/pages/site-search/index?pageType=${type}&electronicAreaId=${deps.electronicAreaId}&longitude=${deps.currentSite.longitude}&latitude=${deps.currentSite.latitude}`,
      url: `/robotaxi/pages/site-search/index?pageType=${type}&electronicAreaId=${deps.electronicAreaId}&longitude=${startLongitude}&latitude=${startLatitude}`,
      success: () => {
        reportEvent(SEARCH_CLICK_EVENT_ID, { element_type: type == 'start' ? 'start' : 'dest' });
      }
src/pages/robotaxi/home/index.tsx
@@ -324,6 +324,8 @@
    setShowPrivacy,
    isLocationAuthDenied,
    electronicAreaId,
    latitude,
    longitude,
    currentSite,
    preferredStartSite,
    userCurrentLocation,
src/robotaxi/pages/begin-route/components/calling-car-modules/temperature-control.tsx
@@ -195,6 +195,12 @@
        if (tripStatus !== TripStatus.VehicleApproaching) {
            return;
        }
        // 连环派单场景:车辆仍在执行上一单(hasBeforeUserEndSite 为 true)时,
        // 当前用户的空调卡片尚未展示,不应初始化/下发温度,否则会把车内温度强制改回默认 23.5°C,
        // 覆盖上一单乘客的设置。待车辆完成上一单后该副作用会重新执行并正常初始化。
        if (hasBeforeUserEndSite) {
            return;
        }
        if (skipQueryOnThisCycleRef.current) {
            return;
        }
@@ -211,7 +217,7 @@
            // 先不展示 storageData,等待校准(限定时间内接口返回 → 展示接口数据,超时 → 展示 storageData 并同步远程)
            handleCalibration(targetOrderId, storageData.acOpen, storageData.temperature);
        }
    }, [tripStatus, orderId, pageDidShowVersion]);
    }, [tripStatus, orderId, pageDidShowVersion, hasBeforeUserEndSite]);
    useEffect(() => {
        lastConfirmedTempRef.current = tempStatus;
src/robotaxi/pages/site-search/hooks/use-site-search.ts
@@ -228,11 +228,12 @@
  // 重新拉取初始化数据(历史记录和附近站点)
  const refreshData = async () => {
    const { pageType: type, latitude: lat, longitude: lon, electronicAreaId } = deps.router.params;
    if (lat && lon) {
    const hasValidCoord = Number.isFinite(Number(lat)) && Number.isFinite(Number(lon));
    if (hasValidCoord) {
      fetchNearbySites(Number(lat), Number(lon), electronicAreaId);
    }
    const otp = await checkOtp(false);
    if (otp && lat && lon) {
    if (otp && hasValidCoord) {
      const payload = { lat: Number(lat), lon: Number(lon), electronicAreaId };
      const handleSuccess = (res: any) => {
        if (Array.isArray(res)) {
@@ -263,8 +264,9 @@
    let isUnmounted = false;
    const initPageData = async () => {
      const { pageType: type, latitude: lat, longitude: lon, electronicAreaId } = deps.router.params;
      const hasValidCoord = Number.isFinite(Number(lat)) && Number.isFinite(Number(lon));
      const initTasks: Promise<unknown>[] = [];
      if (lat && lon) {
      if (hasValidCoord) {
        initTasks.push(
          fetchNearbySites(
            Number(lat),
@@ -277,7 +279,7 @@
      initTasks.push((async () => {
        try {
          const otp = await checkOtp(false);
          if (!otp || !lat || !lon) {
          if (!otp || !hasValidCoord) {
            return;
          }
          const payload = { lat: Number(lat), lon: Number(lon), electronicAreaId };