|
|
@@ -59,10 +59,9 @@
|
|
|
</view>
|
|
|
<!-- 日期网格 -->
|
|
|
<view class="cal-body">
|
|
|
- <!-- Feb 2026 starts on Sunday (index 0), so no empty padding needed for first row -->
|
|
|
<view v-for="(day, idx) in calendarDays" :key="idx" class="cal-day-box"
|
|
|
- :class="getDateClass(day)" @click="selectDateItem(day)">
|
|
|
- <view class="cal-day-text">{{ day }}</view>
|
|
|
+ :class="day ? getDateClass(day) : ''" @click="day && selectDateItem(day)">
|
|
|
+ <view class="cal-day-text" v-if="day">{{ day }}</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -159,7 +158,7 @@
|
|
|
<button class="btn normal danger" v-if="item.status === 2"
|
|
|
@click.stop="handleCancelOrder(item)">取消</button>
|
|
|
<button class="btn normal" @click.stop="reportAbnormal(item)">异常上报</button>
|
|
|
- <button class="btn primary" @click.stop="mainAction(item)">打卡</button>
|
|
|
+ <button class="btn primary" @click.stop="mainAction(item)">到达打卡</button>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -289,7 +288,8 @@ export default {
|
|
|
currentTypeFilterIdx: 0,
|
|
|
activeDropdown: 0,
|
|
|
hasTimeFilter: false,
|
|
|
- currentMonth: '2026年2月',
|
|
|
+ currentMonth: '',
|
|
|
+ viewDate: new Date(),
|
|
|
weekDays: ['日', '一', '二', '三', '四', '五', '六'],
|
|
|
calendarDays: [],
|
|
|
selectedDateRange: [],
|
|
|
@@ -636,15 +636,37 @@ export default {
|
|
|
this.closeDropdown();
|
|
|
},
|
|
|
initCalendar() {
|
|
|
+ const year = this.viewDate.getFullYear();
|
|
|
+ const month = this.viewDate.getMonth();
|
|
|
+ this.currentMonth = `${year}年${month + 1}月`;
|
|
|
+
|
|
|
+ // 获取该月第一天是周几 (0-6)
|
|
|
+ const firstDay = new Date(year, month, 1).getDay();
|
|
|
+ // 获取该月有多少天
|
|
|
+ const daysInMonth = new Date(year, month + 1, 0).getDate();
|
|
|
+
|
|
|
let days = [];
|
|
|
- for (let i = 1; i <= 28; i++) {
|
|
|
+ // 填充开头的空白
|
|
|
+ for (let i = 0; i < firstDay; i++) {
|
|
|
+ days.push(0);
|
|
|
+ }
|
|
|
+ // 填充真实日期
|
|
|
+ for (let i = 1; i <= daysInMonth; i++) {
|
|
|
days.push(i);
|
|
|
}
|
|
|
this.calendarDays = days;
|
|
|
- this.selectedDateRange = [2, 4];
|
|
|
},
|
|
|
- prevMonth() { uni.showToast({ title: '上个月', icon: 'none' }); },
|
|
|
- nextMonth() { uni.showToast({ title: '下个月', icon: 'none' }); },
|
|
|
+ prevMonth() {
|
|
|
+ this.viewDate.setMonth(this.viewDate.getMonth() - 1);
|
|
|
+ // 切换月份时强制重新创建 Date 对象以触发 Vue 响应式(如果需要)或者简单调用 init
|
|
|
+ this.viewDate = new Date(this.viewDate);
|
|
|
+ this.initCalendar();
|
|
|
+ },
|
|
|
+ nextMonth() {
|
|
|
+ this.viewDate.setMonth(this.viewDate.getMonth() + 1);
|
|
|
+ this.viewDate = new Date(this.viewDate);
|
|
|
+ this.initCalendar();
|
|
|
+ },
|
|
|
selectDateItem(day) {
|
|
|
if (this.selectedDateRange.length === 2) {
|
|
|
this.selectedDateRange = [day];
|
|
|
@@ -662,7 +684,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
getDateClass(day) {
|
|
|
- if (this.selectedDateRange.length === 0) return '';
|
|
|
+ if (!day || this.selectedDateRange.length === 0) return '';
|
|
|
if (this.selectedDateRange.length === 1) {
|
|
|
return day === this.selectedDateRange[0] ? 'is-start' : '';
|
|
|
}
|