diff --git a/src/api/mall/statistics/member.ts b/src/api/mall/statistics/member.ts index aba4fae..94d367a 100644 --- a/src/api/mall/statistics/member.ts +++ b/src/api/mall/statistics/member.ts @@ -76,10 +76,9 @@ export const getMemberSummary = () => { } // 查询会员分析数据 -export const getMemberAnalyse = (params: MemberAnalyseReqVO) => { - return request.get({ - url: '/statistics/member/analyse', - params: { times: [formatDate(params.times[0]), formatDate(params.times[1])] } +export const getMemberAnalyse = () => { + return request.post({ + url: '/cloud/home/getStationRanking' }) } @@ -131,6 +130,12 @@ export const getHomeSwapInfo = (data) => { }) } +export const getTodayAndYesterdayStats = () => { + return request.post({ + url: '/cloud/home/getTodayAndYesterdayStats' + }) +} + export const getTotalswapCount = (data) => { return request.post({ url: '/cloud/statistics/total/swapCount', diff --git a/src/views/mall/home/components/MemberStatisticsCard.vue b/src/views/mall/home/components/MemberStatisticsCard.vue index 2095b65..998c2d9 100644 --- a/src/views/mall/home/components/MemberStatisticsCard.vue +++ b/src/views/mall/home/components/MemberStatisticsCard.vue @@ -130,7 +130,6 @@ const handleTimeRangeTypeChange = async () => { } getlist() // 发送时间范围选中事件 - } const getlist = async () => { @@ -143,6 +142,11 @@ const getlist = async () => { let x_data = [] // 换电营收 let y_data_1 = [] + + if (response.length === 0) { + return + } + for (let item of response) { x_data.push(item.stationName) y_data_1.push(item.swapVehicleCount) diff --git a/src/views/mall/home/components/TradeTrendCard.vue b/src/views/mall/home/components/TradeTrendCard.vue index 5327e2b..09d07c5 100644 --- a/src/views/mall/home/components/TradeTrendCard.vue +++ b/src/views/mall/home/components/TradeTrendCard.vue @@ -200,6 +200,9 @@ const getlist = async () => { let y_data_2 = [] // 换电次数 // let y_data_3 = [] + if (response.length > 0) { + return + } for (let item of response) { x_data.push(item.stationName) y_data_1.push(item.swapRevenue / 100) diff --git a/src/views/mall/home/index.vue b/src/views/mall/home/index.vue index 308c8a7..5ac8c72 100644 --- a/src/views/mall/home/index.vue +++ b/src/views/mall/home/index.vue @@ -8,32 +8,32 @@ title="营收" prefix="¥" ::decimals="2" - :value="fenToYuan(orderComparison?.value?.orderPayPrice || 352100.16)" - :reference="fenToYuan(orderComparison?.reference?.orderPayPrice || 423000.2)" + :value="orderComparison.actualPay / 100" + :reference="orderComparison.yesterdayActualPay / 100" /> @@ -41,8 +41,8 @@ tag="今日" title="真实金额" prefix="¥" - :value="userComparison?.value?.registerUserCount || 3521.16" - :reference="userComparison?.reference?.registerUserCount || 4230.20" + :value="orderComparison.actualPay / 100" + :reference="orderComparison.yesterdayActualPay / 100" /> @@ -91,21 +91,27 @@ import MemberFunnelCard from '@/views/mall/statistics/member/components/MemberFu defineOptions({ name: 'MallHome' }) const loading = ref(true) // 加载中 - +const orderComparison = ref({ + actualPay: 0, + swapCount: 0, + totalElectricity: 0, + vehicleCount: 0, + yesterdayActualPay: 0, + yesterdaySwapCount: 0, + yesterdayTotalElectricity: 0, + yesterdayVehicleCount: 0 +}) // 订单数据对比 const getlist = async () => { - let data = { - startTime: '', - endTime: '' - } - const response = await MemberStatisticsApi.getHomeSwapInfo(data) - console.log(response, 'data') + const response = await MemberStatisticsApi.getTodayAndYesterdayStats() + // console.log(response, 'data') + orderComparison.value = response } /** 初始化 **/ onMounted(async () => { // loading.value = true // loading.value = false - // getlist() + getlist() })