Commit 75e9efed by wangzhihui

```

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

- 在公司、部门和个人页面中为饼图组件添加v-if条件渲染,避免空数据时的显示问题
- 为饼图组件添加colors属性支持自定义颜色显示
- 修改用餐招待和差旅住宿的数据绑定,正确显示对应的金额数据
- 添加dashed分割线的条件渲染,只有在有数据时才显示
- 重构数据处理逻辑,添加空值检查避免报错
- 修复个人页面中最贵消费记录的条件显示
- 为金额类型数据添加isCash标识,在展示时进行格式化处理
- 添加警告样式的支持,超标数据显示红色
- 优化文本溢出处理,添加省略号显示
- 调整样式细节,修复间距等问题
```
1 parent b0ccfc60
...@@ -35,10 +35,10 @@ ...@@ -35,10 +35,10 @@
</div> </div>
</div> </div>
</div> </div>
<div class="box"> <div class="box" v-if="deptSpendListData">
<SectionTitle title="部门花费占比" :titleIcon="deptIcon"></SectionTitle> <SectionTitle title="部门花费占比" :titleIcon="deptIcon"></SectionTitle>
<div class="echart-box"> <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="cost">
<div class="text">总消费</div> <div class="text">总消费</div>
<div class="value">{{ formatNum(infoData.totalAmount) }}</div> <div class="value">{{ formatNum(infoData.totalAmount) }}</div>
...@@ -57,13 +57,13 @@ ...@@ -57,13 +57,13 @@
</div> </div>
</div> </div>
</div> </div>
<div class="box"> <div class="box" v-if="dinnerDeptSpendListData">
<SectionTitle title="部门总览|用餐招待" :titleIcon="hospitalityIcon"></SectionTitle> <SectionTitle title="部门总览|用餐招待" :titleIcon="hospitalityIcon"></SectionTitle>
<div class="echart-box"> <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="cost">
<div class="text">用餐招待</div> <div class="text">用餐招待</div>
<div class="value">{{ formatNum(infoData.totalAmount) }}</div> <div class="value">{{ formatNum(infoData.dinnerAmount) }}</div>
</div> </div>
</div> </div>
<div class="list"> <div class="list">
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="dashed"></div> <div class="dashed" v-if="dinnerDeptSpendListData.length > 0"></div>
<div class="deptSpend-box"> <div class="deptSpend-box">
<div class="dept-spend" v-for="(dept, deptIndex) in dinnerDeptSpendListData" :key="deptIndex + 's'"> <div class="dept-spend" v-for="(dept, deptIndex) in dinnerDeptSpendListData" :key="deptIndex + 's'">
<div class="title">{{ dept.name }}</div> <div class="title">{{ dept.name }}</div>
...@@ -94,13 +94,13 @@ ...@@ -94,13 +94,13 @@
</div> </div>
</div> </div>
</div> </div>
<div class="box"> <div class="box" v-if="travelDeptSpendListData">
<SectionTitle title="部门总览|差旅住宿" :titleIcon="hotel"></SectionTitle> <SectionTitle title="部门总览|差旅住宿" :titleIcon="hotel"></SectionTitle>
<div class="echart-box"> <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="cost">
<div class="text">总消费</div> <div class="text">总消费</div>
<div class="value">{{ formatNum(infoData.totalAmount) }}</div> <div class="value">{{ formatNum(infoData.travelAmount) }}</div>
</div> </div>
</div> </div>
<div class="list"> <div class="list">
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="dashed"></div> <div class="dashed" v-if="travelDeptSpendListData.length > 0"></div>
<div class="deptSpend-box"> <div class="deptSpend-box">
<div class="dept-spend" v-for="(dept, deptIndex) in travelDeptSpendListData" :key="deptIndex + 's'"> <div class="dept-spend" v-for="(dept, deptIndex) in travelDeptSpendListData" :key="deptIndex + 's'">
<div class="title">{{ dept.name }}</div> <div class="title">{{ dept.name }}</div>
...@@ -156,64 +156,18 @@ export default { ...@@ -156,64 +156,18 @@ export default {
hotel: require('@/assets/images/hotel.png'), hotel: require('@/assets/images/hotel.png'),
analyse: require('@/assets/images/analyse.png'), analyse: require('@/assets/images/analyse.png'),
pushId: this.$route.query.pushId, pushId: this.$route.query.pushId,
infoData: { 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
}
]
},
deptArr: [ deptArr: [
{ {
title: '总消费金额', title: '总消费金额',
key: 'totalAmount', key: 'totalAmount',
ratioKey: 'totalAmountRing' ratioKey: 'totalAmountRing',
isCash: true
}, },
{ {
title: '人均招待费', title: '人均招待费',
key: 'avgConsumeAmount' key: 'avgConsumeAmount',
isCash: true
}, },
{ {
title: '超标次数', title: '超标次数',
...@@ -224,12 +178,14 @@ export default { ...@@ -224,12 +178,14 @@ export default {
{ {
title: '总消费金额', title: '总消费金额',
key: 'totalAmount', key: 'totalAmount',
ratioKey: 'totalAmountRing' ratioKey: 'totalAmountRing',
isCash: true
}, },
{ {
title: '平均房价/晚', title: '平均房价/晚',
key: 'avgConsumeAmount', key: 'avgConsumeAmount',
ratioKey: 'avgConsumeAmountRing' ratioKey: 'avgConsumeAmountRing',
isCash: true
} }
] ]
} }
...@@ -274,35 +230,44 @@ export default { ...@@ -274,35 +230,44 @@ export default {
] ]
}, },
deptSpendListData() { deptSpendListData() {
return this.infoData.deptSpendList.map(item => { return (
return { this.infoData.deptSpendList &&
...item, this.infoData.deptSpendList.map(item => {
name: item.deptName, return {
value: item.totalAmount ...item,
} name: item.deptName,
}) value: item.totalAmount
}
})
)
}, },
travelDeptSpendListData(){ travelDeptSpendListData() {
return this.infoData.travelDeptSpendList.map(item => { return (
return { this.infoData.travelDeptSpendList &&
...item, this.infoData.travelDeptSpendList.map(item => {
name: item.deptName, return {
value: item.totalAmount ...item,
} name: item.deptName,
}) value: item.totalAmount
}
})
)
}, },
dinnerDeptSpendListData() { dinnerDeptSpendListData() {
return this.infoData.dinnerDeptSpendList.map(item => { return (
return { this.infoData.dinnerDeptSpendList &&
...item, this.infoData.dinnerDeptSpendList.map(item => {
name: item.deptName, return {
value: item.totalAmount ...item,
} name: item.deptName,
}) value: item.totalAmount
}
})
)
} }
}, },
created() { created() {
// this.getData() this.getData()
}, },
methods: { methods: {
getData() { getData() {
...@@ -424,7 +389,7 @@ $boxWidth: 351; ...@@ -424,7 +389,7 @@ $boxWidth: 351;
padding: 8px 12px; padding: 8px 12px;
margin-top: 8px; margin-top: 8px;
.flex-box { .flex-box {
margin-bottom:18px; margin-bottom: 18px;
.item { .item {
background: #ffffff; background: #ffffff;
flex-shrink: 0; flex-shrink: 0;
...@@ -495,6 +460,10 @@ $boxWidth: 351; ...@@ -495,6 +460,10 @@ $boxWidth: 351;
color: #666666; color: #666666;
font-size: 14px; font-size: 14px;
margin: 0 8px; margin: 0 8px;
max-width: 114px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
} }
.value { .value {
color: #222222; color: #222222;
...@@ -530,7 +499,7 @@ $boxWidth: 351; ...@@ -530,7 +499,7 @@ $boxWidth: 351;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
margin-bottom:12px; margin-bottom: 12px;
} }
.title::before { .title::before {
content: ''; content: '';
...@@ -538,7 +507,7 @@ $boxWidth: 351; ...@@ -538,7 +507,7 @@ $boxWidth: 351;
height: 1px; height: 1px;
background: linear-gradient(90deg, #f0f0f000 0%, #f0f0f0 100%); background: linear-gradient(90deg, #f0f0f000 0%, #f0f0f0 100%);
display: inline-block; display: inline-block;
margin-right:8px; margin-right: 8px;
} }
.title::after { .title::after {
...@@ -547,7 +516,7 @@ $boxWidth: 351; ...@@ -547,7 +516,7 @@ $boxWidth: 351;
height: 1px; height: 1px;
background: linear-gradient(90deg, #f0f0f0 0%, #f0f0f000 100%); background: linear-gradient(90deg, #f0f0f0 0%, #f0f0f000 100%);
display: inline-block; display: inline-block;
margin-left:8px; margin-left: 8px;
} }
} }
} }
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
<template> <template>
<div class="data-item-content-wrapper mt-4 flex"> <div class="data-item-content-wrapper mt-4 flex">
<div class="data-item-content"> <div :class="['data-item-content',item.isWarning?'warning' : '']" >
{{ item.isPer ? formatRatio(statisData[item.key]) : formatNum(statisData[item.key]) }} {{ item.isCash ?formatNum(statisData[item.key]): statisData[item.key] }}
</div> </div>
</div> </div>
<template v-if="item.ratioKey"> <template v-if="item.ratioKey">
...@@ -101,6 +101,9 @@ export default { ...@@ -101,6 +101,9 @@ export default {
font-weight: 700; font-weight: 700;
font-family: numberBold; font-family: numberBold;
} }
.warning{
color: #f24724;
}
&-label { &-label {
color: #999999; color: #999999;
font-size: 11px; 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> <template>
<div class="statistic"> <div class="statistic">
<div class="text">总消费</div> <div class="text">总消费</div>
<div class="value">{{ formatNum(statistic.totalAmount) }}</div> <div class="value">{{ formatNum(statistic.totalAmount) }}</div>
<div class="ratio"> <div class="ratio">
环比 环比
<span>{{ formatRatio(statistic.ringPercent) }}</span> <span>{{ formatRatio(isPerson?statistic.ringPercent:statistic.totalAmountRing) }}</span>
<div class="arrow-icon" v-if="formatWhiteIsRatio(statistic.ringPercent)"> <div class="arrow-icon" v-if="formatWhiteIsRatio(isPerson?statistic.ringPercent:statistic.totalAmountRing)">
<img class="just" :src="getIconSrc(formatWhiteIsRatio(statistic.ringPercent))" /> <img class="just" :src="getIconSrc(formatWhiteIsRatio(isPerson?statistic.ringPercent:statistic.totalAmountRing))" />
</div> </div>
</div> </div>
</div> </div>
...@@ -19,6 +27,10 @@ export default { ...@@ -19,6 +27,10 @@ export default {
statistic: { statistic: {
type: Object, type: Object,
default: () => {} default: () => {}
},
isPerson:{
type: Boolean,
default: false
} }
}, },
data() { data() {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div class="header"> <div class="header">
<div class="title">【{{ infoData.reportDetail.monthValue }}月线上消费明细】您的专属账单已生成</div> <div class="title">【{{ infoData.reportDetail.monthValue }}月线上消费明细】您的专属账单已生成</div>
<div class="sub-title">尊敬的{{ infoData.staffName }},您上月美团线上消费情况如下:</div> <div class="sub-title">尊敬的{{ infoData.staffName }},您上月美团线上消费情况如下:</div>
<StatisticCard :statistic="infoData.reportDetail"></StatisticCard> <StatisticCard :statistic="infoData.reportDetail" :isPerson="isPerson"></StatisticCard>
</div> </div>
<div class="box dining-hospitality"> <div class="box dining-hospitality">
<SectionTitle title="用餐招待" :titleIcon="hospitalityIcon"></SectionTitle> <SectionTitle title="用餐招待" :titleIcon="hospitalityIcon"></SectionTitle>
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
招待标准 招待标准
<span>{{ infoData.reportDetail.dinnerStandardAmount || 0 }}元/人</span> <span>{{ infoData.reportDetail.dinnerStandardAmount || 0 }}元/人</span>
</div> </div>
<div class="consume-box"> <div class="consume-box" v-if="infoData.reportDetail.maxDinnerShopName">
<div class="row mb14"> <div class="row mb14">
<div class="text">当月最贵</div> <div class="text">当月最贵</div>
<div class="value"> <div class="value">
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
</template> </template>
</div> </div>
</div> </div>
<div class="consume-box"> <div class="consume-box" v-if="infoData.reportDetail.maxTravelShopName">
<div class="row mb14"> <div class="row mb14">
<div class="text">当月最贵</div> <div class="text">当月最贵</div>
<div class="value"> <div class="value">
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
</div> </div>
</div> </div>
<div class="tip" v-if="infoData.reportDetail.exceedCount == 0">感谢您严格遵守标准!请持续规范消费!</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>
</div> </div>
</template> </template>
...@@ -80,6 +80,7 @@ export default { ...@@ -80,6 +80,7 @@ export default {
components: { StatisticCard, SectionTitle, DataItem }, components: { StatisticCard, SectionTitle, DataItem },
data() { data() {
return { return {
isPerson: true,
hospitalityIcon: require('@/assets/images/hospitality.png'), hospitalityIcon: require('@/assets/images/hospitality.png'),
hotel: require('@/assets/images/hotel.png'), hotel: require('@/assets/images/hotel.png'),
pushId: this.$route.query.pushId, pushId: this.$route.query.pushId,
...@@ -89,25 +90,23 @@ export default { ...@@ -89,25 +90,23 @@ export default {
hospitalityArr: [ hospitalityArr: [
{ {
title: '招待次数', title: '招待次数',
key: 'dinnerCount', key: 'dinnerCount'
className: 'block-171'
}, },
{ {
title: '招待总金额', title: '招待总金额',
key: 'dinnerTotalAmount', key: 'dinnerTotalAmount',
className: 'block-171' isCash: true
}, },
{ {
title: '超标次数', title: '超标次数',
key: 'exceedCount', key: 'exceedCount',
isWarning: true, isWarning: true
className: 'block-171'
}, },
{ {
title: '超标总金额', title: '超标总金额',
key: 'exceedTotalAmount', key: 'exceedTotalAmount',
isWarning: true, isWarning: true,
className: 'block-171' isCash: true
} }
], ],
travelArr: [ travelArr: [
...@@ -119,13 +118,15 @@ export default { ...@@ -119,13 +118,15 @@ export default {
{ {
title: '住宿总金额', title: '住宿总金额',
key: 'travelTotalAmount', key: 'travelTotalAmount',
className: 'block-110' className: 'block-110',
isCash: true
}, },
{ {
title: '平均房价/晚', title: '平均房价/晚',
key: 'avgRoomPrice', key: 'avgRoomPrice',
isWarning: true, isWarning: true,
className: 'block-110' className: 'block-110',
isCash: true
} }
] ]
} }
...@@ -166,7 +167,6 @@ export default { ...@@ -166,7 +167,6 @@ export default {
pushId: this.pushId pushId: this.pushId
}) })
.then(res => { .then(res => {
console.log(res)
this.infoData = res.data 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!