|
@@ -28,7 +28,7 @@
|
|
@click="handleClickTime(index)"
|
|
@click="handleClickTime(index)"
|
|
>
|
|
>
|
|
<span>{{item.time}}</span><br>
|
|
<span>{{item.time}}</span><br>
|
|
- <span>{{item.remain ? `剩余${item.remain}` : `已结束`}}</span>
|
|
|
|
|
|
+ <span>{{item.remain !== null ? `剩余${item.remain}` : ``}}</span>
|
|
</button>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -87,7 +87,7 @@
|
|
<script>
|
|
<script>
|
|
import Swiper from "../../assets/libs/swiper.js";
|
|
import Swiper from "../../assets/libs/swiper.js";
|
|
import BookingSuccess from "@/components/BookingSuccess.vue";
|
|
import BookingSuccess from "@/components/BookingSuccess.vue";
|
|
-import { submitBooking } from "@/api/serveAndMy.js";
|
|
|
|
|
|
+import { submitBooking, getRemainingNumber } from "@/api/serveAndMy.js";
|
|
|
|
|
|
const weekDayList = [
|
|
const weekDayList = [
|
|
'周一',
|
|
'周一',
|
|
@@ -113,15 +113,15 @@ export default {
|
|
timeList: [
|
|
timeList: [
|
|
{
|
|
{
|
|
time: '8:30-12:00',
|
|
time: '8:30-12:00',
|
|
- remain: 100,
|
|
|
|
|
|
+ remain: null,
|
|
},
|
|
},
|
|
{
|
|
{
|
|
time: '12:00-18:30',
|
|
time: '12:00-18:30',
|
|
- remain: 100,
|
|
|
|
|
|
+ remain: null,
|
|
},
|
|
},
|
|
],
|
|
],
|
|
timeIdx: null,
|
|
timeIdx: null,
|
|
- name: ',',
|
|
|
|
|
|
+ name: '',
|
|
idCard: '',
|
|
idCard: '',
|
|
phone: '',
|
|
phone: '',
|
|
age: '',
|
|
age: '',
|
|
@@ -156,6 +156,23 @@ export default {
|
|
this.month = (today.getMonth() + 1).toString().padStart(2, '0')
|
|
this.month = (today.getMonth() + 1).toString().padStart(2, '0')
|
|
this.day = today.getDate().toString().padStart(2, '0')
|
|
this.day = today.getDate().toString().padStart(2, '0')
|
|
this.weekDay = weekDayList[today.getDay() + 1]
|
|
this.weekDay = weekDayList[today.getDay() + 1]
|
|
|
|
+
|
|
|
|
+ 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
|
|
|
|
+ })
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
onConfirmDate(date) {
|
|
onConfirmDate(date) {
|
|
@@ -177,8 +194,8 @@ export default {
|
|
"phone": this.phone,
|
|
"phone": this.phone,
|
|
"timeStr": this.timeIdx === 0 ? 'AM' : this.timeIdx === 1 ? 'PM' : undefined,
|
|
"timeStr": this.timeIdx === 0 ? 'AM' : this.timeIdx === 1 ? 'PM' : undefined,
|
|
}).then((res) => {
|
|
}).then((res) => {
|
|
- if (res.data.code === 0) {
|
|
|
|
- this.bookingRes = res.data.data
|
|
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
+ this.bookingRes = res.data
|
|
this.isShowSuccess = true
|
|
this.isShowSuccess = true
|
|
}
|
|
}
|
|
})
|
|
})
|