From 3a998ccebb754eab56e8c163022a89f48c2dc360 Mon Sep 17 00:00:00 2001 From: Jimmy Liow <18777396951@163.com> Date: Mon, 28 Aug 2023 10:11:03 +0800 Subject: [PATCH] =?UTF-8?q?GP=20=E8=A1=A8=E5=8D=95=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=9C=A8=E7=BA=BF=E6=94=AF=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/views/mobile_first/ah-gp-form.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/application/views/mobile_first/ah-gp-form.php b/application/views/mobile_first/ah-gp-form.php index 9caca961..019708d0 100644 --- a/application/views/mobile_first/ah-gp-form.php +++ b/application/views/mobile_first/ah-gp-form.php @@ -356,6 +356,8 @@ + + @@ -399,6 +401,16 @@ var adultNumberValue = el('adultNumber').value; const plusAdultBtn = el('plusAdult'); const minusAdultBtn = el('minusAdult'); + const totalPriceHidden = el("totalPriceHidden"); + + function calcTotalPrice(ticketPrice, adultNumber) { + var totalPrice = ticketPrice * adultNumber; + if (adultNumber >= 10) { + totalPrice = totalPrice * 0.95; + } + + return totalPrice.toFixed(2); + } plusAdultBtn.on('click', () => { adultNumberValue++; @@ -453,6 +465,9 @@ const gp_form = el('gp_form'); submitFormBtn.on('click', () => { if (validateGPForm()) { + var ticketPrice = 300; + var totalPrice = calcTotalPrice(ticketPrice, adultNumberValue); + totalPriceHidden.value = totalPrice; if (typeof(grecaptcha) === "undefined") { console.warn('grecaptcha is disabled.');