feat(shop): 实时修复今日数据及优化商城设置与商品列表展示
- 修复 dashboard 今日数据统计,改为实时计算订单、销售额、用户数与优惠券使用量 - 统计数据写入 cmsStatistics 表,新增 couponUsedCount 状态与 getter - dashboard 页面移除原有按日期查询逻辑,优惠券使用数改为响应式读取 - 商城设置 Logo 上传改为直接调用 OSS 接口上传,移除图片库选择组件 - 新增商品列表中市场价和会员价列,数据为空时显示 "-" - 同步更新商品列表导出功能,包含新增的价格列与列宽配置 - 商品列表商品图片添加 OSS 压缩访问支持 - 调整商品分类搜索框与关键词输入框宽度以优化布局
This commit is contained in:
@@ -99,7 +99,7 @@
|
||||
<div class="today-stat">
|
||||
<div class="today-stat-icon">💰</div>
|
||||
<div class="today-stat-info">
|
||||
<div class="today-stat-value">{{ todayStats.salesAmount || '0.00' }}</div>
|
||||
<div class="today-stat-value">{{ formatMoney(todayStats.salesAmount) }}</div>
|
||||
<div class="today-stat-label">今日销售额(元)</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -267,7 +267,7 @@ const coreStats = computed(() => [
|
||||
// 待处理事项数据
|
||||
const pendingShipmentCount = ref(0);
|
||||
const pendingRefundCount = ref(0);
|
||||
const couponUsedCount = ref(0);
|
||||
const couponUsedCount = computed(() => statisticsStore.couponUsedCount);
|
||||
|
||||
// 待处理事项(使用computed确保响应式更新)
|
||||
const todoItems = computed(() => [
|
||||
@@ -301,6 +301,12 @@ const navigateTo = (path: string) => {
|
||||
}
|
||||
};
|
||||
|
||||
// 金额格式化(保留两位小数)
|
||||
const formatMoney = (value?: number | string) => {
|
||||
const num = Number(value);
|
||||
return Number.isFinite(num) ? num.toFixed(2) : '0.00';
|
||||
};
|
||||
|
||||
// 清除缓存
|
||||
const handleClearCache = () => {
|
||||
removeSiteInfoCache('SiteInfo:' + localStorage.getItem('TenantId')).then(
|
||||
@@ -358,22 +364,6 @@ const loadData = async () => {
|
||||
pendingRefundCount.value = 0;
|
||||
}
|
||||
|
||||
try {
|
||||
// 获取今日订单总数(用于计算优惠券使用率)
|
||||
const today = new Date().toISOString().split('T')[0];
|
||||
const todayOrderResult = await pageShopOrder({
|
||||
createTimeStart: today,
|
||||
createTimeEnd: today,
|
||||
page: 1,
|
||||
limit: 1
|
||||
});
|
||||
// 暂时使用今日订单数作为优惠券使用参考
|
||||
couponUsedCount.value = todayOrderResult?.count || 0;
|
||||
} catch (e) {
|
||||
console.warn('获取今日订单数失败:', e);
|
||||
couponUsedCount.value = 0;
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('加载数据失败:', error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user