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 (
this.infoData.deptSpendList &&
this.infoData.deptSpendList.map(item => {
return {
...item,
name: item.deptName,
value: item.totalAmount
}
})
)
},
travelDeptSpendListData(){
return this.infoData.travelDeptSpendList.map(item => {
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 (
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() {
......
......@@ -3,9 +3,13 @@
<div class="evection-wrapper">
<div class="container">
<div class="header">
<div class="title">{{ infoData.directOrgName }}{{ infoData.reportDetail.monthValue }}月美团线上消费分析报告</div>
<div class="title">{{ infoData.directOrgName }}{{ infoData.reportDetail && infoData.reportDetail.monthValue }}月美团线上消费分析报告</div>
<div class="sub-title">
<div>统计周期:{{ infoData.reportDetail.monthValue }}月{{ infoData.reportDetail.monthStartDay }}日-{{ infoData.reportDetail.monthValue }}月{{ infoData.reportDetail.monthEndDay }}日</div>
<div>
统计周期:{{ infoData.reportDetail && infoData.reportDetail.monthValue }}月{{ infoData.reportDetail && infoData.reportDetail.monthStartDay }}日-{{
infoData.reportDetail && infoData.reportDetail.monthValue
}}月{{ infoData.reportDetail && infoData.reportDetail.monthEndDay }}日
</div>
<div>数据来源:美团企业版后台系统</div>
</div>
</div>
......@@ -17,7 +21,7 @@
<div class="echart-info">
<div class="echart-info-item" v-for="(item, index) in StatisticData" :key="index">
<div class="text">
<div :class="['dot',index==0?'dinner':'travel']"></div>
<div :class="['dot', index == 0 ? 'dinner' : 'travel']"></div>
{{ item.name }}
</div>
<div class="value">{{ formatNum(item.value) }}</div>
......@@ -46,14 +50,14 @@
</template>
</div>
</div>
<div class="consume-box">
<div class="consume-box" v-if="infoData.reportDetail && infoData.reportDetail.topDinnerStaffName">
<div class="row mb14">
<div class="text">当月最贵</div>
<div class="value">
{{ infoData.reportDetail.topDinnerStaffName || '-' }}于
<span>{{ infoData.reportDetail.topDinnerMonth || '-' }}月{{ infoData.reportDetail.topDinnerDay || '-' }}日</span>
{{ infoData.reportDetail &&infoData.reportDetail.topDinnerStaffName || '-' }}于
<span>{{ infoData.reportDetail &&infoData.reportDetail.topDinnerMonth || '-' }}月{{ infoData.reportDetail &&infoData.reportDetail.topDinnerDay || '-' }}日</span>
在
<span>{{ infoData.reportDetail.topDinnerShopName || '-' }}</span>
<span>{{ infoData.reportDetail &&infoData.reportDetail.topDinnerShopName || '-' }}</span>
消费最多
</div>
</div>
......@@ -75,29 +79,27 @@
</template>
</div>
</div>
<div class="consume-box">
<div class="consume-box" v-if="infoData.reportDetail && infoData.reportDetail.topTravelStaffName">
<div class="row mb14">
<div class="text">当月最贵</div>
<div class="value">
{{ infoData.reportDetail.topTravelStaffName || '-' }}于
<span>{{ infoData.reportDetail.topTravelMonth || '-' }}月{{ infoData.reportDetail.topTravelDay || '-' }}日</span>
{{ infoData.reportDetail &&infoData.reportDetail.topTravelStaffName || '-' }}于
<span>{{infoData.reportDetail && infoData.reportDetail.topTravelMonth || '-' }}月{{ infoData.reportDetail &&infoData.reportDetail.topTravelDay || '-' }}日</span>
在
<span>{{ infoData.reportDetail.topTravelCityName || '-' }}</span>
<span>{{ infoData.reportDetail &&infoData.reportDetail.topTravelCityName || '-' }}</span>
的
<span>{{ infoData.reportDetail.topTravelShopName }}</span>
<span>{{infoData.reportDetail && infoData.reportDetail.topTravelShopName }}</span>
入住房价最贵
</div>
</div>
<div class="row">
<div class="text">共计消费</div>
<div class="value price">{{ infoData.reportDetail.topDinnerAmount }}元/晚</div>
<div class="value price">{{infoData.reportDetail && infoData.reportDetail.topTravelAmount||0 }}元/晚</div>
</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>
<div class="box focusIssues">
<div class="box focusIssues" v-if="focusIssuesRows.length">
<SectionTitle title="重点问题聚集" :titleIcon="focusIssues"></SectionTitle>
<div class="focusIssues">
<div class="focusIssues-list">
......@@ -136,76 +138,15 @@ export default {
analyse: require('@/assets/images/analyse.png'),
pushId: this.$route.query.pushId,
infoData: {
directOrgId: 807477,
directOrgName: '智慧门店运营中心',
reportDetail: {
deptName: '智慧门店运营中心',
monthValue: 1,
monthStartDay: 1,
monthEndDay: 31,
totalAmount: 669.0,
totalAmountRing: 10,
dinnerAmount: 2000,
dinnerAmountRing: -200,
travelAmount: 3669.0,
travelAmountRing: -10,
dinnerPersonCount: 450,
dinnerPersonCountRing: 60,
dinnerPerCapitaCost: 50,
dinnerPerCapitaCostRing: 70,
dinnerExceedCount: 80,
dinnerExceedCountRing: 20,
dinnerExceedAmount: 6780,
dinnerExceedAmountRing: -23.0,
topDinnerStaffName: 'jshshh',
topDinnerMonth: 10,
topDinnerDay: 20,
topDinnerShopName: '刘',
topDinnerAmount: 12120,
travelDayCount: 8,
travelDayCountRing: 50,
avgTravelRoomPrice: 223.0,
avgTravelRoomPriceRing: 0,
topTravelStaffName: '张元',
topTravelMonth: 1,
topTravelDay: 8,
topTravelShopName: '维也纳国际酒店·南宁普罗旺斯金阳路地铁站店',
topTravelAmount: 669.0
},
focusIssues: [
{
sceneType: 1,
staffName: '张思思',
value: 100
},
{
sceneType: 3,
staffName: '张三',
value: 100
},
{
sceneType: 1,
staffName: '陈度',
value: 100
},
{
sceneType: 3,
staffName: '张三',
value: 100
},
{
sceneType: 1,
staffName: '当贵',
value: 100
}
]
reportDetail: {}
},
hospitalityArr: [
{
title: '总消费金额',
key: 'totalAmount',
key: 'dinnerAmount',
className: 'block-171',
ratioKey: 'totalAmountRing'
ratioKey: 'dinnerAmountRing',
isCash: true
},
{
title: '总消费人次',
......@@ -216,23 +157,22 @@ export default {
{
title: '人均成本',
key: 'dinnerPerCapitaCost',
isWarning: true,
className: 'block-171',
ratioKey: 'dinnerPerCapitaCostRing'
ratioKey: 'dinnerPerCapitaCostRing',
isCash: true
},
{
title: '超标次数',
key: 'dinnerExceedCount',
isWarning: true,
className: 'block-171',
ratioKey: 'dinnerExceedCountRing'
},
{
title: '超标金额',
key: 'dinnerExceedAmount',
isWarning: true,
className: 'block-171',
ratioKey: 'dinnerExceedAmountRing'
ratioKey: 'dinnerExceedAmountRing',
isCash: true
}
],
travelArr: [
......@@ -250,7 +190,6 @@ export default {
{
title: '平均房价/晚',
key: 'avgTravelRoomPrice',
isWarning: true,
ratioKey: 'avgTravelRoomPriceRing'
}
]
......@@ -282,7 +221,9 @@ export default {
return rows
},
focusIssuesRows() {
const groupedData = this.infoData.focusIssues.reduce((acc, item) => {
const groupedData =
this.infoData.focusIssues &&
this.infoData.focusIssues.reduce((acc, item) => {
const key = item.sceneType
if (!acc[key]) {
acc[key] = []
......@@ -290,10 +231,12 @@ export default {
acc[key].push(item)
return acc
}, {})
if (groupedData) {
return [groupedData[1] || [], groupedData[3] || []]
}
},
StatisticData() {
if (this.infoData.reportDetail) {
return [
{
name: '用餐招待',
......@@ -307,9 +250,10 @@ export default {
}
]
}
}
},
created() {
// this.getData()
this.getData()
},
methods: {
getData() {
......@@ -366,12 +310,12 @@ $boxWidth: 351;
width: 10px;
height: 10px;
border-radius: 2px;
margin-right:4px;
margin-right: 4px;
}
.dinner{
.dinner {
background: #60d68e;
}
.travel{
.travel {
background: #708df4;
}
}
......@@ -518,11 +462,13 @@ $boxWidth: 351;
.focusIssues-list {
display: flex;
align-items: flex-start;
height: auto;
.focusIssues-group {
flex: 1;
padding: 4px 8px;
box-sizing: border-box;
margin-right: 4px;
height:auto;
.group-title {
color: #666666;
font-size: 14px;
......@@ -536,6 +482,10 @@ $boxWidth: 351;
.text {
padding-right: 4px;
border-right: 1px solid #f0f0f0;
max-width: 115px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.value {
padding-left: 4px;
......
......@@ -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!