Commit 75e9efed by wangzhihui

```

feat(evection): 完善差旅报销页面数据显示和样式优化

- 在公司、部门和个人页面中为饼图组件添加v-if条件渲染,避免空数据时的显示问题
- 为饼图组件添加colors属性支持自定义颜色显示
- 修改用餐招待和差旅住宿的数据绑定,正确显示对应的金额数据
- 添加dashed分割线的条件渲染,只有在有数据时才显示
- 重构数据处理逻辑,添加空值检查避免报错
- 修复个人页面中最贵消费记录的条件显示
- 为金额类型数据添加isCash标识,在展示时进行格式化处理
- 添加警告样式的支持,超标数据显示红色
- 优化文本溢出处理,添加省略号显示
- 调整样式细节,修复间距等问题
```
1 parent b0ccfc60
......@@ -35,10 +35,10 @@
</div>
</div>
</div>
<div class="box">
<div class="box" v-if="deptSpendListData">
<SectionTitle title="部门花费占比" :titleIcon="deptIcon"></SectionTitle>
<div class="echart-box">
<pieChart :serveData="deptSpendListData" width="144px" height="144px"></pieChart>
<pieChart :serveData="deptSpendListData" width="144px" height="144px" :colors="colors"></pieChart>
<div class="cost">
<div class="text">总消费</div>
<div class="value">{{ formatNum(infoData.totalAmount) }}</div>
......@@ -57,13 +57,13 @@
</div>
</div>
</div>
<div class="box">
<div class="box" v-if="dinnerDeptSpendListData">
<SectionTitle title="部门总览|用餐招待" :titleIcon="hospitalityIcon"></SectionTitle>
<div class="echart-box">
<pieChart :serveData="dinnerDeptSpendListData" width="144px" height="144px"></pieChart>
<pieChart :serveData="dinnerDeptSpendListData" width="144px" height="144px" :colors="colors"></pieChart>
<div class="cost">
<div class="text">用餐招待</div>
<div class="value">{{ formatNum(infoData.totalAmount) }}</div>
<div class="value">{{ formatNum(infoData.dinnerAmount) }}</div>
</div>
</div>
<div class="list">
......@@ -78,7 +78,7 @@
</div>
</div>
</div>
<div class="dashed"></div>
<div class="dashed" v-if="dinnerDeptSpendListData.length > 0"></div>
<div class="deptSpend-box">
<div class="dept-spend" v-for="(dept, deptIndex) in dinnerDeptSpendListData" :key="deptIndex + 's'">
<div class="title">{{ dept.name }}</div>
......@@ -94,13 +94,13 @@
</div>
</div>
</div>
<div class="box">
<div class="box" v-if="travelDeptSpendListData">
<SectionTitle title="部门总览|差旅住宿" :titleIcon="hotel"></SectionTitle>
<div class="echart-box">
<pieChart :serveData="travelDeptSpendListData" width="144px" height="144px"></pieChart>
<pieChart :serveData="travelDeptSpendListData" width="144px" height="144px" :colors="colors"></pieChart>
<div class="cost">
<div class="text">总消费</div>
<div class="value">{{ formatNum(infoData.totalAmount) }}</div>
<div class="value">{{ formatNum(infoData.travelAmount) }}</div>
</div>
</div>
<div class="list">
......@@ -115,7 +115,7 @@
</div>
</div>
</div>
<div class="dashed"></div>
<div class="dashed" v-if="travelDeptSpendListData.length > 0"></div>
<div class="deptSpend-box">
<div class="dept-spend" v-for="(dept, deptIndex) in travelDeptSpendListData" :key="deptIndex + 's'">
<div class="title">{{ dept.name }}</div>
......@@ -156,64 +156,18 @@ export default {
hotel: require('@/assets/images/hotel.png'),
analyse: require('@/assets/images/analyse.png'),
pushId: this.$route.query.pushId,
infoData: {
monthValue: 1,
monthStartDay: 1,
monthEndDay: 31,
totalAmount: 6669.0,
totalAmountRing: 0,
dinnerAmount: 0,
dinnerAmountRing: 0,
travelAmount: 669.0,
travelAmountRing: 0,
deptSpendList: [
{
deptName: '营销管理中心',
deptRatio: 100.0,
totalAmount: 569.0
},
{
deptName: '总经办',
deptRatio: 100.0,
totalAmount: 169.0
},
{
deptName: '人力行政中心',
deptRatio: 100.0,
totalAmount: 569.0
},
{
deptName: '智慧门店运营中心',
deptRatio: 100.0,
totalAmount: 669.0
},
{
deptName: '新媒体运营及采',
deptRatio: 100.0,
totalAmount: 669.0
}
],
dinnerDeptSpendList: [],
travelDeptSpendList: [
{
deptName: '智慧门店运营中心',
deptRatio: 100.0,
totalAmount: 669.0,
totalAmountRing: 0,
avgConsumeAmount: 223.0,
avgConsumeAmountRing: 0
}
]
},
infoData: {},
deptArr: [
{
title: '总消费金额',
key: 'totalAmount',
ratioKey: 'totalAmountRing'
ratioKey: 'totalAmountRing',
isCash: true
},
{
title: '人均招待费',
key: 'avgConsumeAmount'
key: 'avgConsumeAmount',
isCash: true
},
{
title: '超标次数',
......@@ -224,12 +178,14 @@ export default {
{
title: '总消费金额',
key: 'totalAmount',
ratioKey: 'totalAmountRing'
ratioKey: 'totalAmountRing',
isCash: true
},
{
title: '平均房价/晚',
key: 'avgConsumeAmount',
ratioKey: 'avgConsumeAmountRing'
ratioKey: 'avgConsumeAmountRing',
isCash: true
}
]
}
......@@ -274,35 +230,44 @@ export default {
]
},
deptSpendListData() {
return this.infoData.deptSpendList.map(item => {
return {
...item,
name: item.deptName,
value: item.totalAmount
}
})
return (
this.infoData.deptSpendList &&
this.infoData.deptSpendList.map(item => {
return {
...item,
name: item.deptName,
value: item.totalAmount
}
})
)
},
travelDeptSpendListData(){
return this.infoData.travelDeptSpendList.map(item => {
return {
...item,
name: item.deptName,
value: item.totalAmount
}
})
travelDeptSpendListData() {
return (
this.infoData.travelDeptSpendList &&
this.infoData.travelDeptSpendList.map(item => {
return {
...item,
name: item.deptName,
value: item.totalAmount
}
})
)
},
dinnerDeptSpendListData() {
return this.infoData.dinnerDeptSpendList.map(item => {
return {
...item,
name: item.deptName,
value: item.totalAmount
}
})
return (
this.infoData.dinnerDeptSpendList &&
this.infoData.dinnerDeptSpendList.map(item => {
return {
...item,
name: item.deptName,
value: item.totalAmount
}
})
)
}
},
created() {
// this.getData()
this.getData()
},
methods: {
getData() {
......@@ -424,7 +389,7 @@ $boxWidth: 351;
padding: 8px 12px;
margin-top: 8px;
.flex-box {
margin-bottom:18px;
margin-bottom: 18px;
.item {
background: #ffffff;
flex-shrink: 0;
......@@ -495,6 +460,10 @@ $boxWidth: 351;
color: #666666;
font-size: 14px;
margin: 0 8px;
max-width: 114px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.value {
color: #222222;
......@@ -530,7 +499,7 @@ $boxWidth: 351;
display: flex;
align-items: center;
justify-content: center;
margin-bottom:12px;
margin-bottom: 12px;
}
.title::before {
content: '';
......@@ -538,7 +507,7 @@ $boxWidth: 351;
height: 1px;
background: linear-gradient(90deg, #f0f0f000 0%, #f0f0f0 100%);
display: inline-block;
margin-right:8px;
margin-right: 8px;
}
.title::after {
......@@ -547,7 +516,7 @@ $boxWidth: 351;
height: 1px;
background: linear-gradient(90deg, #f0f0f0 0%, #f0f0f000 100%);
display: inline-block;
margin-left:8px;
margin-left: 8px;
}
}
}
......
......@@ -7,8 +7,8 @@
<template>
<div class="data-item-content-wrapper mt-4 flex">
<div class="data-item-content">
{{ item.isPer ? formatRatio(statisData[item.key]) : formatNum(statisData[item.key]) }}
<div :class="['data-item-content',item.isWarning?'warning' : '']" >
{{ item.isCash ?formatNum(statisData[item.key]): statisData[item.key] }}
</div>
</div>
<template v-if="item.ratioKey">
......@@ -101,6 +101,9 @@ export default {
font-weight: 700;
font-family: numberBold;
}
.warning{
color: #f24724;
}
&-label {
color: #999999;
font-size: 11px;
......
<!--
* @Author: 'wangzhihui' '1733904062@qq.com'
* @Date: 2026-03-02 11:07:51
* @LastEditors: 'wangzhihui' '1733904062@qq.com'
* @LastEditTime: 2026-03-05 17:57:06
* @FilePath: \wx-notification\src\views\evection\components\StatisticCard.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="statistic">
<div class="text">总消费</div>
<div class="value">{{ formatNum(statistic.totalAmount) }}</div>
<div class="ratio">
环比
<span>{{ formatRatio(statistic.ringPercent) }}</span>
<div class="arrow-icon" v-if="formatWhiteIsRatio(statistic.ringPercent)">
<img class="just" :src="getIconSrc(formatWhiteIsRatio(statistic.ringPercent))" />
<span>{{ formatRatio(isPerson?statistic.ringPercent:statistic.totalAmountRing) }}</span>
<div class="arrow-icon" v-if="formatWhiteIsRatio(isPerson?statistic.ringPercent:statistic.totalAmountRing)">
<img class="just" :src="getIconSrc(formatWhiteIsRatio(isPerson?statistic.ringPercent:statistic.totalAmountRing))" />
</div>
</div>
</div>
......@@ -19,6 +27,10 @@ export default {
statistic: {
type: Object,
default: () => {}
},
isPerson:{
type: Boolean,
default: false
}
},
data() {
......
......@@ -4,7 +4,7 @@
<div class="header">
<div class="title">【{{ infoData.reportDetail.monthValue }}月线上消费明细】您的专属账单已生成</div>
<div class="sub-title">尊敬的{{ infoData.staffName }},您上月美团线上消费情况如下:</div>
<StatisticCard :statistic="infoData.reportDetail"></StatisticCard>
<StatisticCard :statistic="infoData.reportDetail" :isPerson="isPerson"></StatisticCard>
</div>
<div class="box dining-hospitality">
<SectionTitle title="用餐招待" :titleIcon="hospitalityIcon"></SectionTitle>
......@@ -21,7 +21,7 @@
招待标准
<span>{{ infoData.reportDetail.dinnerStandardAmount || 0 }}元/人</span>
</div>
<div class="consume-box">
<div class="consume-box" v-if="infoData.reportDetail.maxDinnerShopName">
<div class="row mb14">
<div class="text">当月最贵</div>
<div class="value">
......@@ -48,7 +48,7 @@
</template>
</div>
</div>
<div class="consume-box">
<div class="consume-box" v-if="infoData.reportDetail.maxTravelShopName">
<div class="row mb14">
<div class="text">当月最贵</div>
<div class="value">
......@@ -66,7 +66,7 @@
</div>
</div>
<div class="tip" v-if="infoData.reportDetail.exceedCount == 0">感谢您严格遵守标准!请持续规范消费!</div>
<div class="tip" v-if="infoData.reportDetail.exceedCount > 0">温馨提示:您本月已超标1次,当月超标3次将有可能暂停招待权!</div>
<div class="tip" style="color: #ff8d1a" v-if="infoData.reportDetail.exceedCount > 0">温馨提示:您本月已超标1次,当月超标3次将有可能暂停招待权!</div>
</div>
</div>
</template>
......@@ -80,6 +80,7 @@ export default {
components: { StatisticCard, SectionTitle, DataItem },
data() {
return {
isPerson: true,
hospitalityIcon: require('@/assets/images/hospitality.png'),
hotel: require('@/assets/images/hotel.png'),
pushId: this.$route.query.pushId,
......@@ -89,25 +90,23 @@ export default {
hospitalityArr: [
{
title: '招待次数',
key: 'dinnerCount',
className: 'block-171'
key: 'dinnerCount'
},
{
title: '招待总金额',
key: 'dinnerTotalAmount',
className: 'block-171'
isCash: true
},
{
title: '超标次数',
key: 'exceedCount',
isWarning: true,
className: 'block-171'
isWarning: true
},
{
title: '超标总金额',
key: 'exceedTotalAmount',
isWarning: true,
className: 'block-171'
isCash: true
}
],
travelArr: [
......@@ -119,13 +118,15 @@ export default {
{
title: '住宿总金额',
key: 'travelTotalAmount',
className: 'block-110'
className: 'block-110',
isCash: true
},
{
title: '平均房价/晚',
key: 'avgRoomPrice',
isWarning: true,
className: 'block-110'
className: 'block-110',
isCash: true
}
]
}
......@@ -166,7 +167,6 @@ export default {
pushId: this.pushId
})
.then(res => {
console.log(res)
this.infoData = res.data
})
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!