mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-28 13:31:04 +00:00
fix(交易统计): 日期区间补齐结束日并修复空值报错
- whereTime between 结束边界停在结束日零点漏掉当天数据,改 whereBetween 并 +86399 按全天统计 - topData series 键位空洞(历史佣金卡片移除)致 JSON 变对象、前端 filter 报错,重排为连续索引;图标序列对齐 8 卡片 - 接口异常时兜底错误文案避免 undefined
This commit is contained in:
parent
f0f8f48998
commit
c28a941257
@ -360,7 +360,9 @@ class UserBillDao extends BaseDao
|
||||
if ($time[0] == $time[1]) {
|
||||
$query->whereDay($field, $time[0]);
|
||||
} else {
|
||||
$query->whereTime($field, 'between', $time);
|
||||
// whereTime between 对日期字符串的结束边界停在结束日 00:00:00,会漏掉结束日当天数据;
|
||||
// 与统计口径 searchTimeAttr 的结束日 +86399 对齐,按全天统计
|
||||
$query->whereBetween($field, [strtotime($time[0]), strtotime($time[1]) + 86399]);
|
||||
}
|
||||
})->field("FROM_UNIXTIME($field,'$timeType') as days,$str as num")->group('days')->select()->toArray();
|
||||
}
|
||||
|
||||
@ -428,6 +428,9 @@ class TradeStatisticServices extends BaseService
|
||||
$data['series'][$k]['rate'] = $v['rate'];
|
||||
$data['series'][$k]['value'] = array_values($v['value']);
|
||||
}
|
||||
// topData 键位不连续(历史支付佣金卡片已移除,键 7 空缺),必须重排为连续索引,
|
||||
// 否则 JSON 序列化输出对象而非数组,前端 series.filter 直接报错
|
||||
$data['series'] = array_values($data['series']);
|
||||
// 仅导出请求时才生成 Excel 文件,普通查询不落盘
|
||||
if ($isExport) {
|
||||
/** @var ExportServices $exportService */
|
||||
|
||||
@ -438,7 +438,7 @@ function getList() {
|
||||
})
|
||||
.catch((res) => {
|
||||
listLoading.value = false;
|
||||
ElMessage.error(res.msg);
|
||||
ElMessage.error(res?.msg || '数据加载失败');
|
||||
});
|
||||
}
|
||||
function getOrder() {}
|
||||
|
||||
@ -138,16 +138,16 @@ function getStatistics() {
|
||||
statisticBottomTradeApi({ data: dataTime.value })
|
||||
.then(async (res) => {
|
||||
const cardLists = res.data;
|
||||
// 图标顺序与后端 series 卡片顺序(营业额/商品支付/购买会员/充值/线下收银/支出/余额支付/商品退款)一致,
|
||||
// 支付佣金卡片已随佣金体系移除
|
||||
const incons = [
|
||||
'iconyingyee',
|
||||
'iconjiaoyijine',
|
||||
'iconshangpinzhifujine',
|
||||
'icongoumaihuiyuanjine',
|
||||
'iconchongzhijianshu',
|
||||
'iconxianxiashouyinjine',
|
||||
'iconzhichujine',
|
||||
'iconyuezhifujine',
|
||||
'iconzhifuyongjinjine',
|
||||
'iconshangpintuikuanjine',
|
||||
];
|
||||
for (var i = 0; i < cardLists.series.length; i++) {
|
||||
@ -158,7 +158,7 @@ function getStatistics() {
|
||||
spinShow.value = false;
|
||||
})
|
||||
.catch((res) => {
|
||||
ElMessage.error(res.msg);
|
||||
ElMessage.error(res?.msg || '数据加载失败');
|
||||
spinShow.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user