1.8 KiB
1.8 KiB
MODIFIED Requirements
Requirement: Agent users can view their shop distribution code
The authenticated home page SHALL show a "View my distribution code" shortcut immediately after withdrawal management only when the current user's user_type is 3. The shortcut SHALL use src/static/icons/分销码.png. Opening it SHALL use the current user's shop_id to retrieve that shop's distribution_code from /api/admin/shops/{shop_id} and display a QR code encoding the absolute registration URL formed from VITE_API_BASE_URL, /agent-registration, and the URL-encoded distribution_code query parameter. The code SHALL be generated locally and SHALL NOT be sent to a third-party QR service.
Scenario: Agent sees and opens the shortcut
- GIVEN
/api/auth/mereturns a user withuser_type3and a validshop_id - WHEN the home page displays its quick actions
- THEN "View my distribution code" appears immediately after withdrawal management with the supplied distribution-code icon
- AND opening it displays a QR code whose decoded value is
${VITE_API_BASE_URL}/agent-registration?distribution_code=${encodeURIComponent(distribution_code)}
Scenario: Non-agent does not see the shortcut
- GIVEN
/api/auth/mereturns a user whoseuser_typeis not3 - WHEN the home page displays its quick actions
- THEN the distribution-code shortcut is not shown
- AND direct navigation to the distribution-code page does not reveal a code
Scenario: Shop or distribution code is unavailable
- GIVEN an agent opens the distribution-code page
- WHEN the current account has no
shop_id, the shop request fails, or the shop has nodistribution_code - THEN no QR code is rendered
- AND the page explains that the distribution code is currently unavailable