feat: frontend credit system UI

Admin:
- New CreditManagement.vue (tabs: rates, packages, plans, user credits, consumptions, stats)
- Sidebar menu + router entry
- Full CRUD for credit packages and subscription plans
- User credit balance adjustment
- Consumption log viewer

User:
- Credits.vue replaces Upgrade.vue (package purchase, subscription, history tabs)
- Credit balance display in topbar + dashboard header CTA card
- Navigation restructured: discovery first
- Profile redirects to /credits
- Dashboard upgrade dialog simplified to redirect to /credits
This commit is contained in:
TradeMate Dev
2026-06-12 11:00:22 +08:00
parent 2a107a42f3
commit a95e8b2b73
10 changed files with 714 additions and 11 deletions
+12
View File
@@ -119,4 +119,16 @@ export function getUsageStats() { return http.get('/usage/stats') }
export function aiChat(message, history = []) { return http.post('/ai/chat', { message, history }) }
export function aiQuickQuestions() { return http.get('/ai/quick-questions') }
export function getCreditBalance() { return http.get('/credits/balance') }
export function getCreditHistory(params) { return http.get('/credits/history', { params }) }
export function getCreditPackages() { return http.get('/credits/packages') }
export function getSubscriptionPlans() { return http.get('/credits/subscription-plans') }
export function purchaseCreditPackage(packageId, payType = 'alipay') {
return http.post('/credits/purchase', { package_id: packageId, pay_type: payType })
}
export function subscribeCreditPlan(planId, payType = 'alipay') {
return http.post('/credits/subscribe', { plan_id: planId, pay_type: payType })
}
export function cancelCreditSubscription() { return http.post('/credits/cancel-subscription') }
export default http