diff --git a/frontend/src/components/payment/PaymentProviderDialog.vue b/frontend/src/components/payment/PaymentProviderDialog.vue index 018bd46169..6f247e26ce 100644 --- a/frontend/src/components/payment/PaymentProviderDialog.vue +++ b/frontend/src/components/payment/PaymentProviderDialog.vue @@ -118,12 +118,15 @@ - +
-

- {{ t('admin.settings.payment.limitsTitle') }} -

-
+ +
@@ -146,7 +149,7 @@ type="number" :value="getLimitVal(lt.value, 'singleMax')" @input="setLimitVal(lt.value, 'singleMax', ($event.target as HTMLInputElement).value)" - class="input mt-0.5" min="0" step="0.01" placeholder="0" + class="input mt-0.5" min="1" step="0.01" placeholder="" />
@@ -155,13 +158,13 @@ type="number" :value="getLimitVal(lt.value, 'dailyLimit')" @input="setLimitVal(lt.value, 'dailyLimit', ($event.target as HTMLInputElement).value)" - class="input mt-0.5" min="0" step="0.01" placeholder="0" + class="input mt-0.5" min="1" step="0.01" placeholder="" />
+

{{ t('admin.settings.payment.limitsHint') }}

-

{{ t('admin.settings.payment.limitsHint') }}

@@ -229,6 +232,7 @@ const form = reactive({ const config = reactive>({}) const limits = reactive>>({}) const callbackBaseUrl = ref('') +const limitsExpanded = ref(false) // --- Computed --- const defaultBaseUrl = typeof window !== 'undefined' ? window.location.origin : '' @@ -281,6 +285,7 @@ function clearConfig() { Object.keys(config).forEach(k => delete config[k]) Object.keys(limits).forEach(k => delete limits[k]) callbackBaseUrl.value = '' + limitsExpanded.value = false } function applyDefaults() { @@ -296,7 +301,14 @@ function getLimitVal(paymentType: string, field: string): string { function setLimitVal(paymentType: string, field: string, val: string) { if (!limits[paymentType]) limits[paymentType] = {} - limits[paymentType][field] = Number(val) || 0 + const num = Number(val) + // Empty → clear the field (use global); reject ≤0 + if (val === '' || isNaN(num)) { + delete limits[paymentType][field] + return + } + if (num <= 0) return + limits[paymentType][field] = num } function serializeLimits(): string { @@ -404,6 +416,7 @@ function loadProvider(provider: ProviderInstance) { for (const [pt, fields] of Object.entries(parsed as Record>)) { limits[pt] = { ...fields } } + limitsExpanded.value = Object.keys(limits).length > 0 } catch { /* ignore */ } } } diff --git a/frontend/src/i18n/locales/en.ts b/frontend/src/i18n/locales/en.ts index 9489306a39..38de796aae 100644 --- a/frontend/src/i18n/locales/en.ts +++ b/frontend/src/i18n/locales/en.ts @@ -4381,7 +4381,7 @@ export default { limitSingleMin: 'Min per order', limitSingleMax: 'Max per order', limitDaily: 'Daily limit', - limitsHint: 'Leave empty or 0 for no limit', + limitsHint: 'Leave empty to use global settings', productNamePrefix: 'Product Name Prefix', productNameSuffix: 'Product Name Suffix', preview: 'Preview', diff --git a/frontend/src/i18n/locales/zh.ts b/frontend/src/i18n/locales/zh.ts index 47f9238275..685a2b2713 100644 --- a/frontend/src/i18n/locales/zh.ts +++ b/frontend/src/i18n/locales/zh.ts @@ -4554,7 +4554,7 @@ export default { limitSingleMin: '单笔最低', limitSingleMax: '单笔最高', limitDaily: '每日限额', - limitsHint: '留空或填 0 表示不限制', + limitsHint: '留空表示使用全局配置', productNamePrefix: '商品名前缀', productNameSuffix: '商品名后缀', preview: '预览',