首页接口对接

master
shilei 2 months ago
parent ccaef7cca7
commit ef7bf8f261

@ -76,10 +76,9 @@ export const getMemberSummary = () => {
} }
// 查询会员分析数据 // 查询会员分析数据
export const getMemberAnalyse = (params: MemberAnalyseReqVO) => { export const getMemberAnalyse = () => {
return request.get<MemberAnalyseRespVO>({ return request.post<MemberAnalyseRespVO>({
url: '/statistics/member/analyse', url: '/cloud/home/getStationRanking'
params: { times: [formatDate(params.times[0]), formatDate(params.times[1])] }
}) })
} }
@ -131,6 +130,12 @@ export const getHomeSwapInfo = (data) => {
}) })
} }
export const getTodayAndYesterdayStats = () => {
return request.post<any>({
url: '/cloud/home/getTodayAndYesterdayStats'
})
}
export const getTotalswapCount = (data) => { export const getTotalswapCount = (data) => {
return request.post<any>({ return request.post<any>({
url: '/cloud/statistics/total/swapCount', url: '/cloud/statistics/total/swapCount',

@ -130,7 +130,6 @@ const handleTimeRangeTypeChange = async () => {
} }
getlist() getlist()
// //
} }
const getlist = async () => { const getlist = async () => {
@ -143,6 +142,11 @@ const getlist = async () => {
let x_data = [] let x_data = []
// //
let y_data_1 = [] let y_data_1 = []
if (response.length === 0) {
return
}
for (let item of response) { for (let item of response) {
x_data.push(item.stationName) x_data.push(item.stationName)
y_data_1.push(item.swapVehicleCount) y_data_1.push(item.swapVehicleCount)

@ -200,6 +200,9 @@ const getlist = async () => {
let y_data_2 = [] let y_data_2 = []
// //
// let y_data_3 = [] // let y_data_3 = []
if (response.length > 0) {
return
}
for (let item of response) { for (let item of response) {
x_data.push(item.stationName) x_data.push(item.stationName)
y_data_1.push(item.swapRevenue / 100) y_data_1.push(item.swapRevenue / 100)

@ -8,32 +8,32 @@
title="营收" title="营收"
prefix="¥" prefix="¥"
::decimals="2" ::decimals="2"
:value="fenToYuan(orderComparison?.value?.orderPayPrice || 352100.16)" :value="orderComparison.actualPay / 100"
:reference="fenToYuan(orderComparison?.reference?.orderPayPrice || 423000.2)" :reference="orderComparison.yesterdayActualPay / 100"
/> />
</el-col> </el-col>
<el-col :md="4" :sm="12" :xs="24" :loading="loading"> <el-col :md="4" :sm="12" :xs="24" :loading="loading">
<ComparisonCard <ComparisonCard
tag="今日" tag="今日"
title="换电次数" title="换电次数"
:value="userComparison?.value?.visitUserCount || 30" :value="orderComparison.swapCount"
:reference="userComparison?.reference?.visitUserCount || 23" :reference="orderComparison.yesterdaySwapCount"
/> />
</el-col> </el-col>
<el-col :md="4" :sm="12" :xs="24" :loading="loading"> <el-col :md="4" :sm="12" :xs="24" :loading="loading">
<ComparisonCard <ComparisonCard
tag="今日" tag="今日"
title="电量" title="电量"
:value="fenToYuan(orderComparison?.value?.orderPayCount || 568900)" :value="orderComparison.totalElectricity"
:reference="fenToYuan(orderComparison?.reference?.orderPayCount || 683287)" :reference="orderComparison.yesterdayTotalElectricity"
/> />
</el-col> </el-col>
<el-col :md="4" :sm="12" :xs="24" :loading="loading"> <el-col :md="4" :sm="12" :xs="24" :loading="loading">
<ComparisonCard <ComparisonCard
tag="今日" tag="今日"
title="换电车辆" title="换电车辆"
:value="userComparison?.value?.registerUserCount || 14" :value="orderComparison.vehicleCount"
:reference="userComparison?.reference?.registerUserCount || 14" :reference="orderComparison.yesterdayVehicleCount"
/> />
</el-col> </el-col>
<el-col :md="6" :sm="12" :xs="24" :loading="loading"> <el-col :md="6" :sm="12" :xs="24" :loading="loading">
@ -41,8 +41,8 @@
tag="今日" tag="今日"
title="真实金额" title="真实金额"
prefix="¥" prefix="¥"
:value="userComparison?.value?.registerUserCount || 3521.16" :value="orderComparison.actualPay / 100"
:reference="userComparison?.reference?.registerUserCount || 4230.20" :reference="orderComparison.yesterdayActualPay / 100"
/> />
</el-col> </el-col>
</el-row> </el-row>
@ -91,21 +91,27 @@ import MemberFunnelCard from '@/views/mall/statistics/member/components/MemberFu
defineOptions({ name: 'MallHome' }) defineOptions({ name: 'MallHome' })
const loading = ref(true) // 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 () => { const getlist = async () => {
let data = { const response = await MemberStatisticsApi.getTodayAndYesterdayStats()
startTime: '', // console.log(response, 'data')
endTime: '' orderComparison.value = response
}
const response = await MemberStatisticsApi.getHomeSwapInfo(data)
console.log(response, 'data')
} }
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
// loading.value = true // loading.value = true
// loading.value = false // loading.value = false
// getlist() getlist()
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

@ -2,80 +2,56 @@
<el-card shadow="never"> <el-card shadow="never">
<template #header> <template #header>
<div class="my--1.5 flex flex-row items-center justify-between"> <div class="my--1.5 flex flex-row items-center justify-between">
<CardTitle title="换电站收入排行" /> <CardTitle title="换电站收入排行(元)" />
<!-- 查询条件 --> <!-- 查询条件 -->
<!-- <ShortcutDateRangePicker @change="handleTimeRangeChange" /> --> <!-- <ShortcutDateRangePicker @change="handleTimeRangeChange" /> -->
</div> </div>
</template> </template>
<div class="min-w-225 py-1.75" v-loading="loading"> <div class="min-w-225 py-1.75" v-loading="loading">
<div class="relative h-24 flex"> <div class="relative h-24 flex" v-if="analyseData.length > 0">
<div class="h-full w-75% bg-blue-50 <lg:w-35% <xl:w-55%"> <div class="h-full w-75% bg-blue-50 <lg:w-35% <xl:w-55%">
<div class="ml-15 h-full flex flex-col justify-center"> <div class="ml-15 h-full flex flex-col justify-center">
<div class="font-bold"> <div class="font-bold">
合肥站{{ analyseData?.comparison?.value?.registerUserCount || 943.58 }} {{ analyseData[0].stationName }}: {{ analyseData[0].actualPay / 100 || 0 }}
</div> </div>
<!-- <div class="mt-2 text-3.5">
合肥换电站{{
calculateRelativeRate(
analyseData?.comparison?.value?.registerUserCount,
analyseData?.comparison?.reference?.registerUserCount
)
}}%
</div> -->
</div> </div>
</div> </div>
<div <div
class="trapezoid1 ml--38.5 mt-1.5 h-full w-77 flex flex-col items-center justify-center bg-blue-5 text-3.5 text-white" class="trapezoid1 ml--38.5 mt-1.5 h-full w-77 flex flex-col items-center justify-center bg-blue-5 text-3.5 text-white"
> >
<span class="text-6 font-bold">{{ analyseData?.visitUserCount || 943.58 }}</span> <span class="text-6 font-bold">{{ analyseData[0].actualPay / 100 || 0 }}</span>
<span>Number One</span> <span>Number One</span>
</div> </div>
</div> </div>
<div class="relative h-24 flex"> <div class="relative h-24 flex" v-if="analyseData.length > 1">
<div class="h-full w-75% flex bg-cyan-50 <lg:w-35% <xl:w-55%"> <div class="h-full w-75% flex bg-cyan-50 <lg:w-35% <xl:w-55%">
<div class="ml-15 h-full flex flex-col justify-center"> <div class="ml-15 h-full flex flex-col justify-center">
<div class="font-bold"> <div class="font-bold">
长沙站{{ analyseData?.comparison?.value?.visitUserCount || 504.22 }} {{ analyseData[1].stationName }}: {{ analyseData[1].actualPay / 100 || 0 }}
</div> </div>
<!-- <div class="mt-2 text-3.5">
武汉换电站{{
calculateRelativeRate(
analyseData?.comparison?.value?.visitUserCount,
analyseData?.comparison?.reference?.visitUserCount
)
}}%
</div> -->
</div> </div>
</div> </div>
<div <div
class="trapezoid2 ml--28 mt-1.7 h-25 w-56 flex flex-col items-center justify-center bg-cyan-5 text-3.5 text-white" class="trapezoid2 ml--28 mt-1.7 h-25 w-56 flex flex-col items-center justify-center bg-cyan-5 text-3.5 text-white"
> >
<span class="text-6 font-bold">{{ analyseData?.orderUserCount || 504.22 }}</span> <span class="text-6 font-bold">{{ analyseData[1].actualPay / 100 || 0 }}</span>
<span>Number Two</span> <span>Number Two</span>
</div> </div>
</div> </div>
<div class="relative h-24 flex"> <div class="relative h-24 flex" v-if="analyseData.length > 2">
<div class="w-75% flex bg-slate-50 <lg:w-35% <xl:w-55%"> <div class="w-75% flex bg-slate-50 <lg:w-35% <xl:w-55%">
<div class="ml-15 h-full flex flex-row gap-x-16"> <div class="ml-15 h-full flex flex-row gap-x-16">
<div class="flex flex-col justify-center"> <div class="flex flex-col justify-center">
<div class="font-bold"> <div class="font-bold">
南京站{{ analyseData?.comparison?.value?.rechargeUserCount || 186.20 }} {{ analyseData[2].stationName }}: {{ analyseData[2].actualPay / 100 || 0 }}
</div> </div>
<!-- <div class="mt-2 text-3.5">
南京换电站{{
calculateRelativeRate(
analyseData?.comparison?.value?.rechargeUserCount,
analyseData?.comparison?.reference?.rechargeUserCount
)
}}%
</div> -->
</div> </div>
</div> </div>
</div> </div>
<div <div
class="trapezoid3 ml--18 mt-3.25 h-23 w-36 flex flex-col items-center justify-center bg-slate-5 text-3.5 text-white" class="trapezoid3 ml--18 mt-3.25 h-23 w-36 flex flex-col items-center justify-center bg-slate-5 text-3.5 text-white"
> >
<span class="text-6 font-bold">{{ analyseData?.payUserCount || 186.20 }}</span> <span class="text-6 font-bold">{{ analyseData[2].actualPay / 100 || 0 }}</span>
<span>Number Three</span> <span>Number Three</span>
</div> </div>
</div> </div>
@ -93,15 +69,20 @@ import { CardTitle } from '@/components/Card'
defineOptions({ name: 'MemberFunnelCard' }) defineOptions({ name: 'MemberFunnelCard' })
const loading = ref(false) // const loading = ref(false) //
const analyseData = ref<MemberAnalyseRespVO>() // const analyseData = ref([]) //
/** 查询会员概览数据列表 */ /** 查询会员概览数据列表 */
const handleTimeRangeChange = async (times: [dayjs.ConfigType, dayjs.ConfigType]) => { const handleTimeRangeChange = async () => {
// loading.value = true loading.value = true
// //
// analyseData.value = await MemberStatisticsApi.getMemberAnalyse({ times }) analyseData.value = await MemberStatisticsApi.getMemberAnalyse()
// loading.value = false // console.log(analyseData.value)
loading.value = false
} }
onMounted(async () => {
handleTimeRangeChange()
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.trapezoid1 { .trapezoid1 {

@ -38,11 +38,11 @@ const terminalChartOptions = reactive<EChartsOption>({
show: true show: true
}, },
data: [ data: [
{ value: 943.58, name: '合肥站' }, // { value: 943.58, name: '' },
{ value: 504.22, name: '长沙站' }, // { value: 504.22, name: '' },
{ value: 186.2, name: '南京站' }, // { value: 186.2, name: '' },
{ value: 0, name: '海口站' }, // { value: 0, name: '' },
{ value: 0, name: '石家庄站' } // { value: 0, name: '' }
] ]
} }
] ]
@ -51,22 +51,27 @@ const terminalChartOptions = reactive<EChartsOption>({
/** 按照终端,查询会员统计列表 */ /** 按照终端,查询会员统计列表 */
const getMemberTerminalStatisticsList = async () => { const getMemberTerminalStatisticsList = async () => {
loading.value = true loading.value = true
const list = await MemberStatisticsApi.getMemberTerminalStatisticsList() const list = await MemberStatisticsApi.getMemberAnalyse()
const dictDataList = getIntDictOptions(DICT_TYPE.TERMINAL) // console.log(list, 'list')
terminalChartOptions.series![0].data = dictDataList.map((dictData: DictDataType) => {
const userCount = list.find( // const dictDataList = getIntDictOptions(DICT_TYPE.TERMINAL)
(item: MemberTerminalStatisticsRespVO) => item.terminal === dictData.value let list_str = []
)?.userCount if (list.length == 0) {
return { return
name: dictData.label, }
value: userCount || 0 for (let item of list) {
let obj = {
value: item.actualPay / 100,
name: item.stationName
}
list_str.push(obj)
} }
}) terminalChartOptions.series![0].data = list_str
loading.value = false loading.value = false
} }
/** 初始化 **/ /** 初始化 **/
onMounted(() => { onMounted(() => {
// getMemberTerminalStatisticsList() getMemberTerminalStatisticsList()
}) })
</script> </script>

Loading…
Cancel
Save