const { bookingConfirm } = require("../../mock/photoBook"); Page({ data: { confirm: bookingConfirm, showSuccessTip: false, submitState: "idle", }, onLoad(query) { const next = { ...bookingConfirm }; if (query.date) { next.dateText = decodeURIComponent(query.date); } if (query.time) { next.timeText = decodeURIComponent(query.time); } if (query.contact) { next.contactText = decodeURIComponent(query.contact); } this.setData({ confirm: next }); }, onTapBack() { wx.navigateBack(); }, onTapSubmit() { if (this.data.submitState === "loading") { return; } this.setData({ submitState: "loading", showSuccessTip: false, }); setTimeout(() => { this.setData({ submitState: "idle", showSuccessTip: true, }); setTimeout(() => { wx.switchTab({ url: "/pages/my-bookings/index", }); }, 800); }, 500); }, });