fix(frontend): remove balance-disabled checkbox, disable provider add when no types enabled

- Remove redundant "禁用余额充值" checkbox
- Disable "添加服务商" button when no payment types are enabled
- Show hint "请先在上方启用至少一种支付方式" when empty + no types
This commit is contained in:
erio
2026-04-06 18:28:17 +08:00
parent f8a07d59c4
commit 515f4aa0ce
3 changed files with 10 additions and 8 deletions
+1
View File
@@ -4355,6 +4355,7 @@ export default {
providerWxpay: 'WeChat Pay (Direct)',
providerStripe: 'Stripe',
typeDisabled: 'type disabled',
enableTypesFirst: 'Enable at least one payment type above first',
productNamePrefix: 'Product Name Prefix',
productNameSuffix: 'Product Name Suffix',
preview: 'Preview',
+1
View File
@@ -4528,6 +4528,7 @@ export default {
providerWxpay: '微信官方',
providerStripe: 'Stripe',
typeDisabled: '类型已禁用',
enableTypesFirst: '请先在上方启用至少一种支付方式',
productNamePrefix: '商品名前缀',
productNameSuffix: '商品名后缀',
preview: '预览',
+8 -8
View File
@@ -1669,13 +1669,9 @@
<div><label class="input-label">{{ t('admin.settings.payment.dailyLimit') }}</label><input v-model.number="form.payment_daily_limit" type="number" step="0.01" min="0" class="input" :placeholder="t('admin.settings.payment.noLimit')" /></div>
<div><label class="input-label">{{ t('admin.settings.payment.orderTimeout') }} <span class="text-red-500">*</span></label><input v-model.number="form.payment_order_timeout_minutes" type="number" min="1" class="input" required /><p class="mt-0.5 text-xs text-gray-400">{{ t('admin.settings.payment.orderTimeoutHint') }}</p></div>
</div>
<!-- Row 3: Pending orders + balance disabled + load balance -->
<!-- Row 3: Pending orders + load balance -->
<div class="flex flex-wrap items-end gap-4">
<div class="w-28"><label class="input-label">{{ t('admin.settings.payment.maxPendingOrders') }}</label><input v-model.number="form.payment_max_pending_orders" type="number" min="1" class="input" /></div>
<div class="flex items-center gap-2 pb-2">
<input id="balance-disabled" v-model="form.payment_balance_disabled" type="checkbox" class="h-4 w-4 rounded border-gray-300 text-primary-600 focus:ring-primary-500" />
<label for="balance-disabled" class="whitespace-nowrap text-sm text-gray-700 dark:text-gray-300">{{ t('admin.settings.payment.balancePaymentDisabled') }}</label>
</div>
<div>
<label class="input-label">{{ t('admin.settings.payment.loadBalanceStrategy') }}</label>
<Select v-model="form.payment_load_balance_strategy" :options="loadBalanceOptions" class="w-40" />
@@ -1724,7 +1720,7 @@
</div>
<div class="flex items-center gap-2">
<button @click="loadProviders" :disabled="providersLoading" class="btn btn-secondary btn-sm" :title="t('common.refresh')"><Icon name="refresh" size="sm" :class="providersLoading ? 'animate-spin' : ''" /></button>
<button @click="openCreateProvider" class="btn btn-primary btn-sm">{{ t('admin.settings.payment.createProvider') }}</button>
<button @click="openCreateProvider" :disabled="!hasAnyPaymentTypeEnabled" :class="hasAnyPaymentTypeEnabled ? 'btn btn-primary btn-sm' : 'btn btn-secondary btn-sm cursor-not-allowed opacity-50'">{{ t('admin.settings.payment.createProvider') }}</button>
</div>
</div>
</div>
@@ -1756,8 +1752,8 @@
</div>
</div>
<div v-else class="py-6 text-center">
<p class="text-sm text-gray-500 dark:text-gray-400">{{ t('admin.settings.payment.noProviders') }}</p>
<button @click="openCreateProvider" class="btn btn-primary btn-sm mt-2">{{ t('admin.settings.payment.createProvider') }}</button>
<p class="text-sm text-gray-500 dark:text-gray-400">{{ hasAnyPaymentTypeEnabled ? t('admin.settings.payment.noProviders') : t('admin.settings.payment.enableTypesFirst') }}</p>
<button v-if="hasAnyPaymentTypeEnabled" @click="openCreateProvider" class="btn btn-primary btn-sm mt-2">{{ t('admin.settings.payment.createProvider') }}</button>
</div>
</div>
</div>
@@ -2935,6 +2931,10 @@ function isPaymentTypeEnabled(type: string): boolean {
return form.payment_enabled_types.split(',').map(s => s.trim()).filter(Boolean).includes(type)
}
const hasAnyPaymentTypeEnabled = computed(() => {
return form.payment_enabled_types.split(',').map(s => s.trim()).filter(Boolean).length > 0
})
function togglePaymentType(type: string) {
const current = form.payment_enabled_types.split(',').map(s => s.trim()).filter(Boolean)
if (current.includes(type)) {