Files
kengee-data-screen/src/views/AppHourCount.vue

143 lines
4.1 KiB
Vue
Raw Normal View History

2024-06-30 15:04:47 +08:00
<script>
export default {
name: "AppHourCount",
label: "市场看板-全门店时段合计",
data() {
return {
summary: {},
tableData: []
}
},
computed: {
search: v => v.$marketBoard.search,
columns: v => {
let {currentDate, compareDate} = v.search
2024-07-01 01:09:26 +08:00
const {compareSaleAmt = 0, compareHourTotalAmt = 0, currentHourTotalAmt = 0, saleGrowthRate = 0} = v.summary
2024-06-30 15:04:47 +08:00
const {dayjs} = window
currentDate = currentDate ? dayjs(currentDate).format("YYYY-MM-DD") : ""
compareDate = compareDate ? dayjs(compareDate).format("YYYY-MM-DD") : ""
return [
2024-06-30 20:10:23 +08:00
{label: "日期", width: 100, children: [{label: '总计', children: [{label: '品类', prop: "categoryName"}]}]},
2024-06-30 15:04:47 +08:00
{
label: compareDate, width: 137, align: 'center', children: [
2024-06-30 20:10:23 +08:00
{label: `${compareSaleAmt}`, align: 'right', children: [{label: "总销售额", prop: "compareSaleAmt", align: 'right'}]},
{label: `${compareHourTotalAmt}`, align: 'right', children: [{label: "时段销售额", prop: "compareHourTotalAmt", align: 'right'}]},
2024-06-30 15:04:47 +08:00
]
},
{
label: currentDate, width: 137, align: 'center', children: [
2024-06-30 20:10:23 +08:00
{label: `${currentHourTotalAmt}`, align: 'right', children: [{label: "时段销售额", prop: "currentHourTotalAmt", align: 'right'}]},
{label: `${saleGrowthRate}`, align: 'right', children: [{label: "销售增长率", prop: "saleGrowthRate", align: 'right'}]},
2024-06-30 15:04:47 +08:00
]
}
]
}
},
methods: {
getTableData() {
const {$http, $waitFor} = window
$waitFor($http).then(() => $http.post("/data-boot/la/screen/marketBoard/hourCount", {
...this.search, limit: 999
})).then(res => {
if (res?.data) {
this.tableData = res.data?.page?.records || []
this.summary = res.data?.total
}
})
},
getHeaderClass({rowIndex}) {
if (rowIndex === 1) {
return "summaryHeader"
}
}
},
watch: {
search: {
immediate: true, deep: true, handler() {
this.getTableData()
}
}
}
}
</script>
<template>
<section class="AppHourCount">
2024-06-30 20:10:23 +08:00
<el-table :data="tableData" size="mini" header-cell-class-name="tableHeader" cell-class-name="tableCell" max-height="242px" stripe :header-row-class-name="getHeaderClass">
2024-06-30 15:04:47 +08:00
<table-column v-for="(column,i) in columns" :key="i" :column="column"/>
</el-table>
</section>
</template>
<style>
.AppHourCount {
color: #fff;
box-sizing: border-box;
}
.AppHourCount .tableHeader {
background: rgba(13, 48, 99, 0.6) !important;
color: #fff;
border-color: transparent !important;
}
.AppHourCount .el-table tr {
background-color: transparent !important;
}
.AppHourCount .el-table {
background: transparent;
border-color: transparent;
}
.AppHourCount .el-table .el-table__footer-wrapper tr, .AppHourCount .el-table .summaryHeader {
background: linear-gradient(90deg, rgba(1, 196, 236, 0.5) 0%, rgba(1, 196, 236, 0.01) 100%);
}
.AppHourCount .summaryHeader .tableHeader {
background: transparent !important;
}
.AppHourCount .el-table .summaryHeader .cell {
color: #66FFFF;
}
.AppHourCount .el-table .el-table__footer-wrapper .is-leaf {
color: #66FFFF;
background: transparent;
border-color: transparent;
}
.AppHourCount .tableCell {
color: #fff;
border-color: transparent !important;
}
.AppHourCount .el-table tr.el-table__row--striped {
--odd-bg: #09265B;
background-color: #081F48;
background-image: linear-gradient(
-45deg, var(--odd-bg) 0, var(--odd-bg) 10%, transparent 10%, transparent 50%,
var(--odd-bg) 50%, var(--odd-bg) 60%, transparent 60%, transparent);
background-size: 10px 10px;
}
.AppHourCount .el-table tr.el-table__row--striped .tableCell {
background-color: transparent !important;
}
.AppHourCount .el-table tr:hover > .tableCell {
background-color: rgba(255, 255, 255, .1) !important;
}
.AppHourCount .subTitle {
line-height: 20px;
width: fit-content;
margin: 24px auto 12px;
background-image: url("http://10.0.97.209/img/kengee/kengee5.png");
background-repeat: no-repeat;
background-size: 100% 2px;
background-position: center bottom;
}
</style>