From c48c003f3fdfc883e782dc249c3c68ad5032efd4 Mon Sep 17 00:00:00 2001 From: erio Date: Tue, 7 Apr 2026 10:56:03 +0800 Subject: [PATCH] fix(payment): plan save with camelCase keys, group badge, toggle switch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix plan create/update: send camelCase keys (groupId, validityDays, forSale, etc.) matching backend JSON tags instead of snake_case - Show GroupBadge with platform color instead of raw group ID in table - Replace checkbox with toggle switch for for_sale, support quick toggle directly from the plan list - Parse features string to array when loading plans (both admin and user) - Fix price display to use ¥ (CNY) instead of $ --- frontend/src/stores/payment.ts | 8 +- .../admin/orders/AdminPaymentPlansView.vue | 93 ++++++++++++++++--- 2 files changed, 86 insertions(+), 15 deletions(-) diff --git a/frontend/src/stores/payment.ts b/frontend/src/stores/payment.ts index 49fd0e09ea..9b3a0fa475 100644 --- a/frontend/src/stores/payment.ts +++ b/frontend/src/stores/payment.ts @@ -46,7 +46,13 @@ export const usePaymentStore = defineStore('payment', () => { async function fetchPlans(): Promise { try { const response = await paymentAPI.getPlans() - plans.value = response.data + // Backend returns features as newline-separated string; parse to array + plans.value = (response.data || []).map((p: any) => ({ + ...p, + features: typeof p.features === 'string' + ? p.features.split('\n').map((f: string) => f.trim()).filter(Boolean) + : (p.features || []), + })) return plans.value } catch (error) { console.error('[payment] Failed to fetch plans:', error) diff --git a/frontend/src/views/admin/orders/AdminPaymentPlansView.vue b/frontend/src/views/admin/orders/AdminPaymentPlansView.vue index dc9884d08a..69d41577b7 100644 --- a/frontend/src/views/admin/orders/AdminPaymentPlansView.vue +++ b/frontend/src/views/admin/orders/AdminPaymentPlansView.vue @@ -16,19 +16,37 @@ #{{ value }} {{ t('payment.admin.groupMissing') }} - {{ groupName(value) }} + + - -