fix(frontend): 优化分组表单中订阅模式的字段显示逻辑
- 订阅模式下隐藏 Exclusive 字段并默认为开启状态 - 编辑分组时禁用计费类型字段,防止修改 - 移除编辑表单中无用的 subscription_type watch
This commit is contained in:
@@ -543,6 +543,7 @@ export default {
|
|||||||
title: 'Subscription Settings',
|
title: 'Subscription Settings',
|
||||||
type: 'Billing Type',
|
type: 'Billing Type',
|
||||||
typeHint: 'Standard billing deducts from user balance. Subscription mode uses quota limits instead.',
|
typeHint: 'Standard billing deducts from user balance. Subscription mode uses quota limits instead.',
|
||||||
|
typeNotEditable: 'Billing type cannot be changed after group creation.',
|
||||||
standard: 'Standard (Balance)',
|
standard: 'Standard (Balance)',
|
||||||
subscription: 'Subscription (Quota)',
|
subscription: 'Subscription (Quota)',
|
||||||
dailyLimit: 'Daily Limit (USD)',
|
dailyLimit: 'Daily Limit (USD)',
|
||||||
|
|||||||
@@ -598,6 +598,7 @@ export default {
|
|||||||
title: '订阅设置',
|
title: '订阅设置',
|
||||||
type: '计费类型',
|
type: '计费类型',
|
||||||
typeHint: '标准计费从用户余额扣除。订阅模式使用配额限制。',
|
typeHint: '标准计费从用户余额扣除。订阅模式使用配额限制。',
|
||||||
|
typeNotEditable: '分组创建后无法修改计费类型。',
|
||||||
standard: '标准(余额)',
|
standard: '标准(余额)',
|
||||||
subscription: '订阅(配额)',
|
subscription: '订阅(配额)',
|
||||||
dailyLimit: '每日限额(USD)',
|
dailyLimit: '每日限额(USD)',
|
||||||
|
|||||||
@@ -180,7 +180,7 @@
|
|||||||
/>
|
/>
|
||||||
<p class="input-hint">{{ t('admin.groups.rateMultiplierHint') }}</p>
|
<p class="input-hint">{{ t('admin.groups.rateMultiplierHint') }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-3">
|
<div v-if="createForm.subscription_type !== 'subscription'" class="flex items-center gap-3">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
@click="createForm.is_exclusive = !createForm.is_exclusive"
|
@click="createForm.is_exclusive = !createForm.is_exclusive"
|
||||||
@@ -323,7 +323,7 @@
|
|||||||
class="input"
|
class="input"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-3">
|
<div v-if="editForm.subscription_type !== 'subscription'" class="flex items-center gap-3">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
@click="editForm.is_exclusive = !editForm.is_exclusive"
|
@click="editForm.is_exclusive = !editForm.is_exclusive"
|
||||||
@@ -360,8 +360,9 @@
|
|||||||
<Select
|
<Select
|
||||||
v-model="editForm.subscription_type"
|
v-model="editForm.subscription_type"
|
||||||
:options="subscriptionTypeOptions"
|
:options="subscriptionTypeOptions"
|
||||||
|
:disabled="true"
|
||||||
/>
|
/>
|
||||||
<p class="input-hint">{{ t('admin.groups.subscription.typeHint') }}</p>
|
<p class="input-hint">{{ t('admin.groups.subscription.typeNotEditable') }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Subscription limits (only show when subscription type is selected) -->
|
<!-- Subscription limits (only show when subscription type is selected) -->
|
||||||
@@ -676,16 +677,11 @@ const confirmDelete = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 监听 subscription_type 变化,配额模式时重置 rate_multiplier 为 1
|
// 监听 subscription_type 变化,订阅模式时重置 rate_multiplier 为 1,is_exclusive 为 true
|
||||||
watch(() => createForm.subscription_type, (newVal) => {
|
watch(() => createForm.subscription_type, (newVal) => {
|
||||||
if (newVal === 'subscription') {
|
if (newVal === 'subscription') {
|
||||||
createForm.rate_multiplier = 1.0
|
createForm.rate_multiplier = 1.0
|
||||||
}
|
createForm.is_exclusive = true
|
||||||
})
|
|
||||||
|
|
||||||
watch(() => editForm.subscription_type, (newVal) => {
|
|
||||||
if (newVal === 'subscription') {
|
|
||||||
editForm.rate_multiplier = 1.0
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user