|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- //提交按钮切换,1为乐园门票,2为剧场门票
- var submit_cut = 1;
- 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("年")
- var thisdata = yearmonth[0]+"年"+yearmonth[1]+"月"+seldate+"日";
- thisdata2 = yearmonth[0]+"-"+yearmonth[1]+"-"+seldate;
- $(".sel_date").html(thisdata);
- $(".month").hide();
- $(".asell_list").show();
- $(".weui_toast").show();
- $("#loadingToast").show();
-
- $.ajax({
- url:'./zz-fx/control.php', //请求地址
- type: "post", //请求方式
- data:{
- type:"distribut_Disney",
- get_tic:thisdata2
- },
- async:true,
- dataType: "json",
- success: function (data) {
- $("#loadingToast").hide();
- console.log(data);
- if(data.code == 0){
- $(".weui_toast").hide();
- $.each(data.info,function(k,v){
- num = k++;
- $('#B'+k+'').text("余票"+v+"张");
- })
- $.each(data.price,function(k,v){
- num = k++;
- $('#prices'+k+'').text(+v+"元");
- })
-
- }else if(data.code == 1){
-
- 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 adult = $("#adult").val();
- var Children = $("#Children").val();
- var Old = $("#Old").val();
-
- var adult2 = $("#adult2").val();
- var Children2 = $("#Children2").val();
- var Old2 = $("#Old2").val();
-
- var total_price = (parseInt(adult)*parseInt($("#prices1").text()))+(parseInt(Children)*parseInt($("#prices2").text()))+(parseInt(Old)*parseInt($("#prices3").text()))+(parseInt(adult2)*parseInt($("#prices4").text()))+(parseInt(Children2)*parseInt($("#prices5").text()))+(parseInt(Old2)*parseInt($("#prices6").text()));
- $("#price").text("¥"+total_price);
- }
-
-
- $("#submit").click(function(){
- var adult = $("#adult").val();
- var Children = $("#Children").val();
- var Old = $("#Old").val();
-
- var adult2 = $("#adult2").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(thisdata2==""){
- 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;
- };
- $("#loadingToast").show();
- $(".weui_toast").show();
- $.ajax({
- url:'./zz-fx/control.php', //请求地址
- type: "post",//请求方式
- async:true,
- data:{
- type:"distribut_Disney",
- date_time:thisdata2,
- 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
- },
- dataType: "json",
- success: function (data) {
- console.log(data);
- $("#loadingToast").hide();
- $(".weui_toast").hide();
- 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) {
-
- // 此处放失败后执行的代码
- }
- });
- })
|