Files
vmall/openspec/changes/add-membership-messaging/proposal.md
T

30 lines
2.5 KiB
Markdown

## Why
Members have no growth ladder and no reach-out channel: a customer's spending never converts into status, and order events (payment, dispatch, refund) are invisible unless the shopper re-opens the buyer center. tigshop's level page is itself a half-finished stub, so vmall defines its own member-level and growth-value design instead of porting that page, and pairs it with a system in-site message inbox so transaction events actually reach the customer.
## What Changes
- Add platform-managed member levels with bilingual name, icon, growth-value threshold, and bilingual benefits description.
- Accrue growth value from an order's realized paid amount when the customer confirms receipt, recorded in an append-only growth ledger in the same style as the points ledger.
- Automatically upgrade a customer's level inside the accrual transaction, writing `users.level` with a guarded update from the highest threshold the customer's growth qualifies for.
- Emit system in-site messages on order payment, shipment dispatch, and refund completion events.
- Give customers a message inbox with unread/read state, mark-all-read, soft deletion, and an unread count endpoint for the header badge.
- Surface all of it through `@vmall/shared`: a Mall member-center level page, a message center, and a top-bar unread badge (with fixed-adapter fallback and live picks for the new domains), plus a member-level management page in the admin console.
## Capabilities
### New Capabilities
- `membership`: Member level catalog, growth-value accrual ledger, automatic upgrade-only leveling, and level benefits display.
- `messaging`: Order and after-sale event-driven system messages, per-user unread/read state with soft deletion, and unread counting.
### Modified Capabilities
- `frontend-mall`: Member-center level page, message center, and top-bar unread badge use the selected API adapter instead of absent or local state.
- `frontend-admin`: Member level management beside the existing platform operations.
## Non-goals
Paid level purchases, level-exclusive pricing, SMS/email/WeChat-template push delivery, real-time WebSocket push (polling or fetch-on-entry is enough), and rich-text message bodies are excluded.
## Impact
Adds one Postgres migration, Rust `membership` and `messaging` modules with order/fulfillment event hooks, shared types and API methods, `membership` and `messaging` Mall domains with fixed adapters and live picks, Mall pages `user/membership` and `user/messages` plus the shell badge, and an admin `member-levels` page.