Commit b0ccfc60 by wangzhihui

美团报表需求开发

1 parent 143639af
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
"autoprefixer": "^8.0.0", "autoprefixer": "^8.0.0",
"core-js": "^3.6.4", "core-js": "^3.6.4",
"dayjs": "^1.10.5", "dayjs": "^1.10.5",
"echarts": "^6.0.0",
"glsx-common": "^2.1.0", "glsx-common": "^2.1.0",
"lib-flexible": "^0.3.2", "lib-flexible": "^0.3.2",
"postcss-loader": "^6.2.0", "postcss-loader": "^6.2.0",
......
const url = '/rop-dj-staff-miniprogram/router'
export default {
/** 美团消费个人月度总结*/
getMeituanOrderPerson(data = {}) {
data.method = 'dj.api.staff.miniprogram.meituan.order.person'
return window.$HTTP({
url,
data,
returnAll: true
})
},
/** 美团消费部门月度总结*/
getMeituanOrderDept(data = {}) {
data.method = 'dj.api.staff.miniprogram.meituan.order.dept'
return window.$HTTP({
url,
data,
returnAll: true
})
},
/** 美团消费公司月度总结*/
getMeituanOrderCompany(data = {}) {
data.method = 'dj.api.staff.miniprogram.meituan.order.company'
return window.$HTTP({
url,
data,
returnAll: true
})
},
}
\ No newline at end of file \ No newline at end of file
@import './normalize.scss'; @import './normalize.scss';
@import './sprite.scss'; @import './sprite.scss';
@font-face {
font-family: "numberNor";
font-style: normal;
// font-weight: 500;
font-display: swap;
src:
url("https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/font/D-DIN-PRO-500-Medium.woff2") format("woff2"),
url("https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/font/D-DIN-PRO-500-Medium.woff") format("woff"),
url("https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/font/D-DIN-PRO-500-Medium.ttf") format("truetype");
}
@font-face {
font-family: "numberBold";
font-style: normal;
// font-weight: 700;
font-display: swap;
src:
url("https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/font/D-DIN-PRO-700-Bold.woff2") format("woff2"),
url("https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/font/D-DIN-PRO-700-Bold.woff") format("woff"),
url("https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/font/D-DIN-PRO-700-Bold.ttf") format("truetype");
}
html, html,
body .app { body .app {
color: #333333; color: #333333;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 'wangzhihui' '1733904062@qq.com' * @Author: 'wangzhihui' '1733904062@qq.com'
* @Date: 2025-11-18 14:23:31 * @Date: 2025-11-18 14:23:31
* @LastEditors: 'wangzhihui' '1733904062@qq.com' * @LastEditors: 'wangzhihui' '1733904062@qq.com'
* @LastEditTime: 2026-02-11 10:04:12 * @LastEditTime: 2026-03-02 10:36:46
* @FilePath: \wx-notification\src\router\routes.js * @FilePath: \wx-notification\src\router\routes.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%A * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%A
*/ */
...@@ -65,6 +65,39 @@ const pages = { ...@@ -65,6 +65,39 @@ const pages = {
showAction: true showAction: true
} }
} }
],
evection:[
{
name: 'personage',
meta: {
keepAlive: true,
title: '美团消费个人月度总结',
noAuth: true,
backgroundColor: '#f7f8fa',
showAction: true
}
},
{
name: 'department',
meta: {
keepAlive: true,
title: '美团消费部门月度总结',
noAuth: true,
backgroundColor: '#f7f8fa',
showAction: true
}
},
{
name: 'company',
meta: {
keepAlive: true,
title: '美团消费公司月度总结',
noAuth: true,
backgroundColor: '#f7f8fa',
showAction: true
}
},
] ]
} }
let routes = [ let routes = [
......
...@@ -4,6 +4,12 @@ ...@@ -4,6 +4,12 @@
* @param {string} cFormat * @param {string} cFormat
* @returns {string} * @returns {string}
*/ */
import rise from "@/assets/images/icon-red-rise.png";
import decline from "@/assets/images/icon-green-decline.png";
import just01 from "@/assets/images/just01.png";
import whiteRise from "@/assets/images/rise.png";
import whiteDecline from "@/assets/images/decline.png";
import whiteJust01 from "@/assets/images/icon-white-just01.png";
export function parseTime(time, cFormat) { export function parseTime(time, cFormat) {
if (arguments.length === 0) { if (arguments.length === 0) {
return null return null
...@@ -198,4 +204,56 @@ export function transformDecimal(number, i) { ...@@ -198,4 +204,56 @@ export function transformDecimal(number, i) {
decimalNum = Number(decimalNum).toFixed(i) decimalNum = Number(decimalNum).toFixed(i)
} }
return decimalNum return decimalNum
}
\ No newline at end of file \ No newline at end of file
}
export const formatNum = v => {
const s = typeof v === 'string' ? v.trim() : v
if (s === null || s === undefined || (typeof s === 'string' && s === '')) return '-'
const n = typeof s === 'number' ? s : Number(s.replace(/[,%\s]/g, ''))
if (isNaN(n)) return '-'
return new Intl.NumberFormat('en-US', {
minimumFractionDigits: 0,
maximumFractionDigits: 2
}).format(n)
}
export const formatRatio = v => {
const s = typeof v === 'string' ? v.trim() : v
if (s === null || s === undefined || (typeof s === 'string' && s === '')) return '-'
const n = typeof s === 'number' ? s : Number(s.replace(/[%\s,]/g, ''))
if (isNaN(n)) return '-'
const str = n.toFixed(2).replace(/\.?0+$/, '') // 去掉尾随0与小数点
return `${str}%`
}
export const formatIsRatio = v => {
const s = typeof v === 'string' ? v.trim() : v
if (s === null || s === undefined || (typeof s === 'string' && s === '')) return ''
const n = typeof s === 'number' ? s : parseFloat(s.replace(/[^\d.\-]/g, ''))
if (isNaN(n)) return ''
return n < 0 ? 'decline' : n === 0 ? 'just01' : 'rise'
}
export const formatWhiteIsRatio = v => {
const s = typeof v === 'string' ? v.trim() : v
if (s === null || s === undefined || (typeof s === 'string' && s === '')) return ''
const n = typeof s === 'number' ? s : parseFloat(s.replace(/[^\d.\-]/g, ''))
if (isNaN(n)) return ''
return n < 0 ? 'whiteDecline' : n === 0 ? 'whiteJust01' : 'whiteRise'
}
const iconMap = {
rise: rise,
decline: decline,
just01: just01,
whiteRise: whiteRise,
whiteDecline: whiteDecline,
whiteJust01: whiteJust01
}
export const getIconSrc = (name) => iconMap[name]
export const getRatioColor = (v) => {
const s = typeof v === "string" ? v.trim() : v;
if (s === null || s === undefined || (typeof s === "string" && s === ""))
return "#ff0000"; // 默认颜色
const n = typeof s === "number" ? s : Number(s.replace(/[%\s,]/g, ""));
if (isNaN(n)) return "#ff0000"; // 默认颜色
if (n > 0) return "#ff0000"; // 大于0:红色
if (n < 0) return "#35c376"; // 小于0:绿色
return "#ff9d0a"; // 等于0:橙色
};
\ No newline at end of file \ No newline at end of file
import Vue from 'vue' import Vue from 'vue'
import { import { Toast, Dialog } from 'vant'
Toast,
Dialog
} from 'vant'
/** /**
* 日期格式化 * 日期格式化
* let time = new Date().format('yyyy-MM-dd hh:mm:ss') * let time = new Date().format('yyyy-MM-dd hh:mm:ss')
*/ */
Date.prototype.format = function(fmt) { Date.prototype.format = function (fmt) {
let o = { let o = {
'M+': this.getMonth() + 1, //月份 'M+': this.getMonth() + 1, //月份
'd+': this.getDate(), //日 'd+': this.getDate(), //日
'h+': this.getHours(), //小时 'h+': this.getHours(), //小时
'm+': this.getMinutes(), //分 'm+': this.getMinutes(), //分
's+': this.getSeconds(), //秒 's+': this.getSeconds(), //秒
//季度 //季度
'q+': Math.floor((this.getMonth() + 3) / 3), 'q+': Math.floor((this.getMonth() + 3) / 3),
'S': this.getMilliseconds() //毫秒 S: this.getMilliseconds() //毫秒
}; }
if (/(y+)/.test(fmt)) { if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length))
} }
for (let k in o) { for (let k in o) {
if (new RegExp(`(${k})`).test(fmt)) { if (new RegExp(`(${k})`).test(fmt)) {
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length))) fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length))
} }
} }
return fmt return fmt
} }
const throttle = (fn, gapTime) => { const throttle = (fn, gapTime) => {
if (gapTime == null || gapTime == undefined) { if (gapTime == null || gapTime == undefined) {
gapTime = 1500 gapTime = 1500
} }
let _lastTime = null let _lastTime = null
return function() { return function () {
let _nowTime = +new Date() let _nowTime = +new Date()
if (_nowTime - _lastTime > gapTime || !_lastTime) { if (_nowTime - _lastTime > gapTime || !_lastTime) {
fn.apply(this, arguments) fn.apply(this, arguments)
_lastTime = _nowTime _lastTime = _nowTime
}
} }
} }
/**防止重复点击 */ }
/**防止重复点击 */
const showLoading = (title = '加载中...', callBack, custom) => { const showLoading = (title = '加载中...', callBack, custom) => {
Toast({ Toast({
type: 'loading', type: 'loading',
...@@ -56,27 +54,27 @@ const showLoading = (title = '加载中...', callBack, custom) => { ...@@ -56,27 +54,27 @@ const showLoading = (title = '加载中...', callBack, custom) => {
} }
} }
const hideLoading = () => { const hideLoading = () => {
Toast.clear() Toast.clear()
} }
/**num:要转换的数值,fixed:精确几位小数 */ /**num:要转换的数值,fixed:精确几位小数 */
const decimal = (num, fixed) => { const decimal = (num, fixed) => {
let pow = Math.pow(10, fixed) let pow = Math.pow(10, fixed)
return Math.round(num * pow) / pow return Math.round(num * pow) / pow
} }
const showToast = (message = '', callBack) => { const showToast = (message = '', callBack) => {
let params = { let params = {
message, message,
forbidClick: true, forbidClick: true,
duration: 1500 duration: 1500
}
Toast(params)
if (callBack && typeof callBack == 'function') {
setTimeout(() => {
callBack()
}, 1500)
}
} }
/**触摸样式 */ Toast(params)
if (callBack && typeof callBack == 'function') {
setTimeout(() => {
callBack()
}, 1500)
}
}
/**触摸样式 */
const touchstart = e => { const touchstart = e => {
e.target.classList.add('btn-on-leave') e.target.classList.add('btn-on-leave')
} }
...@@ -85,31 +83,30 @@ const touchend = e => { ...@@ -85,31 +83,30 @@ const touchend = e => {
} }
const setLocalStorage = (key, item) => { const setLocalStorage = (key, item) => {
window.localStorage.setItem(key, JSON.stringify(item)) window.localStorage.setItem(key, JSON.stringify(item))
// sessionStorage.setItem(key, JSON.stringify(item)) // sessionStorage.setItem(key, JSON.stringify(item))
} }
const getLocalStorage = key => { const getLocalStorage = key => {
return JSON.parse(window.localStorage.getItem(key)) return JSON.parse(window.localStorage.getItem(key))
// return JSON.parse(sessionStorage.getItem(key)) // return JSON.parse(sessionStorage.getItem(key))
} }
const removeLocalStorage = key => { const removeLocalStorage = key => {
window.localStorage.removeItem(key) window.localStorage.removeItem(key)
// sessionStorage.removeItem(key) // sessionStorage.removeItem(key)
} }
const dialog = (params = {}) => { const dialog = (params = {}) => {
if (!params.confirmButtonColor) params.confirmButtonColor = '#FF7336' if (!params.confirmButtonColor) params.confirmButtonColor = '#FF7336'
return Dialog.confirm(params) return Dialog.confirm(params)
} }
/**拨打电话 */ /**拨打电话 */
const makePhoneCall = phoneNumber => { const makePhoneCall = phoneNumber => {
window.location.href = `tel://${phoneNumber}` window.location.href = `tel://${phoneNumber}`
} }
/**是否全面屏 */ /**是否全面屏 */
const isFullSucreen = () => { const isFullSucreen = () => {
let result = false; let result = false
const rate = window.screen.height / window.screen.width const rate = window.screen.height / window.screen.width
let limit = window.screen.height == window.screen.availHeight ? 1.8 : 1.65 // 临界判断值 let limit = window.screen.height == window.screen.availHeight ? 1.8 : 1.65 // 临界判断值
result = rate > limit result = rate > limit
return result return result
} }
...@@ -155,7 +152,7 @@ const toTop = () => { ...@@ -155,7 +152,7 @@ const toTop = () => {
const getParams = () => { const getParams = () => {
return window.vm.$route.params return window.vm.$route.params
} }
const getQuery = (name) => { const getQuery = name => {
let [url, paramsList] = window.location.href.split('?') let [url, paramsList] = window.location.href.split('?')
if (!paramsList) return name ? null : {} if (!paramsList) return name ? null : {}
let param = paramsList.split('&') let param = paramsList.split('&')
...@@ -169,42 +166,43 @@ const getQuery = (name) => { ...@@ -169,42 +166,43 @@ const getQuery = (name) => {
const closeWindow = () => { const closeWindow = () => {
wx.closeWindow() wx.closeWindow()
} }
const debounce=(fn, delay, triggerNow)=> { const debounce = (fn, delay, triggerNow) => {
var t = null; var t = null
var debounced = function () { var debounced = function () {
var _self = this, var _self = this,
args = arguments; args = arguments
if (t) { if (t) {
clearTimeout(t); clearTimeout(t)
} }
if (triggerNow) { if (triggerNow) {
var exec = !t; var exec = !t
t = setTimeout(function () { t = setTimeout(function () {
t = null; t = null
}, delay); }, delay)
console.log(exec,'exec') console.log(exec, 'exec')
if (exec) { if (exec) {
fn.apply(_self, args); fn.apply(_self, args)
} }
} else { } else {
t = setTimeout(function () { t = setTimeout(function () {
fn.apply(_self, args); fn.apply(_self, args)
}, delay); }, delay)
} }
}; }
debounced.cancel = function () { debounced.cancel = function () {
clearTimeout(t); clearTimeout(t)
t = null; t = null
}; }
return debounced; return debounced
} }
const getIconSrc = (name) => iconMap[name] ;
const utils = { const utils = {
removeLocalStorage, removeLocalStorage,
setClipboardData, setClipboardData,
...@@ -232,4 +230,4 @@ const utils = { ...@@ -232,4 +230,4 @@ const utils = {
Object.keys(utils).map(key => { Object.keys(utils).map(key => {
Vue.prototype[key] = utils[key] Vue.prototype[key] = utils[key]
}) })
export default utils
\ No newline at end of file \ No newline at end of file
export default utils
<template>
<div class="data-item">
<div class="data-item-title">
<div class="dot"></div> {{ item.title }}
<slot name="title-slot"></slot>
</div>
<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>
</div>
<template v-if="item.ratioKey">
<div class="data-item-ratio mt-4 flex">
<span class="data-item-label">环比</span>
<div class="value" :style="{ color: getRatioColor(statisData[item.ratioKey]) }">
{{ formatRatio(statisData[item.ratioKey]) }}
</div>
<div class="arrow-icon" v-if="formatIsRatio(statisData[item.ratioKey])">
<img class="just" :src="getIconSrc(formatIsRatio(statisData[item.ratioKey]))" />
</div>
</div>
</template>
</template>
</div>
</template>
<script>
import { formatNum, formatRatio, formatIsRatio, getIconSrc, getRatioColor } from '@/utils/tools.js'
export default {
props: {
item: {
type: Object,
default: () => ({})
},
statisData: {
type: Object,
default: () => ({})
},
queryType: {
type: String,
default: ''
}
},
data(){
return {
formatNum,
formatRatio,
formatIsRatio,
getIconSrc,
getRatioColor
}
}
}
</script>
<style lang="scss" scoped>
.data-item {
padding:4px 8px;
box-sizing: border-box;
.data-item-title {
padding-bottom: 2px;
}
.value {
font-family: numberNor;
}
.flex {
display: flex;
align-items: center;
}
width: 100%;
box-sizing: border-box;
padding: 0 10px;
padding-right: 0;
line-height: 15px;
.mt-4 {
margin-top: 4px;
}
&-title {
color: #666666;
font-size: 13px;
display: flex;
// white-space: nowrap;
.info {
width: 14px;
height: 14px;
vertical-align: top;
margin-left: 3.8px;
}
.title-arrow {
width: 12px;
height: 12px;
margin-left: auto;
}
}
&-content-wrapper {
align-items: center;
}
&-content {
color: #222222;
font-size: 18px;
font-weight: 700;
font-family: numberBold;
}
&-label {
color: #999999;
font-size: 11px;
}
&-ratio {
color: #ff0000;
font-size: 11px;
.value {
margin-left: 2px;
font-size: 11px;
}
.arrow-icon {
width: 13px;
height: 13px;
img {
width: 100%;
}
}
}
&-personne {
color: #666666;
font-size: 11px;
.value {
color: #222222;
margin-left: 4px;
font-size: 14px;
font-weight: 500;
}
}
&-ranking {
color: #666666;
font-size: 8px;
font-weight: 400;
background: #185efe1a;
padding: 0 2px;
margin-left: 4px;
border-radius: 2px;
.value {
margin: 0 2px;
color: #ff5733;
}
}
}
</style>
<template>
<div class="title">
<img class="icon" :src="titleIcon" />
<span class="title-text">{{ title }}</span>
</div>
</template>
<script>
export default {
props: {
title: {
type: String,
default: ''
},
titleIcon: {
type: String,
default: ''
}
}
}
</script>
<style lang="scss" scoped>
.title {
padding:11px 0;
display: flex;
align-items: center;
.icon {
width: 18px;
height: 18px;
}
.title-text {
color: #222222;
font-size: 15px;
font-weight: 500;
margin-left: 6px;
}
}
</style>
<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))" />
</div>
</div>
</div>
</template>
<script>
import { formatNum, formatRatio, formatWhiteIsRatio, getIconSrc } from '@/utils/tools.js'
export default {
props: {
statistic: {
type: Object,
default: () => {}
}
},
data() {
return {
formatNum,
formatRatio,
formatWhiteIsRatio,
getIconSrc
}
}
}
</script>
<style lang="scss" scoped>
.statistic {
height: 86px;
border-radius: 8px;
padding: 12px;
box-sizing: border-box;
background: linear-gradient(90deg, #3d76fc 0%, #4da6ff 100%);
color: #ffffff;
.text {
font-size: 14px;
font-weight: 400;
}
.value {
font-size: 22px;
font-weight: 600;
margin: 4px 0;
font-family: numberBold;
}
.ratio {
font-size: 12px;
font-family: numberNor;
display: flex;
align-items: center;
span {
margin: 0 2px;
}
.arrow-icon {
width: 13px;
height: 13px;
img {
width: 100%;
}
}
}
}
</style>
<template>
<div class="echart" :ref="id" :style="{ width: width, height: height }"></div>
</template>
<script>
import * as echarts from 'echarts'
export default {
props: {
id: {
type: String,
default: ''
},
colors: {
type: Array,
default: () => ['#60D68E', '#708DF4']
},
serveData: {
type: Array,
default: () => []
},
height: {
type: String,
default: '72px'
},
width: {
type: String,
default: '72px'
}
},
data() {
return {
myChart: null
}
},
watch: {
serveData: {
handler(val) {
this.updateChart(val)
},
deep: true
}
},
mounted() {
this.$nextTick(() => {
this.initEcharts()
})
},
beforeDestroy() {
if (this.myChart) {
this.myChart.dispose()
this.myChart = null
}
},
methods: {
initEcharts() {
const client = this.$refs[this.id]
if (!client) {
console.warn('ECharts container not found')
return
}
if (this.myChart) {
this.myChart.dispose()
}
this.myChart = echarts.init(client)
this.updateChart(this.serveData)
},
updateChart(data) {
if (!this.myChart) {
return
}
const option = {
color: this.colors,
textStyle: {
fontFamily: 'numberBold'
},
series: [
{
type: 'pie',
radius: ['55%', '80%'],
avoidLabelOverlap: false,
label: {
normal: {
show: false,
position: 'center',
formatter: (params) => {
const percent = params.percent ? params.percent.toFixed(2) : 0
return '占比\n' + percent + '%'
},
textStyle: {
fontFamily: 'numberBold'
}
},
emphasis: {
show: true,
textStyle: {
fontSize: 12,
color: '#333',
fontFamily: 'numberBold'
}
}
},
labelLine: {
show: false
},
data: data
}
]
}
this.myChart.setOption(option, true)
this.myChart.off('mouseover')
if (data && data.length > 0) {
this.myChart.dispatchAction({
type: 'highlight',
seriesIndex: 0,
dataIndex: 0
})
this.myChart.on('mouseover', (e) => {
this.myChart.dispatchAction({
type: 'downplay',
seriesIndex: 0,
dataIndex: 0
})
if (e.dataIndex === 0) {
this.myChart.dispatchAction({
type: 'highlight',
seriesIndex: 0,
dataIndex: e.dataIndex
})
}
})
}
}
}
}
</script>
<style lang="scss" scoped>
.echart {
display: inline-block;
}
</style>
\ No newline at end of file \ No newline at end of file
<!--个人月度总结 -->
<template>
<div class="evection-wrapper">
<div class="header">
<div class="title">【{{ infoData.reportDetail.monthValue }}月线上消费明细】您的专属账单已生成</div>
<div class="sub-title">尊敬的{{ infoData.staffName }},您上月美团线上消费情况如下:</div>
<StatisticCard :statistic="infoData.reportDetail"></StatisticCard>
</div>
<div class="box dining-hospitality">
<SectionTitle title="用餐招待" :titleIcon="hospitalityIcon"></SectionTitle>
<div class="flex-box">
<div :class="['flex-row', row.length === 2 ? 'flex-row--two' : row.length === 3 ? 'flex-row--three' : '']" v-for="(row, rowIndex) in hospitalityArrRows" :key="rowIndex">
<template v-for="(item, index) in row">
<div :class="['item', item.className]" :key="index">
<data-item :item="item" :statis-data="infoData.reportDetail"></data-item>
</div>
</template>
</div>
</div>
<div class="standard">
招待标准
<span>{{ infoData.reportDetail.dinnerStandardAmount || 0 }}元/人</span>
</div>
<div class="consume-box">
<div class="row mb14">
<div class="text">当月最贵</div>
<div class="value">
您在
<span>{{ infoData.reportDetail.maxDinnerShopName || '-' }}</span>
消费最多
</div>
</div>
<div class="row">
<div class="text">共计消费</div>
<div class="value price">{{ infoData.reportDetail.maxDinnerAmount || 0 }}元</div>
</div>
</div>
</div>
<div class="box business-travel">
<SectionTitle title="差旅住宿" :titleIcon="hotel"></SectionTitle>
<div class="flex-box">
<div :class="['flex-row', row.length === 2 ? 'flex-row--two' : row.length === 3 ? 'flex-row--three' : '']" v-for="(row, rowIndex) in travelArrRows" :key="rowIndex">
<template v-for="(item, index) in row">
<div :class="['item', item.className]" :key="index">
<data-item :item="item" :statis-data="infoData.reportDetail"></data-item>
</div>
</template>
</div>
</div>
<div class="consume-box">
<div class="row mb14">
<div class="text">当月最贵</div>
<div class="value">
您在
<span>{{ infoData.reportDetail.maxTravelCityName }}</span>
的
<span>{{ infoData.reportDetail.maxTravelShopName }}</span>
入住房价最贵
</div>
</div>
<div class="row">
<div class="text">共计消费</div>
<div class="value price">{{ infoData.reportDetail.maxTravelAmount }}元/晚</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>
</template>
<script>
import StatisticCard from './components/StatisticCard.vue'
import SectionTitle from './components/SectionTitle.vue'
import DataItem from './components/DataItem.vue'
import evectionApi from '@/api/evection'
export default {
components: { StatisticCard, SectionTitle, DataItem },
data() {
return {
hospitalityIcon: require('@/assets/images/hospitality.png'),
hotel: require('@/assets/images/hotel.png'),
pushId: this.$route.query.pushId,
infoData: {
reportDetail: {}
},
hospitalityArr: [
{
title: '招待次数',
key: 'dinnerCount',
className: 'block-171'
},
{
title: '招待总金额',
key: 'dinnerTotalAmount',
className: 'block-171'
},
{
title: '超标次数',
key: 'exceedCount',
isWarning: true,
className: 'block-171'
},
{
title: '超标总金额',
key: 'exceedTotalAmount',
isWarning: true,
className: 'block-171'
}
],
travelArr: [
{
title: '入住城市',
key: 'cityCount',
className: 'block-110'
},
{
title: '住宿总金额',
key: 'travelTotalAmount',
className: 'block-110'
},
{
title: '平均房价/晚',
key: 'avgRoomPrice',
isWarning: true,
className: 'block-110'
}
]
}
},
computed: {
hospitalityArrRows() {
const list = this.hospitalityArr || []
const rowSizes = [2, 2]
const rows = []
let start = 0
for (const size of rowSizes) {
const row = list.slice(start, start + size)
if (row.length) rows.push(row)
start += size
}
return rows
},
travelArrRows() {
const list = this.travelArr || []
const rowSizes = [3]
const rows = []
let start = 0
for (const size of rowSizes) {
const row = list.slice(start, start + size)
if (row.length) rows.push(row)
start += size
}
return rows
}
},
created() {
this.getData()
},
methods: {
getData() {
evectionApi
.getMeituanOrderPerson({
pushId: this.pushId
})
.then(res => {
console.log(res)
this.infoData = res.data
})
}
}
}
</script>
<style scoped lang="scss">
$phoneWidth: 375;
$boxWidth: 351;
@function formatWidth($val, $width: true) {
$base: if($width ==true or $width ==null, $boxWidth, $width);
@return percentage($val / $base);
}
.evection-wrapper {
.header {
background: #fff;
padding: 12px;
box-sizing: border-box;
.title {
color: #000000;
font-size: 16px;
font-weight: 500;
}
.sub-title {
color: #999999;
font-size: 12px;
font-weight: 400;
padding: 4px 0 12px;
}
}
.box {
background: #ffffff;
padding: 8px 12px;
margin-top: 8px;
.flex-box {
padding-top: 10px;
.item {
background: #ffffff;
flex-shrink: 0;
& + .item {
border-left: 1px solid #f0f0f0;
}
}
}
.flex-row {
width: 100%;
display: flex;
flex-wrap: nowrap;
gap: 3px;
margin-bottom: 24px;
&:last-child {
margin-bottom: 0;
}
}
// 单行卡片均分布局(不依赖单个卡片的 width class)
.flex-row--two,
.flex-row--three {
.item {
flex: 1;
min-width: 0;
}
}
.standard {
color: #666666;
font-size: 14px;
font-weight: 400;
display: flex;
align-items: center;
margin-top: 8px;
span {
font-family: numberBold;
margin-left: 4px;
color: #222222;
font-size: 16px;
}
}
.consume-box {
border-radius: 8px;
background: #f7f8fa;
padding: 12px;
margin-top: 16px;
.row {
color: #999999;
font-size: 14px;
display: flex;
align-items: flex-start;
}
.mb14 {
margin-bottom: 14px;
}
.text {
width: 60px;
color: #999999;
font-size: 14px;
}
.value {
width: calc(100% - 60px);
color: #222222;
font-size: 14px;
margin-left: 8px;
span {
font-weight: 700;
}
}
.price {
color: #f24724;
font-size: 14px;
font-weight: 400;
}
}
}
.block-171 {
width: formatWidth(171, $boxWidth);
}
.tip {
color: #222222;
font-size: 12px;
padding: 16px 0 8px;
text-align: center;
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!