diff --git a/pages/bonus/index.vue b/pages/bonus/index.vue index 3d29c95..175e8a6 100644 --- a/pages/bonus/index.vue +++ b/pages/bonus/index.vue @@ -131,15 +131,13 @@ export default { }, methods: { setDefaultDateRange() { - const end = new Date() - const start = new Date() - end.setDate(end.getDate() - 1) - start.setDate(start.getDate() - 15) // 默认查询最近15天 + const end = dayjs().subtract(1, 'day') + const start = dayjs().subtract(15, 'day') + this.startDate = start.format('YYYY-MM-DD') + this.endDate = end.format('YYYY-MM-DD') - this.startDate = this.formatDate(start) - this.endDate = this.formatDate(end) - this.startDateValue = Number(start) - this.endDateValue = Number(end) + this.startDateValue = Number(start.toDate()) + this.endDateValue = Number(end.toDate()) }, formatDate(date) { return dayjs(date).format('YYYY-MM-DD')