|
@@ -135,7 +135,8 @@
|
|
<div class="col-12">
|
|
<div class="col-12">
|
|
<div class="d-flex justify-content-between align-items-center">
|
|
<div class="d-flex justify-content-between align-items-center">
|
|
<h5 id="currentDate" class="mb-0"></h5>
|
|
<h5 id="currentDate" class="mb-0"></h5>
|
|
- <div>
|
|
|
|
|
|
+ <div class="d-flex align-items-center">
|
|
|
|
+ <input type="date" id="datePicker" class="form-control me-3" style="width: auto;">
|
|
<button class="btn btn-outline-primary me-2" onclick="loadPreviousDay()">
|
|
<button class="btn btn-outline-primary me-2" onclick="loadPreviousDay()">
|
|
<i class="bi bi-arrow-left"></i> 查看前一天
|
|
<i class="bi bi-arrow-left"></i> 查看前一天
|
|
</button>
|
|
</button>
|
|
@@ -285,6 +286,10 @@
|
|
const dateStr = formatDate(currentDate);
|
|
const dateStr = formatDate(currentDate);
|
|
document.getElementById('currentDate').textContent = dateStr;
|
|
document.getElementById('currentDate').textContent = dateStr;
|
|
|
|
|
|
|
|
+ // 更新日期选择器的值
|
|
|
|
+ const datePicker = document.getElementById('datePicker');
|
|
|
|
+ datePicker.value = dateStr;
|
|
|
|
+
|
|
// 如果是今天,禁用"查看后一天"按钮
|
|
// 如果是今天,禁用"查看后一天"按钮
|
|
const nextDayBtn = document.getElementById('nextDayBtn');
|
|
const nextDayBtn = document.getElementById('nextDayBtn');
|
|
if (isToday(currentDate)) {
|
|
if (isToday(currentDate)) {
|
|
@@ -318,6 +323,23 @@
|
|
loadTransactions(1);
|
|
loadTransactions(1);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 处理日期选择器变化
|
|
|
|
+ function handleDateChange() {
|
|
|
|
+ const datePicker = document.getElementById('datePicker');
|
|
|
|
+ const selectedDate = new Date(datePicker.value);
|
|
|
|
+
|
|
|
|
+ // 检查选择的日期是否超过今天
|
|
|
|
+ if (selectedDate > new Date()) {
|
|
|
|
+ alert('不能选择未来的日期');
|
|
|
|
+ datePicker.value = formatDate(currentDate);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ currentDate = selectedDate;
|
|
|
|
+ updateDateDisplay();
|
|
|
|
+ loadTransactions(1);
|
|
|
|
+ }
|
|
|
|
+
|
|
// 加载交易记录
|
|
// 加载交易记录
|
|
async function loadTransactions(page = 1) {
|
|
async function loadTransactions(page = 1) {
|
|
try {
|
|
try {
|
|
@@ -529,6 +551,10 @@
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
updateDateDisplay();
|
|
updateDateDisplay();
|
|
loadTransactions();
|
|
loadTransactions();
|
|
|
|
+
|
|
|
|
+ // 添加日期选择器事件监听器
|
|
|
|
+ const datePicker = document.getElementById('datePicker');
|
|
|
|
+ datePicker.addEventListener('change', handleDateChange);
|
|
});
|
|
});
|
|
</script>
|
|
</script>
|
|
</body>
|
|
</body>
|