feat: 更新日期格式化方法,新增多个统计卡片组件
- 将日期格式化方法从 formatDate 更新为 formatDate2,提升日期处理的灵活性 - 新增会员概览、用户统计、会员终端和交易量趋势等统计卡片组件 - 在商城首页引入新组件以展示关键会员和交易数据 - 优化数据获取逻辑,提升用户体验
This commit is contained in:
@@ -26,6 +26,15 @@ export function formatDateTime(time: Date | number | string | undefined) {
|
||||
return formatDate(time, 'YYYY-MM-DD HH:mm:ss');
|
||||
}
|
||||
|
||||
export function formatDate2(date: Date, format?: string): string {
|
||||
// 日期不存在,则返回空
|
||||
if (!date) {
|
||||
return '';
|
||||
}
|
||||
// 日期存在,则进行格式化
|
||||
return date ? dayjs(date).format(format ?? 'YYYY-MM-DD HH:mm:ss') : '';
|
||||
}
|
||||
|
||||
export function isDate(value: any): value is Date {
|
||||
return value instanceof Date;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,10 @@ withDefaults(defineProps<Props>(), {});
|
||||
<template>
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle class="text-xl">{{ title }}</CardTitle>
|
||||
<div class="my--1.5 flex flex-row items-center justify-between">
|
||||
<CardTitle class="text-xl">{{ title }}</CardTitle>
|
||||
<slot name="header-suffix"></slot>
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<slot></slot>
|
||||
|
||||
Reference in New Issue
Block a user