Merge branch 'fix/modify-point' into 'feature_v1.0'
fix(temperature-control): 连环派单:当前车辆有一笔订单,第二个用户下连环单,车辆接单后,车的温度会被重新改为默认值23.5度
See merge request robotaxi1/xp-robotaxi-miniprogram!73
| | |
| | | isLocationAuthDenied: boolean; |
| | | /** 当前电子围栏 ID */ |
| | | electronicAreaId: string; |
| | | /** 当前地图中心纬度 */ |
| | | latitude: number | null; |
| | | /** 当前地图中心经度 */ |
| | | longitude: number | null; |
| | | /** 当前选中站点 */ |
| | | currentSite: any; |
| | | /** 首页确认上车点。 */ |
| | |
| | | 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' }); |
| | | } |
| | |
| | | setShowPrivacy, |
| | | isLocationAuthDenied, |
| | | electronicAreaId, |
| | | latitude, |
| | | longitude, |
| | | currentSite, |
| | | preferredStartSite, |
| | | userCurrentLocation, |
| | |
| | | if (tripStatus !== TripStatus.VehicleApproaching) { |
| | | return; |
| | | } |
| | | // 连环派单场景:车辆仍在执行上一单(hasBeforeUserEndSite 为 true)时, |
| | | // 当前用户的空调卡片尚未展示,不应初始化/下发温度,否则会把车内温度强制改回默认 23.5°C, |
| | | // 覆盖上一单乘客的设置。待车辆完成上一单后该副作用会重新执行并正常初始化。 |
| | | if (hasBeforeUserEndSite) { |
| | | return; |
| | | } |
| | | if (skipQueryOnThisCycleRef.current) { |
| | | return; |
| | | } |
| | |
| | | // 先不展示 storageData,等待校准(限定时间内接口返回 → 展示接口数据,超时 → 展示 storageData 并同步远程) |
| | | handleCalibration(targetOrderId, storageData.acOpen, storageData.temperature); |
| | | } |
| | | }, [tripStatus, orderId, pageDidShowVersion]); |
| | | }, [tripStatus, orderId, pageDidShowVersion, hasBeforeUserEndSite]); |
| | | |
| | | useEffect(() => { |
| | | lastConfirmedTempRef.current = tempStatus; |
| | |
| | | // 重新拉取初始化数据(历史记录和附近站点) |
| | | 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)) { |
| | |
| | | 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), |
| | |
| | | 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 }; |