Files
luo 2b4fd6fff8
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 2m22s
feat: 分销码
2026-10-08 11:00:51 +08:00

1.6 KiB

ADDED Requirements

Requirement: Agent users can view their shop distribution code

The authenticated home page SHALL show a “查看我的分销码” shortcut immediately after “提现管理” 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 that exact value. 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/me returns a user with user_type 3 and a valid shop_id
  • WHEN the home page displays its quick actions
  • THEN “查看我的分销码” appears immediately after “提现管理” with the supplied distribution-code icon
  • AND opening it displays the current shop's distribution code as a QR code

Scenario: Non-agent does not see the shortcut

  • GIVEN /api/auth/me returns a user whose user_type is not 3
  • 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 no distribution_code
  • THEN no QR code is rendered
  • AND the page explains that the distribution code is currently unavailable