|
-
- //提交按钮切换,1为乐园门票,2为剧场门票
- var submit_cut = 2;
- var lion_time = "";
- var thisdata ="";
- var thisdata2 ="";
- var login_data = getStorJson("login_data");
- //选择日期
- $(document).ready(function(){
- var tomonth = new Date();
- $(".sel_goback").on("click",function(){
- addmouth($(".month"),tomonth.getFullYear(),tomonth.getMonth());
- $(".content").show();
- $(".month").show();
- $(".asell_list").hide();
- selectDate();
- });
-
-
-
- })
-
- function selectDate(){
- $(".canday").on("click",function(){
- if($(this).html()=="今天"){
- var seldate = new Date().getDate();
- }else{
- var seldate =$(this).html();
- }
- var yearmonth = $(".currentdate").html().split("年")
- thisdata = yearmonth[0]+"年"+yearmonth[1]+"月"+seldate+"日";
- thisdata2 = yearmonth[0]+"-"+yearmonth[1]+"-"+seldate;
- var weekday = new Date(thisdata2).getDay();
-
- $.ajax({
- url:'./zz-fx/control.php', //请求地址
- type: "post", //请求方式
- data:{
- type:"distribut_Theater",
- date_get:weekday
- },
- async:false,
- dataType: "json",
- success: function (data) {
- console.log(data);
- if(data.code == 0){
- createHtml(data.list);
-
- }else if(data.code == 1){
- $("#show_time").html();
- alert(data.info);
-
- }
- },
- fail: function (date) {
-
- // 此处放失败后执行的代码
- }
- });
- // $(".month").hide();
- // $(".content").hide();
- // $(".asell_list").show();
- // $("#loadingToast").show();
-
-
- })
- }
-
-
- //遍历时间
- function createHtml(data){
- var temp = "";
- for(var i=0;i<data.length;i++){
- temp += '<span class="ui_m_r10 sc-bg change_date2" style="padding: 0.05rem 0.1rem;">'+data[i]+'</span>'
- }
- $("#show_time").html(temp);
-
- //选择时间
- $(".change_date2").click(function(){
- lion_time = $(this).text();
- $("#show_time").children().css("background-color","#eee");
- $("#show_time").html("");
- // $(this).css("background-color","#58C9B9");
- $(".month").hide();
- $(".content").hide();
- $(".asell_list").show();
- $("#loadingToast").show();
- $(".sel_date").html(thisdata+'('+lion_time+')');
- //余票
- $.ajax({
- url:'./zz-fx/control.php', //请求地址
- type: "post", //请求方式
- data:{
- type:"distribut_Theater",
- get_tic:thisdata2,
- time :lion_time
-
- },
- dataType: "json",
- success: function (data) {
- $("#loadingToast").hide();
- console.log(data);
- if(data.code == 0){
- $.each(data.info,function(k,v){
- num = k++;
- $('#K'+k+'').html("余票"+v+"张");
- })
- $.each(data.price,function(k,v){
- num = k++;
- $('#lion_price'+k+'').text(v+"元");
- })
-
- }else if(data.code == 1){
- $("#show_time").html();
- alert(data.info);
-
- }
- },
- fail: function (date) {
-
- // 此处放失败后执行的代码
- }
- });
-
- })
- }
- //加减票
- $(".add").on("click",function(){
- var num =parseInt($(this).siblings("input").val());
- $.each($(".aticket"),function(){
- num += parseInt($(this).val());
- })
- if(submit_cut==1){
- if(num>=5){
- return;
- }else{
- var num = $(this).siblings("input").val();
- $(this).siblings("input").val(++num);
- total_price()
- }
- }else{
- var num = $(this).siblings("input").val();
- $(this).siblings("input").val(++num);
- total_price()
- }
-
-
-
- })
- $(".cut").on("click",function(){
- var num = parseInt($(this).siblings("input").val());
- if(num==0){
-
-
- }else{
- $(this).siblings("input").val(--num);
- total_price()
- }
-
- })
-
-
- function total_price(){
- var AA = $("#AA").val();
- var AB = $("#AB").val();
- var BA = $("#BA").val();
-
- var BB = $("#BB").val();
- var CA = $("#CA").val();
- var CB = $("#CB").val();
-
- var total_price = (parseInt(AA)*parseInt(1000))+(parseInt(AB)*parseInt(800))+(parseInt(BA)*parseInt(590))+(parseInt(BB)*parseInt(490))+(parseInt(CA)*parseInt(390))+(parseInt(CB)*parseInt(290));
- $("#price").text("¥"+total_price);
- }
-
-
- $("#submit").click(function(){
- var AA = $("#AA").val();
- var AB = $("#AB").val();
- var BA = $("#BA").val();
-
- var BB = $("#BB").val();
- var CA = $("#CA").val();
- var CB = $("#CB").val();
-
- var lion_name = $("#lion_name").val();
- var lion_phone = $("#lion_phone").val();
- var lion_phoneRe =/^1[3|4|5|7|8]\d{9}$/;
- var lion_add = parseInt(AA)+parseInt(AB)+parseInt(BA)+parseInt(BB)+parseInt(CA)+parseInt(CB);
-
- if(thisdata2==""){
- alert("请输入日期");
- return false;
- }else if(lion_time==""){
- alert("请选择时间");
- return false;
- }else if(lion_add<=0){
- alert("请选择门票");
- return false;
- }else if(lion_name==""){
- alert("请输入姓名");
- return false;
- }else if(lion_phone == "") {
- alert("请输入手机号");
- return false;
- }else if(!lion_phoneRe.test(lion_phone)){
- alert("请输入正确的手机号");
- return false;
- };
- $("#loadingToast").show();
-
- $.ajax({
- url:'./zz-fx/control.php', //请求地址
- type: "post", //请求方式
- data:{
- type:"distribut_Theater",
- date_time:thisdata2,
- time:lion_time,
- customer_name:lion_name,
- customer_phone:lion_phone,
- AA:AA,
- AB:AB,
- BA:BA,
- BB:BB,
- CA:CA,
- CB:CB
- },
- dataType: "json",
- success: function (data) {
- $("#loadingToast").show();
- console.log(data);
- if(data.code == 0){
- if(login_data.pay_status=="0"){
- setStorJson("resever_succsee",data.list);
- window.location.href="pay_order_disney.html";
- }else if(login_data.pay_status=="1"){
- setStorJson("resever_succsee",data.list);
- window.location.href="resever_success.html";
- }
-
-
- }else{
- alert(data.info);
- }
- },
- fail: function (date) {
- // 此处放失败后执行的代码
- }
- });
- })
|