Skip to content

feat(app): 建單前車資預估(懸而未決 #1) - #43

Merged
thothawei merged 2 commits into
mainfrom
claude/next-todo-item-9b501a
Jul 23, 2026
Merged

thothawei merged 2 commits into
mainfrom
claude/next-todo-item-9b501a

Conversation

@thothawei

Copy link
Copy Markdown
Owner

背景

叫車表單顯示預估車資,讓乘客建單前就看到大概金額。多停靠點行程放大了「先搭後知價」的痛點——排一堆繞路卻看不到金額。是預估不是定價:後端仍於行程完成時依實際行駛路線定格計費,卡片明確標示。

後端對應:thothawei/fleet-dispatch#44(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/車種變更重算含清潔費/失敗靜默/clearEstimate/移除乘客清空/模型解析)。
  • 尚未做:模擬器實跑 E2E(需後端 docker)。

🤖 Generated with Claude Code

thothawei and others added 2 commits July 23, 2026 07:55
叫車表單顯示預估車資:地圖選目的地(單點)或停靠點填完(多停靠點)時自動算、
車種變更時重算。是預估不是定價——實際依行駛路線於行程結束時結算,卡片明確標示。
後端對應 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>
@thothawei
thothawei merged commit 5963e90 into main Jul 23, 2026
2 checks passed
@thothawei
thothawei deleted the claude/next-todo-item-9b501a branch July 28, 2026 00:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant