|
- //提交按钮切换,1为乐园门票,2为剧场门票
- var submit_cut = 3;
- var lion_time = "";
- var order_from_id = '-1';
-
- window.onload = function(){
- $('.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();});
-
- $.ajax({
- url:'./zz-fx/Model/zhouvilige.php', //请求地址
- type: "post", //请求方式
- data:{
- price:1
- },
- async:true,
- dataType: "json",
- success: function (data) {
- console.log(data);
- if(data.code == 0){
- $('#zhouzhuangprice').html(data.price+'元');
- }
- }
- });
- $(".filter-item").click(function() {
- order_from_id = $(this).val();
- });
- }
-
- function cut_botton(index){
- if(index==1){
- $("#cut_top").children().removeClass("cut_sub");
- $("#cut1").addClass("cut_sub");
- $("#ticket1").removeAttr("style");
- $("#ticket2").css("display","none");
- $("#ticket3").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");
- $("#ticket3").css("display","none");
- submit_cut = 2;
- }else if(index==3){
- $("#cut_top").children().removeClass("cut_sub");
- $("#cut3").addClass("cut_sub");
- $("#ticket3").removeAttr("style");
- $("#ticket1").css("display","none");
- $("#ticket2").css("display","none");
- submit_cut = 3;
- }
-
- }
-
- //选择日期按钮
- $("#start_time").change(function(){
- $('#loading').show();
- d_ticket()
-
-
- })
-
- function d_ticket(){
- start_time = "";
- var weekday = $("#start_time").val();
- $.ajax({
- url:'./zz-fx/control.php', //请求地址
- type: "post", //请求方式
- data:{
- type:"distribut_Disney",
- get_tic:weekday
- },
- async:true,
- dataType: "json",
- success: function (data) {
-
- console.log(data);
- if(data.code == 0){
- $('#loading').hide();
- $.each(data.info,function(k,v){
- num = k++;
- $('#B'+k+'').html(" 余票"+v+"张");
- })
- $.each(data.price,function(k,v){
- num = k++;
- $('#prices'+k+'').text(v+"元");
- })
-
- }else if(data.code == 1){
- $('#loading').hide();
- swal(
- '订单录入失败',
- data.info,
- 'error'
- );
- }
- },
- fail: function (date) {
- $('#loading').hide();
- // 此处放失败后执行的代码
- }
- });
- }
-
- //选择日期按钮
- $("#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();
- swal(
- '获取票源信息失败',
- data.info,
- 'error'
- );
- }
- },
- 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");
-
-
- })
- }
-
- //狮子王门票余量获取
-
- //选择日期按钮
- $("#show_time").click(function(){
- $('#loading').show();
- lionticket()
-
-
- })
-
- function lionticket(){
- var weekday =$("#lion_date").val();
-
- $.ajax({
- url:'./zz-fx/control.php', //请求地址
- type: "post", //请求方式
- data:{
- type:"distribut_Theater",
- get_tic:weekday,
- time :lion_time
-
- },
- async:true,
- dataType: "json",
- success: function (data) {
- $('#loading').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);
- }
- }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){
- $("#submit").text("提交中...");
- submit_disney()
-
-
-
- }else if(submit_cut==2){
- $("#submit").text("提交中...");
- submit_lion()
- }else if (submit_cut == 3) {
- $("#submit").text("提交中...");
- submit_zhouzhuang();
- }
-
-
-
-
- })
-
- function submit_disney(){
- var outside_no = $("#outside_no").val();
- var outside_org_id = order_from_id;
- 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==""){
- alert("请输入日期");
- return false;
- }else if(ticket_add>5){
- alert("购票不能超过5张");
- return false;
- }else if(ticket_add<=0){
- alert("请选择门票");
- return false;
- }else if(sub_name==""){
- alert("请输入姓名");
- return false;
- }else if(sub_phone == "") {
- alert("请输入手机号");
- return false;
- }else if(!phoneRe.test(sub_phone)){
- alert("请输入正确的手机号");
- return false;
- }else if(customer_id==""){
- alert("请输入证件号");
- 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,
- outside_no:outside_no,
- outside_org_id:outside_org_id,
- D:adult,
- O:Old,
- C:Children,
- D2:adult2,
- O2:Old2,
- C2:Children2
- },
- async:true,
- dataType: "json",
- success: function (data) {
- $("#submit").text("提交")
- console.log(data);
- if(data.code == 0){
- disney_success(data.list);
-
- }else{
-
- alert(data.info);
- }
- },
- fail: function (date) {
-
- // 此处放失败后执行的代码
- }
- });
- }
- function submit_lion(){
- var outside_no = $("#outside_no").val();
- var outside_org_id = order_from_id;
-
- 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==""){
- 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;
- };
-
-
- $.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,
- outside_no:outside_no,
- outside_org_id:outside_org_id,
- AA:AA,
- AB:AB,
- BA:BA,
- BB:BB,
- CA:CA,
- CB:CB
- },
- async:true,
- dataType: "json",
- success: function (data) {
- $('#loading').hide();
- console.log(data);
- if(data.code == 0){
- $("#submit").text("提交")
- disney_success(data.list);
-
- }else{
- $("#submit").text("提交")
- //alert(data.info, window.wxc.xcConfirm.typeEnum.info);
- alert(data.info);
- }
- },
- fail: function (date) {
- $("#submit").text("提交")
- // 此处放失败后执行的代码
- }
- });
- }
-
-
- function submit_zhouzhuang(){
- var outside_no = $("#outside_no").val();
- var outside_org_id = order_from_id;
- var lion_date = $("#start_datezhou").val();
- var AA = $("#zhouzhuangval").val();
-
- var lion_name = $("#sub_name_z").val();
- var lion_phone = $("#sub_phone_z").val();
- var lion_phoneRe =/^1[3|4|5|7|8]\d{9}$/;
- var lion_add = parseInt(AA);
- var card_style = $('#customer_type_z').val();
- var card_id = $('#customer_id_z').val();
-
- if(lion_date==""){
- 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;
- }else if (lion_add>20) {
- alert('购买上线不能超过20张');
- return false;
- }else if (card_id == "") {
- alert('请输入证件号码!');
- return false;
- }
-
-
- $.ajax({
- url:'./zz-fx/Model/zhouvilige.php', //请求地址
- type: "post", //请求方式
- data:{
- date_time:lion_date,
- customer_name:lion_name,
- customer_phone:lion_phone,
- customer_id_type:card_style,
- customer_id:card_id,
- outside_no:outside_no,
- outside_org_id:outside_org_id,
- tic:AA
- },
- async:true,
- dataType: "json",
- success: function (data) {
- $('#loading').hide();
- console.log(data);
- if(data.code == 0){
- $("#submit").text("提交")
- disney_success(data.list);
-
- }else{
- $("#submit").text("提交")
- alert(data.info);
- }
- },
- fail: function (date) {
- $("#submit").text("提交")
- }
- });
- }
-
-
- 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="./des_order_list.html";
- }
-
- function getbig(){
- $(".alert_picture").removeAttr("style");
- }
- function getsmall(){
- $(".alert_picture").css("display","none");
- }
|