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.
 
 
 
 

130 lines
5.8 KiB

  1. <html>
  2. <head>
  3. <meta charset="UTF-8">
  4. <script language="javascript" src="js/jquery-1.4.4.min.js"></script>
  5. <script language="javascript" src="js/jquery.jqprint-0.3.js"></script>
  6. </head>
  7. <body>
  8. <!---->
  9. <div style="width: 1100px;" id="ddd">
  10. </div>
  11. </body>
  12. <script>
  13. $(document).ready(function(){
  14. var order_id = getPar("order_id");
  15. $.ajax({
  16. url:'./st-xm/Api/print.php', //请求地址
  17. type: "post", //请求方式
  18. data:{
  19. order_id:order_id
  20. },
  21. async:false,
  22. dataType: "json",
  23. success: function (data) {
  24. console.log(data);
  25. if(data.code == 0){
  26. creatHtml(data.list,data.totalnum);
  27. }else{
  28. alert(data.info);
  29. }
  30. },
  31. fail: function (date) {
  32. }
  33. });
  34. })
  35. function getPar(par) {
  36. //获取当前URL
  37. var local_url = document.location.href;
  38. local_url = decodeURI(local_url);
  39. //获取要取得的get参数位置
  40. var get = local_url.indexOf(par + "=");
  41. if(get == -1) {
  42. return "";
  43. }
  44. //截取字符串
  45. var get_par = local_url.slice(par.length + get + 1);
  46. //判断截取后的字符串是否还有其他get参数
  47. var nextPar = get_par.indexOf("&");
  48. if(nextPar != -1) {
  49. get_par = get_par.slice(0, nextPar);
  50. }
  51. return get_par;
  52. }
  53. function creatHtml(data,num){
  54. var temp = "";
  55. for(var i=0;i<num;i++) {
  56. if ( data[i].supplier == 1 ) {
  57. temp += '<div style=" font-size: 22px;display:inline-block;margin-top: 0px;width:500px;" >'
  58. + '<span style="margin-left:30px;font-size:28px;">南京太平洋国际旅游有限责任公司</span><br><br><br><br>'
  59. + '<span>' + data[i].tp.start_area + '-' + data[i].tp.end_area + ' 单程票</span><br>'
  60. + '<span>票价:' + data[i].lp.order_price + '元</span><br>'
  61. + '<span>' + data[i].tp.son_name + ' ' + data[i].tp.main_phone + ' ' + data[i].lp.date + ' ' + data[i].lp.bus_no + '车' + data[i].lp.seat_no + '座</span><br>'
  62. + '<span>' + data[i].tp.start_res + ' ' + data[i].lp.time + '</span><br>'
  63. + '</div>';
  64. temp += '<div style=" font-size: 14px;display:inline-block;width:210px;vertical-align: top;text-align:left;margin-top: 0px;" id="">'
  65. + '<span style="margin-left:20px;font-size:22px;">旅客须知</span><br><br><br><br>'
  66. + '<span style="margin-left:-5px;word-break:normal; width:185px; display:block; white-space:pre-wrap;word-wrap : break-word ;overflow: hidden ;">1.出发前3日退票收取车票面额10%。出发前2日退票收入车票面额20%。出发前1日及出发当天不予退票。<br>'
  67. + '2.此票仅为乘车凭证,请保留好,遗失不补。<br>'
  68. + '3.凡已购迪士尼门票,刷身份证直接入园。<br>'
  69. + '4.图一票规定以此为准。<br>'
  70. + '</div>';
  71. temp += '<div style=" font-size: 16px;display:inline-block;width:210px;vertical-align: top;margin-top: 130px;" id="">'
  72. + '<span style="margin-left:30px;font-size:30px;">此联作废</span><br>'
  73. + '</div>';
  74. temp += '<div style=" font-size: 18px;display:inline-block;width:170px;vertical-align: top;margin-top: 0px;" id="">'
  75. + '<span style="margin-left:40px;font-size:22px;">去程检票联</span><br><br><br><br>'
  76. + '<span style="margin-left:18px;font-size:20px;">' + data[i].lp.start_area + '-' + data[i].lp.end_area + '</span><br><br>'
  77. + '<span style="margin-left:18px;font-size:18px;">' + data[i].lp.date + ' ' + data[i].lp.time + '</span><br>'
  78. + '<span style="margin-left:18px;font-size:20px;">' + data[i].tp.start_res + '</span><br>'
  79. + '<span style="margin-left:18px;font-size:22px;">' + data[i].lp.bus_no + '车' + data[i].lp.seat_no + '座</span><br>'
  80. + '</div>';
  81. } else {
  82. temp += '<div style=" font-size: 16px;display: inline-block;margin-top: 100px;width:500px;" >'
  83. + '<span>' + data[i].tp.start_area + '(' + data[i].tp.start_res + ')-' + data[i].tp.end_area + '(' + data[i].tp.end_res + ')</span><br>'
  84. + '<span>发车日期:' + data[i].tp.date + '</span><br>'
  85. + '<span>发车时间:' + data[i].tp.time + '</span><br>'
  86. + '<span>乘客姓名:' + data[i].tp.son_name + '</span><br>'
  87. + '<span>身份证号:' + data[i].tp.son_idcard + '</span><br>'
  88. + '<span>乘客电话:' + data[i].tp.main_phone + '</span><br>'
  89. + '<span>订单编号:' + data[i].tp.son_order_id + '</span><br>'
  90. + '</div>';
  91. temp += '<div style=" font-size: 16px;display: inline-block;width:210px;vertical-align: top;margin-top: 100px;" id="">'
  92. + '<span style="margin-left:10px;">检票联</span><br>'
  93. + '<span style="margin-left:10px;">' + data[i].lp.start_area + '-' + data[i].lp.end_area + '</span><br>'
  94. + '<span style="margin-left:10px;">发车日期:' + data[i].lp.date + '</span><br>'
  95. + '<span style="margin-left:10px;">发车时间:' + data[i].lp.time + '</span><br>'
  96. + '</div>';
  97. temp += '<div style=" font-size: 16px;display: inline-block;width:210px;vertical-align: top;margin-top: 100px;" id="">'
  98. + '<span style="margin-left:30px;">检票联</span><br>'
  99. + '<span style="margin-left:30px;">' + data[i].lp.start_area + '-' + data[i].lp.end_area + '</span><br>'
  100. + '<span style="margin-left:30px;">发车日期:' + data[i].lp.date + '</span><br>'
  101. + '<span style="margin-left:30px;">发车时间:' + data[i].lp.time + '</span><br>'
  102. + '</div>';
  103. temp += '<div style=" font-size: 16px;display: inline-block;width:170px;vertical-align: top;margin-top: 100px;" id="">'
  104. + '<span style="margin-left:30px;">检票联</span><br>'
  105. + '<span style="margin-left:30px;">' + data[i].lp.start_area + '-' + data[i].lp.end_area + '</span><br>'
  106. + '<span style="margin-left:30px;">发车日期:' + data[i].lp.date + '</span><br>'
  107. + '<span style="margin-left:30px;">发车时间:' + data[i].lp.time + '</span><br>'
  108. + '</div>';
  109. }
  110. }
  111. $("#ddd").html(temp);
  112. $("#ddd").jqprint();
  113. }
  114. </script>
  115. </html>