水灯节表单增加酒店选项

hotfix/paypal-note
Jimmy Liow 2 years ago
parent 3522ce1d1b
commit f2750b8108

@ -1,8 +1,13 @@
<script <!--AH-Lantern-From-Info-->
src="https://www.recaptcha.net/recaptcha/enterprise.js?render=6Lf828MhAAAAANNetijCXKwW5ARyhcJ-b1Hhslja"></script> <script src="https://www.recaptcha.net/recaptcha/enterprise.js?render=6Lf828MhAAAAANNetijCXKwW5ARyhcJ-b1Hhslja"></script>
<div class="tmbottom"> <div class="tmbottom">
<h3 style="font-size: 24px; line-height: 22px;">Chiang Mai CAD Yi Peng Festival 2023 - Secure Your Exclusive Tickets Before They're Gone!</h3> <h3 style="font-size: 24px; line-height: 22px;">Chiang Mai CAD Yi Peng Festival 2023 - Secure Your Exclusive Tickets Before They're Gone!</h3>
<form id='ticket_form' action="https://www.asiahighlights.com/orders/lantern_save" method="post"> <p><strong>SPECIAL NOTE:</strong><br>
1. We have exclusive, reserved premium tickets available for customers who reserve both the ticket and the hotel. <br>
2. Regardless of the quantity of tickets required, a minimum of one night's stay in one room at <strong><em>Novotel Chiang Mai (4 star)</em></strong> or <strong><em>Smile Lanna Hotel (4.5 star)</em></strong> between November 26th and 29th is required.<br>
3. Superior room of Novotel Chiang Mai or deluxe room of Smile Lanna Hotel, both at <strong><em>US$110 per room per night</em></strong>, which includes breakfast and tax.
</p>
<form id='ticket_form' action="https://www.asiahighlights.com/orders/lantern_save" method="post" >
<p style=" font-size: 22px;"><strong>Select Date</strong></p> <p style=" font-size: 22px;"><strong>Select Date</strong></p>
<div class="selectHotl" style="margin-bottom: 20px;"> <div class="selectHotl" style="margin-bottom: 20px;">
<div class="optionLable"> <div class="optionLable">
@ -18,7 +23,8 @@
</label> </label>
</div> </div>
</div> </div>
<p style=" font-size: 22px;"><strong>Select Ticket Type</strong></p> <p style="font-size: 22px;"><strong>Select Ticket Type</strong></p>
<div class="selectHotl" style="margin-bottom: 20px;"> <div class="selectHotl" style="margin-bottom: 20px;">
<div class="optionLable" id="ticket_type_premium"> <div class="optionLable" id="ticket_type_premium">
<input type="radio" value="Premium+Transfer+Dinner" id="Premium" name="ticket_type"> <input type="radio" value="Premium+Transfer+Dinner" id="Premium" name="ticket_type">
@ -51,31 +57,58 @@
</label> </label>
</div> </div>
</div> </div>
<p style="display: inline-block;">The standard ticket for the 27th has been sold out.</p> <div id="hotel_choice" style="display: none">
<p style="display: inline-block;"><strong>Premium ticket booking for the 27th is now closed.</strong> However, we have exclusive reserved tickets available for the following customers:<br> <p style="font-size: 22px;"><strong>What's your hotel choice?</strong></p>
A. Customers who <a href="/thailand/tours/lantern-festival">book our Lantern Festival Tour</a>. <br> <div class="selectHotl" style="margin-bottom: 20px;">
B. Customers who <a href="/contact-us">reserve both the ticket and the hotel</a>. A minimum of one night's stay at Novotel Chiang Mai between November 26th and 29th is required. We offer a competitive price of US$100 per room per night, which includes breakfast and tax. <div class="optionLable">
</p> <input type="radio" value="Novotel Chiang Mai" id="Novotel" name="hotel" checked>
<p style=" font-size: 22px;"><strong>Select Quantity</strong></p> <label for="Novotel">
Novotel Chiang Mai (4 star)
<div>superior room with balcony</div>
</label>
</div>
<div class="optionLable">
<input type="radio" value="Smile Lanna Hotel" id="Lanna" name="hotel">
<label for="Lanna">
Smile Lanna Hotel (4.5 star)
<div>deluxe room</div>
</label>
</div>
</div>
<div class="peopleSelect" style="width: auto;">
<span class="formMemo">
Select the Number of Hotel Rooms and Length of Stay
</span>
<div class="numberBtn">
<input class="minaddBtn reduce_room" id='minusRoomBtn' type="button" value="-">
<input class="number" id="hotel_room" readonly="readonly" type="text" value="1" name="hotelrooms">
<input class="minaddBtn add_room" id='plusRoomBtn' type="button" value="+">
</div>
<div class="numberBtn">
<input class="minaddBtn reduce_stay" id='minusStayBtn' type="button" value="-">
<input class="number" id="stay_length" readonly="readonly" type="text" value="1" name="hotelstay">
<input class="minaddBtn add_stay" id='plusStayBtn' type="button" value="+">
</div>
</div>
</div>
<p style="font-size: 22px;"><strong>Select Quantity</strong></p>
<div class="peopleSelect" style="width: auto;"> <div class="peopleSelect" style="width: auto;">
<span class="formMemo"> <span class="formMemo">
Adults and older children (8+ years old) Adults and older children (8+ years old)
</span> </span>
<div class="numberBtn"> <div class="numberBtn">
<input class="minaddBtn reduceadult" id='minusButton' type="button" value="-"> <input class="minaddBtn reduceadult" id='minusButton' type="button" value="-">
<input class="number" id="adultNumberValue" readonly="readonly" type="text" value="1" <input class="number" id="adultNumberValue" readonly="readonly" type="text" value="1" name="adult">
name="adult">
<input class="minaddBtn addadult" id='plusButton' type="button" value="+"> <input class="minaddBtn addadult" id='plusButton' type="button" value="+">
</div> </div>
</div> </div>
<p style="display: inline-block;">Children under 8 years old enter free; 8-year-olds and above are charged the same as adults. You can buy a <p style="display: inline-block;">Children under 8 years old enter free; 8-year-olds and above are charged the same as adults. You can buy a ticket for your child under 8 if you would like her or him to enjoy the same provision.</p>
ticket for your child under 8 if you would like her or him to enjoy the same provision.</p>
<div class="payonline_price">Total price: <strong id="totalPriceText">$122</strong></div> <div class="payonline_price">Total price: <strong id="totalPriceText">$122</strong></div>
<p style="margin-top: 50px;"><strong>Please provide correct personal information for your ticket <p style="margin-top: 50px;"><strong>Please provide correct personal information for your ticket
booking. Double booking. Double
check.</strong></p> check.</strong></p>
<input class="FullName" id="ticket_realname" name="fullname" <input class="FullName" id="ticket_realname" name="fullname"
placeholder="Your name * (exactly as in your passport)" required="" type="text" value="" /> placeholder="Your name * (exactly as in your passport)" required="" type="text" value="" />
<div id="ticket_realname_errmsg" style="display: none"> <div id="ticket_realname_errmsg" style="display: none">
@ -348,10 +381,10 @@ B. Customers who <a href="/contact-us">reserve both the ticket and the hotel</a>
<div id="ticket_contact_errmsg" style="display: none"> <div id="ticket_contact_errmsg" style="display: none">
<div class="requiredArea" style="margin-top:-10px;">Please enter your phone number.</div> <div class="requiredArea" style="margin-top:-10px;">Please enter your phone number.</div>
</div> </div>
<textarea name="other_travels_name" <textarea name="other_travelers_names" placeholder="For booking two/or more tickets, please fill in other traveler name(s) here: (per passport, e.g. Smith Sarah Jean)"></textarea>
placeholder="For booking two/or more tickets, please fill in other traveler name(s) here: (per passport, e.g. Smith Sarah Jean)"></textarea>
<textarea name="additional_requirements" <textarea name="additional_requirements"
placeholder="If you have other requirements such as hotel booking, customized guided tour, private transport, or a full tour package, please let us know .... (optional)"></textarea> placeholder="If you have other requirements such as hotel booking, customized guided tour, private transport, or a full tour package, please let us know .... (optional)"
></textarea>
<p style=" <p style="
margin-top: 0; margin-top: 0;
@ -359,56 +392,77 @@ B. Customers who <a href="/contact-us">reserve both the ticket and the hotel</a>
padding: 0; padding: 0;
">I prefer to be contacted via:</p> ">I prefer to be contacted via:</p>
<div class="checkYes"> <div class="checkYes">
<input type="checkbox" value="yes" name="contact_via_whatsapp" id="whatsapp" class="checkBorder"> <input type="checkbox" value="yes" name="contact_via_whatsapp" id="whatsapp" class="checkBorder" >
<label for="whatsapp">WhatsApp</label> <label for="whatsapp">WhatsApp</label>
</div> </div>
<div class="checkYes"> <div class="checkYes">
<input type="checkbox" value="yes" name="contact_via_iMessage" id="iMessage" class="checkBorder"> <input type="checkbox" value="yes" name="contact_via_iMessage" id="iMessage" class="checkBorder" >
<label for="iMessage">iMessage</label> <label for="iMessage">iMessage</label>
</div> </div>
<div class="checkYes"> <div class="checkYes">
<input type="checkbox" value="yes" name="contact_via_phone_call" id="Phone" class="checkBorder"> <input type="checkbox" value="yes" name="contact_via_phone_call" id="Phone" class="checkBorder" >
<label for="Phone">Phone call</label> <label for="Phone">Phone call</label>
</div> </div>
<div class="checkYes"> <div class="checkYes">
<input type="checkbox" value="yes" name="contact_via_email" id="Email" class="checkBorder"> <input type="checkbox" value="yes" name="contact_via_email" id="Email" class="checkBorder" >
<label for="Email">Email</label> <label for="Email">Email</label>
</div> </div>
<div class="checkYes"> <div class="checkYes">
<input type="checkbox" value="yes" name="contact_via_video_appointment" id="Video" class="checkBorder"> <input type="checkbox" value="yes" name="contact_via_video_appointment" id="Video" class="checkBorder" >
<label for="Video">Video appointment</label> <label for="Video">Video appointment</label>
</div> </div>
<input name="total_price" id="totalPriceHidden" type="hidden" value="10000" /> <input name="total_price" id="totalPriceHidden" type="hidden" value="10000" />
<input name="product_sn" id="product_sn" type="hidden" value="13949" /> <input name="product_code" id="cli_no" type="hidden" value="YDFW-AH"/>
<input name="product_code" id="cli_no" type="hidden" value="YDFW-AH" />
<input name="itinerary" type="hidden" value="<?php echo $information->ic_title; ?>" /> <input name="itinerary" type="hidden" value="<?php echo $information->ic_title; ?>" />
<button class="sendButton" id="submit_ticket_button" name="submit_ticket_form" type="button">Proceed to <button class="sendButton" id="submit_ticket_button" name="submit_ticket_form"
Payment</button> type="button">Proceed to Payment</button>
</form> </form>
</div> </div>
<script> <script>
function calcTotalPrice(ticketPrice, adultNumber) { function calcTotalPrice() {
var totalPrice = ticketPrice * adultNumber; var ticketTotalPrice = ticketPrice * adultNumberValue;
if (adultNumber >= 10) { if (adultNumberValue >= 10) {
totalPrice = totalPrice * 0.95; ticketTotalPrice = ticketTotalPrice * 0.95;
}
// 27 号 P 票,酒店 110 美金/间/夜
var hotelTotalPrice = 0;
if (selectedTicketDate === 'november27th' && selectedTicketType === 'Premium+Transfer+Dinner') {
hotelTotalPrice = 110 * hotelRoomValue * stayLengthValue;
}
var totalPrice = ticketTotalPrice + hotelTotalPrice;
if (!Number.isInteger(totalPrice)) {
totalPrice = totalPrice.toFixed(2);
} }
return totalPrice.toFixed(2); totalPriceText.innerText = '$' + totalPrice;
totalPriceHidden.value = totalPrice;
} }
var adultNumberNode = document.getElementById("adultNumberValue"); var adultNumberNode = document.getElementById("adultNumberValue");
var hotelRoomNode = document.getElementById("hotel_room");
var stayLengthNode = document.getElementById("stay_length");
var ticketTypeList = document.querySelectorAll("input[name='ticket_type']"); var ticketTypeList = document.querySelectorAll("input[name='ticket_type']");
var totalPriceText = document.getElementById("totalPriceText"); var totalPriceText = document.getElementById("totalPriceText");
var totalPriceHidden = document.getElementById("totalPriceHidden"); var totalPriceHidden = document.getElementById("totalPriceHidden");
var hotelChoiceBlock = document.getElementById("hotel_choice");
var adultNumberValue = parseInt(adultNumberNode.value); var adultNumberValue = parseInt(adultNumberNode.value);
var hotelRoomValue = parseInt(hotelRoomNode.value);
var stayLengthValue = parseInt(stayLengthNode.value);
var ticketPrice = 139; var ticketPrice = 139;
totalPriceHidden.value = ticketPrice * adultNumberValue; var selectedTicketDate = '';
totalPriceText.innerText = '$' + ticketPrice; var selectedTicketType = '';
calcTotalPrice();
for (var i = 0; i < ticketTypeList.length; i++) { for (var i = 0; i < ticketTypeList.length; i++) {
var ticketTypeNode = ticketTypeList[i]; var ticketTypeNode = ticketTypeList[i];
ticketTypeNode.addEventListener('click', function (event) { ticketTypeNode.addEventListener('click', function (event) {
var currentTarget = event.currentTarget; var currentTarget = event.currentTarget;
selectedTicketType = currentTarget.value;
var adultNumberValue = parseInt(adultNumberNode.value); var adultNumberValue = parseInt(adultNumberNode.value);
if (currentTarget.value === 'Premium+Transfer+Dinner') { if (currentTarget.value === 'Premium+Transfer+Dinner') {
ticketPrice = 199; ticketPrice = 199;
@ -417,9 +471,13 @@ B. Customers who <a href="/contact-us">reserve both the ticket and the hotel</a>
} else if (currentTarget.value === 'VIP+Transfer+Dinner') { } else if (currentTarget.value === 'VIP+Transfer+Dinner') {
ticketPrice = 179; ticketPrice = 179;
} }
var totalPrice = calcTotalPrice(ticketPrice, adultNumberValue);
totalPriceText.innerText = '$' + totalPrice; if (selectedTicketDate === 'november27th' && currentTarget.value === 'Premium+Transfer+Dinner') {
totalPriceHidden.value = totalPrice; hotelChoiceBlock.style.display = '';
} else {
hotelChoiceBlock.style.display = 'none';
}
calcTotalPrice();
}); });
} }
@ -428,6 +486,10 @@ B. Customers who <a href="/contact-us">reserve both the ticket and the hotel</a>
var vipTypePremium = document.getElementById("vip_type_premium"); var vipTypePremium = document.getElementById("vip_type_premium");
var ticketTypeStandard = document.getElementById("ticket_type_standard"); var ticketTypeStandard = document.getElementById("ticket_type_standard");
var premiumOption = document.getElementById("Premium");
var vipOption = document.getElementById("VIP");
var standardOption = document.getElementById("Standard");
var premiumTicketLeft = document.getElementById("premium_ticket_left"); var premiumTicketLeft = document.getElementById("premium_ticket_left");
var vipTicketLeft = document.getElementById("vip_ticket_left"); var vipTicketLeft = document.getElementById("vip_ticket_left");
var standardTicketLeft = document.getElementById("standard_ticket_left"); var standardTicketLeft = document.getElementById("standard_ticket_left");
@ -437,48 +499,83 @@ B. Customers who <a href="/contact-us">reserve both the ticket and the hotel</a>
var ticketDateNode = ticketDateList[i]; var ticketDateNode = ticketDateList[i];
ticketDateNode.addEventListener('click', function (event) { ticketDateNode.addEventListener('click', function (event) {
var currentTarget = event.currentTarget; var currentTarget = event.currentTarget;
selectedTicketDate = currentTarget.id;
if (currentTarget.id === 'november27th') { if (currentTarget.id === 'november27th') {
ticketTypePremium.style.display = 'none'; // ticketTypePremium.style.display = 'none';
ticketTypeStandard.style.display = 'none'; ticketTypeStandard.style.display = 'none';
// vipTypePremium.style.display = 'none'; // vipTypePremium.style.display = 'none';
// standardOption.disabled = true;
setNovember27thTicketLeft(); setNovember27thTicketLeft();
} else { } else { // november28th
ticketTypePremium.style.display = ''; // ticketTypePremium.style.display = '';
ticketTypeStandard.style.display = ''; ticketTypeStandard.style.display = '';
// vipTypePremium.style.display = ''; // vipTypePremium.style.display = '';
// standardOption.disabled = false;
setNovember28thTicketLeft(); setNovember28thTicketLeft();
} }
if (selectedTicketDate === 'november27th' && selectedTicketType === 'Premium+Transfer+Dinner') {
hotelChoiceBlock.style.display = '';
} else {
hotelChoiceBlock.style.display = 'none';
}
}); });
} }
function setNovember27thTicketLeft() { function setNovember27thTicketLeft() {
premiumTicketLeft.innerText = '0 left'; premiumTicketLeft.innerText = '30 left';
vipTicketLeft.innerText = '14 left'; vipTicketLeft.innerText = '14 left';
standardTicketLeft.innerText = '18 left'; standardTicketLeft.innerText = '0 left';
} }
function setNovember28thTicketLeft() { function setNovember28thTicketLeft() {
premiumTicketLeft.innerText = '90 left'; premiumTicketLeft.innerText = '35 left';
vipTicketLeft.innerText = '198 left'; vipTicketLeft.innerText = '198 left';
standardTicketLeft.innerText = '149 left'; standardTicketLeft.innerText = '149 left';
} }
var plusButton = document.getElementById("plusButton"); var plusButton = document.getElementById("plusButton");
var minusButton = document.getElementById("minusButton"); var minusButton = document.getElementById("minusButton");
plusButton.addEventListener('click', function (event) { plusButton.addEventListener('click', function (event) {
var adultNumberValue = parseInt(adultNumberNode.value) + 1; adultNumberValue = parseInt(adultNumberNode.value) + 1;
adultNumberNode.value = adultNumberValue; adultNumberNode.value = adultNumberValue;
var totalPrice = calcTotalPrice(ticketPrice, adultNumberValue); calcTotalPrice();
totalPriceText.innerText = '$' + totalPrice;
totalPriceHidden.value = totalPrice;
}); });
minusButton.addEventListener('click', function (event) { minusButton.addEventListener('click', function (event) {
var beforeValue = parseInt(adultNumberNode.value); var beforeValue = parseInt(adultNumberNode.value);
if (beforeValue > 1) { if (beforeValue > 1) {
var adultNumberValue = beforeValue - 1; adultNumberValue = beforeValue - 1;
adultNumberNode.value = adultNumberValue; adultNumberNode.value = adultNumberValue;
var totalPrice = calcTotalPrice(ticketPrice, adultNumberValue); calcTotalPrice();
totalPriceText.innerText = '$' + totalPrice; }
totalPriceHidden.value = totalPrice; });
var plusRoomBtn = document.getElementById("plusRoomBtn");
var minusRoomBtn = document.getElementById("minusRoomBtn");
var plusStayBtn = document.getElementById("plusStayBtn");
var minusStayBtn = document.getElementById("minusStayBtn");
plusRoomBtn.addEventListener('click', function (event) {
hotelRoomValue = parseInt(hotelRoomNode.value) + 1;
hotelRoomNode.value = hotelRoomValue;
calcTotalPrice();
});
minusRoomBtn.addEventListener('click', function (event) {
var beforeValue = parseInt(hotelRoomNode.value);
if (beforeValue > 1) {
hotelRoomValue = beforeValue - 1;
hotelRoomNode.value = hotelRoomValue;
calcTotalPrice();
}
});
plusStayBtn.addEventListener('click', function (event) {
stayLengthValue = parseInt(stayLengthNode.value) + 1;
stayLengthNode.value = stayLengthValue;
calcTotalPrice();
});
minusStayBtn.addEventListener('click', function (event) {
var beforeValue = parseInt(stayLengthNode.value);
if (beforeValue > 1) {
stayLengthValue = beforeValue - 1;
stayLengthNode.value = stayLengthValue;
calcTotalPrice();
} }
}); });
</script> </script>
@ -543,3 +640,4 @@ B. Customers who <a href="/contact-us">reserve both the ticket and the hotel</a>
return result; return result;
} }
</script> </script>
<!--AH-Lantern-From-Info-->

