You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

285 lines
7.7 KiB

  1. //提交按钮切换,1为乐园门票,2为剧场门票
  2. var submit_cut = 1;
  3. var lion_time = "";
  4. window.onload = function(){
  5. iflogin();
  6. $('.date-picker').datepicker({autoclose:true}).next().on("click", function(){$(this).prev().focus();});
  7. $('#timepicker1').timepicker({minuteStep: 1,showSeconds: false,showMeridian: false}).next().on("click", function(){$(this).prev().focus();});
  8. var cutId = getStorage("cutId")
  9. if(cutId==3){
  10. $("#cutid3").css("background-color","#000000")
  11. }
  12. }
  13. function cut_botton(index){
  14. if(index==1){
  15. $("#cut_top").children().removeClass("cut_sub");
  16. $("#cut1").addClass("cut_sub");
  17. $("#ticket1").removeAttr("style");
  18. $("#ticket2").css("display","none");
  19. submit_cut = 1;
  20. }else if(index==2){
  21. $("#cut_top").children().removeClass("cut_sub");
  22. $("#cut2").addClass("cut_sub");
  23. $("#ticket2").removeAttr("style");
  24. $("#ticket1").css("display","none");
  25. submit_cut = 2;
  26. }
  27. }
  28. //选择日期按钮
  29. $("#lion_date").change(function(){
  30. lion_time = "";
  31. var weekday = new Date($("#lion_date").val()).getDay();
  32. $.ajax({
  33. url:'./zz-fx/control.php', //请求地址
  34. type: "post", //请求方式
  35. data:{
  36. type:"distribut_Theater",
  37. date_get:weekday
  38. },
  39. async:false,
  40. dataType: "json",
  41. success: function (data) {
  42. console.log(data);
  43. if(data.code == 0){
  44. createHtml(data.list);
  45. }else if(data.code == 1){
  46. $("#show_time").html();
  47. alert(data.info);
  48. }
  49. },
  50. fail: function (date) {
  51. // 此处放失败后执行的代码
  52. }
  53. });
  54. })
  55. function createHtml(data){
  56. var temp = "";
  57. for(var i=0;i<data.length;i++){
  58. temp += '<span class="change_date2">'+data[i]+'</span>'
  59. }
  60. $("#show_time").html(temp);
  61. //选择时间
  62. $(".change_date2").click(function(){
  63. lion_time = $(this).text();
  64. $("#show_time").children().css("background-color","#FFF");
  65. $(this).css("background-color","#E0E0E0");
  66. })
  67. }
  68. $(".add").on("click",function(){
  69. var num =parseInt($(this).siblings("input").val());
  70. $.each($(".aticket"),function(){
  71. num += parseInt($(this).val());
  72. })
  73. if(submit_cut==1){
  74. if(num>=5){
  75. return;
  76. }else{
  77. var num = $(this).siblings("input").val();
  78. $(this).siblings("input").val(++num);
  79. }
  80. }else{
  81. var num = $(this).siblings("input").val();
  82. $(this).siblings("input").val(++num);
  83. }
  84. })
  85. $(".cut").on("click",function(){
  86. var num = parseInt($(this).siblings("input").val());
  87. if(num==0){
  88. }else{
  89. $(this).siblings("input").val(--num);
  90. }
  91. })
  92. //提交订单
  93. $("#submit").click(function(){
  94. if(submit_cut==1){
  95. var sub_date = $("#start_time").val();
  96. var adult = $("#D").val();
  97. var Children = $("#Children").val();
  98. var Old = $("#Old").val();
  99. var adult2 = $("#D2").val();
  100. var Children2 = $("#Children2").val();
  101. var Old2 = $("#Old2").val();
  102. var sub_name = $("#sub_name").val();
  103. var sub_phone = $("#sub_phone").val();
  104. var customer_type = $("#customer_type").val();
  105. var customer_id = $("#customer_id").val();
  106. var phoneRe =/^1[3|4|5|7|8]\d{9}$/;
  107. var ticket_add = parseInt(adult)+parseInt(Children)+parseInt(Old)+parseInt(adult2)+parseInt(Children2)+parseInt(Old2);
  108. if(sub_date==""){
  109. window.wxc.xcConfirm("请输入日期", window.wxc.xcConfirm.typeEnum.info);
  110. return false;
  111. }else if(ticket_add>5){
  112. window.wxc.xcConfirm("购票不能超过5张", window.wxc.xcConfirm.typeEnum.info);
  113. return false;
  114. }else if(ticket_add<=0){
  115. window.wxc.xcConfirm("请选择门票", window.wxc.xcConfirm.typeEnum.info);
  116. return false;
  117. }else if(sub_name==""){
  118. window.wxc.xcConfirm("请输入姓名", window.wxc.xcConfirm.typeEnum.info);
  119. return false;
  120. }else if(sub_phone == "") {
  121. window.wxc.xcConfirm("请输入手机号", window.wxc.xcConfirm.typeEnum.info);
  122. return false;
  123. }else if(!phoneRe.test(sub_phone)){
  124. window.wxc.xcConfirm("请输入正确的手机号", window.wxc.xcConfirm.typeEnum.info);
  125. return false;
  126. }else if(customer_id==""){
  127. window.wxc.xcConfirm("请输入证件号", window.wxc.xcConfirm.typeEnum.info);
  128. return false;
  129. };
  130. $.ajax({
  131. url:'./zz-fx/control.php', //请求地址
  132. type: "post", //请求方式
  133. data:{
  134. type:"distribut_Disney",
  135. date_time:sub_date,
  136. customer_name:sub_name,
  137. customer_phone:sub_phone,
  138. customer_id_type:customer_type,
  139. customer_id:customer_id,
  140. D:adult,
  141. O:Old,
  142. C:Children,
  143. D2:adult2,
  144. O2:Old2,
  145. C2:Children2
  146. },
  147. async:false,
  148. dataType: "json",
  149. success: function (data) {
  150. console.log(data);
  151. if(data.code == 0){
  152. disney_success(data.list);
  153. }else if(data.code == -1){
  154. }
  155. },
  156. fail: function (date) {
  157. // 此处放失败后执行的代码
  158. }
  159. });
  160. }else if(submit_cut==2){
  161. var lion_date = $("#lion_date").val();
  162. var AA = $("#AA").val();
  163. var AB = $("#AB").val();
  164. var BA = $("#BA").val();
  165. var BB = $("#BB").val();
  166. var CA = $("#CA").val();
  167. var CB = $("#CB").val();
  168. var lion_name = $("#lion_name").val();
  169. var lion_phone = $("#lion_phone").val();
  170. var lion_phoneRe =/^1[3|4|5|7|8]\d{9}$/;
  171. var lion_add = parseInt(AA)+parseInt(AB)+parseInt(BA)+parseInt(BB)+parseInt(CA)+parseInt(CB);
  172. if(lion_date==""){
  173. window.wxc.xcConfirm("请输入日期", window.wxc.xcConfirm.typeEnum.info);
  174. return false;
  175. }else if(lion_time==""){
  176. window.wxc.xcConfirm("请选择时间", window.wxc.xcConfirm.typeEnum.info);
  177. return false;
  178. }else if(lion_add<=0){
  179. window.wxc.xcConfirm("请选择门票", window.wxc.xcConfirm.typeEnum.info);
  180. return false;
  181. }else if(lion_name==""){
  182. window.wxc.xcConfirm("请输入姓名", window.wxc.xcConfirm.typeEnum.info);
  183. return false;
  184. }else if(lion_phone == "") {
  185. window.wxc.xcConfirm("请输入手机号", window.wxc.xcConfirm.typeEnum.info);
  186. return false;
  187. }else if(!lion_phoneRe.test(lion_phone)){
  188. window.wxc.xcConfirm("请输入正确的手机号", window.wxc.xcConfirm.typeEnum.info);
  189. return false;
  190. };
  191. $.ajax({
  192. url:'./zz-fx/control.php', //请求地址
  193. type: "post", //请求方式
  194. data:{
  195. type:"distribut_Theater",
  196. date_time:lion_date,
  197. time:lion_time,
  198. customer_name:lion_name,
  199. customer_phone:lion_phone,
  200. AA:AA,
  201. AB:AB,
  202. BA:BA,
  203. BB:BB,
  204. CA:CA,
  205. CB:CB
  206. },
  207. async:false,
  208. dataType: "json",
  209. success: function (data) {
  210. console.log(data);
  211. if(data.code == 0){
  212. disney_success(data.list);
  213. }else if(data.code == -1){
  214. }
  215. },
  216. fail: function (date) {
  217. // 此处放失败后执行的代码
  218. }
  219. });
  220. }
  221. })
  222. function disney_success(data){
  223. $("#ticket_name").text(data.type);
  224. $("#ticket_time").text("时间:"+data.date);
  225. $("#ticket_no").text("数量:"+data.desc);
  226. $("#man_name").text("姓名:"+data.name);
  227. $("#man_phone").text("手机:"+data.phone);
  228. $("#total_price").text("订单总额:"+data.price+"元");
  229. $("#alert_1").removeAttr("style");
  230. }
  231. function close_alert(){
  232. $("#alert_1").css("display","none");
  233. window.location.href="disney_ticket.html";
  234. }
  235. function getbig(){
  236. $(".alert_picture").removeAttr("style");
  237. }
  238. function getsmall(){
  239. $(".alert_picture").css("display","none");
  240. }