|
- //提交按钮切换,1为乐园门票,2为剧场门票
- var submit_cut = 1;
- var lion_time = "";
-
- window.onload = function(){
- iflogin();
- $('.date-picker').datepicker({autoclose:true}).next().on("click", function(){$(this).prev().focus();});
- $('#timepicker1').timepicker({minuteStep: 1,showSeconds: false,showMeridian: false}).next().on("click", function(){$(this).prev().focus();});
- var cutId = getStorage("cutId")
- if(cutId==3){
- $("#cutid3").css("background-color","#000000")
- }
- }
-
- function cut_botton(index){
- if(index==1){
- $("#cut_top").children().removeClass("cut_sub");
- $("#cut1").addClass("cut_sub");
- $("#ticket1").removeAttr("style");
- $("#ticket2").css("display","none");
- submit_cut = 1;
- }else if(index==2){
- $("#cut_top").children().removeClass("cut_sub");
- $("#cut2").addClass("cut_sub");
- $("#ticket2").removeAttr("style");
- $("#ticket1").css("display","none");
- submit_cut = 2;
- }
-
- }
-
- //选择日期按钮
- $("#lion_date").change(function(){
- lion_time = "";
- var weekday = new Date($("#lion_date").val()).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) {
-
- // 此处放失败后执行的代码
- }
- });
-
- })
- function createHtml(data){
- var temp = "";
- for(var i=0;i<data.length;i++){
- temp += '<span class="change_date2">'+data[i]+'</span>'
- }
- $("#show_time").html(temp);
-
- //选择时间
- $(".change_date2").click(function(){
- lion_time = $(this).text();
- $("#show_time").children().css("background-color","#FFF");
- $(this).css("background-color","#E0E0E0");
-
-
- })
- }
-
-
- $(".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);
- }
- }else{
- var num = $(this).siblings("input").val();
- $(this).siblings("input").val(++num);
- }
-
-
-
- })
- $(".cut").on("click",function(){
- var num = parseInt($(this).siblings("input").val());
- if(num==0){
-
-
- }else{
- $(this).siblings("input").val(--num);
- }
-
- })
-
-
- //提交订单
- $("#submit").click(function(){
- if(submit_cut==1){
- var sub_date = $("#start_time").val();
- var adult = $("#D").val();
- var Children = $("#Children").val();
- var Old = $("#Old").val();
-
- var adult2 = $("#D2").val();
- var Children2 = $("#Children2").val();
- var Old2 = $("#Old2").val();
-
- var sub_name = $("#sub_name").val();
- var sub_phone = $("#sub_phone").val();
- var customer_type = $("#customer_type").val();
- var customer_id = $("#customer_id").val();
-
- var phoneRe =/^1[3|4|5|7|8]\d{9}$/;
-
- var ticket_add = parseInt(adult)+parseInt(Children)+parseInt(Old)+parseInt(adult2)+parseInt(Children2)+parseInt(Old2);
- if(sub_date==""){
- window.wxc.xcConfirm("请输入日期", window.wxc.xcConfirm.typeEnum.info);
- return false;
- }else if(ticket_add>5){
- window.wxc.xcConfirm("购票不能超过5张", window.wxc.xcConfirm.typeEnum.info);
- return false;
- }else if(ticket_add<=0){
- window.wxc.xcConfirm("请选择门票", window.wxc.xcConfirm.typeEnum.info);
- return false;
- }else if(sub_name==""){
- window.wxc.xcConfirm("请输入姓名", window.wxc.xcConfirm.typeEnum.info);
- return false;
- }else if(sub_phone == "") {
- window.wxc.xcConfirm("请输入手机号", window.wxc.xcConfirm.typeEnum.info);
- return false;
- }else if(!phoneRe.test(sub_phone)){
- window.wxc.xcConfirm("请输入正确的手机号", window.wxc.xcConfirm.typeEnum.info);
- return false;
- }else if(customer_id==""){
- window.wxc.xcConfirm("请输入证件号", window.wxc.xcConfirm.typeEnum.info);
- return false;
- };
- $.ajax({
- url:'./zz-fx/control.php', //请求地址
- type: "post", //请求方式
- data:{
- type:"distribut_Disney",
- date_time:sub_date,
- customer_name:sub_name,
- customer_phone:sub_phone,
- customer_id_type:customer_type,
- customer_id:customer_id,
- D:adult,
- O:Old,
- C:Children,
- D2:adult2,
- O2:Old2,
- C2:Children2
- },
- async:false,
- dataType: "json",
- success: function (data) {
- console.log(data);
- if(data.code == 0){
- disney_success(data.list);
-
- }else if(data.code == -1){
-
-
- }
- },
- fail: function (date) {
-
- // 此处放失败后执行的代码
- }
- });
-
- }else if(submit_cut==2){
- var lion_date = $("#lion_date").val();
- 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(lion_date==""){
- window.wxc.xcConfirm("请输入日期", window.wxc.xcConfirm.typeEnum.info);
- return false;
- }else if(lion_time==""){
- window.wxc.xcConfirm("请选择时间", window.wxc.xcConfirm.typeEnum.info);
- return false;
- }else if(lion_add<=0){
- window.wxc.xcConfirm("请选择门票", window.wxc.xcConfirm.typeEnum.info);
- return false;
- }else if(lion_name==""){
- window.wxc.xcConfirm("请输入姓名", window.wxc.xcConfirm.typeEnum.info);
- return false;
- }else if(lion_phone == "") {
- window.wxc.xcConfirm("请输入手机号", window.wxc.xcConfirm.typeEnum.info);
- return false;
- }else if(!lion_phoneRe.test(lion_phone)){
- window.wxc.xcConfirm("请输入正确的手机号", window.wxc.xcConfirm.typeEnum.info);
- return false;
- };
- $.ajax({
- url:'./zz-fx/control.php', //请求地址
- type: "post", //请求方式
- data:{
- type:"distribut_Theater",
- date_time:lion_date,
- time:lion_time,
- customer_name:lion_name,
- customer_phone:lion_phone,
- AA:AA,
- AB:AB,
- BA:BA,
- BB:BB,
- CA:CA,
- CB:CB
- },
- async:false,
- dataType: "json",
- success: function (data) {
- console.log(data);
- if(data.code == 0){
- disney_success(data.list);
-
- }else if(data.code == -1){
-
-
- }
- },
- fail: function (date) {
-
- // 此处放失败后执行的代码
- }
- });
-
- }
-
-
-
-
- })
- function disney_success(data){
- $("#ticket_name").text(data.type);
- $("#ticket_time").text("时间:"+data.date);
- $("#ticket_no").text("数量:"+data.desc);
- $("#man_name").text("姓名:"+data.name);
- $("#man_phone").text("手机:"+data.phone);
- $("#total_price").text("订单总额:"+data.price+"元");
- $("#alert_1").removeAttr("style");
-
- }
- function close_alert(){
- $("#alert_1").css("display","none");
- window.location.href="disney_ticket.html";
- }
-
- function getbig(){
- $(".alert_picture").removeAttr("style");
- }
- function getsmall(){
- $(".alert_picture").css("display","none");
- }
|