Browse Source

bug fix: 切换日期后刷新各时段剩余名额数

任一存 2 years ago
parent
commit
9f4ce61db7
1 changed files with 19 additions and 0 deletions
  1. 19 0
      yfyc/src/views/Serve/Booking.vue

+ 19 - 0
yfyc/src/views/Serve/Booking.vue

@@ -181,6 +181,25 @@ export default {
       this.month = (date.getMonth() + 1).toString().padStart(2, '0')
       this.day = date.getDate().toString().padStart(2, '0')
       this.weekDay = weekDayList[date.getDay() + 1]
+      
+      this.timeIdx = null
+
+      getRemainingNumber({
+        buildId: this.attractionId,
+        day: `${this.year}-${this.month}-${this.day}`,
+        timeStr: 'AM',
+      }).then((res) => {
+        console.log(res);
+        this.timeList[0].remain = res.data
+      })
+      getRemainingNumber({
+        buildId: this.attractionId,
+        day: `${this.year}-${this.month}-${this.day}`,
+        timeStr: 'PM',
+      }).then((res) => {
+        console.log(res);
+        this.timeList[1].remain = res.data
+      })
     },
     handleClickTime(index) {
       this.timeIdx = index