|
- <html>
- <head>
- <meta charset="UTF-8">
-
- <script language="javascript" src="js/jquery-1.4.4.min.js"></script>
- <script language="javascript" src="js/jquery.jqprint-0.3.js"></script>
-
- </head>
- <body>
- <!---->
-
-
- <div style="width: 1100px;" id="ddd">
-
- </div>
-
- </body>
- <script>
- $(document).ready(function(){
- var order_id = getPar("order_id");
- $.ajax({
- url:'./st-xm/Api/print.php', //请求地址
- type: "post", //请求方式
- data:{
- order_id:order_id
- },
- async:false,
- dataType: "json",
- success: function (data) {
-
- console.log(data);
- if(data.code == 0){
- creatHtml(data.list,data.totalnum);
- }else{
- alert(data.info);
- }
- },
- fail: function (date) {
- }
- });
- })
-
-
-
-
- function getPar(par) {
- //获取当前URL
- var local_url = document.location.href;
- local_url = decodeURI(local_url);
- //获取要取得的get参数位置
- var get = local_url.indexOf(par + "=");
- if(get == -1) {
- return "";
- }
- //截取字符串
- var get_par = local_url.slice(par.length + get + 1);
- //判断截取后的字符串是否还有其他get参数
- var nextPar = get_par.indexOf("&");
- if(nextPar != -1) {
- get_par = get_par.slice(0, nextPar);
- }
- return get_par;
- }
-
-
- function creatHtml(data,num){
- var temp = "";
- for(var i=0;i<num;i++) {
- if ( data[i].supplier == 1 ) {
- temp += '<div style=" font-size: 22px;display:inline-block;margin-top: 0px;width:500px;" >'
- + '<span style="margin-left:30px;font-size:28px;">南京太平洋国际旅游有限责任公司</span><br><br><br><br>'
- + '<span>' + data[i].tp.start_area + '-' + data[i].tp.end_area + ' 单程票</span><br>'
- + '<span>票价:' + data[i].lp.order_price + '元</span><br>'
- + '<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>'
- + '<span>' + data[i].tp.start_res + ' ' + data[i].lp.time + '</span><br>'
- + '</div>';
- temp += '<div style=" font-size: 14px;display:inline-block;width:210px;vertical-align: top;text-align:left;margin-top: 0px;" id="">'
- + '<span style="margin-left:20px;font-size:22px;">旅客须知</span><br><br><br><br>'
- + '<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>'
- + '2.此票仅为乘车凭证,请保留好,遗失不补。<br>'
- + '3.凡已购迪士尼门票,刷身份证直接入园。<br>'
- + '4.图一票规定以此为准。<br>'
- + '</div>';
- temp += '<div style=" font-size: 16px;display:inline-block;width:210px;vertical-align: top;margin-top: 130px;" id="">'
- + '<span style="margin-left:30px;font-size:30px;">此联作废</span><br>'
- + '</div>';
- temp += '<div style=" font-size: 18px;display:inline-block;width:170px;vertical-align: top;margin-top: 0px;" id="">'
- + '<span style="margin-left:40px;font-size:22px;">去程检票联</span><br><br><br><br>'
- + '<span style="margin-left:18px;font-size:20px;">' + data[i].lp.start_area + '-' + data[i].lp.end_area + '</span><br><br>'
- + '<span style="margin-left:18px;font-size:18px;">' + data[i].lp.date + ' ' + data[i].lp.time + '</span><br>'
- + '<span style="margin-left:18px;font-size:20px;">' + data[i].tp.start_res + '</span><br>'
- + '<span style="margin-left:18px;font-size:22px;">' + data[i].lp.bus_no + '车' + data[i].lp.seat_no + '座</span><br>'
- + '</div>';
- } else {
- temp += '<div style=" font-size: 16px;display: inline-block;margin-top: 100px;width:500px;" >'
- + '<span>' + data[i].tp.start_area + '(' + data[i].tp.start_res + ')-' + data[i].tp.end_area + '(' + data[i].tp.end_res + ')</span><br>'
- + '<span>发车日期:' + data[i].tp.date + '</span><br>'
- + '<span>发车时间:' + data[i].tp.time + '</span><br>'
- + '<span>乘客姓名:' + data[i].tp.son_name + '</span><br>'
- + '<span>身份证号:' + data[i].tp.son_idcard + '</span><br>'
- + '<span>乘客电话:' + data[i].tp.main_phone + '</span><br>'
- + '<span>订单编号:' + data[i].tp.son_order_id + '</span><br>'
- + '</div>';
- temp += '<div style=" font-size: 16px;display: inline-block;width:210px;vertical-align: top;margin-top: 100px;" id="">'
- + '<span style="margin-left:10px;">检票联</span><br>'
- + '<span style="margin-left:10px;">' + data[i].lp.start_area + '-' + data[i].lp.end_area + '</span><br>'
- + '<span style="margin-left:10px;">发车日期:' + data[i].lp.date + '</span><br>'
- + '<span style="margin-left:10px;">发车时间:' + data[i].lp.time + '</span><br>'
- + '</div>';
- temp += '<div style=" font-size: 16px;display: inline-block;width:210px;vertical-align: top;margin-top: 100px;" id="">'
- + '<span style="margin-left:30px;">检票联</span><br>'
- + '<span style="margin-left:30px;">' + data[i].lp.start_area + '-' + data[i].lp.end_area + '</span><br>'
- + '<span style="margin-left:30px;">发车日期:' + data[i].lp.date + '</span><br>'
- + '<span style="margin-left:30px;">发车时间:' + data[i].lp.time + '</span><br>'
- + '</div>';
- temp += '<div style=" font-size: 16px;display: inline-block;width:170px;vertical-align: top;margin-top: 100px;" id="">'
- + '<span style="margin-left:30px;">检票联</span><br>'
- + '<span style="margin-left:30px;">' + data[i].lp.start_area + '-' + data[i].lp.end_area + '</span><br>'
- + '<span style="margin-left:30px;">发车日期:' + data[i].lp.date + '</span><br>'
- + '<span style="margin-left:30px;">发车时间:' + data[i].lp.time + '</span><br>'
- + '</div>';
- }
- }
- $("#ddd").html(temp);
- $("#ddd").jqprint();
- }
-
-
- </script>
- </html>
|