Files
汉秋 3dcfb99254 对齐 Android 立即收款页面 UI,并补齐推送状态与语音开关。
统一收款详情布局、设置金额弹窗和收款记录样式,接入 type 6/1 推送驱动与轮询 fallback,使 iOS 收款反馈与 Android 一致。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 15:17:09 +08:00

45 lines
2.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 收款模块
## 模块职责
`Features/Payment` 承接首页 `payment_collection``payment_qr``payment_code` 权限入口,负责当前景区下的收款码、动态金额二维码、收款记录和到账反馈。
## 代码结构
- `PaymentAPI`:封装收款码和扫码收款记录接口。
- `PaymentCollectionViewModel`:管理收款码加载、金额校验、动态二维码生成、推送状态和到账轮询 fallback。
- `PaymentCollectionRecordViewModel`:管理收款记录加载和按日期分组。
- `PaymentCollectionView`:展示 Android 对齐后的收款详情页 UI。
- `PaymentCollectionComponents`:收款页复用 UI 组件白卡、QR 区、设置金额弹窗、记录卡片)。
- `PaymentPushEventCenter`:应用内收款推送事件总线,对齐 Android `PushBus`
- `PaymentCollectionRecordView`:展示收款记录明细。
## 页面结构(对齐 Android
主页面标题为「收款详情」,自上而下:
1. QR 卡景区名、182×182 二维码、设置金额/保存二维码文字链;失败态显示红字与点击刷新。
2. 状态卡:推送 type=6 时显示「扫码成功支付中...」;付款成功后显示金额/时间/单号/备注。
3. 信息卡:景区名称、收款方、员工 ID。
4. 收款记录入口行。
5. 收款到账语音提醒开关。
设置金额使用居中 Dialog确认后直接更新主二维码。
## 数据流
1. 页面读取 `AccountContext.currentScenic``AccountContext.profile.userId`
2. 有景区时调用 `/api/yf-handset-app/photog/pay-code?scenic_id=...` 获取收款码。
3. 设置金额后基于动态收款码 URL 追加 `amount` 和可选 `remark`,生成二维码。
4. 优先通过推送更新 UI
- `type=6`:扫码成功,展示扫码时间 + 「扫码成功支付中...」
- `type=1`付款成功QR 区大成功态 + 详情卡;若语音开关开启则全局 TTS 播报
5. 保留轮询 fallback`/api/yf-handset-app/photog/order/photo-scan-order-list?scenic_id=...`,最多 60 次,每 2 秒一次。
6. 命中新收款记录后进入成功态,并填充 `PaymentSuccessDisplayData`
## 缓存边界
- 收款码 URL、付款状态、轮询结果不落盘。
- 语音开关写入 `AppPreferencesStore``suixinkan.preferences.payment_receive_voice`)。
- 保存二维码只写入系统相册App 不额外缓存图片文件或 Data。