Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 

210 рядки
5.4 KiB

  1. //提交按钮切换,1为乐园门票,2为剧场门票
  2. var submit_cut = 1;
  3. var thisdata ="";
  4. var thisdata2 ="";
  5. var login_data = getStorJson("login_data");
  6. //选择日期
  7. $(document).ready(function(){
  8. var tomonth = new Date();
  9. $(".sel_goback").on("click",function(){
  10. addmouth($(".month"),tomonth.getFullYear(),tomonth.getMonth());
  11. $(".content").show();
  12. $(".month").show();
  13. $(".asell_list").hide();
  14. selectDate();
  15. });
  16. })
  17. function selectDate(){
  18. $(".canday").on("click",function(){
  19. if($(this).html()=="今天"){
  20. var seldate = new Date().getDate();
  21. }else{
  22. var seldate =$(this).html();
  23. }
  24. var yearmonth = $(".currentdate").html().split("年")
  25. var thisdata = yearmonth[0]+"年"+yearmonth[1]+"月"+seldate+"日";
  26. thisdata2 = yearmonth[0]+"-"+yearmonth[1]+"-"+seldate;
  27. $(".sel_date").html(thisdata);
  28. $(".month").hide();
  29. $(".asell_list").show();
  30. $(".weui_toast").show();
  31. $("#loadingToast").show();
  32. $.ajax({
  33. url:'./zz-fx/control.php', //请求地址
  34. type: "post", //请求方式
  35. data:{
  36. type:"distribut_Disney",
  37. get_tic:thisdata2
  38. },
  39. async:true,
  40. dataType: "json",
  41. success: function (data) {
  42. $("#loadingToast").hide();
  43. console.log(data);
  44. if(data.code == 0){
  45. $(".weui_toast").hide();
  46. $.each(data.info,function(k,v){
  47. num = k++;
  48. $('#B'+k+'').text("余票"+v+"张");
  49. })
  50. $.each(data.price,function(k,v){
  51. num = k++;
  52. $('#prices'+k+'').text(+v+"元");
  53. })
  54. }else if(data.code == 1){
  55. alert(data.info);
  56. }
  57. },
  58. fail: function (date) {
  59. // 此处放失败后执行的代码
  60. }
  61. });
  62. })
  63. }
  64. //加减票
  65. $(".add").on("click",function(){
  66. var num =parseInt($(this).siblings("input").val());
  67. $.each($(".aticket"),function(){
  68. num += parseInt($(this).val());
  69. })
  70. if(submit_cut==1){
  71. if(num>=5){
  72. return;
  73. }else{
  74. var num = $(this).siblings("input").val();
  75. $(this).siblings("input").val(++num);
  76. total_price()
  77. }
  78. }else{
  79. var num = $(this).siblings("input").val();
  80. $(this).siblings("input").val(++num);
  81. total_price()
  82. }
  83. })
  84. $(".cut").on("click",function(){
  85. var num = parseInt($(this).siblings("input").val());
  86. if(num==0){
  87. }else{
  88. $(this).siblings("input").val(--num);
  89. total_price()
  90. }
  91. })
  92. function total_price(){
  93. var adult = $("#adult").val();
  94. var Children = $("#Children").val();
  95. var Old = $("#Old").val();
  96. var adult2 = $("#adult2").val();
  97. var Children2 = $("#Children2").val();
  98. var Old2 = $("#Old2").val();
  99. 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()));
  100. $("#price").text("¥"+total_price);
  101. }
  102. $("#submit").click(function(){
  103. var adult = $("#adult").val();
  104. var Children = $("#Children").val();
  105. var Old = $("#Old").val();
  106. var adult2 = $("#adult2").val();
  107. var Children2 = $("#Children2").val();
  108. var Old2 = $("#Old2").val();
  109. var sub_name = $("#sub_name").val();
  110. var sub_phone = $("#sub_phone").val();
  111. var customer_type = $("#customer_type").val();
  112. var customer_id = $("#customer_id").val();
  113. var phoneRe =/^1[3|4|5|7|8]\d{9}$/;
  114. var ticket_add = parseInt(adult)+parseInt(Children)+parseInt(Old)+parseInt(adult2)+parseInt(Children2)+parseInt(Old2);
  115. if(thisdata2==""){
  116. alert("请输入日期");
  117. return false;
  118. }else if(ticket_add>5){
  119. alert("购票不能超过5张");
  120. return false;
  121. }else if(ticket_add<=0){
  122. alert("请选择门票");
  123. return false;
  124. }else if(sub_name==""){
  125. alert("请输入姓名");
  126. return false;
  127. }else if(sub_phone == "") {
  128. alert("请输入手机号");
  129. return false;
  130. }else if(!phoneRe.test(sub_phone)){
  131. alert("请输入正确的手机号");
  132. return false;
  133. }else if(customer_id==""){
  134. alert("请输入证件号");
  135. return false;
  136. };
  137. $("#loadingToast").show();
  138. $(".weui_toast").show();
  139. $.ajax({
  140. url:'./zz-fx/control.php', //请求地址
  141. type: "post",//请求方式
  142. async:true,
  143. data:{
  144. type:"distribut_Disney",
  145. date_time:thisdata2,
  146. customer_name:sub_name,
  147. customer_phone:sub_phone,
  148. customer_id_type:customer_type,
  149. customer_id:customer_id,
  150. D:adult,
  151. O:Old,
  152. C:Children,
  153. D2:adult2,
  154. O2:Old2,
  155. C2:Children2
  156. },
  157. dataType: "json",
  158. success: function (data) {
  159. console.log(data);
  160. $("#loadingToast").hide();
  161. $(".weui_toast").hide();
  162. if(data.code == 0){
  163. if(login_data.pay_status=="0"){
  164. setStorJson("resever_succsee",data.list);
  165. window.location.href="pay_order_disney.html";
  166. }else if(login_data.pay_status=="1"){
  167. setStorJson("resever_succsee",data.list);
  168. window.location.href="resever_success.html";
  169. }
  170. }else{
  171. alert(data.info);
  172. }
  173. },
  174. fail: function (date) {
  175. // 此处放失败后执行的代码
  176. }
  177. });
  178. })