|
@@ -98,6 +98,7 @@
|
|
|
<script>
|
|
|
import Swiper from "../../assets/libs/swiper.js";
|
|
|
import BookingSuccess from "@/components/BookingSuccess.vue";
|
|
|
+import { submitBooking } from "@/api/interact.js";
|
|
|
|
|
|
const weekDayList = [
|
|
|
'周一',
|
|
@@ -115,28 +116,25 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- bookingYear: 'null',
|
|
|
- bookingMonth: 'null',
|
|
|
- bookingDay: 'null',
|
|
|
- bookingHour: 'null',
|
|
|
- bookingMinute: 'null',
|
|
|
- bookingSecond: 'null',
|
|
|
+ attractionId: 1,
|
|
|
+ bookingYear: null,
|
|
|
+ bookingMonth: null,
|
|
|
+ bookingDay: null,
|
|
|
+ bookingHour: null,
|
|
|
+ bookingMinute: null,
|
|
|
+ bookingSecond: null,
|
|
|
year: null,
|
|
|
month: null,
|
|
|
day: null,
|
|
|
weekDay: null,
|
|
|
timeList: [
|
|
|
{
|
|
|
- time: '9:00-12:00',
|
|
|
- remain: 0,
|
|
|
+ time: '8:30-12:00',
|
|
|
+ remain: 100,
|
|
|
},
|
|
|
{
|
|
|
- time: '12:00-15:00',
|
|
|
- remain: 120,
|
|
|
- },
|
|
|
- {
|
|
|
- time: '15:00-18:00',
|
|
|
- remain: 80,
|
|
|
+ time: '12:00-18:30',
|
|
|
+ remain: 100,
|
|
|
},
|
|
|
],
|
|
|
timeIdx: null,
|
|
@@ -186,14 +184,26 @@ export default {
|
|
|
this.timeIdx = index
|
|
|
},
|
|
|
onClickSubmit() {
|
|
|
- const now = new Date()
|
|
|
- this.bookingYear = now.getFullYear()
|
|
|
- this.bookingMonth = (now.getMonth() + 1).toString().padStart(2, '0')
|
|
|
- this.bookingDay = now.getDate().toString().padStart(2, '0')
|
|
|
- this.bookingHour = (now.getHours()).toString().padStart(2, '0')
|
|
|
- this.bookingMinute = (now.getMinutes()).toString().padStart(2, '0')
|
|
|
- this.bookingSecond = (now.getSeconds()).toString().padStart(2, '0')
|
|
|
- this.isShowSuccess = true
|
|
|
+ submitBooking({
|
|
|
+ "buildId": this.attractionId,
|
|
|
+ "day": `${this.year}-${this.month}-${this.day}`,
|
|
|
+ "identity": this.idCard,
|
|
|
+ "name": this.name,
|
|
|
+ "num": this.number,
|
|
|
+ "phone": this.phone,
|
|
|
+ "timeStr": this.timeIdx === 0 ? 'AM' : this.timeIdx === 1 ? 'PM' : undefined,
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ const now = new Date()
|
|
|
+ this.bookingYear = now.getFullYear()
|
|
|
+ this.bookingMonth = (now.getMonth() + 1).toString().padStart(2, '0')
|
|
|
+ this.bookingDay = now.getDate().toString().padStart(2, '0')
|
|
|
+ this.bookingHour = (now.getHours()).toString().padStart(2, '0')
|
|
|
+ this.bookingMinute = (now.getMinutes()).toString().padStart(2, '0')
|
|
|
+ this.bookingSecond = (now.getSeconds()).toString().padStart(2, '0')
|
|
|
+ this.isShowSuccess = true
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
}
|
|
|
}
|