1
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 24s
Docker Build & Deploy / Deploy to Production (push) Successful in 11s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 0s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 24s
Docker Build & Deploy / Deploy to Production (push) Successful in 11s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 0s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s
This commit is contained in:
@@ -104,7 +104,7 @@
|
|||||||
<van-swipe-cell v-for="budget in incomeBudgets" :key="budget.id">
|
<van-swipe-cell v-for="budget in incomeBudgets" :key="budget.id">
|
||||||
<BudgetCard
|
<BudgetCard
|
||||||
:budget="budget"
|
:budget="budget"
|
||||||
:progress-color="getIncomeProgressColor(budget)"
|
:progress-color="getProgressColor(budget)"
|
||||||
:percent-class="{ 'income': (budget.current / budget.limit) >= 1 }"
|
:percent-class="{ 'income': (budget.current / budget.limit) >= 1 }"
|
||||||
:period-label="getPeriodLabel(budget.type)"
|
:period-label="getPeriodLabel(budget.type)"
|
||||||
@click="budgetEditRef.open({
|
@click="budgetEditRef.open({
|
||||||
@@ -149,7 +149,7 @@
|
|||||||
v-for="budget in savingsBudgets"
|
v-for="budget in savingsBudgets"
|
||||||
:key="budget.id"
|
:key="budget.id"
|
||||||
:budget="budget"
|
:budget="budget"
|
||||||
progress-color="var(--van-success-color)"
|
:progress-color="getProgressColor(budget)"
|
||||||
:percent-class="{ 'income': (budget.current / budget.limit) >= 1 }"
|
:percent-class="{ 'income': (budget.current / budget.limit) >= 1 }"
|
||||||
:period-label="getPeriodLabel(budget.type)"
|
:period-label="getPeriodLabel(budget.type)"
|
||||||
style="margin: 0 12px 12px;"
|
style="margin: 0 12px 12px;"
|
||||||
@@ -417,34 +417,20 @@ const getPeriodLabel = (type) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const getProgressColor = (budget) => {
|
const getProgressColor = (budget) => {
|
||||||
const ratio = budget.current / budget.limit
|
if (!budget.limit || budget.limit === 0) return 'var(--van-primary-color)'
|
||||||
if (ratio >= 1) return 'var(--van-danger-color)'
|
|
||||||
if (ratio > 0.8) return 'var(--van-warning-color)'
|
|
||||||
return 'var(--van-primary-color)'
|
|
||||||
}
|
|
||||||
|
|
||||||
const getIncomeProgressColor = (budget) => {
|
const ratio = Math.min(Math.max(budget.current / budget.limit, 0), 1)
|
||||||
const ratio = budget.current / budget.limit
|
|
||||||
if (ratio >= 1) return 'var(--van-success-color)'
|
|
||||||
return 'var(--van-primary-color)'
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleDelete = (budget) => {
|
// Start color (Blue): #1989fa -> rgb(25, 137, 250)
|
||||||
showConfirmDialog({
|
// End color (Red): #ee0a24 -> rgb(238, 10, 36)
|
||||||
title: '确认删除',
|
const startColor = { r: 25, g: 137, b: 250 }
|
||||||
message: `确定要删除预算 "${budget.name}" 吗?`,
|
const endColor = { r: 238, g: 10, b: 36 }
|
||||||
}).then(async () => {
|
|
||||||
try {
|
const r = Math.round(startColor.r + (endColor.r - startColor.r) * ratio)
|
||||||
const res = await deleteBudget(budget.id)
|
const g = Math.round(startColor.g + (endColor.g - startColor.g) * ratio)
|
||||||
if (res.success) {
|
const b = Math.round(startColor.b + (endColor.b - startColor.b) * ratio)
|
||||||
showToast('已删除')
|
|
||||||
fetchBudgetList()
|
return `linear-gradient(to right, var(--van-primary-color), rgb(${r}, ${g}, ${b}))`
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
showToast('删除失败')
|
|
||||||
console.error('删除预算失败', err)
|
|
||||||
}
|
|
||||||
}).catch(() => {})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const showArchiveSummary = async () => {
|
const showArchiveSummary = async () => {
|
||||||
|
|||||||
@@ -596,4 +596,8 @@ const onMonthDaysConfirm = ({ selectedValues, selectedOptions }) => {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:deep(.van-nav-bar) {
|
||||||
|
background: transparent !important;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user