@ -1,6 +1,12 @@
<!--AH-Lantern-Form-->
<script src="https://www.recaptcha.net/recaptcha/enterprise.js?render=6Lf828MhAAAAANNetijCXKwW5ARyhcJ-b1Hhslja"></script> <script src="https://www.recaptcha.net/recaptcha/enterprise.js?render=6Lf828MhAAAAANNetijCXKwW5ARyhcJ-b1Hhslja"></script>
<div class="tmbottom"> <div class="tmbottom">
<h3 style="font-size: 24px; line-height: 22px;">Chiang Mai CAD Yi Peng Festival 2023 - Secure Your Exclusive Tickets Before They're Gone!</h3> <h3 style="font-size: 24px; line-height: 22px;">Chiang Mai CAD Yi Peng Festival 2023 - Secure Your Exclusive Tickets Before They're Gone!</h3>
<p><strong>SPECIAL NOTE:</strong><br>
1. We have exclusive, reserved premium tickets available for customers who reserve both the ticket and the hotel. <br>
2. Regardless of the quantity of tickets required, a minimum of one night's stay in one room at <strong><em>Novotel Chiang Mai (4 star)</em></strong> or <strong><em>Smile Lanna Hotel (4.5 star)</em></strong> between November 26th and 29th is required.<br>
3. Superior room of Novotel Chiang Mai or deluxe room of Smile Lanna Hotel, both at <strong><em>US$110 per room per night</em></strong>, which includes breakfast and tax.
</p>
<form id='ticket_form' action="https://www.asiahighlights.com/orders/lantern_save" method="post" > <form id='ticket_form' action="https://www.asiahighlights.com/orders/lantern_save" method="post" >
<p style=" font-size: 22px;"><strong>Select Date</strong></p> <p style=" font-size: 22px;"><strong>Select Date</strong></p>
<div class="selectHotl" style="margin-bottom: 20px;"> <div class="selectHotl" style="margin-bottom: 20px;">
@ -51,12 +57,43 @@
</label> </label>
</div> </div>
</div> </div>
<p style="display: inline-block;">The standard ticket for the 27th has been sold out.</p> <div id="hotel_choice" style="display: none">
<p style="display: inline-block;"><strong>Premium ticket booking for the 27th is now closed.</strong> However, we have exclusive reserved tickets available for the following customers:<br> <p style="font-size: 22px;"><strong>What's your hotel choice?</strong></p>
A. Customers who <a href="/thailand/tours/lantern-festival">book our Lantern Festival Tour</a>. <br> <div class="selectHotl" style="margin-bottom: 20px;">
B. Customers who <a href="/contact-us">reserve both the ticket and the hotel</a>. A minimum of one night's stay at Novotel Chiang Mai between November 26th and 29th is required. We offer a competitive price of US$100 per room per night, which includes breakfast and tax. <div class="optionLable">
</p> <input type="radio" value="Novotel Chiang Mai" id="Novotel" name="hotel" checked>
<p style=" font-size: 22px;"><strong>Select Quantity</strong></p> <label for="Novotel">
Novotel Chiang Mai (4 star)
<div>superior room with balcony</div>
</label>
</div>
<div class="optionLable">
<input type="radio" value="Smile Lanna Hotel" id="Lanna" name="hotel">
<label for="Lanna">
Smile Lanna Hotel (4.5 star)
<div>deluxe room</div>
</label>
</div>
</div>
<div class="peopleSelect" style="width: auto;">
<span class="formMemo">
Select the Number of Hotel Rooms and Length of Stay
</span>
<div class="numberBtn">
<input class="minaddBtn reduce_room" id='minusRoomBtn' type="button" value="-">
<input class="number" id="hotel_room" readonly="readonly" type="text" value="1" name="hotelrooms">
<input class="minaddBtn add_room" id='plusRoomBtn' type="button" value="+">
</div>
<div class="numberBtn">
<input class="minaddBtn reduce_stay" id='minusStayBtn' type="button" value="-">
<input class="number" id="stay_length" readonly="readonly" type="text" value="1" name="hotelstay">
<input class="minaddBtn add_stay" id='plusStayBtn' type="button" value="+">
</div>
</div>
</div>
<p style="font-size: 22px;"><strong>Select Quantity</strong></p>
<div class="peopleSelect" style="width: auto;"> <div class="peopleSelect" style="width: auto;">
<span class="formMemo"> <span class="formMemo">
Adults and older children (8+ years old) Adults and older children (8+ years old)
@ -385,26 +422,47 @@ B. Customers who <a href="/contact-us">reserve both the ticket and the hotel</a>
</form> </form>
</div> </div>
<script> <script>
function calcTotalPrice(ticketPrice, adultNumber) { function calcTotalPrice() {
var totalPrice = ticketPrice * adultNumber; var ticketTotalPrice = ticketPrice * adultNumberValue;
if (adultNumber >= 10) { if (adultNumberValue >= 10) {
totalPrice = totalPrice * 0.95; ticketTotalPrice = ticketTotalPrice * 0.95;
}
// 27 号 P 票,酒店 110 美金/间/夜
var hotelTotalPrice = 0;
if (selectedTicketDate === 'november27th' && selectedTicketType === 'Premium+Transfer+Dinner') {
hotelTotalPrice = 110 * hotelRoomValue * stayLengthValue;
} }
return totalPrice.toFixed(2); var totalPrice = ticketTotalPrice + hotelTotalPrice;
if (!Number.isInteger(totalPrice)) {
totalPrice = totalPrice.toFixed(2);
}
totalPriceText.innerText = '$' + totalPrice;
totalPriceHidden.value = totalPrice;
} }
var adultNumberNode = document.getElementById("adultNumberValue"); var adultNumberNode = document.getElementById("adultNumberValue");
var hotelRoomNode = document.getElementById("hotel_room");
var stayLengthNode = document.getElementById("stay_length");
var ticketTypeList = document.querySelectorAll("input[name='ticket_type']"); var ticketTypeList = document.querySelectorAll("input[name='ticket_type']");
var totalPriceText = document.getElementById("totalPriceText"); var totalPriceText = document.getElementById("totalPriceText");
var totalPriceHidden = document.getElementById("totalPriceHidden"); var totalPriceHidden = document.getElementById("totalPriceHidden");
var hotelChoiceBlock = document.getElementById("hotel_choice");
var adultNumberValue = parseInt(adultNumberNode.value); var adultNumberValue = parseInt(adultNumberNode.value);
var hotelRoomValue = parseInt(hotelRoomNode.value);
var stayLengthValue = parseInt(stayLengthNode.value);
var ticketPrice = 139; var ticketPrice = 139;
totalPriceHidden.value = ticketPrice * adultNumberValue; var selectedTicketDate = '';
totalPriceText.innerText = '$' + ticketPrice; var selectedTicketType = '';
calcTotalPrice();
for (var i = 0; i < ticketTypeList.length; i++) { for (var i = 0; i < ticketTypeList.length; i++) {
var ticketTypeNode = ticketTypeList[i]; var ticketTypeNode = ticketTypeList[i];
ticketTypeNode.addEventListener('click', function (event) { ticketTypeNode.addEventListener('click', function (event) {
var currentTarget = event.currentTarget; var currentTarget = event.currentTarget;
selectedTicketType = currentTarget.value;
var adultNumberValue = parseInt(adultNumberNode.value); var adultNumberValue = parseInt(adultNumberNode.value);
if (currentTarget.value === 'Premium+Transfer+Dinner') { if (currentTarget.value === 'Premium+Transfer+Dinner') {
ticketPrice = 199; ticketPrice = 199;
@ -413,9 +471,13 @@ B. Customers who <a href="/contact-us">reserve both the ticket and the hotel</a>
} else if (currentTarget.value === 'VIP+Transfer+Dinner') { } else if (currentTarget.value === 'VIP+Transfer+Dinner') {
ticketPrice = 179; ticketPrice = 179;
} }
var totalPrice = calcTotalPrice(ticketPrice, adultNumberValue);
totalPriceText.innerText = '$' + totalPrice; if (selectedTicketDate === 'november27th' && currentTarget.value === 'Premium+Transfer+Dinner') {
totalPriceHidden.value = totalPrice; hotelChoiceBlock.style.display = '';
} else {
hotelChoiceBlock.style.display = 'none';
}
calcTotalPrice();
}); });
} }
@ -437,50 +499,83 @@ B. Customers who <a href="/contact-us">reserve both the ticket and the hotel</a>
var ticketDateNode = ticketDateList[i]; var ticketDateNode = ticketDateList[i];
ticketDateNode.addEventListener('click', function (event) { ticketDateNode.addEventListener('click', function (event) {
var currentTarget = event.currentTarget; var currentTarget = event.currentTarget;
selectedTicketDate = currentTarget.id;
if (currentTarget.id === 'november27th') { if (currentTarget.id === 'november27th') {
ticketTypePremium.style.display = 'none'; // ticketTypePremium.style.display = 'none';
ticketTypeStandard.style.display = 'none'; ticketTypeStandard.style.display = 'none';
// vipTypePremium.style.display = 'none'; // vipTypePremium.style.display = 'none';
// standardOption.disabled = true; // standardOption.disabled = true;
setNovember27thTicketLeft(); setNovember27thTicketLeft();
} else { // november28th } else { // november28th
ticketTypePremium.style.display = ''; // ticketTypePremium.style.display = '';
ticketTypeStandard.style.display = ''; ticketTypeStandard.style.display = '';
// vipTypePremium.style.display = ''; // vipTypePremium.style.display = '';
// standardOption.disabled = false; // standardOption.disabled = false;
setNovember28thTicketLeft(); setNovember28thTicketLeft();
} }
if (selectedTicketDate === 'november27th' && selectedTicketType === 'Premium+Transfer+Dinner') {
hotelChoiceBlock.style.display = '';
} else {
hotelChoiceBlock.style.display = 'none';
}
}); });
} }
function setNovember27thTicketLeft() { function setNovember27thTicketLeft() {
premiumTicketLeft.innerText = '0 left'; premiumTicketLeft.innerText = '30 left';
vipTicketLeft.innerText = '14 left'; vipTicketLeft.innerText = '14 left';
standardTicketLeft.innerText = '0 left'; standardTicketLeft.innerText = '0 left';
} }
function setNovember28thTicketLeft() { function setNovember28thTicketLeft() {
premiumTicketLeft.innerText = '90 left'; premiumTicketLeft.innerText = '35 left';
vipTicketLeft.innerText = '198 left'; vipTicketLeft.innerText = '198 left';
standardTicketLeft.innerText = '149 left'; standardTicketLeft.innerText = '149 left';
} }
var plusButton = document.getElementById("plusButton"); var plusButton = document.getElementById("plusButton");
var minusButton = document.getElementById("minusButton"); var minusButton = document.getElementById("minusButton");
plusButton.addEventListener('click', function (event) { plusButton.addEventListener('click', function (event) {
var adultNumberValue = parseInt(adultNumberNode.value) + 1; adultNumberValue = parseInt(adultNumberNode.value) + 1;
adultNumberNode.value = adultNumberValue; adultNumberNode.value = adultNumberValue;
var totalPrice = calcTotalPrice(ticketPrice, adultNumberValue); calcTotalPrice();
totalPriceText.innerText = '$' + totalPrice;
totalPriceHidden.value = totalPrice;
}); });
minusButton.addEventListener('click', function (event) { minusButton.addEventListener('click', function (event) {
var beforeValue = parseInt(adultNumberNode.value); var beforeValue = parseInt(adultNumberNode.value);
if (beforeValue > 1) { if (beforeValue > 1) {
var adultNumberValue = beforeValue - 1; adultNumberValue = beforeValue - 1;
adultNumberNode.value = adultNumberValue; adultNumberNode.value = adultNumberValue;
var totalPrice = calcTotalPrice(ticketPrice, adultNumberValue); calcTotalPrice();
totalPriceText.innerText = '$' + totalPrice; }
totalPriceHidden.value = totalPrice; });
var plusRoomBtn = document.getElementById("plusRoomBtn");
var minusRoomBtn = document.getElementById("minusRoomBtn");
var plusStayBtn = document.getElementById("plusStayBtn");
var minusStayBtn = document.getElementById("minusStayBtn");
plusRoomBtn.addEventListener('click', function (event) {
hotelRoomValue = parseInt(hotelRoomNode.value) + 1;
hotelRoomNode.value = hotelRoomValue;
calcTotalPrice();
});
minusRoomBtn.addEventListener('click', function (event) {
var beforeValue = parseInt(hotelRoomNode.value);
if (beforeValue > 1) {
hotelRoomValue = beforeValue - 1;
hotelRoomNode.value = hotelRoomValue;
calcTotalPrice();
}
});
plusStayBtn.addEventListener('click', function (event) {
stayLengthValue = parseInt(stayLengthNode.value) + 1;
stayLengthNode.value = stayLengthValue;
calcTotalPrice();
});
minusStayBtn.addEventListener('click', function (event) {
var beforeValue = parseInt(stayLengthNode.value);
if (beforeValue > 1) {
stayLengthValue = beforeValue - 1;
stayLengthNode.value = stayLengthValue;
calcTotalPrice();
} }
}); });
</script> </script>
@ -545,3 +640,4 @@ B. Customers who <a href="/contact-us">reserve both the ticket and the hotel</a>
return result; return result;
} }
</script> </script>
<!--AH-Lantern-From-->
Loading…
Cancel
Save