diff --git a/src/api/mall/statistics/common.ts b/src/api/mall/statistics/common.ts new file mode 100644 index 00000000..3d964392 --- /dev/null +++ b/src/api/mall/statistics/common.ts @@ -0,0 +1,5 @@ +/** 数据对照 Response VO */ +export interface DataComparisonRespVO { + value: T + reference: T +} diff --git a/src/api/mall/statistics/member.ts b/src/api/mall/statistics/member.ts index d4680d3d..28d5a78c 100644 --- a/src/api/mall/statistics/member.ts +++ b/src/api/mall/statistics/member.ts @@ -1,6 +1,6 @@ import request from '@/config/axios' import dayjs from 'dayjs' -import { TradeStatisticsComparisonRespVO } from '@/api/mall/statistics/trade' +import { DataComparisonRespVO } from '@/api/mall/statistics/common' import { formatDate } from '@/utils/formatTime' /** 会员分析 Request VO */ @@ -10,17 +10,17 @@ export interface MemberAnalyseReqVO { /** 会员分析 Response VO */ export interface MemberAnalyseRespVO { - visitorCount: number + visitUserCount: number orderUserCount: number payUserCount: number atv: number - comparison: TradeStatisticsComparisonRespVO + comparison: DataComparisonRespVO } /** 会员分析对照数据 Response VO */ export interface MemberAnalyseComparisonRespVO { - userCount: number - activeUserCount: number + registerUserCount: number + visitUserCount: number rechargeUserCount: number } @@ -29,8 +29,8 @@ export interface MemberAreaStatisticsRespVO { areaId: number areaName: string userCount: number - orderCreateCount: number - orderPayCount: number + orderCreateUserCount: number + orderPayUserCount: number orderPayPrice: number } @@ -54,6 +54,20 @@ export interface MemberTerminalStatisticsRespVO { userCount: number } +/** 会员数量统计 Response VO */ +export interface MemberCountRespVO { + /** 用户访问量 */ + visitUserCount: string + /** 新增用户数量 */ + createUserCount: number +} + +/** 会员注册数量 Response VO */ +export interface MemberRegisterCountRespVO { + date: string + count: number +} + // 查询会员统计 export const getMemberSummary = () => { return request.get({ @@ -89,3 +103,21 @@ export const getMemberTerminalStatisticsList = () => { url: '/statistics/member/get-terminal-statistics-list' }) } + +// 获得用户数量量对照 +export const getUserCountComparison = () => { + return request.get>({ + url: '/statistics/member/user-count-comparison' + }) +} + +// 获得会员注册数量列表 +export const getMemberRegisterCountList = ( + beginTime: dayjs.ConfigType, + endTime: dayjs.ConfigType +) => { + return request.get({ + url: '/statistics/member/register-count-list', + params: { times: [formatDate(beginTime), formatDate(endTime)] } + }) +} diff --git a/src/api/mall/statistics/pay.ts b/src/api/mall/statistics/pay.ts new file mode 100644 index 00000000..1593f38d --- /dev/null +++ b/src/api/mall/statistics/pay.ts @@ -0,0 +1,6 @@ +import request from '@/config/axios' + +/** 获取钱包充值金额 */ +export const getWalletRechargePrice = async () => { + return await request.get({ url: `/statistics/pay/wallet-recharge-price` }) +} diff --git a/src/api/mall/statistics/trade.ts b/src/api/mall/statistics/trade.ts index f7829ccb..ef2a2b2b 100644 --- a/src/api/mall/statistics/trade.ts +++ b/src/api/mall/statistics/trade.ts @@ -1,12 +1,7 @@ import request from '@/config/axios' import dayjs from 'dayjs' import { formatDate } from '@/utils/formatTime' - -/** 交易统计对照 Response VO */ -export interface TradeStatisticsComparisonRespVO { - value: T - reference: T -} +import { DataComparisonRespVO } from '@/api/mall/statistics/common' /** 交易统计 Response VO */ export interface TradeSummaryRespVO { @@ -24,46 +19,100 @@ export interface TradeTrendReqVO { /** 交易状况统计 Response VO */ export interface TradeTrendSummaryRespVO { time: string - turnover: number + turnoverPrice: number orderPayPrice: number rechargePrice: number expensePrice: number - balancePrice: number + orderWalletPayPrice: number brokerageSettlementPrice: number orderRefundPrice: number } +/** 交易订单数量 Response VO */ +export interface TradeOrderCountRespVO { + /** 待发货 */ + undelivered?: number + /** 待核销 */ + pickUp?: number + /** 退款中 */ + afterSaleApply?: number + /** 提现待审核 */ + auditingWithdraw?: number +} + +/** 交易订单统计 Response VO */ +export interface TradeOrderSummaryRespVO { + /** 支付订单商品数 */ + orderPayCount?: number + /** 总支付金额,单位:分 */ + orderPayPrice?: number +} + +/** 订单量趋势统计 Response VO */ +export interface TradeOrderTrendRespVO { + /** 日期 */ + date: string + /** 订单数量 */ + orderPayCount: number + /** 订单支付金额 */ + orderPayPrice: number +} + // 查询交易统计 export const getTradeStatisticsSummary = () => { - return request.get>({ + return request.get>({ url: '/statistics/trade/summary' }) } // 获得交易状况统计 export const getTradeTrendSummary = (params: TradeTrendReqVO) => { - return request.get>({ + return request.get>({ url: '/statistics/trade/trend/summary', params: formatDateParam(params) }) } // 获得交易状况明细 -export const getTradeTrendList = (params: TradeTrendReqVO) => { +export const getTradeStatisticsList = (params: TradeTrendReqVO) => { return request.get({ - url: '/statistics/trade/trend/list', + url: '/statistics/trade/list', params: formatDateParam(params) }) } // 导出交易状况明细 -export const exportTradeTrend = (params: TradeTrendReqVO) => { +export const exportTradeStatisticsExcel = (params: TradeTrendReqVO) => { return request.download({ - url: '/statistics/trade/trend/export-excel', + url: '/statistics/trade/export-excel', params: formatDateParam(params) }) } +// 获得交易订单数量 +export const getOrderCount = async () => { + return await request.get({ url: `/statistics/trade/order-count` }) +} + +// 获得交易订单数量对照 +export const getOrderComparison = async () => { + return await request.get>({ + url: `/statistics/trade/order-comparison` + }) +} + +// 获得订单量趋势统计 +export const getOrderCountTrendComparison = ( + type: number, + beginTime: dayjs.ConfigType, + endTime: dayjs.ConfigType +) => { + return request.get[]>({ + url: '/statistics/trade/order-count-trend', + params: { type, beginTime: formatDate(beginTime), endTime: formatDate(endTime) } + }) +} + /** 时间参数需要格式化, 确保接口能识别 */ const formatDateParam = (params: TradeTrendReqVO) => { return { times: [formatDate(params.times[0]), formatDate(params.times[1])] } as TradeTrendReqVO diff --git a/src/components/ShortcutDateRangePicker/index.vue b/src/components/ShortcutDateRangePicker/index.vue new file mode 100644 index 00000000..d7fa90cb --- /dev/null +++ b/src/components/ShortcutDateRangePicker/index.vue @@ -0,0 +1,89 @@ + + diff --git a/src/utils/index.ts b/src/utils/index.ts index 6c9a5df2..e6b3173c 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -233,3 +233,16 @@ export const yuanToFen = (amount: string | number): number => { export const fenToYuan = (price: string | number): number => { return formatToFraction(price) } + +/** + * 计算环比 + * + * @param value 当前数值 + * @param reference 对比数值 + */ +export const calculateRelativeRate = (value?: number, reference?: number) => { + // 防止除0 + if (!reference) return 0 + + return ((100 * ((value || 0) - reference)) / reference).toFixed(0) +} diff --git a/src/views/mall/home/components/ComparisonCard.vue b/src/views/mall/home/components/ComparisonCard.vue new file mode 100644 index 00000000..ee1c2f0c --- /dev/null +++ b/src/views/mall/home/components/ComparisonCard.vue @@ -0,0 +1,42 @@ + + diff --git a/src/views/mall/home/components/MemberStatisticsCard.vue b/src/views/mall/home/components/MemberStatisticsCard.vue new file mode 100644 index 00000000..2f9d7ab5 --- /dev/null +++ b/src/views/mall/home/components/MemberStatisticsCard.vue @@ -0,0 +1,91 @@ + + diff --git a/src/views/mall/home/components/OperationDataCard.vue b/src/views/mall/home/components/OperationDataCard.vue new file mode 100644 index 00000000..cae09a3e --- /dev/null +++ b/src/views/mall/home/components/OperationDataCard.vue @@ -0,0 +1,91 @@ + + diff --git a/src/views/mall/home/components/ShortcutCard.vue b/src/views/mall/home/components/ShortcutCard.vue new file mode 100644 index 00000000..9fdd5cd4 --- /dev/null +++ b/src/views/mall/home/components/ShortcutCard.vue @@ -0,0 +1,79 @@ + + diff --git a/src/views/mall/home/components/TradeTrendCard.vue b/src/views/mall/home/components/TradeTrendCard.vue new file mode 100644 index 00000000..6aa9fdcc --- /dev/null +++ b/src/views/mall/home/components/TradeTrendCard.vue @@ -0,0 +1,208 @@ + + diff --git a/src/views/mall/home/index.vue b/src/views/mall/home/index.vue new file mode 100644 index 00000000..ede05bff --- /dev/null +++ b/src/views/mall/home/index.vue @@ -0,0 +1,111 @@ + + + diff --git a/src/views/mall/statistics/member/components/MemberFunnelCard.vue b/src/views/mall/statistics/member/components/MemberFunnelCard.vue new file mode 100644 index 00000000..fc847ef3 --- /dev/null +++ b/src/views/mall/statistics/member/components/MemberFunnelCard.vue @@ -0,0 +1,119 @@ + + + diff --git a/src/views/mall/statistics/member/components/MemberTerminalCard.vue b/src/views/mall/statistics/member/components/MemberTerminalCard.vue new file mode 100644 index 00000000..7bbab76c --- /dev/null +++ b/src/views/mall/statistics/member/components/MemberTerminalCard.vue @@ -0,0 +1,69 @@ + + diff --git a/src/views/mall/statistics/member/index.vue b/src/views/mall/statistics/member/index.vue index e76e861c..0d77f6c7 100644 --- a/src/views/mall/statistics/member/index.vue +++ b/src/views/mall/statistics/member/index.vue @@ -44,118 +44,20 @@ - - -
-
-
-
-
- 注册用户数量:{{ analyseData?.comparison?.value?.userCount || 0 }} -
-
- 环比增长率:{{ - calculateRelativeRate( - analyseData?.comparison?.value?.userCount, - analyseData?.comparison?.reference?.userCount - ) - }}% -
-
-
-
- {{ analyseData?.visitorCount || 0 }} - 访客 -
-
-
-
-
-
- 活跃用户数量:{{ analyseData?.comparison?.value?.activeUserCount || 0 }} -
-
- 环比增长率:{{ - calculateRelativeRate( - analyseData?.comparison?.value?.activeUserCount, - analyseData?.comparison?.reference?.activeUserCount - ) - }}% -
-
-
-
- {{ analyseData?.orderUserCount || 0 }} - 下单 -
-
-
-
-
-
-
- 充值用户数量:{{ analyseData?.comparison?.value?.rechargeUserCount || 0 }} -
-
- 环比增长率:{{ - calculateRelativeRate( - analyseData?.comparison?.value?.rechargeUserCount, - analyseData?.comparison?.reference?.rechargeUserCount - ) - }}% -
-
-
-
客单价:{{ fenToYuan(analyseData?.atv || 0) }}
-
-
-
-
- {{ analyseData?.payUserCount || 0 }} - 成交用户 -
-
-
-
+ +
- - - + +
- + + @@ -180,14 +82,14 @@ /> - + + @@ -214,62 +119,33 @@