fix(robotaxi): 待支付时切换优惠券后服务端推送待评价或者已完成,页面进入到支付成功态
地图选点页围栏虚线展示并降低非同一运营区围栏的边框以及填充色
| | |
| | | try { |
| | | const orderDetail = await getOrderDetail(targetOrderId); |
| | | const orderStatus = Number(orderDetail?.status); |
| | | const nextTripStatus = orderStatus === SocketOrderStatus.PendingComment |
| | | const nextTripStatus = [ |
| | | SocketOrderStatus.PendingComment, |
| | | SocketOrderStatus.Completed |
| | | ].includes(orderStatus) |
| | | ? TripStatus.PaymentSuccess |
| | | : TripStatus.TripFinished; |
| | | return { |
| | |
| | | import { queryVehicleByOrderId } from '../../../../api/begin-route'; |
| | | import { clearOrderTripStorage, reportEvent } from '../../../../../utils/Robotaxi-public-method'; |
| | | import { getOrderId } from '../../../../utils/order'; |
| | | import { TripStatus, toTripStatus } from '../../../../constants/trip-status'; |
| | | import { SocketOrderStatus, TripStatus, toTripStatus } from '../../../../constants/trip-status'; |
| | | import { ARRIVED_DROPOFF_PAGE_VIEW_EVENT_ID, PICKUP_ARRIVED_PAGE_VIEW_EVENT_ID, TRIP_IN_PROGRESS_PAGE_VIEW_EVENT_ID, TRIP_IN_PROGRESS_COMPLETE_TRIP_BUTTON_EVENT_ID } from '../../../../constants/report-events'; |
| | | import { createTripInProgressCompleteTripReportPayload } from '../../../../constants/confirm-ride-report'; |
| | | import { clearPassedRouteCache } from '../passed-route-cache'; |
| | |
| | | deps.tripStatusRef.current = mappedTripStatus; |
| | | Taro.setStorageSync('tripStatus', mappedTripStatus); |
| | | return mappedTripStatus; |
| | | }; |
| | | |
| | | /** |
| | | * 待支付态切券后若后端已推进行程免支付完成,立即同步为支付成功态。 |
| | | */ |
| | | const syncPaymentSuccessByOrderStatus = ( |
| | | payload: any, |
| | | changeStatusOld: TripStatus, |
| | | mappedTripStatus: TripStatus | null, |
| | | deps: UseWebSocketEventsDeps |
| | | ) => { |
| | | if (mappedTripStatus === TripStatus.PaymentSuccess) { |
| | | return mappedTripStatus; |
| | | } |
| | | if (changeStatusOld !== TripStatus.TripFinished) { |
| | | return mappedTripStatus; |
| | | } |
| | | const socketStatus = Number(payload?.status); |
| | | const shouldSyncPaymentSuccess = [ |
| | | SocketOrderStatus.PendingComment, |
| | | SocketOrderStatus.Completed |
| | | ].includes(socketStatus); |
| | | if (!shouldSyncPaymentSuccess) { |
| | | return mappedTripStatus; |
| | | } |
| | | deps.setTripStatus(TripStatus.PaymentSuccess); |
| | | deps.tripStatusRef.current = TripStatus.PaymentSuccess; |
| | | Taro.setStorageSync('tripStatus', TripStatus.PaymentSuccess); |
| | | return TripStatus.PaymentSuccess; |
| | | }; |
| | | |
| | | /** |
| | |
| | | return; |
| | | } |
| | | const mappedTripStatus = syncTripStatus(payload, currentDeps); |
| | | const effectiveTripStatus = syncPaymentSuccessByOrderStatus(payload, changeStatusOld, mappedTripStatus, currentDeps); |
| | | const effectiveOrderId = resolveEffectiveOrderId(payload, currentOrderId); |
| | | syncVehicleInfo(effectiveOrderId, currentDeps, lastFetchedVehicleOrderIdRef); |
| | | reportPickupArrivedEventIfNeeded(mappedTripStatus, changeStatusOld, effectiveOrderId, currentDeps); |
| | | reportTripInProgressEventIfNeeded(mappedTripStatus, changeStatusOld, effectiveOrderId, currentDeps); |
| | | reportTripCompleteEventIfNeeded(mappedTripStatus, changeStatusOld, effectiveOrderId, currentDeps); |
| | | handleStatusSideEffects(mappedTripStatus, changeStatusOld, currentDeps); |
| | | reportPickupArrivedEventIfNeeded(effectiveTripStatus, changeStatusOld, effectiveOrderId, currentDeps); |
| | | reportTripInProgressEventIfNeeded(effectiveTripStatus, changeStatusOld, effectiveOrderId, currentDeps); |
| | | reportTripCompleteEventIfNeeded(effectiveTripStatus, changeStatusOld, effectiveOrderId, currentDeps); |
| | | handleStatusSideEffects(effectiveTripStatus, changeStatusOld, currentDeps); |
| | | handleCancelPopupPush(payload, changeStatusOld, currentDeps, pendingCancelContext); |
| | | if (payload?.showPassengerNotice) { |
| | | currentDeps.checkAndShowPassengerNotice(); |
| | |
| | | const INCLUDE_POINTS_PADDING = [100, 100, 100, 100] as [number, number, number, number]; // 地图回视图内边距 |
| | | const CROSS_OPERATING_AREA_FILL_COLOR = '#0000001a'; // 非可选运营区围栏填充色 |
| | | const CROSS_OPERATING_AREA_STROKE_COLOR = '#00000033'; // 非可选运营区围栏描边色 |
| | | const CROSS_OPERATING_AREA_STROKE_WIDTH = 2; // 非可选运营区围栏描边宽度 |
| | | const CROSS_OPERATING_AREA_DASH_ARRAY = [10, 10] as [number, number]; // 非可选运营区 polygon 虚线边框 |
| | | const SELECT_MAP_POINT_ON_OFF = { |
| | | start: 1, |
| | | end: 2 |
| | |
| | | const disabledPolygons = formatGeofenceByType(disabledGeofenceList).polygons.map((polygon: any) => ({ |
| | | ...polygon, |
| | | fillColor: CROSS_OPERATING_AREA_FILL_COLOR, |
| | | strokeColor: 'rgba(0, 0, 0, 0)' |
| | | strokeColor: CROSS_OPERATING_AREA_STROKE_COLOR, |
| | | strokeWidth: CROSS_OPERATING_AREA_STROKE_WIDTH, |
| | | dashArray: CROSS_OPERATING_AREA_DASH_ARRAY |
| | | })); |
| | | return [...selectableGeofenceDisplay.polygons, ...disabledPolygons]; |
| | | }, [ |
| | |
| | | ]); |
| | | |
| | | /** |
| | | * 围栏边框灰显展示:非可选运营区统一输出灰色虚线边框。 |
| | | * 围栏边框展示:禁用态边框改由 polygon 自身虚线能力承载,这里仅保留同运营区原始折线。 |
| | | */ |
| | | const displayFencePolylines = useMemo(() => { |
| | | if (!referenceElectronicAreaId || renderableGeofenceList.length === 0) { |
| | | return state.fencePolylines; |
| | | } |
| | | const disabledFencePolylines = disabledGeofenceList.reduce((acc: any[], item: any, index: number) => { |
| | | if (!Array.isArray(item?.points) || item.points.length < 2) { |
| | | return acc; |
| | | } |
| | | const linePoints = item.points.map((point: any) => ({ |
| | | latitude: point.lat, |
| | | longitude: point.lng |
| | | })); |
| | | acc.push({ |
| | | id: `cross_operating_area_${index}_${getMapGeofenceAreaId(item)}`, |
| | | points: [...linePoints, linePoints[0]], |
| | | color: CROSS_OPERATING_AREA_STROKE_COLOR, |
| | | width: 2, |
| | | dottedLine: true, |
| | | arrowLine: false |
| | | }); |
| | | return acc; |
| | | }, []); |
| | | return [...selectableGeofenceDisplay.fencePolylines, ...disabledFencePolylines]; |
| | | return selectableGeofenceDisplay.fencePolylines; |
| | | }, [ |
| | | disabledGeofenceList, |
| | | referenceElectronicAreaId, |
| | | renderableGeofenceList.length, |
| | | selectableGeofenceDisplay.fencePolylines, |