diff --git a/Management.html b/Management.html
index 527a973..4eb8551 100644
--- a/Management.html
+++ b/Management.html
@@ -749,6 +749,22 @@
let usersData = [];
let chartData = [];
+ // 防抖动函数
+ function debounce(func, wait) {
+ let timeout;
+ return function executedFunction(...args) {
+ const later = () => {
+ clearTimeout(timeout);
+ func(...args);
+ };
+ clearTimeout(timeout);
+ timeout = setTimeout(later, wait);
+ };
+ }
+
+ // 防重复点击标志
+ let isFiltering = false;
+
// 货源详情相关变量
let currentSellerId = null; // 当前正在显示的卖家ID
@@ -1264,6 +1280,10 @@
// 设置筛选条件
function setFilter(filter) {
+ // 防重复点击检查
+ if (isFiltering) return;
+
+ isFiltering = true;
currentFilter = filter;
// 重置当前卖家ID,确保切换时间筛选时显示所有货源
@@ -1283,11 +1303,17 @@
endDateInput.value = '';
// 重新加载数据
- loadStats(filter);
+ loadStats(filter).finally(() => {
+ isFiltering = false;
+ });
}
// 应用自定义时间筛选
function applyCustomFilter() {
+ // 防重复点击检查
+ if (isFiltering) return;
+
+ isFiltering = true;
const startDate = startDateInput.value;
const endDate = endDateInput.value;
@@ -1312,7 +1338,9 @@
[todayBtn, yesterdayBtn, beforeYesterdayBtn, weekBtn, monthBtn, lastMonthBtn, allBtn].forEach(btn => btn.classList.remove('active'));
// 重新加载数据,传递自定义日期范围
- loadStats('custom', startDate, endDate);
+ loadStats('custom', startDate, endDate).finally(() => {
+ isFiltering = false;
+ });
}
// 从缓存中获取数据