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.
 
 
 
 

911 lines
33 KiB

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>2.0系统</title>
  6. <link rel="stylesheet" href="css/font-awesome.min.css">
  7. <link rel="stylesheet" href="css/bootstrap.min.css">
  8. <link rel="stylesheet" href="css/ace.min.css">
  9. <link rel="stylesheet" href="css/master.css">
  10. <link rel="stylesheet" type="text/css" href="./css/bootstrap-timepicker.css" />
  11. <link rel="stylesheet" type="text/css" href="./css/daterangepicker.css" />
  12. <link rel="stylesheet" type="text/css" href="./css/datepicker.css" />
  13. <script src="js/jquery-2.2.4.min.js"></script>
  14. <script type="text/javascript" src="./js/date-time/bootstrap-datepicker.min.js"></script>
  15. <script type="text/javascript" src="./js/date-time/bootstrap-timepicker.min.js"></script>
  16. <script src="js/jquery.cookie.js"></script>
  17. <!--<script src="js/xm.js"></script>-->
  18. <!-- <script src="js/bootstrap.min.js"></script> -->
  19. <!--<script>
  20. login();
  21. </script>-->
  22. <style type="text/css">
  23. body{
  24. font-size:12px !important;
  25. background-color:#fff;
  26. }
  27. .padding{
  28. padding-bottom:10px;
  29. }
  30. .padding1{
  31. width:230px !important;
  32. }
  33. .gray{
  34. color:gray !important;
  35. }
  36. #sample-table-1 tbody td div:last-child{
  37. padding-bottom:0;
  38. }
  39. td,th{
  40. text-align:center;
  41. }
  42. </style>
  43. </head>
  44. <body>
  45. <!--<div class="navbar navbar-default" style="margin-bottom: 0px;">
  46. <div class="navbar-header ">
  47. <a href="#" class="navbar-brand">
  48. <i class="icon-leaf"></i>
  49. CS System<sub style="font-size:12px;position: initial;">&nbsp;<span id="version_txt"></span></sub>
  50. </a>
  51. </div>
  52. </div>
  53. <div id="show_html" style="display:none;" class="warp clearfix">
  54. <div class="control-bar">
  55. </div>
  56. <div class="control-show" style="display:none;" id="xm_show">-->
  57. <div style="display:none;" id="xm_show">
  58. <div style="width:1200px; margin:40px 0 0 40px;" id="width">
  59. <div style="margin-bottom:10px;font-size:14px;">车票退改</div>
  60. <div class="row" style="margin-bottom:20px;">
  61. <div class="col-xs-12">
  62. <!-- PAGE CONTENT BEGINS -->
  63. <div class="row">
  64. <div class="col-xs-12">
  65. <div class="table-responsive">
  66. <table id="sample-table-2" class="table table-striped table-bordered">
  67. <thead>
  68. <tr style=" background: #fff;">
  69. <th>线路</th>
  70. <th>出发地</th>
  71. <th>目的地</th>
  72. <th>出发时间</th>
  73. <th>车号</th>
  74. <th>座位</th>
  75. <th>人群</th>
  76. <th>座号</th>
  77. <th>打印</th>
  78. <th>改签</th>
  79. <th>退票</th>
  80. <th>金额</th>
  81. <th>选择</th>
  82. </tr>
  83. </thead>
  84. </table>
  85. <div style="margin:0 0 10px 10px;"><b>现有票</b></div>
  86. <table id="sample-table-1" class="table table-striped table-bordered">
  87. <tbody>
  88. <tr>
  89. <td class="padding1">SHWZ - J01(上海 - 乌镇 - 萧山)</td>
  90. <td>上海(黄埔集散)</td>
  91. <td>乌镇(西栅牌坊)</td>
  92. <td>
  93. <div class="padding">2016.05.20 07:00</div>
  94. <div class="padding gray">2016.05.20 07:00</div>
  95. <div class="padding gray">2016.05.20 07:00</div>
  96. </td>
  97. <td>
  98. <div class="padding">01</div>
  99. <div class="padding gray">01</div>
  100. <div class="padding gray">01</div>
  101. </td>
  102. <td>
  103. <div class="padding">普通</div>
  104. <div class="padding gray">普通</div>
  105. <div class="padding gray">普通</div>
  106. </td>
  107. <td>
  108. <div class="padding">成人</div>
  109. <div class="padding gray">儿童</div>
  110. <div class="padding gray">儿童</div>
  111. </td>
  112. <td>
  113. <div class="padding ">02</div>
  114. <div class="padding gray ">03</div>
  115. <div class="padding gray ">03</div>
  116. </td>
  117. <td>
  118. <div class="padding">否</div>
  119. <div class="padding gray">是</div>
  120. <div class="padding gray">是</div>
  121. </td>
  122. <td>
  123. <div class="padding" id="xxc1_meal">否</div>
  124. <div class="padding gray" id="xxc2_meal">是</div>
  125. <div class="padding gray" id="xxc2_meal">是</div>
  126. </td>
  127. <td>
  128. <div class="padding" id="xxc1_bounce">已退票</div>
  129. <div class="padding gray" id="xxc2_bounce">-</div>
  130. <div class="padding gray" id="xxc2_bounce">-</div>
  131. </td>
  132. <td>
  133. <div class="padding" style="color:#FF9900;"><span style="font-family:Arial;">&yen;</span>120</div>
  134. <div class="padding gray">¥50</div>
  135. <div class="padding gray">¥50</div>
  136. </td>
  137. <td>
  138. <div class="padding"><input id="xxc1" type="radio" name="radio_exist" pid=0 onclick="checkBoxClick(this)" /></div>
  139. <div class="padding"><input id="xxc2" type="radio" name="radio_exist" pid=0 onclick="checkBoxClick(this)" /></div>
  140. <div class="padding"><input id="xxc2" type="radio" name="radio_exist" pid=0 onclick="checkBoxClick(this)" /></div>
  141. </td>
  142. </tr>
  143. <tr>
  144. <td class="">SHWZ - J01(上海 - 乌镇 - 萧山)</td>
  145. <td>上海(黄埔集散)</td>
  146. <td>乌镇(西栅牌坊)</td>
  147. <td>
  148. <div class="padding">2016.05.20 07:00</div>
  149. <div class="gray">2016.05.20 07:00</div>
  150. </td>
  151. <td>
  152. <div class="padding">01</div>
  153. <div class="gray">01</div>
  154. </td>
  155. <td>
  156. <div class="padding">普通</div>
  157. <div class="gray">普通</div>
  158. </td>
  159. <td>
  160. <div class="padding">成人</div>
  161. <div class="gray">儿童</div>
  162. </td>
  163. <td>
  164. <div class="padding">2</div>
  165. <div class="gray">3</div>
  166. </td>
  167. <td>
  168. <div class="padding">否</div>
  169. <div class="gray">是</div>
  170. </td>
  171. <td>
  172. <div class="padding" id="xxc3_meal">是</div>
  173. <div class="gray" id="xxc4_meal">是</div>
  174. </td>
  175. <td>
  176. <div class="padding" id="xxc3_bounce">-</div>
  177. <div class="gray" id="xxc4_bounce">-</div>
  178. </td>
  179. <td>
  180. <div class="padding" style="color:#FF9900;">¥120</div>
  181. <div class="gray">¥50</div>
  182. </td>
  183. <td>
  184. <div><input id="xxc3" type="radio" name="radio_exist" pid=1 onclick="checkBoxClick(this)"/></div>
  185. <div><input id="xxc4" type="radio" name="radio_exist" pid=1 onclick="checkBoxClick(this)"/></div>
  186. </td>
  187. </tr>
  188. </tbody>
  189. </table>
  190. <div>
  191. <button class="btn btn-white" style="padding:2px 0;font-size:12px;margin-left:10px;float:right;width:70px;" id="bounce">退票</button>
  192. <button class="btn btn-white" style="padding:2px 0;font-size:12px; float:right;width:70px;" id="meal">改签</button>
  193. </div>
  194. <div style="clear:both;"></div>
  195. <div id="meal_tickets">
  196. <div style="margin:0 0 10px 10px;"><b>改签票</b></div>
  197. <input id="meal_tickets_order_id" type="hidden">
  198. <input id="meal_tickets_run_id" type="hidden">
  199. <table id="sample-table-3" class="table table-striped table-bordered">
  200. <tbody>
  201. <tr>
  202. <td>SHWZ - J01(上海 - 乌镇 - 萧山)</td>
  203. <td>上海(黄埔集散)</td>
  204. <td>乌镇(西栅牌坊)</td>
  205. <td>
  206. <div class="padding">2016.05.20 07:00</div>
  207. </td>
  208. <td>
  209. <div class="padding">01</div>
  210. </td>
  211. <td>
  212. <div class="padding">普通</div>
  213. </td>
  214. <td>
  215. <div class="padding">成人</div>
  216. </td>
  217. <td>
  218. <div class="padding">2</div>
  219. </td>
  220. <td>
  221. <div class="padding">否</div>
  222. </td>
  223. <td>
  224. <div class="padding">是</div>
  225. </td>
  226. <td>
  227. <div class="padding">-</div>
  228. </td>
  229. <td>
  230. <div class="padding" style="color:#FF9900;"><span style="font-family:Arial;">&yen;</span>120</div>
  231. </td>
  232. <td>
  233. <div><input id="xxca1" type="checkbox" name="radio_meal" pid=0 onclick="checkBoxClick1(this)" /></div>
  234. </td>
  235. </tr>
  236. </tbody>
  237. </table>
  238. <div>
  239. <button class="btn btn-white" style="padding:2px 0;font-size:12px;margin-left:10px;float:right;width:70px;" id="cancel_meal">取消</button>
  240. <button class="btn btn-white" style="padding:2px 0;font-size:12px; float:right;width:70px;" id="confirm_meal">确认改签</button>
  241. </div>
  242. </div>
  243. </div><!-- /.table-responsive -->
  244. </div><!-- /span -->
  245. </div><!-- /row -->
  246. <!--</div>--><!-- /.col -->
  247. </div><!-- /.row -->
  248. <div id="choice_tickets" style="bottom:0;position:absolute;left:235px;">
  249. <div class="widget-main" style="border:1px solid #ccc;" >
  250. <div style="margin-bottom:40px;height:30px;line-height:30px;">
  251. <div style="float:left;">出发日期:</div>
  252. <div class="col-sm-2" style="float:left;">
  253. <div class="input-group">
  254. <input type="text" data-date-format="dd-mm-yyyy" id="id-date-picker-1" class="form-control date-picker">
  255. <span class="input-group-addon">
  256. <i class="icon-calendar bigger-110"></i>
  257. </span>
  258. </div>
  259. </div>
  260. <div style="float:left;">
  261. <button class="btn btn-white" style="padding:2px 0;font-size:12px;margin:0 10px;width:70px;" id="prev_day">前一天</button>
  262. <button class="btn btn-white" style="padding:2px 0;font-size:12px;width:70px;" id="next_day">后一天</button>
  263. <button class="btn btn-white" style="padding:2px 0;font-size:12px;background-color:#ebebeb !important;margin-left:20px;width:70px;" id="search">查询</button>
  264. </div>
  265. <div class="widget-toolbar">
  266. <a data-action="close" onclick="choiceClose()" style="cursor: pointer;" >
  267. <i class="icon-remove"></i>
  268. </a>
  269. </div>
  270. </div>
  271. <div class="row" style="margin-bottom:20px;">
  272. <div class="col-xs-12">
  273. <!-- PAGE CONTENT BEGINS -->
  274. <div class="row">
  275. <div class="col-xs-12">
  276. <div class="table-responsive">
  277. <input id="xm_prod_id" type="hidden">
  278. <input id="xm_parent_prod_id" type="hidden">
  279. <input id="xm_order_id" type="hidden">
  280. <input id="xm_up_station_id" type="hidden">
  281. <input id="xm_down_station_id" type="hidden">
  282. <table id="sample-table-4" class="table table-striped table-bordered">
  283. <thead>
  284. <tr style=" background: #fff;">
  285. <th>出发地</th>
  286. <th>目的地</th>
  287. <th>线路</th>
  288. <th>出发日期</th>
  289. <th>出发站</th>
  290. <th>到达站</th>
  291. <th>座位</th>
  292. <th>人群</th>
  293. <th>价格</th>
  294. <th>库存</th>
  295. <th>操作</th>
  296. </tr>
  297. </thead>
  298. <tbody>
  299. <tr>
  300. <td>上海(黄埔集散)</td>
  301. <td>乌镇(西栅牌坊)</td>
  302. <td>SHWZ - J01(上海 - 乌镇 - 萧山)</td>
  303. <td>2016.05.20 07:00</td>
  304. <td>
  305. <select>
  306. <option value ="volvo">黄埔集散(07:30)</option>
  307. <option value ="volvo">黄埔集散(08:30)</option>
  308. <option value ="volvo">黄埔集散(09:30)</option>
  309. <option value ="volvo">黄埔集散(10:30)</option>
  310. </select>
  311. </td>
  312. <td>
  313. <select>
  314. <option value ="volvo">东栏牌坊(07:30)</option>
  315. <option value ="volvo">东栏牌坊(08:30)</option>
  316. <option value ="volvo">东栏牌坊(09:30)</option>
  317. <option value ="volvo">东栏牌坊(10:30)</option>
  318. </select>
  319. </td>
  320. <td>
  321. <div class="padding">普通</div>
  322. <!-- <div class="gray">贵宾</div> -->
  323. </td>
  324. <td>
  325. <div class="padding">成人</div>
  326. <!-- <div class="gray">成人</div> -->
  327. </td>
  328. <td>
  329. <div class="padding" style="color:#FF9900;"><span style="font-family:Arial;">&yen;</span>120</div>
  330. <!-- <div class="gray">¥128</div> -->
  331. </td>
  332. <td>
  333. <div class="padding">10</div>
  334. <!-- <div class="gray">2</div> -->
  335. </td>
  336. <td>
  337. <div class="padding"><button style="border:none;background:none;" onclick="choice_button()" id="aaa">选择</button></div>
  338. <!-- <div class="gray"><button style="border:none;background:none;" disabled="disabled">选择</button></div> -->
  339. </td>
  340. </tr>
  341. </tbody>
  342. </table>
  343. </div><!-- /.table-responsive -->
  344. </div><!-- /span -->
  345. </div><!-- /row -->
  346. </div><!-- /.col -->
  347. </div><!-- /.row -->
  348. </div>
  349. </div>
  350. </div>
  351. </div>
  352. </div>
  353. <script type="text/javascript">
  354. $('.date-picker').datepicker({
  355. autoclose:true,
  356. format:'yyyy-mm-dd',
  357. language: 'zh-CN'
  358. }).next().on("click", function(){$(this).prev().focus();});
  359. var orderid=getQueryString("order_id");
  360. if(orderid !=''){
  361. var ticket=ticketExist();
  362. if(ticket.code==0){
  363. $(function(){
  364. $("input:radio").attr("checked",false);
  365. $("input:checkbox").attr("checked",false);
  366. $("#bounce").attr("disabled","disabled");
  367. $("#meal").attr("disabled","disabled");
  368. $("#meal_tickets").css("display","none");
  369. $("#choice_tickets").css("display","none");
  370. //var screenWidth = $(window).width();//获取屏幕可视区域的宽度。
  371. var screenWidth = $("#width").width();//获取屏幕可视区域的宽度。
  372. //var screenWidth = '1200px';//获取屏幕可视区域的宽度。
  373. $("#choice_tickets").width(screenWidth);//将宽度赋值给bottomDiv使其可以贯穿整个屏幕。
  374. var screenHeight = $(window).height();//获取屏幕可视区域的高度。
  375. var divHeight = $("#choice_tickets").height() + 1;//bottomDiv的高度再加上它一像素的边框。
  376. $(window).scroll(function(){
  377. var scrollHeight = $(document).scrollTop();//获取滚动条滚动的高度。
  378. if(!window.XMLHttpRequest){
  379. $("#choice_tickets").css("top",screenHeight + scrollHeight - divHeight);
  380. }//判断是否为IE6,如果是,执行大括号中内容
  381. });
  382. var tab1_width = $("#sample-table-1 tr:first td").length
  383. for(i=0;i<tab1_width;i++)
  384. {
  385. $("#sample-table-2 tr:first th").eq(i).width($("#sample-table-1 tr:first td").eq(i).width());
  386. }
  387. });
  388. }else{
  389. alert("单号错误");
  390. $('#xm_show').html("");
  391. }
  392. }else{
  393. alert('请传入正确参数');
  394. $('#xm_show').html("");
  395. }
  396. $("#meal").click(function(){
  397. $("#sample-table-1 input[name='radio_exist']").each(function(){
  398. if(this.checked==true){
  399. meal_order_id=$(this).attr("order_id");
  400. meal_prod_id=$(this).attr("prod_id");
  401. meal_parent_prod_id=$(this).attr("parent_prod_id");
  402. meal_up_id=$(this).attr("up_station_id");
  403. meal_down_id=$(this).attr("down_station_id");
  404. var mydate = new Date();
  405. var month=mydate.getMonth()+1;
  406. var day= mydate.getDate();
  407. if(month<10){
  408. month="0"+month;
  409. }
  410. if(day<10){
  411. day="0"+day;
  412. }
  413. meal_date = mydate.getFullYear() + "-"+month+"-"+day;
  414. meal_date = '2016-08-08';
  415. $('#xm_prod_id').val(meal_prod_id);
  416. $('#xm_parent_prod_id').val(meal_parent_prod_id);
  417. $('#xm_order_id').val(meal_order_id);
  418. $('#xm_up_station_id').val(meal_up_id);
  419. $('#xm_down_station_id').val(meal_down_id);
  420. }
  421. });
  422. $.ajax({
  423. url: "./st-xm/Api/change_back.php", //请求地址
  424. type: "get", //请求方式
  425. data: { prodid: meal_prod_id,method:"meal",meal_date:meal_date,meal_up_id:meal_up_id,meal_down_id:meal_down_id }, //请求参数
  426. async:false,
  427. dataType: "json",
  428. success: function (response) {
  429. if(response.errcode==0){
  430. //alert("改签成功");
  431. //window.location.href=window.location.href;
  432. var order_no=response.order_no;
  433. var line_info=response.line_info;
  434. //alert(line_info);
  435. var insertTable="";
  436. insertTable+="<tr id='copy'><td>"+line_info.start_area+"</td><td>"+line_info.end_area+"</td><td>"+line_info.line_code+'('+line_info.line_name+')'+"</td><td>"+line_info.start_time+"</td>";
  437. var departure_station='';
  438. var destination_station='';
  439. for(var item1 in line_info.departure_station){
  440. departure_station+="<option value ='"+item1+"'>"+line_info.departure_station[item1]+"</option>";
  441. }
  442. for(var item1 in line_info.destination_station){
  443. destination_station+="<option value ='"+item1+"'>"+line_info.destination_station[item1]+"</option>";
  444. }
  445. insertTable+="<td><select id='select_start_station' onChange='getEndStation();'>"+departure_station+"</select></td><td><select id='select_end_station' onChange='getStartStation();'>"+destination_station+"</select></td><td>"+line_info.seat+"</td><td>"+line_info.ticket_name+"</td><td><span style='color:#FF9900;font-family:Arial;'>&yen;"+line_info.price+"</span></td><td>"+line_info.in_stock+"</td><td><button style='border:none;background:none;' onclick='choice_button()' id='aaa'>选择</button></td></tr>";
  446. //insertTable+="<tr style='border-top:1px solid #797979;'><td colspan='10'></td><td>总额</td><td style='color:#FF9900;'><span style='font-family:Arial;'>&yen;</span>"+jieguo.total_rmb+"</td></tr>";
  447. //console.log(insertTable);
  448. $('#sample-table-4 tbody').html(insertTable);
  449. $('#sample-table-4 tbody').css("display","table-row-group");
  450. }else{
  451. $('#sample-table-4 tbody').css('display',"none");
  452. $('#sample-table-4 tbody').html('');
  453. alert("该日期下没有可改签的票");
  454. }
  455. },
  456. fail: function (status) {
  457. // 此处放失败后执行的代码
  458. }
  459. });
  460. $('#id-date-picker-1').val(meal_date);
  461. $('#choice_tickets').css('display','block');
  462. });
  463. $("#bounce").click(function(){
  464. $.ajax({
  465. url: "./json/change_back.php", //请求地址
  466. type: "POST", //请求方式
  467. data: { orderid: orderid,method:"bounce" }, //请求参数
  468. async:false,
  469. dataType: "json",
  470. success: function (response) {
  471. if(response.errcode==0){
  472. alert("退票成功");
  473. //window.location.href=window.location.href;
  474. ticketExist();
  475. }
  476. },
  477. fail: function (status) {
  478. // 此处放失败后执行的代码
  479. }
  480. });
  481. });
  482. $('#confirm_meal').click(function(){
  483. var status =$('#meal_tickets input:checkbox').attr("checked");
  484. if(status !="checked"){
  485. alert("未选择无法改签");
  486. }else{
  487. $.ajax({
  488. url: "./json/change_back.php", //请求地址
  489. type: "POST", //请求方式
  490. data: { orderid: orderid,method:"confirm_meal" }, //请求参数
  491. async:false,
  492. dataType: "json",
  493. success: function (response) {
  494. if(response.errcode==0){
  495. alert(response.errinfo);
  496. //window.location.href=window.location.href;
  497. //ticketExist();
  498. }
  499. },
  500. fail: function (status) {
  501. // 此处放失败后执行的代码
  502. }
  503. });
  504. }
  505. //alert(status);
  506. });
  507. $('#cancel_meal').click(function(){
  508. var checkboxObj=$('#meal_tickets input:checkbox');
  509. var status =checkboxObj.attr("checked");
  510. if(status !="checked"){
  511. alert("未选择无法取消");
  512. }else{
  513. checkboxObj.attr("checked",false);
  514. $('#meal_tickets').css("display","none");
  515. }
  516. });
  517. $('#search').click(function(){
  518. $("#sample-table-1 input[name='radio_exist']").each(function(){
  519. if(this.checked==true){
  520. meal_order_id=$(this).attr("order_id");
  521. meal_prod_id=$(this).attr("prod_id");
  522. meal_parent_prod_id=$(this).attr("parent_prod_id");
  523. meal_up_id=$(this).attr("up_station_id");
  524. meal_down_id=$(this).attr("down_station_id");
  525. meal_date =$('#id-date-picker-1').val();;
  526. //meal_date = '2016-08-08';
  527. $('#xm_prod_id').val(meal_prod_id);
  528. $('#xm_parent_prod_id').val(meal_parent_prod_id);
  529. $('#xm_order_id').val(meal_order_id);
  530. $('#xm_up_station_id').val(meal_up_id);
  531. $('#xm_down_station_id').val(meal_down_id);
  532. }
  533. });
  534. $.ajax({
  535. url: "./st-xm/Api/change_back.php", //请求地址
  536. type: "get", //请求方式
  537. data: {prodid: meal_prod_id,method:"meal",meal_date:meal_date,meal_up_id:meal_up_id,meal_down_id:meal_down_id }, //请求参数
  538. async:false,
  539. dataType: "json",
  540. success: function (response) {
  541. if(response.errcode==0){
  542. var order_no=response.order_no;
  543. var line_info=response.line_info;
  544. //alert(line_info);
  545. var insertTable="";
  546. insertTable+="<tr id='copy'><td>"+line_info.start_area+"</td><td>"+line_info.end_area+"</td><td>"+line_info.line_code+'('+line_info.line_name+')'+"</td><td>"+line_info.start_time+"</td>";
  547. var departure_station='';
  548. var destination_station='';
  549. for(var item1 in line_info.departure_station){
  550. departure_station+="<option value ='"+item1+"'>"+line_info.departure_station[item1]+"</option>";
  551. }
  552. for(var item1 in line_info.destination_station){
  553. destination_station+="<option value ='"+item1+"'>"+line_info.destination_station[item1]+"</option>";
  554. }
  555. insertTable+="<td><select id='select_start_station' onChange='getEndStation();'>"+departure_station+"</select></td><td><select id='select_end_station' onChange='getStartStation();'>"+destination_station+"</select></td><td>"+line_info.seat+"</td><td>"+line_info.ticket_name+"</td><td><span style='color:#FF9900;font-family:Arial;'>&yen;"+line_info.price+"</span></td><td>"+line_info.in_stock+"</td><td><button style='border:none;background:none;' onclick='choice_button()' id='aaa'>选择</button></td></tr>";
  556. //insertTable+="<tr style='border-top:1px solid #797979;'><td colspan='10'></td><td>总额</td><td style='color:#FF9900;'><span style='font-family:Arial;'>&yen;</span>"+jieguo.total_rmb+"</td></tr>";
  557. //console.log(insertTable);
  558. $('#sample-table-4 tbody').css("display","table-row-group");
  559. $('#sample-table-4 tbody').html(insertTable);
  560. }else{
  561. $('#sample-table-4 tbody').css('display',"none");
  562. $('#meal_tickets').css('display',"none");
  563. $('#sample-table-4 tbody').html('');
  564. $('#sample-table-3 tbody').html('');
  565. alert("该日期下没有可改签的票");
  566. }
  567. },
  568. fail: function (status) {
  569. // 此处放失败后执行的代码
  570. }
  571. });
  572. });
  573. $('#prev_day').click(function(){
  574. var date=$('#id-date-picker-1').val();
  575. if(date ==0){
  576. alert("日期不能为空");
  577. return;
  578. }
  579. var dateTime=date.split("-");
  580. var today=new Date(dateTime); //月份为0-11
  581. // var today=new Date(2006,0,12); //月份为0-11
  582. var yesterday_milliseconds=today.getTime()-1000*60*60*24;
  583. var yesterday=new Date();
  584. yesterday.setTime(yesterday_milliseconds);
  585. var strYear=yesterday.getFullYear();
  586. var strDay=yesterday.getDate();
  587. var strMonth=yesterday.getMonth()+1;
  588. if(strDay<10){
  589. strDay="0"+strDay;
  590. }
  591. if(strMonth<10)
  592. {
  593. strMonth="0"+strMonth;
  594. }
  595. var strYesterday=strYear+"-"+strMonth+"-"+strDay;
  596. $('#id-date-picker-1').val(strYesterday);
  597. });
  598. $('#next_day').click(function(){
  599. var date=$('#id-date-picker-1').val();
  600. if(date ==0){
  601. alert("日期不能为空");
  602. return;
  603. }
  604. var dateTime=date.split("-");
  605. var today=new Date(dateTime); //月份为0-11
  606. // var today=new Date(2006,0,12); //月份为0-11
  607. var yesterday_milliseconds=today.getTime()+1000*60*60*24;
  608. var yesterday=new Date();
  609. yesterday.setTime(yesterday_milliseconds);
  610. var strYear=yesterday.getFullYear();
  611. var strDay=yesterday.getDate();
  612. var strMonth=yesterday.getMonth()+1;
  613. if(strDay<10){
  614. strDay="0"+strDay;
  615. }
  616. if(strMonth<10)
  617. {
  618. strMonth="0"+strMonth;
  619. }
  620. var strYesterday=strYear+"-"+strMonth+"-"+strDay;
  621. $('#id-date-picker-1').val(strYesterday);
  622. });
  623. function ticketExist(){
  624. //var status=getQueryString("status");
  625. $.ajax({
  626. url: "./st-xm/Api/change_back.php", //请求地址
  627. type: "get", //请求方式
  628. data: { orderid: orderid,method:"getticket" }, //请求参数
  629. async:false,
  630. dataType: "json",
  631. success: function (response) {
  632. jieguo =response;
  633. },
  634. fail: function (status) {
  635. // 此处放失败后执行的代码
  636. }
  637. });
  638. if(jieguo.code==0){
  639. var order_no=jieguo.order_no;
  640. var line_info=jieguo.line_info;
  641. var insertTable="";
  642. for(var item in line_info){
  643. insertTable+="<tr><td><a href='#'>"+line_info[item].line_code+"</a>"+line_info[item].line_name+"</td><td>"+line_info[item].start_area+"</td><td>"+line_info[item].end_area+"</td>";
  644. var start_time='';
  645. var car_number='';
  646. var seat='';
  647. var ticket_name='';
  648. var seat_number='';
  649. var if_print='';
  650. var if_meal='';
  651. var if_bounce='';
  652. var price='';
  653. var choice='';
  654. for(var item1 in line_info[item].tickets){
  655. (line_info[item].tickets[item1].if_print==0)?aif_print="否":aif_print="是";
  656. (line_info[item].tickets[item1].if_meal==0)?aif_meal="否":aif_meal="是";
  657. (line_info[item].tickets[item1].if_bounce==0)?aif_bounce="-":aif_bounce="已退票";
  658. var radioId="xm_radio_"+item+"_"+item1;
  659. if(line_info[item].tickets[item1].if_bounce !=0){
  660. start_time+="<div class='padding gray'>"+line_info[item].tickets[item1].start_time+"</div>";
  661. car_number+="<div class='padding gray'>"+line_info[item].tickets[item1].car_number+"</div>";
  662. seat+="<div class='padding gray'>"+line_info[item].tickets[item1].seat+"</div>";
  663. ticket_name+="<div class='padding gray'>"+line_info[item].tickets[item1].ticket_name+"</div>";
  664. seat_number+="<div class='padding gray'>"+line_info[item].tickets[item1].seat_number+"</div>";
  665. if_print+="<div class='padding gray'>"+aif_print+"</div>";
  666. if_meal+="<div id='"+radioId+"_meal' class='padding gray'>"+aif_meal+"</div>";
  667. if_bounce+="<div id='"+radioId+"_bounce' class='padding gray'>"+aif_bounce+"</div>";
  668. price+="<div class='padding gray' style='color:#FF9900;'><span style='font-family:Arial;'>&yen;</span>"+line_info[item].tickets[item1].price+"</div>";
  669. choice+="<div class='padding gray'><input type='radio' onclick='checkBoxClick(this)' order_id='"+line_info[item].tickets[item1].order_id+"' parent_prod_id='"+line_info[item].tickets[item1].parent_prod_id+"' prod_id='"+line_info[item].tickets[item1].prod_id+"' up_station_id='"+line_info[item].tickets[item1].up_station_id+"' down_station_id='"+line_info[item].tickets[item1].down_station_id+"' pid='0' name='radio_exist' id='"+radioId+"' disabled='disabled' style='margin:0;'></div>"
  670. }else{
  671. start_time+="<div class='padding'>"+line_info[item].tickets[item1].start_time+"</div>";
  672. car_number+="<div class='padding'>"+line_info[item].tickets[item1].car_number+"</div>";
  673. seat+="<div class='padding'>"+line_info[item].tickets[item1].seat+"</div>";
  674. ticket_name+="<div class='padding'>"+line_info[item].tickets[item1].ticket_name+"</div>";
  675. seat_number+="<div class='padding'>"+line_info[item].tickets[item1].seat_number+"</div>";
  676. if_print+="<div class='padding'>"+aif_print+"</div>";
  677. if_meal+="<div id='"+radioId+"_meal' class='padding'>"+aif_meal+"</div>";
  678. if_bounce+="<div id='"+radioId+"_bounce' class='padding'>"+aif_bounce+"</div>";
  679. price+="<div class='padding' style='color:#FF9900;'><span style='font-family:Arial;'>&yen;</span>"+line_info[item].tickets[item1].price+"</div>";
  680. choice+="<div class='padding'> <input type='radio' onclick='checkBoxClick(this)' order_id='"+line_info[item].tickets[item1].order_id+"' parent_prod_id='"+line_info[item].tickets[item1].parent_prod_id+"' prod_id='"+line_info[item].tickets[item1].prod_id+"' up_station_id='"+line_info[item].tickets[item1].up_station_id+"' down_station_id='"+line_info[item].tickets[item1].down_station_id+"' pid='0' name='radio_exist' id='"+radioId+"' style='margin:0;'></div>"
  681. }
  682. }
  683. insertTable+="<td>"+start_time+"</td><td>"+car_number+"</td><td>"+seat+"</td><td>"+ticket_name+"</td><td>"+seat_number+"</td><td>"+if_print+"</td><td>"+if_meal+"</td><td>"+if_bounce+"</td><td>"+price+"</td><td>"+choice+"</td></tr>";
  684. }
  685. //insertTable+="<tr style='border-top:1px solid #797979;'><td colspan='10'></td><td>总额</td><td style='color:#FF9900;'><span style='font-family:Arial;'>&yen;</span>"+jieguo.total_rmb+"</td></tr>";
  686. //console.log(insertTable);
  687. $('#sample-table-1 tbody').html(insertTable);
  688. $('#xm_show').css("display","block");
  689. }else{
  690. alert(jieguo.info);
  691. $('#xm_show').html("");
  692. }
  693. return jieguo;
  694. }
  695. function checkBoxClick(checkbox){
  696. if(checkbox.checked==true){
  697. var checkId=checkbox.id;
  698. if($("#"+checkId+"_meal").text()=='否'){
  699. $("#meal").attr("disabled",false);
  700. }else{
  701. $("#meal").attr("disabled","disabled");
  702. }
  703. //checkBoxObj.attr("checked","checked");
  704. //var pid=checkBoxObj.attr("pid");
  705. //$("#bounce").attr("disabled",false);
  706. if($("#"+checkId+"_bounce").text()=='-'){
  707. //$("#meal").attr("disabled",false);
  708. $("#bounce").attr("disabled",false);
  709. }else{
  710. $("#bounce").attr("disabled","disabled");
  711. }
  712. }
  713. }
  714. function checkBoxClick1(checkbox){
  715. var id=checkbox.id;
  716. //alert(id);
  717. if(checkbox.checked==true){
  718. //checkbox.setAttribute("checked","checked");
  719. $("#"+id).attr("checked","checked");
  720. }else{
  721. //checkbox.setAttribute("checked",false);
  722. $("#"+id).attr("checked",false);
  723. }
  724. }
  725. function choiceClose(){
  726. $('#choice_tickets').css('display','none');
  727. $('#meal_tickets').css("display","none");
  728. }
  729. function choice_button(){
  730. var start_area=$('#copy td:nth-child(1)').text();
  731. var end_area=$('#copy td:nth-child(2)').text();
  732. var line=$('#copy td:nth-child(3)').text();
  733. var start_date=$('#copy td:nth-child(4)').text();
  734. var start_up=$('#copy td:nth-child(5) select option:selected').text().split(" ");
  735. var start_date_time=start_date+' '+start_up[1];
  736. var seat_type=$('#copy td:nth-child(7)').text();
  737. var crowd=$('#copy td:nth-child(8)').text();
  738. var price=$('#copy td:nth-child(9)').text();
  739. var stock=$('#copy td:nth-child(10)').text();
  740. var xm_prod_id=$('#xm_prod_id').val();
  741. var xm_order_id=$('#xm_order_id').val();
  742. var xm_run_id=$('#copy td:nth-child(5) select option:selected').val();
  743. var insertTable="";
  744. insertTable+="<tr><td>"+line+"</td><td>"+start_area+"</td><td>"+end_area+"</td><td>"+start_date_time+"</td>";
  745. insertTable+="<td>"+seat_type+"</td><td>"+crowd+"</td><td>否</td><td>否</td><td>-</td><td><span style='color:#FF9900;font-family:Arial;'>"+price+"</span></td><td><input id='"+xm_prod_id+'-'+xm_order_id+"' type='checkbox' onclick='checkBoxClick1(this)'></td></tr>";
  746. $('#meal_tickets_order_id').val(xm_order_id);
  747. $('#meal_tickets_run_id').val(xm_run_id);
  748. $('#sample-table-3 tbody').html(insertTable);
  749. //$('#meal_tickets').css('display',"none");
  750. $('#meal_tickets').css("display","block");
  751. /* alert(start_area);
  752. alert(end_area);
  753. alert(line);
  754. alert(start_date);
  755. alert(seat_type);
  756. alert(crowd);
  757. alert(price);
  758. alert(stock); */
  759. //alert($('#copy td:nth-child(5) select').val());
  760. //alert($('#copy td:nth-child(5) select option:selected').text());
  761. /*
  762. var prod_id =$('#xm_prod_id').val();
  763. var parent_prod_id =$('#xm_parent_prod_id').val();
  764. $.ajax({
  765. url: "./st-xm/Api/change_back.php", //请求地址
  766. type: "get", //请求方式
  767. data: { prod_id: prod_id,method:"mealticket",parent_prod_id:parent_prod_id}, //请求参数
  768. async:false,
  769. dataType: "json",
  770. success: function (response) {
  771. if(response.errcode==0){
  772. var order_no=response.order_no;
  773. var line_info=response.line_info;
  774. var insertTable="";
  775. var checkboxId="xm_checkbox_0";
  776. (line_info.if_print==0)?aif_print="否":aif_print="是";
  777. (line_info.if_meal==0)?aif_meal="否":aif_meal="是";
  778. (line_info.if_bounce==0)?aif_bounce="-":aif_bounce="已退票";
  779. insertTable+="<tr><td>"+line_info.line_code+line_info.line_name+"</td><td>"+line_info.start_area+"</td><td>"+line_info.end_area+"</td><td>"+line_info.start_time+"</td>";
  780. insertTable+="<td>"+line_info.seat+"</td><td>"+line_info.ticket_name+"</td><td>"+aif_print+"</td><td>"+aif_meal+"</td><td>"+aif_bounce+"</td><td><span style='color:#FF9900;font-family:Arial;'>&yen;"+line_info.price+"</span></td><td><input id='"+checkboxId+"' type='checkbox' onclick='checkBoxClick1(this)'></td></tr>";
  781. //insertTable+="<tr style='border-top:1px solid #797979;'><td colspan='10'></td><td>总额</td><td style='color:#FF9900;'><span style='font-family:Arial;'>&yen;</span>"+jieguo.total_rmb+"</td></tr>";
  782. //console.log(insertTable);
  783. $('#sample-table-3 tbody').html(insertTable);
  784. }else{
  785. alert(response.info);
  786. $('#meal_tickets').html("");
  787. }
  788. },
  789. fail: function (status) {
  790. // 此处放失败后执行的代码
  791. }
  792. });
  793. $('#meal_tickets').css("display","block");*/
  794. }
  795. function getEndStation(){
  796. var x1=document.getElementById('select_start_station');
  797. var ops=x1.getElementsByTagName('option');
  798. var x2=document.getElementById('select_end_station');
  799. var ops2=x2.getElementsByTagName('option');
  800. for (var i = 0; i < ops.length; i++) {
  801. if (ops[i].selected==true) {
  802. ops2[i].selected=true;
  803. };
  804. };
  805. }
  806. function getStartStation(){
  807. var x1=document.getElementById('select_start_station');
  808. var ops=x1.getElementsByTagName('option');
  809. var x2=document.getElementById('select_end_station');
  810. var ops2=x2.getElementsByTagName('option');
  811. for (var i = 0; i < ops2.length; i++) {
  812. if (ops2[i].selected==true) {
  813. ops[i].selected=true;
  814. };
  815. };
  816. }
  817. function getQueryString(name) {
  818. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
  819. var r = window.location.search.substr(1).match(reg);
  820. if (r != null) return unescape(r[2]); return '';
  821. }
  822. </script>
  823. </body>
  824. <!--<script src="js/master.js"></script> -->
  825. </html>