diff --git a/src/api/home/index.js b/src/api/home/index.js index d0d3a8f..17f7024 100644 --- a/src/api/home/index.js +++ b/src/api/home/index.js @@ -47,7 +47,7 @@ export const orderSummary = (params) => { // 获取今日订单统计数据 export const orderToday = () => { return request({ - url: '/mall/base/frontPage/listOrderStatistics', + url: '/mall/base/frontPage/listTodayOrderStatistics', method: 'get', }); }; diff --git a/src/assets/home/customer.png b/src/assets/home/customer.png new file mode 100644 index 0000000..fa59ae8 Binary files /dev/null and b/src/assets/home/customer.png differ diff --git a/src/assets/home/down.png b/src/assets/home/down.png new file mode 100644 index 0000000..8f8574d Binary files /dev/null and b/src/assets/home/down.png differ diff --git a/src/assets/home/icon-advertise.png b/src/assets/home/icon-advertise.png new file mode 100644 index 0000000..e79c09b Binary files /dev/null and b/src/assets/home/icon-advertise.png differ diff --git a/src/assets/home/icon-limit.png b/src/assets/home/icon-limit.png new file mode 100644 index 0000000..51c70ef Binary files /dev/null and b/src/assets/home/icon-limit.png differ diff --git a/src/assets/home/icon-notify.png b/src/assets/home/icon-notify.png new file mode 100644 index 0000000..c9ff219 Binary files /dev/null and b/src/assets/home/icon-notify.png differ diff --git a/src/assets/home/icon-order.png b/src/assets/home/icon-order.png new file mode 100644 index 0000000..de47fc9 Binary files /dev/null and b/src/assets/home/icon-order.png differ diff --git a/src/assets/home/icon-product.png b/src/assets/home/icon-product.png new file mode 100644 index 0000000..f9c98eb Binary files /dev/null and b/src/assets/home/icon-product.png differ diff --git a/src/assets/home/order.png b/src/assets/home/order.png new file mode 100644 index 0000000..26503b3 Binary files /dev/null and b/src/assets/home/order.png differ diff --git a/src/assets/home/sales.png b/src/assets/home/sales.png new file mode 100644 index 0000000..73f1b60 Binary files /dev/null and b/src/assets/home/sales.png differ diff --git a/src/assets/home/sales2.png b/src/assets/home/sales2.png new file mode 100644 index 0000000..dc41ac8 Binary files /dev/null and b/src/assets/home/sales2.png differ diff --git a/src/assets/home/up.png b/src/assets/home/up.png new file mode 100644 index 0000000..f11fd1f Binary files /dev/null and b/src/assets/home/up.png differ diff --git a/src/layouts/default.vue b/src/layouts/default.vue index 2da54df..1dfb112 100644 --- a/src/layouts/default.vue +++ b/src/layouts/default.vue @@ -28,6 +28,7 @@ .layout-container { width: 100vw; height: 100vh; + min-width: 1200px; background-color: @color-white-dark; } .layout-default { diff --git a/src/store/modules/home/home.js b/src/store/modules/home/home.js index 0cd681b..eb1f4c0 100644 --- a/src/store/modules/home/home.js +++ b/src/store/modules/home/home.js @@ -1,78 +1,87 @@ import * as api from '@/api/home/index.js'; +import customer from '~/home/customer.png'; +import iconAdvertise from '~/home/icon-advertise.png'; +import iconLimit from '~/home/icon-limit.png'; +import iconNotify from '~/home/icon-notify.png'; +import iconOrder from '~/home/icon-order.png'; +import iconProduct from '~/home/icon-product.png'; +import order from '~/home/order.png'; +import sales from '~/home/sales.png'; +import sales2 from '~/home/sales2.png'; const state = () => ({ opts: { summary: [ { label: '今日访客数', - value: 1526, - icon: 'bar-chart', + value: '-', + icon: customer, }, { label: '今日订单数', - value: 200, - icon: 'file-list', + value: '-', + icon: order, }, { label: '今日销售额', - value: 5000, - icon: 'money-cny-box', + value: '-', + icon: sales, type: 'money', }, { label: '近7天销售总额', - value: 50000, - icon: 'line-chart', + value: '-', + icon: sales2, type: 'money', }, ], order: [ { label: '待付款订单', - value: '10', + value: '-', route: { name: 'OrderManagement', - params: { + query: { status: 1, }, }, }, { - label: '待处理退款申请', - value: '10', + label: '待发货订单', + value: '-', route: { - name: 'ServiceManagement', - params: { - status: 1, + name: 'OrderManagement', + query: { + status: 3, }, }, }, { - label: '待发货订单', - value: '10', + label: '已发货订单', + value: '-', route: { name: 'OrderManagement', - params: { - status: 1, + query: { + status: 4, }, }, }, { - label: '待确认退货订单', - value: '10', + label: '待处理退款申请', + value: '-', route: { - name: 'ServiceManagement', - params: { + name: 'ServiceApplication', + query: { status: 1, }, }, }, { - label: '已发货订单', - value: '10', + label: '待确认退货订单', + value: '-', route: { - name: 'OrderManagement', - params: { - status: 1, + name: 'ServiceApplication', + query: { + status: 4, }, }, }, @@ -80,35 +89,38 @@ const state = () => ({ teleport: [ { label: '添加商品', - value: 'product-hunt', + value: iconProduct, route: { name: 'CreateProduct', }, }, { label: '订单列表', - value: 'money-cny-circle', + value: iconOrder, route: { name: 'OrderManagement', + query: { + status: 0, + }, }, }, { label: '秒杀管理', - value: 'auction', + value: iconLimit, route: { name: 'LimitActivity', }, }, { label: '消息通知', - value: 'notification-3', + value: iconNotify, route: { name: 'NotifyManagement', }, }, { label: '广告管理', - value: 'advertisement', + value: iconAdvertise, route: { name: 'AdvertiseManagement', }, @@ -117,69 +129,66 @@ const state = () => ({ product: [ { label: '已上架', - value: 100, + value: '-', }, { label: '未上架', - value: 400, + value: '-', }, { label: '库存紧张', - value: 50, + value: '-', }, { label: '全部商品', - value: 500, + value: '-', }, ], customer: [ { label: '今日新增', - value: 100, + value: '-', }, { label: '昨日新添', - value: 200, + value: '-', }, { label: '本月新增', - value: 1000, + value: '-', }, { label: '用户总数', - value: 5000, + value: '-', }, ], chart: [ { - info: {}, - data: [ - { label: '1月', value: 152 }, - { label: '2月', value: 215 }, - { label: '3月', value: 198 }, - { label: '4月', value: 348 }, - { label: '5月', value: 111 }, - ], + info: { + monthUpsOrDownsScale: '-', + monthVisitor: '-', + weekUpsOrDownsScale: '-', + weekVisitor: '-', + }, + data: [], }, { - info: {}, - data: [ - { label: '1月', value: 152 }, - { label: '2月', value: 215 }, - { label: '3月', value: 198 }, - { label: '4月', value: 348 }, - { label: '5月', value: 111 }, - ], + info: { + monthUpsOrDownsScale: '-', + monthOrder: '-', + weekUpsOrDownsScale: '-', + weekOrder: '-', + }, + data: [], }, { - info: {}, - data: [ - { label: '1月', value: 152 }, - { label: '2月', value: 215 }, - { label: '3月', value: 198 }, - { label: '4月', value: 348 }, - { label: '5月', value: 111 }, - ], + info: { + monthUpsOrDownsScale: '-', + monthSales: '-', + weekUpsOrDownsScale: '-', + weekSales: '-', + }, + data: [], }, ], }, @@ -194,10 +203,10 @@ const mutations = { }, setOrder: (state, data) => { state.opts.order[0].value = data.waitPayCount || 0; - state.opts.order[1].value = data.waitRefundCount || 0; - state.opts.order[2].value = data.waitShipCount || 0; - state.opts.order[3].value = data.waitReturnGoodsCount || 0; - state.opts.order[4].value = data.shippedCount || 0; + state.opts.order[1].value = data.waitShipCount || 0; + state.opts.order[2].value = data.shippedCount || 0; + state.opts.order[3].value = data.waitRefundCount || 0; + state.opts.order[4].value = data.waitReturnGoodsCount || 0; }, setProduct: (state, data) => { state.opts.product[0].value = data.onTheShelfCount || 0; @@ -211,9 +220,27 @@ const mutations = { state.opts.customer[2].value = data.monthIncreaseCount || 0; state.opts.customer[3].value = data.allCount || 0; }, - setChartInfo1: (state, data) => (state.opts.chart[0].info = data), - setChartInfo2: (state, data) => (state.opts.chart[1].info = data), - setChartInfo3: (state, data) => (state.opts.chart[2].info = data), + setChartInfo1: (state, data) => + (state.opts.chart[0].info = data || { + monthUpsOrDownsScale: 0, + monthVisitor: 0, + weekUpsOrDownsScale: 0, + weekVisitor: 0, + }), + setChartInfo2: (state, data) => + (state.opts.chart[1].info = data || { + monthUpsOrDownsScale: 0, + monthOrder: 0, + weekUpsOrDownsScale: 0, + weekOrder: 0, + }), + setChartInfo3: (state, data) => + (state.opts.chart[2].info = data || { + monthUpsOrDownsScale: 0, + monthSales: 0, + weekUpsOrDownsScale: 0, + weekSales: 0, + }), setChartData1: (state, data) => (state.opts.chart[0].data = data), setChartData2: (state, data) => (state.opts.chart[1].data = data), setChartData3: (state, data) => (state.opts.chart[2].data = data), @@ -221,22 +248,22 @@ const mutations = { const actions = { loadSummary: async ({ commit }) => { let res = await api.summary(); - commit('setSummary', res); + commit('setSummary', res || {}); return res; }, loadOrder: async ({ commit }) => { let res = await api.order(); - commit('setOrder', res); + commit('setOrder', res || {}); return res; }, loadProduct: async ({ commit }) => { let res = await api.product(); - commit('setProduct', res); + commit('setProduct', res || {}); return res; }, loadCustomer: async ({ commit }) => { let res = await api.customer(); - commit('setCustomer', res); + commit('setCustomer', res || {}); return res; }, loadChartInfo1: async ({ commit }) => { @@ -255,24 +282,63 @@ const actions = { return 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 || []); + let res = await api.customerSummary(data); + commit( + 'setChartData1', + (res || []).map((item) => { + return { label: item.recordDate, value: item.count }; + }) + ); + return res; + }, + loadChartData11: async ({ commit }) => { + let res = await api.customerToday(); + commit( + 'setChartData1', + (res || []).map((item) => { + return { label: item.recordDate, value: item.count }; + }) + ); return 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 || []); + let res = await api.orderSummary(data); + commit( + 'setChartData2', + (res || []).map((item) => { + return { label: item.recordDate, value: item.count }; + }) + ); + return res; + }, + loadChartData22: async ({ commit }) => { + let res = await api.orderToday(); + commit( + 'setChartData2', + (res || []).map((item) => { + return { label: item.recordDate, value: item.count }; + }) + ); return 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 || []); + let res = await api.moneySummary(data); + commit( + 'setChartData3', + (res || []).map((item) => { + return { label: item.recordDate, value: item.sales }; + }) + ); + return res; + }, + loadChartData33: async ({ commit }) => { + let res = await api.moneyToday(); + commit( + 'setChartData3', + (res || []).map((item) => { + return { label: item.recordDate, value: item.sales }; + }) + ); return res; }, load: async ({ dispatch }) => { diff --git a/src/views/home/dateRange.vue b/src/views/home/dateRange.vue index 238fbe8..390a537 100644 --- a/src/views/home/dateRange.vue +++ b/src/views/home/dateRange.vue @@ -1,16 +1,18 @@