权门店时段销售

This commit is contained in:
2024-06-30 15:04:47 +08:00
parent ef817384bb
commit fa2f8761ae
4 changed files with 276 additions and 3 deletions

View File

@@ -4,7 +4,7 @@ import Vue from 'vue'
window.axios = axios
const KENGEE_CDN_BASE = "http://10.0.97.209/presource/datascreen/"
const libs = [`${KENGEE_CDN_BASE}/js/pinyin.min.js`]
const libs = [`${KENGEE_CDN_BASE}/js/pinyin.min.js`, `${KENGEE_CDN_BASE}/js/dayjs.min.js`]
window.$glob = {}
window.$dicts = dicts
window.$waitFor = (target, t = 500) => new Promise(resolve => {
@@ -42,7 +42,7 @@ Vue.component("tableColumn", {
},
render(h) {
const config = this.$props.column
return h('el-table-column', {props: config},
return h('el-table-column', {props: {...config, label: `${config.label}` || "-"}},
config.children?.map(col => h("tableColumn", {props: {column: col}})) || h('template', {
slotScope: {
default: ({row}) => {

142
src/views/AppHourCount.vue Normal file
View File

@@ -0,0 +1,142 @@
<script>
export default {
name: "AppHourCount",
label: "市场看板-全门店时段合计",
data() {
return {
summary: {},
tableData: []
}
},
computed: {
search: v => v.$marketBoard.search,
columns: v => {
let {currentDate, compareDate} = v.search
const {compareSaleAmt, compareHourTotalAmt, currentHourTotalAmt, saleGrowthRate} = v.summary
const {dayjs} = window
currentDate = currentDate ? dayjs(currentDate).format("YYYY-MM-DD") : ""
compareDate = compareDate ? dayjs(compareDate).format("YYYY-MM-DD") : ""
return [
{label: "日期", width: 100, children: [{label: '总计', children: [{label: '时段', prop: "hour"}]}]},
{
label: compareDate, width: 137, align: 'center', children: [
{label: compareSaleAmt, align: 'center', children: [{label: "总销售额", prop: "compareSaleAmt", align: 'center'}]},
{label: compareHourTotalAmt, align: 'center', children: [{label: "时段销售额", prop: "compareHourTotalAmt", align: 'center'}]},
]
},
{
label: currentDate, width: 137, align: 'center', children: [
{label: currentHourTotalAmt, align: 'center', children: [{label: "时段销售额", prop: "currentHourTotalAmt", align: 'center'}]},
{label: saleGrowthRate, align: 'center', children: [{label: "销售增长率", prop: "saleGrowthRate", align: 'center'}]},
]
}
]
}
},
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">
<el-table :data="tableData" size="mini" header-cell-class-name="tableHeader" cell-class-name="tableCell" max-height="440px" stripe :header-row-class-name="getHeaderClass">
<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>

131
src/views/AppHourSale.vue Normal file
View File

@@ -0,0 +1,131 @@
<script>
export default {
name: "AppHourSale",
label: "市场看板-全门店时段销售",
data() {
return {
tableData: []
}
},
computed: {
search: v => v.$marketBoard.search,
columns: v => {
let {currentDate, compareDate} = v.search
const {dayjs} = window
currentDate = currentDate ? dayjs(currentDate).format("YYYY-MM-DD") : ""
compareDate = compareDate ? dayjs(compareDate).format("YYYY-MM-DD") : ""
return [
{label: "日期", width: 100, children: [{label: '时段', prop: "hour"}]},
{
label: compareDate, width: 137, align: 'center', children: [
{label: "销售额", prop: "compareSaleAmt", align: 'center'},
{label: "有效订单数", prop: "compareValidOrderNum", align: 'center'},
]
},
{
label: currentDate, width: 137, align: 'center', children: [
{label: "销售额", prop: "currentSaleAmt", align: 'center'},
{label: "有效订单数", prop: "currentValidOrderNum", align: 'center'},
]
},
{label: "销售增长率", width: 70, align: 'center', prop: "saleGrowthRate"},
]
}
},
methods: {
getTableData() {
const {$http, $waitFor} = window
$waitFor($http).then(() => $http.post("/data-boot/la/screen/marketBoard/hourSale", {
...this.search, limit: 999
})).then(res => {
if (res?.data) {
this.tableData = res.data?.page?.records || []
}
})
}
},
watch: {
search: {
immediate: true, deep: true, handler() {
this.getTableData()
}
}
}
}
</script>
<template>
<section class="AppHourSale">
<el-table :data="tableData" size="mini" header-cell-class-name="tableHeader" cell-class-name="tableCell" max-height="440px" show-summary stripe>
<table-column v-for="(column,i) in columns" :key="i" :column="column"/>
</el-table>
</section>
</template>
<style>
.AppHourSale {
color: #fff;
box-sizing: border-box;
}
.AppHourSale .tableHeader {
background: rgba(13, 48, 99, 0.6) !important;
color: #fff;
border-color: transparent !important;
}
.AppHourSale .el-table tr {
background-color: transparent !important;
}
.AppHourSale .el-table {
background: transparent;
border-color: transparent;
}
.AppHourSale .el-table .el-table__footer-wrapper tr {
background: linear-gradient(90deg, rgba(1, 196, 236, 0.5) 0%, rgba(1, 196, 236, 0.01) 100%);
}
.AppHourSale .el-table .el-table__footer-wrapper .is-leaf {
color: #66FFFF;
background: transparent;
border-color: transparent;
}
.AppHourSale .el-table:before {
background: transparent;
}
.AppHourSale .tableCell {
color: #fff;
border-color: transparent !important;
}
.AppHourSale .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;
}
.AppHourSale .el-table tr.el-table__row--striped .tableCell {
background-color: transparent !important;
}
.AppHourSale .el-table tr:hover > .tableCell {
background-color: rgba(255, 255, 255, .1) !important;
}
.AppHourSale .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>

View File

@@ -44,7 +44,7 @@ export default {
<template>
<section class="AppStoreMonitor">
<el-table :data="tableData" size="mini" header-cell-class-name="tableHeader" cell-class-name="tableCell" max-height="440px" stripe>
<el-table :data="tableData" size="mini" header-cell-class-name="tableHeader" cell-class-name="tableCell" max-height="440px" show-summary stripe>
<table-column v-for="(column,i) in columns" :key="i" :column="column"/>
</el-table>
</section>