From bd867ce01af970dc9d715266cf9d47f2347f95f0 Mon Sep 17 00:00:00 2001 From: woody Date: Tue, 21 Oct 2025 14:50:01 +0800 Subject: [PATCH] =?UTF-8?q?feat(statistics):=20=E4=BC=9E=E4=B8=8B=E4=B8=9A?= =?UTF-8?q?=E7=BB=A9=E9=BB=98=E8=AE=A4=E6=97=B6=E9=97=B4=E6=AE=B5=E7=BB=93?= =?UTF-8?q?=E6=9D=9F=E6=97=A5=E6=9C=9F=E4=B8=BA=E5=89=8D=E4=B8=80=E5=A4=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + src/router/index.js | 12 +- src/utils/date.js | 24 ++ src/views/statistics/underDirectAdd.vue | 322 ++++++++--------- src/views/statistics/underDirectAddNew.vue | 324 ++++++++---------- src/views/statistics/underPlacementPer.vue | 210 +++++------- src/views/statistics/underPlacementPerNew.vue | 220 ++++++------ 7 files changed, 520 insertions(+), 593 deletions(-) create mode 100644 src/utils/date.js diff --git a/package.json b/package.json index 384a29f..2bb1325 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "@riophae/vue-treeselect": "^0.4.0", "axios": "0.18.1", "core-js": "3.6.5", + "dayjs": "^1.11.18", "echarts": "^5.4.2", "element-ui": "2.13.2", "file-saver": "^2.0.5", diff --git a/src/router/index.js b/src/router/index.js index aef5151..4fb308a 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -2755,12 +2755,12 @@ export const constantRoutes = [ component: () => import('@/views/statistics/underBalance'), meta: { title: '伞下账户余额' } }, - { - path: 'underDirectPushBox', - name: 'UnderDirectPushBox', - component: () => import('@/views/statistics/underDirectPushBox'), - meta: { title: '伞下直推新增盒数' } - }, + // { + // path: 'underDirectPushBox', + // name: 'UnderDirectPushBox', + // component: () => import('@/views/statistics/underDirectPushBox'), + // meta: { title: '伞下直推新增盒数' } + // }, { path: 'realPerAddAwards', name: 'RealPerAddAwards', diff --git a/src/utils/date.js b/src/utils/date.js new file mode 100644 index 0000000..8c0331e --- /dev/null +++ b/src/utils/date.js @@ -0,0 +1,24 @@ +import dayjs from 'dayjs' + +export function getBeforeDays(n = 1) { + return dayjs().subtract(n, 'day').format('YYYY-MM-DD') +} + +// 获取本月第一天 +export function getMonthFirstDay() { + return dayjs().startOf('month').format('YYYY-MM-DD') +} + +// 获取本月最后一天 +export function getMonthLastDay() { + return dayjs().endOf('month').format('YYYY-MM-DD') +} + +// 获取本月第一天和当前天前一天的日期,如果当天为本月第一天,则返回上月第一天和上月最后一天 +export function getMonthFirstDayAndBeforeDay() { + const isFirstDate = new Date().getDate() === 1 + if (isFirstDate) { + return [dayjs().add(-1, 'month').startOf('month').format('YYYY-MM-DD'), dayjs().add(-1, 'month').endOf('month').format('YYYY-MM-DD')] + } + return [getMonthFirstDay(), getBeforeDays(1)] +} diff --git a/src/views/statistics/underDirectAdd.vue b/src/views/statistics/underDirectAdd.vue index 8878fc2..b0938ac 100644 --- a/src/views/statistics/underDirectAdd.vue +++ b/src/views/statistics/underDirectAdd.vue @@ -1,28 +1,22 @@ - @@ -175,74 +170,63 @@ prop="shortName" :label="'国家'" min-width="120px" - > - + /> - + /> - + /> - + /> - + /> - + /> - + /> - + /> - + /> - + /> - + />