{{ item.label }}
-{{ item.value }}
+{{ handleValue(item) }}
diff --git a/src/router/index.js b/src/router/index.js
index f31982c..ad7b75c 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -22,28 +22,6 @@ export const globalRoutes = [
global: true,
},
},
- {
- path: '/',
- name: 'App',
- redirect: { name: 'Home' },
- component: () => import('@/layouts/default.vue'),
- meta: {
- layout: true,
- title: '首页',
- icon: 'home-fill',
- },
- children: [
- {
- path: '/home',
- name: 'Home',
- component: () => import('@/views/home/index.vue'),
- meta: {
- title: '首页',
- icon: 'home-fill',
- },
- },
- ],
- },
];
export const demoRoutes = import.meta.env.MODE === 'development' ? demoModule : [];
diff --git a/src/store/modules/home/home.js b/src/store/modules/home/home.js
index 976ee94..0cd681b 100644
--- a/src/store/modules/home/home.js
+++ b/src/store/modules/home/home.js
@@ -16,11 +16,13 @@ const state = () => ({
label: '今日销售额',
value: 5000,
icon: 'money-cny-box',
+ type: 'money',
},
{
label: '近7天销售总额',
value: 50000,
icon: 'line-chart',
+ type: 'money',
},
],
order: [
@@ -181,21 +183,6 @@ const state = () => ({
},
],
},
- condition1: {
- today: false,
- beginDateTime: null,
- endDateTime: null,
- },
- condition2: {
- today: false,
- beginDateTime: null,
- endDateTime: null,
- },
- condition3: {
- today: false,
- beginDateTime: null,
- endDateTime: null,
- },
});
const getters = {};
const mutations = {
@@ -267,19 +254,25 @@ const actions = {
commit('setChartInfo3', res);
return res;
},
- loadChartData1: async ({ state, commit }) => {
- let res = await (state.condition1.today ? api.customerToday : api.customerSummary)(state.condition1);
- commit('setChartData1', res);
+ loadChartData1: async ({ commit }, data) => {
+ let today =
+ data.beginDateTime === data.endDateTime && data.endDateTime === dayjs(new Date()).format('YYYY-MM-DD');
+ let res = await (today ? api.customerToday : api.customerSummary)(data);
+ commit('setChartData1', res || []);
return res;
},
- loadChartData2: async ({ state, commit }) => {
- let res = await (state.condition2.today ? api.orderToday : api.orderSummary)(state.condition2);
- commit('setChartData2', res);
+ loadChartData2: async ({ commit }, data) => {
+ let today =
+ data.beginDateTime === data.endDateTime && data.endDateTime === dayjs(new Date()).format('YYYY-MM-DD');
+ let res = await (today ? api.orderToday : api.orderSummary)(data);
+ commit('setChartData2', res || []);
return res;
},
- loadChartData3: async ({ state, commit }) => {
- let res = await (state.condition3.today ? api.orderToday : api.orderSummary)(state.condition3);
- commit('setChartData3', res);
+ loadChartData3: async ({ commit }, data) => {
+ let today =
+ data.beginDateTime === data.endDateTime && data.endDateTime === dayjs(new Date()).format('YYYY-MM-DD');
+ let res = await (today ? api.orderToday : api.orderSummary)(data);
+ commit('setChartData3', res || []);
return res;
},
load: async ({ dispatch }) => {
@@ -291,9 +284,6 @@ const actions = {
dispatch('loadChartInfo1'),
dispatch('loadChartInfo2'),
dispatch('loadChartInfo3'),
- dispatch('loadChartData1'),
- dispatch('loadChartData2'),
- dispatch('loadChartData3'),
]);
},
};
diff --git a/src/views/home/dateRange.vue b/src/views/home/dateRange.vue
new file mode 100644
index 0000000..238fbe8
--- /dev/null
+++ b/src/views/home/dateRange.vue
@@ -0,0 +1,87 @@
+
+
{{ item.label }}
-{{ item.value }}
+{{ handleValue(item) }}
{{ item.value }}
@@ -54,7 +54,7 @@{{ item.value }}
@@ -88,9 +88,7 @@近一周访客统计
-近一周订单统计
-近一周销售统计
-