fix
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 39s
Docker Build & Deploy / Deploy to Production (push) Successful in 12s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 2s

This commit is contained in:
孙诚
2026-01-16 23:18:04 +08:00
parent 14bbd62262
commit c74ce24727
8 changed files with 207 additions and 74 deletions

View File

@@ -21,20 +21,46 @@
<!-- 新增不记额预算复选框 -->
<van-field label="不记额预算">
<template #input>
<van-checkbox v-model="form.noLimit" @update:model-value="onNoLimitChange">
不记额预算仅限年度
<van-checkbox
v-model="form.noLimit"
@update:model-value="onNoLimitChange"
>
不记额预算
</van-checkbox>
</template>
</van-field>
<van-field name="type" label="统计周期">
<!-- 新增硬性消费复选框 -->
<van-field label="硬性消费">
<template #input>
<div class="mandatory-wrapper">
<van-checkbox
v-model="form.isMandatoryExpense"
:disabled="form.noLimit"
>
硬性消费
<span class="mandatory-tip">
当前周期 / 按天数自动累加
</span>
</van-checkbox>
</div>
</template>
</van-field>
<van-field
name="type"
label="统计周期"
>
<template #input>
<van-radio-group
v-model="form.type"
direction="horizontal"
:disabled="isEdit || form.noLimit"
>
<van-radio :name="BudgetPeriodType.Month"> </van-radio>
<van-radio :name="BudgetPeriodType.Year"> </van-radio>
<van-radio :name="BudgetPeriodType.Month">
</van-radio>
<van-radio :name="BudgetPeriodType.Year">
</van-radio>
</van-radio-group>
</template>
</van-field>
@@ -60,7 +86,10 @@
>
可多选分类
</div>
<div v-else class="selected-categories">
<div
v-else
class="selected-categories"
>
<span class="ellipsis-text">
{{ form.selectedCategories.join('、') }}
</span>
@@ -78,7 +107,14 @@
</van-form>
</div>
<template #footer>
<van-button block round type="primary" @click="onSubmit"> 保存预算 </van-button>
<van-button
block
round
type="primary"
@click="onSubmit"
>
保存预算
</van-button>
</template>
</PopupContainer>
</template>
@@ -103,7 +139,8 @@ const form = reactive({
category: BudgetCategory.Expense,
limit: '',
selectedCategories: [],
noLimit: false // 新增字段
noLimit: false, // 新增字段
isMandatoryExpense: false // 新增:硬性消费
})
const open = ({ data, isEditFlag, category }) => {
@@ -121,7 +158,8 @@ const open = ({ data, isEditFlag, category }) => {
category: category,
limit: data.limit,
selectedCategories: data.selectedCategories ? [...data.selectedCategories] : [],
noLimit: data.noLimit || false // 新增
noLimit: data.noLimit || false, // 新增
isMandatoryExpense: data.isMandatoryExpense || false // 新增:硬性消费
})
} else {
Object.assign(form, {
@@ -131,7 +169,8 @@ const open = ({ data, isEditFlag, category }) => {
category: category,
limit: '',
selectedCategories: [],
noLimit: false // 新增
noLimit: false, // 新增
isMandatoryExpense: false // 新增:硬性消费
})
}
visible.value = true
@@ -155,7 +194,8 @@ const onSubmit = async () => {
...form,
limit: form.noLimit ? 0 : parseFloat(form.limit), // 不记额时金额为0
selectedCategories: form.selectedCategories,
noLimit: form.noLimit // 新增
noLimit: form.noLimit, // 新增
isMandatoryExpense: form.isMandatoryExpense // 新增:硬性消费
}
const res = form.id ? await updateBudget(data) : await createBudget(data)
@@ -187,6 +227,8 @@ const onNoLimitChange = (value) => {
if (value) {
// 选中不记额时,自动设为年度预算
form.type = BudgetPeriodType.Year
// 选中不记额时,清除硬性消费选择
form.isMandatoryExpense = false
}
}
</script>
@@ -218,4 +260,16 @@ const onNoLimitChange = (value) => {
color: var(--van-text-color-2);
padding: 8px 16px;
}
.mandatory-wrapper {
display: flex;
flex-direction: column;
gap: 4px;
}
.mandatory-tip {
font-size: 11px;
color: var(--van-text-color-3);
margin-left: 6px;
}
</style>