From 3f45e8fdfa31d7b764d60a7c0cb5dd11944ed418 Mon Sep 17 00:00:00 2001
From: 刘帅 <rr.iii@qq.com>
Date: 星期一, 21 九月 2026 23:38:59 +0800
Subject: [PATCH] bug:统计数据修正
---
cloud-server-management/src/main/webapp/WEB-INF/view/system/dataStatistics/storeIncome.html | 37 +++++++++++++++++++++----------------
1 files changed, 21 insertions(+), 16 deletions(-)
diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/dataStatistics/storeIncome.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/dataStatistics/storeIncome.html
index 3e88fa6..e7db838 100644
--- a/cloud-server-management/src/main/webapp/WEB-INF/view/system/dataStatistics/storeIncome.html
+++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/dataStatistics/storeIncome.html
@@ -280,6 +280,11 @@
<script src="${ctxPath}/modular/system/dataStatistics/tSite.js"></script>
<script src="${ctxPath}/static/js/plugins/switchery/switchery.js"></script>
<script>
+ // 仅格式化前端展示,接口返回的原始数值不作改动。
+ function formatStatisticNumber(value) {
+ var number = Number(value);
+ return isFinite(number) ? number.toFixed(2) : '0.00';
+ }
function search(){
@@ -306,9 +311,9 @@
var records = labels.map(function (label, index) {
var item = statistics[index];
return '<div class="income-period-record"><strong>' + label + '</strong>:总营收金额 '
- + item.totalIncomeAmount + ',净收入金额 ' + item.netIncomeAmount
- + ',优惠券抵扣金额 ' + item.couponDeductionAmount + ',退款金额 '
- + item.refundAmount + '</div>';
+ + formatStatisticNumber(item.totalIncomeAmount) + ',净收入金额 ' + formatStatisticNumber(item.netIncomeAmount)
+ + ',优惠券抵扣金额 ' + formatStatisticNumber(item.couponDeductionAmount) + ',退款金额 '
+ + formatStatisticNumber(item.refundAmount) + '</div>';
}).join('');
document.getElementById(elementId).innerHTML = '<div class="income-period-title">' + title
+ '</div><div class="income-period-records">' + records + '</div>';
@@ -320,9 +325,9 @@
title: {text: title, left: 'center', textStyle: {fontSize: 15}},
tooltip: {trigger: 'axis', formatter: function (params) {
var detail = statistics[params[0].dataIndex];
- return labels[params[0].dataIndex] + '<br/>总营收:' + detail.totalIncomeAmount
- + '<br/>净收入:' + detail.netIncomeAmount + '<br/>优惠券抵扣:'
- + detail.couponDeductionAmount + '<br/>退款:' + detail.refundAmount;
+ return labels[params[0].dataIndex] + '<br/>总营收:' + formatStatisticNumber(detail.totalIncomeAmount)
+ + '<br/>净收入:' + formatStatisticNumber(detail.netIncomeAmount) + '<br/>优惠券抵扣:'
+ + formatStatisticNumber(detail.couponDeductionAmount) + '<br/>退款:' + formatStatisticNumber(detail.refundAmount);
}},
grid: {left: '5%', right: '4%', bottom: '18%', containLabel: true},
xAxis: {type: 'category', boundaryGap: false, data: labels, axisLabel: {rotate: labels.length > 7 ? 35 : 0, interval: 0}},
@@ -335,17 +340,17 @@
function income(){
var ajax = new $ax(Feng.ctxPath + "/data/getIncomeData", function(resp){
yearX = resp.year;
- $("#totalIncome").text(resp.incomeStatistics.totalIncomeAmount || 0);
- $("#netIncomeAmount").text(resp.incomeStatistics.netIncomeAmount || 0);
- $("#couponDeductionAmount").text(resp.incomeStatistics.couponDeductionAmount || 0);
- $("#refundAmount").text(resp.incomeStatistics.refundAmount || 0);
+ $("#totalIncome").text(formatStatisticNumber(resp.incomeStatistics.totalIncomeAmount));
+ $("#netIncomeAmount").text(formatStatisticNumber(resp.incomeStatistics.netIncomeAmount));
+ $("#couponDeductionAmount").text(formatStatisticNumber(resp.incomeStatistics.couponDeductionAmount));
+ $("#refundAmount").text(formatStatisticNumber(resp.incomeStatistics.refundAmount));
var incomeTypeNet = resp.incomeTypeNet || {};
- $("#fee1").text(incomeTypeNet[1] || 0);
- $("#fee2").text(incomeTypeNet[2] || 0);
- $("#fee3").text(incomeTypeNet[3] || 0);
- $("#fee4").text(incomeTypeNet[4] || 0);
- $("#fee5").text(incomeTypeNet[5] || 0);
- $("#fee7").text(incomeTypeNet[6] || 0);
+ $("#fee1").text(formatStatisticNumber(incomeTypeNet[1]));
+ $("#fee2").text(formatStatisticNumber(incomeTypeNet[2]));
+ $("#fee3").text(formatStatisticNumber(incomeTypeNet[3]));
+ $("#fee4").text(formatStatisticNumber(incomeTypeNet[4]));
+ $("#fee5").text(formatStatisticNumber(incomeTypeNet[5]));
+ $("#fee7").text(formatStatisticNumber(incomeTypeNet[6]));
renderIncomeStatisticsList("yearIncomeStatistics", "历年营收明细", resp.yearLabels, resp.yearIncomeStatistics);
renderIncomeStatisticsList("monthIncomeStatistics", "本年各月营收明细", resp.monthLabels, resp.monthIncomeStatistics);
renderIncomeStatisticsList("weekIncomeStatistics", "近四周营收明细", resp.weekLabels, resp.weekIncomeStatistics);
--
Gitblit v1.7.1