選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 

251 行
6.1 KiB

  1. //提交按钮切换,1为乐园门票,2为剧场门票
  2. var submit_cut = 2;
  3. var lion_time = "";
  4. var thisdata ="";
  5. var thisdata2 ="";
  6. var login_data = getStorJson("login_data");
  7. //选择日期
  8. $(document).ready(function(){
  9. var tomonth = new Date();
  10. $(".sel_goback").on("click",function(){
  11. addmouth($(".month"),tomonth.getFullYear(),tomonth.getMonth());
  12. $(".content").show();
  13. $(".month").show();
  14. $(".asell_list").hide();
  15. selectDate();
  16. });
  17. })
  18. function selectDate(){
  19. $(".canday").on("click",function(){
  20. if($(this).html()=="今天"){
  21. var seldate = new Date().getDate();
  22. }else{
  23. var seldate =$(this).html();
  24. }
  25. var yearmonth = $(".currentdate").html().split("年")
  26. thisdata = yearmonth[0]+"年"+yearmonth[1]+"月"+seldate+"日";
  27. thisdata2 = yearmonth[0]+"-"+yearmonth[1]+"-"+seldate;
  28. var weekday = new Date(thisdata2).getDay();
  29. $.ajax({
  30. url:'./zz-fx/control.php', //请求地址
  31. type: "post", //请求方式
  32. data:{
  33. type:"distribut_Theater",
  34. date_get:weekday
  35. },
  36. async:false,
  37. dataType: "json",
  38. success: function (data) {
  39. console.log(data);
  40. if(data.code == 0){
  41. createHtml(data.list);
  42. }else if(data.code == 1){
  43. $("#show_time").html();
  44. alert(data.info);
  45. }
  46. },
  47. fail: function (date) {
  48. // 此处放失败后执行的代码
  49. }
  50. });
  51. // $(".month").hide();
  52. // $(".content").hide();
  53. // $(".asell_list").show();
  54. // $("#loadingToast").show();
  55. })
  56. }
  57. //遍历时间
  58. function createHtml(data){
  59. var temp = "";
  60. for(var i=0;i<data.length;i++){
  61. temp += '<span class="ui_m_r10 sc-bg change_date2" style="padding: 0.05rem 0.1rem;">'+data[i]+'</span>'
  62. }
  63. $("#show_time").html(temp);
  64. //选择时间
  65. $(".change_date2").click(function(){
  66. lion_time = $(this).text();
  67. $("#show_time").children().css("background-color","#eee");
  68. $("#show_time").html("");
  69. // $(this).css("background-color","#58C9B9");
  70. $(".month").hide();
  71. $(".content").hide();
  72. $(".asell_list").show();
  73. $("#loadingToast").show();
  74. $(".sel_date").html(thisdata+'('+lion_time+')');
  75. //余票
  76. $.ajax({
  77. url:'./zz-fx/control.php', //请求地址
  78. type: "post", //请求方式
  79. data:{
  80. type:"distribut_Theater",
  81. get_tic:thisdata2,
  82. time :lion_time
  83. },
  84. dataType: "json",
  85. success: function (data) {
  86. $("#loadingToast").hide();
  87. console.log(data);
  88. if(data.code == 0){
  89. $.each(data.info,function(k,v){
  90. num = k++;
  91. $('#K'+k+'').html("余票"+v+"张");
  92. })
  93. $.each(data.price,function(k,v){
  94. num = k++;
  95. $('#lion_price'+k+'').text(v+"元");
  96. })
  97. }else if(data.code == 1){
  98. $("#show_time").html();
  99. alert(data.info);
  100. }
  101. },
  102. fail: function (date) {
  103. // 此处放失败后执行的代码
  104. }
  105. });
  106. })
  107. }
  108. //加减票
  109. $(".add").on("click",function(){
  110. var num =parseInt($(this).siblings("input").val());
  111. $.each($(".aticket"),function(){
  112. num += parseInt($(this).val());
  113. })
  114. if(submit_cut==1){
  115. if(num>=5){
  116. return;
  117. }else{
  118. var num = $(this).siblings("input").val();
  119. $(this).siblings("input").val(++num);
  120. total_price()
  121. }
  122. }else{
  123. var num = $(this).siblings("input").val();
  124. $(this).siblings("input").val(++num);
  125. total_price()
  126. }
  127. })
  128. $(".cut").on("click",function(){
  129. var num = parseInt($(this).siblings("input").val());
  130. if(num==0){
  131. }else{
  132. $(this).siblings("input").val(--num);
  133. total_price()
  134. }
  135. })
  136. function total_price(){
  137. var AA = $("#AA").val();
  138. var AB = $("#AB").val();
  139. var BA = $("#BA").val();
  140. var BB = $("#BB").val();
  141. var CA = $("#CA").val();
  142. var CB = $("#CB").val();
  143. 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));
  144. $("#price").text("¥"+total_price);
  145. }
  146. $("#submit").click(function(){
  147. var AA = $("#AA").val();
  148. var AB = $("#AB").val();
  149. var BA = $("#BA").val();
  150. var BB = $("#BB").val();
  151. var CA = $("#CA").val();
  152. var CB = $("#CB").val();
  153. var lion_name = $("#lion_name").val();
  154. var lion_phone = $("#lion_phone").val();
  155. var lion_phoneRe =/^1[3|4|5|7|8]\d{9}$/;
  156. var lion_add = parseInt(AA)+parseInt(AB)+parseInt(BA)+parseInt(BB)+parseInt(CA)+parseInt(CB);
  157. if(thisdata2==""){
  158. alert("请输入日期");
  159. return false;
  160. }else if(lion_time==""){
  161. alert("请选择时间");
  162. return false;
  163. }else if(lion_add<=0){
  164. alert("请选择门票");
  165. return false;
  166. }else if(lion_name==""){
  167. alert("请输入姓名");
  168. return false;
  169. }else if(lion_phone == "") {
  170. alert("请输入手机号");
  171. return false;
  172. }else if(!lion_phoneRe.test(lion_phone)){
  173. alert("请输入正确的手机号");
  174. return false;
  175. };
  176. $("#loadingToast").show();
  177. $.ajax({
  178. url:'./zz-fx/control.php', //请求地址
  179. type: "post", //请求方式
  180. data:{
  181. type:"distribut_Theater",
  182. date_time:thisdata2,
  183. time:lion_time,
  184. customer_name:lion_name,
  185. customer_phone:lion_phone,
  186. AA:AA,
  187. AB:AB,
  188. BA:BA,
  189. BB:BB,
  190. CA:CA,
  191. CB:CB
  192. },
  193. dataType: "json",
  194. success: function (data) {
  195. $("#loadingToast").show();
  196. console.log(data);
  197. if(data.code == 0){
  198. if(login_data.pay_status=="0"){
  199. setStorJson("resever_succsee",data.list);
  200. window.location.href="pay_order_disney.html";
  201. }else if(login_data.pay_status=="1"){
  202. setStorJson("resever_succsee",data.list);
  203. window.location.href="resever_success.html";
  204. }
  205. }else{
  206. alert(data.info);
  207. }
  208. },
  209. fail: function (date) {
  210. // 此处放失败后执行的代码
  211. }
  212. });
  213. })