修改箭头颜色逻辑成本费用相关

This commit is contained in:
2026-07-07 16:01:07 +08:00
parent 1e8fbc5f5a
commit af01e6a691
7 changed files with 15 additions and 265 deletions

View File

@@ -13,7 +13,7 @@
<div class="line"></div>
<div class="right">
<!-- 本月数值动态绑定颜色 -->
<div class="number" :style="{ color: getColor(item.currentValue, item.targetValue) }">
<div class="number" :style="{ color: getColor(item.thbe) }">
{{ item.currentValue }}
</div>
<div class="title">{{currentTap==='month'?'本月':'本年'}}</div>
@@ -23,7 +23,7 @@
<div class="right">
<!-- 环比额计算差值并动态绑定颜色 -->
<div class="number" :style="{ color: getColor(item.currentValue, item.targetValue) }">
<div class="number" :style="{ color: getColor(item.thbe) }">
{{ item.thbe }}
</div>
<div class="title">环比额</div>
@@ -126,18 +126,11 @@ export default {
},
// 颜色判断:本月 >= 上月 绿色,否则 橙色
getColor(current, target) {
return current >= target
? "rgba(98, 213, 180, 1)" // 绿色:增长或持平
: "rgba(249, 164, 74, 1)"; // 橙色:下降
},
// 计算环比额(本月 - 上月),保留一位小数
// getData(current, target) {
// const diff = current - target;
// // 正数加"+"号,负数和零保持原样
// return diff > 0 ? `+${diff.toFixed(1)}` : diff.toFixed(1);
// }
getColor(thbe) {
return thbe < 0
? "rgba(98, 213, 180, 1)" // 绿色
: "rgba(249, 164, 74, 1)"; // 橙色
}
},
};
</script>