This commit is contained in:
24
openspec/changes/update-wallet-display-rules/proposal.md
Normal file
24
openspec/changes/update-wallet-display-rules/proposal.md
Normal file
@@ -0,0 +1,24 @@
|
||||
## Why
|
||||
|
||||
The homepage wallet entry currently displays the raw wallet balance value returned by the backend, which is cent-based. This causes incorrect user-facing values such as showing `100` instead of `1`. In addition, the wallet recharge order list always renders the auto purchase row, which can show misleading fallback text when the backend does not provide auto purchase data.
|
||||
|
||||
## What Changes
|
||||
|
||||
- Convert the homepage wallet entry balance from cents to yuan before rendering the value inside `钱包(...)`
|
||||
- Keep the homepage wallet entry aligned with user-facing currency expectations instead of exposing the raw cent amount
|
||||
- Render the recharge order `自动购包` field only when the recharge order includes auto purchase status data
|
||||
- Preserve the current auto purchase status text mapping when the field exists, including existing compatibility values
|
||||
|
||||
## Capabilities
|
||||
|
||||
### New Capabilities
|
||||
- `wallet-display-rules`: Define wallet-related UI display rules for homepage balance presentation and recharge order field visibility
|
||||
|
||||
### Modified Capabilities
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected code: `components/FunctionCard.vue`, `pages/index/index.vue`, `pages/my-wallet/my-wallet.vue`
|
||||
- Affected UI flows: homepage function menu wallet entry, wallet recharge order list
|
||||
- No backend API changes
|
||||
- No payment flow changes
|
||||
@@ -0,0 +1,42 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Homepage wallet entry SHALL display wallet balance in yuan
|
||||
The system SHALL convert the backend wallet balance value from cents to yuan before rendering the balance inside the homepage wallet entry label.
|
||||
|
||||
#### Scenario: Cent-based balance is converted for homepage display
|
||||
- **WHEN** the homepage wallet entry receives a wallet balance value of `100`
|
||||
- **THEN** the system SHALL display the wallet entry label as `钱包 (1)` instead of showing the raw cent value
|
||||
|
||||
#### Scenario: Non-round cent amount is converted for homepage display
|
||||
- **WHEN** the homepage wallet entry receives a cent-based wallet balance that is not a whole yuan amount
|
||||
- **THEN** the system SHALL display the converted yuan value
|
||||
- **AND** the system SHALL NOT display the raw cent integer
|
||||
|
||||
#### Scenario: Zero balance is displayed consistently
|
||||
- **WHEN** the homepage wallet entry receives a wallet balance value of `0`
|
||||
- **THEN** the system SHALL display `钱包 (0)`
|
||||
|
||||
### Requirement: Recharge order auto purchase row SHALL render only when data exists
|
||||
The system SHALL render the `自动购包` row in the wallet recharge order list only when the recharge order includes auto purchase status data.
|
||||
|
||||
#### Scenario: Auto purchase data exists on a recharge order
|
||||
- **WHEN** a recharge order includes `auto_purchase_status`
|
||||
- **THEN** the system SHALL render the `自动购包` row
|
||||
- **AND** the system SHALL display the status text mapped from that value
|
||||
|
||||
#### Scenario: Compatible disabled value still counts as existing data
|
||||
- **WHEN** a recharge order includes `auto_purchase_status` with a value of `0` or `'0'`
|
||||
- **THEN** the system SHALL render the `自动购包` row
|
||||
- **AND** the system SHALL display the compatible disabled status text
|
||||
|
||||
#### Scenario: Auto purchase data is absent on a recharge order
|
||||
- **WHEN** a recharge order does not include `auto_purchase_status`
|
||||
- **THEN** the system SHALL NOT render the `自动购包` row
|
||||
|
||||
### Requirement: Wallet display rules SHALL NOT change API contracts or payment behavior
|
||||
The system SHALL preserve the existing backend data contract, recharge order retrieval flow, payment actions, and wallet detail page amount handling while applying these display rules.
|
||||
|
||||
#### Scenario: Display-only adjustment does not alter business flow
|
||||
- **WHEN** the homepage wallet balance or recharge order list is rendered with the new display rules
|
||||
- **THEN** the system SHALL only change user-facing presentation
|
||||
- **AND** the system SHALL NOT change payment processing or backend request behavior
|
||||
18
openspec/changes/update-wallet-display-rules/tasks.md
Normal file
18
openspec/changes/update-wallet-display-rules/tasks.md
Normal file
@@ -0,0 +1,18 @@
|
||||
## 1. Homepage Wallet Balance Display
|
||||
|
||||
- [x] 1.1 Add a display rule for the homepage wallet entry that converts the backend cent amount to yuan before rendering
|
||||
- [x] 1.2 Ensure converted values do not expose the raw cent amount in the `钱包(...)` label
|
||||
- [x] 1.3 Preserve correct display for zero and non-integer yuan values
|
||||
|
||||
## 2. Recharge Order Auto Purchase Field Visibility
|
||||
|
||||
- [x] 2.1 Render the recharge order `自动购包` row only when the recharge order includes auto purchase status data
|
||||
- [x] 2.2 Preserve the existing status text mapping when auto purchase status data exists, including compatible `0` and `1` values
|
||||
- [x] 2.3 Hide the row entirely when auto purchase status data is absent
|
||||
|
||||
## 3. Regression Verification
|
||||
|
||||
- [x] 3.1 Verify a homepage wallet balance of `100` is displayed as `1` in the wallet entry
|
||||
- [x] 3.2 Verify a non-round cent amount is displayed as its yuan value rather than the raw cent integer
|
||||
- [x] 3.3 Verify recharge orders with `auto_purchase_status` render the `自动购包` row
|
||||
- [x] 3.4 Verify recharge orders without `auto_purchase_status` do not render the `自动购包` row
|
||||
Reference in New Issue
Block a user