Repository navigation
feat(app): 建單前車資預估(懸而未決 #1) - #43
Merged
Merged
Conversation
叫車表單顯示預估車資:地圖選目的地(單點)或停靠點填完(多停靠點)時自動算、 車種變更時重算。是預估不是定價——實際依行駛路線於行程結束時結算,卡片明確標示。 後端對應 dispatch 的 POST /api/customer/rides/estimate(以全程規劃路線試算, 與完成計費共用 FeeSettings.Quote)。 - FareEstimate 模型+CustomerApiClient.estimateFare。 - CustomerController 加預估狀態:dropoff 座標存 controller 才能在車種變更時重算; 多停靠點由 stops 推導不需 GPS,單點需上車 GPS(優先用已取得定位,8 秒逾時)。 - _FareEstimateCard:有清潔費時拆「車資+寵物車清潔費=預估合計」,否則單一金額; 附「約 X 公里・Y 分鐘」與「實際車資依行駛路線可能不同,於行程結束時結算」。 - 失敗一律靜默清空——預估只是輔助資訊,不擋叫車、不彈錯誤(與 P5 查費率同原則)。 - 送出叫車/登出時清掉預估狀態,不留到下一趟。 驗收:flutter analyze 無 issue、flutter test 197 passed(新增 customer_fare_estimate_test 7 案:多停靠點帶 stops 不需 GPS/車種變更重算含清潔費/失敗靜默/clear/移除乘客清空/模型解析)。 尚未做:模擬器實跑 E2E(需後端 docker)。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
App 建單 ride #24 完成卡「車資 NT$94」=同座標預估 NT$94;API 層單點與寵物車 (清潔費 20%)預估皆與完成實收完全一致(共用 FeeSettings.Quote+同一 OSRM 路線)。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
叫車表單顯示預估車資,讓乘客建單前就看到大概金額。多停靠點行程放大了「先搭後知價」的痛點——排一堆繞路卻看不到金額。是預估不是定價:後端仍於行程完成時依實際行駛路線定格計費,卡片明確標示。
後端對應:thothawei/fleet-dispatch#44(
POST /api/customer/rides/estimate,以全程規劃路線試算,與完成計費共用FeeSettings.Quote)。改了什麼
FareEstimate模型 +CustomerApiClient.estimateFare。CustomerController加預估狀態:地圖選目的地(單點)或停靠點填完(多停靠點)時自動算、車種變更時重算(寵物車加清潔費要即時反映)。dropoff 座標存 controller 才能在車種變更時重算;多停靠點由 stops 推導不需 GPS,單點需上車 GPS(優先用已取得定位,8 秒逾時)。_FareEstimateCard:有清潔費時拆「車資 + 寵物車清潔費 = 預估合計」,否則單一金額;附「約 X 公里・Y 分鐘」與**「實際車資依行駛路線可能不同,於行程結束時結算」**。驗收
flutter analyze無 issue、flutter test197 passed(新增customer_fare_estimate_test7 案:多停靠點帶 stops 不需 GPS/車種變更重算含清潔費/失敗靜默/clearEstimate/移除乘客清空/模型解析)。🤖 Generated with Claude Code