统计:Review修改
This commit is contained in:
parent
195309dbb6
commit
e1a72779d4
5
src/api/mall/statistics/common.ts
Normal file
5
src/api/mall/statistics/common.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
/** 数据对照 Response VO */
|
||||||
|
export interface DataComparisonRespVO<T> {
|
||||||
|
value: T
|
||||||
|
reference: T
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
import request from '@/config/axios'
|
import request from '@/config/axios'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { TradeStatisticsComparisonRespVO } from '@/api/mall/statistics/trade'
|
import { DataComparisonRespVO } from '@/api/mall/statistics/common'
|
||||||
import { formatDate } from '@/utils/formatTime'
|
import { formatDate } from '@/utils/formatTime'
|
||||||
|
|
||||||
/** 会员分析 Request VO */
|
/** 会员分析 Request VO */
|
||||||
@ -10,17 +10,17 @@ export interface MemberAnalyseReqVO {
|
|||||||
|
|
||||||
/** 会员分析 Response VO */
|
/** 会员分析 Response VO */
|
||||||
export interface MemberAnalyseRespVO {
|
export interface MemberAnalyseRespVO {
|
||||||
visitorCount: number
|
visitUserCount: number
|
||||||
orderUserCount: number
|
orderUserCount: number
|
||||||
payUserCount: number
|
payUserCount: number
|
||||||
atv: number
|
atv: number
|
||||||
comparison: TradeStatisticsComparisonRespVO<MemberAnalyseComparisonRespVO>
|
comparison: DataComparisonRespVO<MemberAnalyseComparisonRespVO>
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 会员分析对照数据 Response VO */
|
/** 会员分析对照数据 Response VO */
|
||||||
export interface MemberAnalyseComparisonRespVO {
|
export interface MemberAnalyseComparisonRespVO {
|
||||||
userCount: number
|
registerUserCount: number
|
||||||
activeUserCount: number
|
visitUserCount: number
|
||||||
rechargeUserCount: number
|
rechargeUserCount: number
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,8 +29,8 @@ export interface MemberAreaStatisticsRespVO {
|
|||||||
areaId: number
|
areaId: number
|
||||||
areaName: string
|
areaName: string
|
||||||
userCount: number
|
userCount: number
|
||||||
orderCreateCount: number
|
orderCreateUserCount: number
|
||||||
orderPayCount: number
|
orderPayUserCount: number
|
||||||
orderPayPrice: number
|
orderPayPrice: number
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ export const getMemberTerminalStatisticsList = () => {
|
|||||||
|
|
||||||
// 获得用户数量量对照
|
// 获得用户数量量对照
|
||||||
export const getUserCountComparison = () => {
|
export const getUserCountComparison = () => {
|
||||||
return request.get<TradeStatisticsComparisonRespVO<MemberCountRespVO>>({
|
return request.get<DataComparisonRespVO<MemberCountRespVO>>({
|
||||||
url: '/statistics/member/user-count-comparison'
|
url: '/statistics/member/user-count-comparison'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,7 @@
|
|||||||
import request from '@/config/axios'
|
import request from '@/config/axios'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { formatDate } from '@/utils/formatTime'
|
import { formatDate } from '@/utils/formatTime'
|
||||||
|
import { DataComparisonRespVO } from '@/api/mall/statistics/common'
|
||||||
/** 交易统计对照 Response VO */
|
|
||||||
export interface TradeStatisticsComparisonRespVO<T> {
|
|
||||||
value: T
|
|
||||||
reference: T
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 交易统计 Response VO */
|
/** 交易统计 Response VO */
|
||||||
export interface TradeSummaryRespVO {
|
export interface TradeSummaryRespVO {
|
||||||
@ -24,11 +19,11 @@ export interface TradeTrendReqVO {
|
|||||||
/** 交易状况统计 Response VO */
|
/** 交易状况统计 Response VO */
|
||||||
export interface TradeTrendSummaryRespVO {
|
export interface TradeTrendSummaryRespVO {
|
||||||
time: string
|
time: string
|
||||||
turnover: number
|
turnoverPrice: number
|
||||||
orderPayPrice: number
|
orderPayPrice: number
|
||||||
rechargePrice: number
|
rechargePrice: number
|
||||||
expensePrice: number
|
expensePrice: number
|
||||||
balancePrice: number
|
orderWalletPayPrice: number
|
||||||
brokerageSettlementPrice: number
|
brokerageSettlementPrice: number
|
||||||
orderRefundPrice: number
|
orderRefundPrice: number
|
||||||
}
|
}
|
||||||
@ -65,31 +60,31 @@ export interface TradeOrderTrendRespVO {
|
|||||||
|
|
||||||
// 查询交易统计
|
// 查询交易统计
|
||||||
export const getTradeStatisticsSummary = () => {
|
export const getTradeStatisticsSummary = () => {
|
||||||
return request.get<TradeStatisticsComparisonRespVO<TradeSummaryRespVO>>({
|
return request.get<DataComparisonRespVO<TradeSummaryRespVO>>({
|
||||||
url: '/statistics/trade/summary'
|
url: '/statistics/trade/summary'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获得交易状况统计
|
// 获得交易状况统计
|
||||||
export const getTradeTrendSummary = (params: TradeTrendReqVO) => {
|
export const getTradeTrendSummary = (params: TradeTrendReqVO) => {
|
||||||
return request.get<TradeStatisticsComparisonRespVO<TradeTrendSummaryRespVO>>({
|
return request.get<DataComparisonRespVO<TradeTrendSummaryRespVO>>({
|
||||||
url: '/statistics/trade/trend/summary',
|
url: '/statistics/trade/trend/summary',
|
||||||
params: formatDateParam(params)
|
params: formatDateParam(params)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获得交易状况明细
|
// 获得交易状况明细
|
||||||
export const getTradeTrendList = (params: TradeTrendReqVO) => {
|
export const getTradeStatisticsList = (params: TradeTrendReqVO) => {
|
||||||
return request.get<TradeTrendSummaryRespVO[]>({
|
return request.get<TradeTrendSummaryRespVO[]>({
|
||||||
url: '/statistics/trade/trend/list',
|
url: '/statistics/trade/list',
|
||||||
params: formatDateParam(params)
|
params: formatDateParam(params)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出交易状况明细
|
// 导出交易状况明细
|
||||||
export const exportTradeTrend = (params: TradeTrendReqVO) => {
|
export const exportTradeStatisticsExcel = (params: TradeTrendReqVO) => {
|
||||||
return request.download({
|
return request.download({
|
||||||
url: '/statistics/trade/trend/export-excel',
|
url: '/statistics/trade/export-excel',
|
||||||
params: formatDateParam(params)
|
params: formatDateParam(params)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -101,7 +96,7 @@ export const getOrderCount = async () => {
|
|||||||
|
|
||||||
// 获得交易订单数量对照
|
// 获得交易订单数量对照
|
||||||
export const getOrderComparison = async () => {
|
export const getOrderComparison = async () => {
|
||||||
return await request.get<TradeStatisticsComparisonRespVO<TradeOrderSummaryRespVO>>({
|
return await request.get<DataComparisonRespVO<TradeOrderSummaryRespVO>>({
|
||||||
url: `/statistics/trade/order-comparison`
|
url: `/statistics/trade/order-comparison`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -112,7 +107,7 @@ export const getOrderCountTrendComparison = (
|
|||||||
beginTime: dayjs.ConfigType,
|
beginTime: dayjs.ConfigType,
|
||||||
endTime: dayjs.ConfigType
|
endTime: dayjs.ConfigType
|
||||||
) => {
|
) => {
|
||||||
return request.get<TradeStatisticsComparisonRespVO<TradeOrderTrendRespVO>[]>({
|
return request.get<DataComparisonRespVO<TradeOrderTrendRespVO>[]>({
|
||||||
url: '/statistics/trade/order-count-trend',
|
url: '/statistics/trade/order-count-trend',
|
||||||
params: { type, beginTime: formatDate(beginTime), endTime: formatDate(endTime) }
|
params: { type, beginTime: formatDate(beginTime), endTime: formatDate(endTime) }
|
||||||
})
|
})
|
||||||
|
@ -66,10 +66,8 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import * as TradeStatisticsApi from '@/api/mall/statistics/trade'
|
import * as TradeStatisticsApi from '@/api/mall/statistics/trade'
|
||||||
import * as MemberStatisticsApi from '@/api/mall/statistics/member'
|
import * as MemberStatisticsApi from '@/api/mall/statistics/member'
|
||||||
import {
|
import { DataComparisonRespVO } from '@/api/mall/statistics/common'
|
||||||
TradeOrderSummaryRespVO,
|
import { TradeOrderSummaryRespVO } from '@/api/mall/statistics/trade'
|
||||||
TradeStatisticsComparisonRespVO
|
|
||||||
} from '@/api/mall/statistics/trade'
|
|
||||||
import { MemberCountRespVO } from '@/api/mall/statistics/member'
|
import { MemberCountRespVO } from '@/api/mall/statistics/member'
|
||||||
import { fenToYuan } from '@/utils'
|
import { fenToYuan } from '@/utils'
|
||||||
import ComparisonCard from './components/ComparisonCard.vue'
|
import ComparisonCard from './components/ComparisonCard.vue'
|
||||||
@ -84,8 +82,8 @@ 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<TradeStatisticsComparisonRespVO<TradeOrderSummaryRespVO>>() // 交易对照数据
|
const orderComparison = ref<DataComparisonRespVO<TradeOrderSummaryRespVO>>() // 交易对照数据
|
||||||
const userComparison = ref<TradeStatisticsComparisonRespVO<MemberCountRespVO>>() // 用户对照数据
|
const userComparison = ref<DataComparisonRespVO<MemberCountRespVO>>() // 用户对照数据
|
||||||
|
|
||||||
/** 查询交易对照卡片数据 */
|
/** 查询交易对照卡片数据 */
|
||||||
const getOrderComparison = async () => {
|
const getOrderComparison = async () => {
|
||||||
|
@ -12,13 +12,13 @@
|
|||||||
<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?.userCount || 0 }}
|
注册用户数量:{{ analyseData?.comparison?.value?.registerUserCount || 0 }}
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-2 text-3.5">
|
<div class="mt-2 text-3.5">
|
||||||
环比增长率:{{
|
环比增长率:{{
|
||||||
calculateRelativeRate(
|
calculateRelativeRate(
|
||||||
analyseData?.comparison?.value?.userCount,
|
analyseData?.comparison?.value?.registerUserCount,
|
||||||
analyseData?.comparison?.reference?.userCount
|
analyseData?.comparison?.reference?.registerUserCount
|
||||||
)
|
)
|
||||||
}}%
|
}}%
|
||||||
</div>
|
</div>
|
||||||
@ -27,7 +27,7 @@
|
|||||||
<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?.visitorCount || 0 }}</span>
|
<span class="text-6 font-bold">{{ analyseData?.visitUserCount || 0 }}</span>
|
||||||
<span>访客</span>
|
<span>访客</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -35,13 +35,13 @@
|
|||||||
<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?.activeUserCount || 0 }}
|
活跃用户数量:{{ analyseData?.comparison?.value?.visitUserCount || 0 }}
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-2 text-3.5">
|
<div class="mt-2 text-3.5">
|
||||||
环比增长率:{{
|
环比增长率:{{
|
||||||
calculateRelativeRate(
|
calculateRelativeRate(
|
||||||
analyseData?.comparison?.value?.activeUserCount,
|
analyseData?.comparison?.value?.visitUserCount,
|
||||||
analyseData?.comparison?.reference?.activeUserCount
|
analyseData?.comparison?.reference?.visitUserCount
|
||||||
)
|
)
|
||||||
}}%
|
}}%
|
||||||
</div>
|
</div>
|
||||||
|
@ -82,14 +82,14 @@
|
|||||||
/>
|
/>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="订单创建数量"
|
label="订单创建数量"
|
||||||
prop="orderCreateCount"
|
prop="orderCreateUserCount"
|
||||||
align="center"
|
align="center"
|
||||||
min-width="135"
|
min-width="135"
|
||||||
sortable
|
sortable
|
||||||
/>
|
/>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="订单支付数量"
|
label="订单支付数量"
|
||||||
prop="orderPayCount"
|
prop="orderPayUserCount"
|
||||||
align="center"
|
align="center"
|
||||||
min-width="135"
|
min-width="135"
|
||||||
sortable
|
sortable
|
||||||
|
@ -84,11 +84,11 @@
|
|||||||
icon-bg-color="text-blue-500"
|
icon-bg-color="text-blue-500"
|
||||||
prefix="¥"
|
prefix="¥"
|
||||||
:decimals="2"
|
:decimals="2"
|
||||||
:value="fenToYuan(trendSummary?.value?.turnover || 0)"
|
:value="fenToYuan(trendSummary?.value?.turnoverPrice || 0)"
|
||||||
:percent="
|
:percent="
|
||||||
calculateRelativeRate(
|
calculateRelativeRate(
|
||||||
trendSummary?.value?.turnover,
|
trendSummary?.value?.turnoverPrice,
|
||||||
trendSummary?.reference?.turnover
|
trendSummary?.reference?.turnoverPrice
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
@ -156,11 +156,11 @@
|
|||||||
icon-bg-color="text-cyan-500"
|
icon-bg-color="text-cyan-500"
|
||||||
prefix="¥"
|
prefix="¥"
|
||||||
:decimals="2"
|
:decimals="2"
|
||||||
:value="fenToYuan(trendSummary?.value?.balancePrice || 0)"
|
:value="fenToYuan(trendSummary?.value?.orderWalletPayPrice || 0)"
|
||||||
:percent="
|
:percent="
|
||||||
calculateRelativeRate(
|
calculateRelativeRate(
|
||||||
trendSummary?.value?.balancePrice,
|
trendSummary?.value?.orderWalletPayPrice,
|
||||||
trendSummary?.reference?.balancePrice
|
trendSummary?.reference?.orderWalletPayPrice
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
@ -214,11 +214,8 @@ import * as TradeStatisticsApi from '@/api/mall/statistics/trade'
|
|||||||
import TradeStatisticValue from './components/TradeStatisticValue.vue'
|
import TradeStatisticValue from './components/TradeStatisticValue.vue'
|
||||||
import TradeTrendValue from './components/TradeTrendValue.vue'
|
import TradeTrendValue from './components/TradeTrendValue.vue'
|
||||||
import { EChartsOption } from 'echarts'
|
import { EChartsOption } from 'echarts'
|
||||||
import {
|
import { DataComparisonRespVO } from '@/api/mall/statistics/common'
|
||||||
TradeStatisticsComparisonRespVO,
|
import { TradeSummaryRespVO, TradeTrendSummaryRespVO } from '@/api/mall/statistics/trade'
|
||||||
TradeSummaryRespVO,
|
|
||||||
TradeTrendSummaryRespVO
|
|
||||||
} from '@/api/mall/statistics/trade'
|
|
||||||
import { calculateRelativeRate, fenToYuan } from '@/utils'
|
import { calculateRelativeRate, fenToYuan } from '@/utils'
|
||||||
import download from '@/utils/download'
|
import download from '@/utils/download'
|
||||||
import { CardTitle } from '@/components/Card'
|
import { CardTitle } from '@/components/Card'
|
||||||
@ -231,14 +228,14 @@ const message = useMessage() // 消息弹窗
|
|||||||
const loading = ref(true) // 加载中
|
const loading = ref(true) // 加载中
|
||||||
const trendLoading = ref(true) // 交易状态加载中
|
const trendLoading = ref(true) // 交易状态加载中
|
||||||
const exportLoading = ref(false) // 导出的加载中
|
const exportLoading = ref(false) // 导出的加载中
|
||||||
const summary = ref<TradeStatisticsComparisonRespVO<TradeSummaryRespVO>>() // 交易统计数据
|
const summary = ref<DataComparisonRespVO<TradeSummaryRespVO>>() // 交易统计数据
|
||||||
const trendSummary = ref<TradeStatisticsComparisonRespVO<TradeTrendSummaryRespVO>>() // 交易状况统计数据
|
const trendSummary = ref<DataComparisonRespVO<TradeTrendSummaryRespVO>>() // 交易状况统计数据
|
||||||
const shortcutDateRangePicker = ref()
|
const shortcutDateRangePicker = ref()
|
||||||
|
|
||||||
/** 折线图配置 */
|
/** 折线图配置 */
|
||||||
const lineChartOptions = reactive<EChartsOption>({
|
const lineChartOptions = reactive<EChartsOption>({
|
||||||
dataset: {
|
dataset: {
|
||||||
dimensions: ['date', 'turnover', 'orderPayPrice', 'rechargePrice', 'expensePrice'],
|
dimensions: ['date', 'turnoverPrice', 'orderPayPrice', 'rechargePrice', 'expensePrice'],
|
||||||
source: []
|
source: []
|
||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
@ -293,7 +290,7 @@ const lineChartOptions = reactive<EChartsOption>({
|
|||||||
/** 处理交易状况查询 */
|
/** 处理交易状况查询 */
|
||||||
const getTradeTrendData = async () => {
|
const getTradeTrendData = async () => {
|
||||||
trendLoading.value = true
|
trendLoading.value = true
|
||||||
await Promise.all([getTradeTrendSummary(), getTradeTrendList()])
|
await Promise.all([getTradeTrendSummary(), getTradeStatisticsList()])
|
||||||
trendLoading.value = false
|
trendLoading.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,13 +306,13 @@ const getTradeTrendSummary = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 查询交易状况数据列表 */
|
/** 查询交易状况数据列表 */
|
||||||
const getTradeTrendList = async () => {
|
const getTradeStatisticsList = async () => {
|
||||||
// 查询数据
|
// 查询数据
|
||||||
const times = shortcutDateRangePicker.value.times
|
const times = shortcutDateRangePicker.value.times
|
||||||
const list = await TradeStatisticsApi.getTradeTrendList({ times })
|
const list = await TradeStatisticsApi.getTradeStatisticsList({ times })
|
||||||
// 处理数据
|
// 处理数据
|
||||||
for (let item of list) {
|
for (let item of list) {
|
||||||
item.turnover = fenToYuan(item.turnover)
|
item.turnoverPrice = fenToYuan(item.turnoverPrice)
|
||||||
item.orderPayPrice = fenToYuan(item.orderPayPrice)
|
item.orderPayPrice = fenToYuan(item.orderPayPrice)
|
||||||
item.rechargePrice = fenToYuan(item.rechargePrice)
|
item.rechargePrice = fenToYuan(item.rechargePrice)
|
||||||
item.expensePrice = fenToYuan(item.expensePrice)
|
item.expensePrice = fenToYuan(item.expensePrice)
|
||||||
@ -334,7 +331,7 @@ const handleExport = async () => {
|
|||||||
// 发起导出
|
// 发起导出
|
||||||
exportLoading.value = true
|
exportLoading.value = true
|
||||||
const times = shortcutDateRangePicker.value.times
|
const times = shortcutDateRangePicker.value.times
|
||||||
const data = await TradeStatisticsApi.exportTradeTrend({ times })
|
const data = await TradeStatisticsApi.exportTradeStatisticsExcel({ times })
|
||||||
download.excel(data, '交易状况.xls')
|
download.excel(data, '交易状况.xls')
|
||||||
} catch {
|
} catch {
|
||||||
} finally {
|
} finally {
|
||||||
|
Loading…
Reference in New Issue
Block a user