flight-query.html 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>机票预订</title>
  6. <meta name="description" content="后台管理系统"/>
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  8. <!-- bootstrap -->
  9. <link href="css/bootstrap/bootstrap.css" rel="stylesheet">
  10. <link href="css/bootstrap/bootstrap-overrides.css" type="text/css" rel="stylesheet">
  11. <!-- global styles -->
  12. <link rel="stylesheet" type="text/css" href="css/compiled/layout.css">
  13. <link rel="stylesheet" type="text/css" href="css/compiled/elements.css">
  14. <link rel="stylesheet" type="text/css" href="css/compiled/icons.css">
  15. <!-- libraries -->
  16. <link href="css/lib/font-awesome.css" type="text/css" rel="stylesheet"/>
  17. <!-- this page specific styles -->
  18. <link rel="stylesheet" href="css/compiled/flight-query.css" type="text/css" media="screen"/>
  19. <!--[if lt IE 9]>
  20. <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
  21. <![endif]-->
  22. </head>
  23. <body>
  24. <!-- navbar -->
  25. <header class="navbar navbar-inverse" role="banner">
  26. <div class="navbar-header">
  27. <button class="navbar-toggle" type="button" data-toggle="collapse" id="menu-toggler">
  28. <span class="sr-only">导航</span>
  29. <span class="icon-bar"></span>
  30. <span class="icon-bar"></span>
  31. <span class="icon-bar"></span>
  32. </button>
  33. <a class="navbar-brand" href="./index.html"><img src="img/logo.png"></a>
  34. </div>
  35. <ul class="nav navbar-nav pull-right hidden-xs">
  36. <li class="settings hidden-xs hidden-sm">
  37. <a href="./setting.html" role="button">
  38. <i class="icon-cog"></i>
  39. </a>
  40. </li>
  41. <li class="settings hidden-xs hidden-sm">
  42. <a href="./signin.html" role="button">
  43. 退出<i class="icon-signout" style="font-size: 12px;margin-left: 10px;"></i>
  44. </a>
  45. </li>
  46. </ul>
  47. </header>
  48. <!-- end navbar -->
  49. <!-- sidebar -->
  50. <div id="sidebar-nav">
  51. <ul id="dashboard-menu">
  52. <li>
  53. <a href="./index.html">
  54. <i class="icon-home"></i>
  55. <span>首页</span>
  56. </a>
  57. </li>
  58. <li class="active">
  59. <div class="pointer">
  60. <div class="arrow"></div>
  61. <div class="arrow_border"></div>
  62. </div>
  63. <a href="./flight-query.html">
  64. <i class="icon-plane"></i>
  65. <span>快捷下单</span>
  66. </a>
  67. </li>
  68. <li>
  69. <a href="./flight-query-complex.html">
  70. <i class="icon-fighter-jet"></i>
  71. <span>人工下单</span>
  72. </a>
  73. </li>
  74. <li>
  75. <a href="./order-list.html">
  76. <i class="icon-tasks"></i>
  77. <span>订单管理</span>
  78. </a>
  79. </li>
  80. <li>
  81. <a href="./setting.html">
  82. <i class="icon-cog"></i>
  83. <span>系统配置</span>
  84. </a>
  85. </li>
  86. </ul>
  87. </div>
  88. <!-- end sidebar -->
  89. <!-- main container -->
  90. <div class="content">
  91. <div id="pad-wrapper">
  92. <!-- query form -->
  93. <form role="form" class="query">
  94. <div class="alert alert-danger"><i class="icon-remove-sign"></i>请输入您的查询信息。</div>
  95. <textarea rows="10" class="form-control query-txt" placeholder="由于阿里接口参数原因,本系统有以下限制
  96. 1: 不支持往返下单
  97. 2: 不支持护照下单及其他证件下单
  98. 3: 生日格式 YYYY-MM-DD
  99. " name="txt"></textarea>
  100. <button class="btn-flat" type="button">查询</button>
  101. </form>
  102. <!-- end query form -->
  103. <!-- query-list table -->
  104. <div class="panel panel-default">
  105. <div class="panel-heading">航班信息</div>
  106. <div class="panel-body">
  107. <div class="table-wrapper orders-table section">
  108. <div class="row">
  109. <table class="table">
  110. <thead>
  111. <tr class="text-center">
  112. <th class="col-md-1" style="width: 14%">
  113. 产品类型
  114. </th>
  115. <th class="col-md-2" style="width: 15%">
  116. <span class="line"></span>
  117. 航班信息
  118. </th>
  119. <th class="col-md-2">
  120. <span class="line"></span>
  121. 起飞时间
  122. </th>
  123. <th class="col-md-2">
  124. <span class="line"></span>
  125. 到达时间
  126. </th>
  127. <th class="col-md-2" style="width: 12%">
  128. <span class="line"></span>
  129. 价格
  130. </th>
  131. <th class="col-md-3">
  132. <span class="line"></span>
  133. 退改签信息
  134. </th>
  135. </tr>
  136. </thead>
  137. <tbody class="query-list">
  138. <!-- row -->
  139. <tr class="first">
  140. <td>--</td>
  141. <td>--</td>
  142. <td>--</td>
  143. <td>--</td>
  144. <td>--</td>
  145. <td>--</td>
  146. </tr>
  147. </tbody>
  148. </table>
  149. </div>
  150. </div>
  151. </div>
  152. <!-- end query-list table -->
  153. </div>
  154. <div class="panel panel-default passengers-info">
  155. <div class="panel-heading">乘车人信息</div>
  156. <div class="panel-body">
  157. <div class="row">
  158. <table class="table table-hover">
  159. <thead>
  160. <tr>
  161. <th class="col-md-2" width="14%;">
  162. 乘客姓名
  163. </th>
  164. <th class="col-md-3" width="20%;">
  165. <span class="line"></span>
  166. 证件类型
  167. </th>
  168. <th class="col-md-3" width="24%;">
  169. <span class="line"></span>
  170. 证件号
  171. </th>
  172. <th class="col-md-2">
  173. <span class="line"></span>
  174. 出生日期
  175. </th>
  176. <th class="col-md-2">
  177. <span class="line"></span>
  178. 乘客类型
  179. </th>
  180. </tr>
  181. </thead>
  182. <tbody class="passengers-list">
  183. </tbody>
  184. </table>
  185. </div>
  186. </div>
  187. </div>
  188. <div class="alert alert-success" style="display: none;"><i class="icon-ok-sign"></i>您已成功下单。</div>
  189. <button class="btn-flat success quick-buy" type="button" data-toggle="modal">下单</button>
  190. </div>
  191. </div>
  192. <!-- end main container -->
  193. <div class="modal fade" tabindex="-1" role="dialog" aria-labelledby="orderinfoS" id="orderinfoS">
  194. <div class="modal-dialog" role="document" style="width:32%;">
  195. <div class="modal-content">
  196. <div class="modal-header">
  197. <button type="button" class="close modalClose" data-dismiss="modal"><span
  198. aria-hidden="true">&times;</span></button>
  199. <h3 class="modal-title text-success" id="gridSystemModalLabel">操作成功!</h3>
  200. </div>
  201. <div class="modal-body">
  202. <ul class="list-group" style="margin-bottom: 0;">
  203. <!-- <li class="list-group-item">淘宝订单号:12313356633</li>
  204. <li class="list-group-item">支付宝交易流水号:800123654796643366555663</li>
  205. <li class="list-group-item">订单实际支付金额:1000</li>
  206. <li class="list-group-item">该单是否使用了原PNR出票:否</li> -->
  207. </ul>
  208. </div>
  209. <div class="modal-footer">
  210. <a type="button" class="btn btn-info details" href="javascript:;">查看订单详情</a>
  211. <button type="button" class="btn btn-default modalClose" data-dismiss="modal">关闭</button>
  212. </div>
  213. </div><!-- /.modal-content -->
  214. </div><!-- /.modal-dialog -->
  215. </div><!-- /.modal -->
  216. <!-- scripts -->
  217. <script src="js/jquery.min.js"></script>
  218. <script src="js/bootstrap.min.js"></script>
  219. <script src="js/theme.js"></script>
  220. <script>
  221. $(function () {
  222. var uname = localStorage.uname;
  223. var token = localStorage.tokenId;
  224. $(".icon-remove-sign").click(function () {
  225. $(this).parent(".alert").hide();
  226. });
  227. // 提交表单
  228. $(".query button").click(function () {
  229. var txt = $(".query-txt").val();
  230. // console.log(txt);
  231. if (txt == "") {
  232. $(this).parent(".query").find(".alert").show();
  233. } else {
  234. $.ajax({
  235. url: 'http://114.55.6.23/jh/ticket/parseTxtAndGetInfo',
  236. // url:'http://192.168.1.19:16001/ticket/parseTxtAndGetInfo',
  237. data: {"uname": uname, "token": token, "txt": txt},
  238. type: "POST",
  239. dataType: "json",
  240. error: function (XMLHttpRequest, textStatus, errorThrown) {
  241. console.log(XMLHttpRequest.responseText);
  242. console.log(XMLHttpRequest.readyState);
  243. console.log(textStatus);
  244. $(".query .alert").html('<i class="icon-remove-sign"></i>' + "您输入的信息有误,请重新输入!").show();
  245. $(".icon-remove-sign").click(function () {
  246. $(this).parent(".alert").hide();
  247. });
  248. },
  249. success: function (data) {
  250. if (data.status == 100) {
  251. $(".query .alert").html('<i class="icon-remove-sign"></i>' + data.attachment).show();
  252. $(".icon-remove-sign").click(function () {
  253. $(this).parent(".alert").hide();
  254. });
  255. } else if (data.status == 200) {
  256. // $(".query-txt").val("");
  257. $(".query-list .first").hide();
  258. $(".passengers-info").show();
  259. $(".quick-buy").show();
  260. console.log(data);
  261. var queryList = "";
  262. var passengersList = "";
  263. for (var i = 0; i < data.attachment.getPriceResps.length; i++) {
  264. var str = '<tr>' +
  265. '<td>' +
  266. '<p>' + '<i class="icon-ok" style="display: none"></i>' + '<span>' + data.attachment.getPriceResps[i].productType + '</span>' + '</p>' +
  267. '<p class = "hidden">infoId:' + '<span class="infoId">' + data.attachment.getPriceResps[i].infoId + '</span>' + '</p>' +
  268. '</td>' +
  269. '<td>' +
  270. '<p>航空公司:' + '<span>' + data.attachment.getPriceResps[i].airLine + '</span>' + '</p>' +
  271. '<p>航班号:' + '<span>' + data.attachment.getPriceResps[i].flightNum + '</span>' + '</p>' +
  272. '<p>舱位:' + '<span>' + data.attachment.getPriceResps[i].cabin + '</span>' + '</p>' +
  273. '<p>舱位等级:' + '<span>' + data.attachment.getPriceResps[i].cabinClass + '</span>' + '</p>' +
  274. '</td>' +
  275. '<td>' +
  276. '<p>出发城市:' + '<span>' + data.attachment.getPriceResps[i].depAirport + '</span>' + '</p>' +
  277. '<p>' + '<span>' + data.attachment.getPriceResps[i].depTime + '</span>' + '</p>' +
  278. '</td>' +
  279. '<td>' +
  280. '<p>到达城市:' + '<span>' + data.attachment.getPriceResps[i].arrAirport + '</span>' + '</p>' +
  281. '<p>' + '<span>' + data.attachment.getPriceResps[i].arrTime + '</span>' + '</p>' +
  282. '</td>' +
  283. '<td>' +
  284. '<p>舱位价格:' + '<span>' + data.attachment.getPriceResps[i].cabinPrice + '</span>' + '</p>' +
  285. '<p>票面价格:' + '<span>' + data.attachment.getPriceResps[i].ticketPrice + '</span>' + '</p>' +
  286. '</td>' +
  287. '<td>' +
  288. '<p>退改签说明:' + '<span>' + data.attachment.getPriceResps[i].tuiGaiQian.tuigaiqianStr + '</span>' + '</p>' +
  289. // '<p>产品类型:'+ data.attachment.getPriceResps[i].productType+'</p>'+
  290. '</td>' +
  291. '</tr>';
  292. queryList += str;
  293. }
  294. $(".query-list").html(queryList);
  295. //判断返回的乘客信息是否有误
  296. if (data.attachment.passengers.length < 1) {
  297. passengersList = '<tr class="psg-item">' +
  298. '<td>' +
  299. '<input class="form-control pname" type="text" name="Pname" required="required" placeholder="姓名">' +
  300. '</td>' +
  301. '<td>' +
  302. '<select class="form-control docType" name="docType" required="required">' +
  303. '<option value="NI">身份证</option>' +
  304. '<option value="PP">护照</option>' +
  305. '<option value="MI">军人证</option>' +
  306. '<option value="BH">回乡证</option>' +
  307. '<option value="TW">台胞证</option>' +
  308. '<option value="HK">港澳通行证</option>' +
  309. '<option value="PO">警官证 </option>' +
  310. '<option value="SO">士兵证</option>' +
  311. '<option value="TH">其他证件</option>' +
  312. '</select>' +
  313. '</td>' +
  314. '<td>' +
  315. '<input class="form-control docId" type="text" name="docId" required="required"/>' +
  316. '</td>' +
  317. '<td>' +
  318. '<input class="form-control birthDay" type="text" name="birthDay" required="required" placeholder="YYYY-MM-DD"/>' +
  319. '</td>' +
  320. '<td>' +
  321. '<select class="form-control ptype" name="Ptype" required="required">' +
  322. '<option value="ADT">成人</option>' +
  323. '<option value="CHD">儿童</option>' +
  324. '</select>' +
  325. '</td>' +
  326. '</tr>';
  327. } else {
  328. for (var i = 0; i < data.attachment.passengers.length; i++) {
  329. if (data.attachment.passengers[i].docId == null || data.attachment.passengers[i].docId == "") {
  330. var nameval = "";
  331. if (data.attachment.passengers[i].pname == null || data.attachment.passengers[i].pname == "") {
  332. nameval = "";
  333. } else {
  334. nameval = data.attachment.passengers[i].pname;
  335. }
  336. ;
  337. var str = '<tr class="psg-item">' +
  338. '<td>' +
  339. '<input class="form-control pname" type="text" name="Pname" required="required" placeholder="姓名" value=' + nameval + '>' +
  340. '</td>' +
  341. '<td>' +
  342. '<select class="form-control docType" name="docType" required="required">' +
  343. '<option value="NI">身份证</option>' +
  344. '<option value="PP">护照</option>' +
  345. '<option value="MI">军人证</option>' +
  346. '<option value="BH">回乡证</option>' +
  347. '<option value="TW">台胞证</option>' +
  348. '<option value="HK">港澳通行证</option>' +
  349. '<option value="PO">警官证 </option>' +
  350. '<option value="SO">士兵证</option>' +
  351. '<option value="TH">其他证件</option>' +
  352. '</select>' +
  353. '</td>' +
  354. '<td>' +
  355. '<input class="form-control docId" type="text" name="docId" required="required"/>' +
  356. '</td>' +
  357. '<td>' +
  358. '<input class="form-control birthDay" type="text" name="birthDay" required="required" placeholder="YYYY-MM-DD"/>' +
  359. '</td>' +
  360. '<td>' +
  361. '<select class="form-control ptype" name="Ptype" required="required">' +
  362. '<option value="ADT">成人</option>' +
  363. '<option value="CHD">儿童</option>' +
  364. '</select>' +
  365. '</td>' +
  366. '</tr>';
  367. passengersList += str;
  368. } else {
  369. var docTypeL;
  370. var docTypeS = data.attachment.passengers[i].docType;
  371. switch (docTypeS) {
  372. case "PP":
  373. docTypeL = "护照";
  374. break;
  375. case "NI":
  376. docTypeL = "身份证";
  377. break;
  378. case "MI":
  379. docTypeL = "军人证";
  380. break;
  381. case "BH":
  382. docTypeL = "回乡证";
  383. break;
  384. case "TW":
  385. docTypeL = "台胞证";
  386. break;
  387. case "HK":
  388. docTypeL = "港澳通行证";
  389. break;
  390. case "PO":
  391. docTypeL = "警官证";
  392. break;
  393. case "SO":
  394. docTypeL = "士兵证";
  395. break;
  396. case "TH":
  397. docTypeL = "其他证件";
  398. break;
  399. }
  400. docTypeS = docTypeL;
  401. var pTypeL;
  402. var pTypeS = data.attachment.passengers[i].ptype;
  403. switch (pTypeS) {
  404. case "ADT":
  405. pTypeL = "成人";
  406. break;
  407. case "CHD":
  408. pTypeL = "儿童";
  409. break;
  410. }
  411. pTypeS = pTypeL;
  412. var pasStr = '<tr>' +
  413. '<td>' +
  414. '<p class="pname">' + data.attachment.passengers[i].pname + '</p>' +
  415. '</td>' +
  416. '<td>' +
  417. '<p>' + '<span class="docType hidden">' + data.attachment.passengers[i].docType + '</span>' + docTypeS + '</p>' +
  418. '</td>' +
  419. '<td>' +
  420. '<p>' + '<span class="docId">' + data.attachment.passengers[i].docId + '</span>' + '</p>' +
  421. '</td>' +
  422. '<td>' +
  423. '<p class="birthDay">' + data.attachment.passengers[i].birthDay + '</p>' +
  424. '</td>' +
  425. '<td>' +
  426. '<p>' + '<span class="ptype hidden">' + data.attachment.passengers[i].ptype + '</span>' + pTypeS + '</p>' +
  427. '</td>' +
  428. '</tr>';
  429. passengersList += pasStr;
  430. }
  431. }
  432. }
  433. $(".passengers-list").html(passengersList);
  434. //选中需要购买的航班信息
  435. var checkedInfo = "";
  436. $(".query-list tr").click(function () {
  437. $(".query-list tr.active").removeClass("active");
  438. $(this).addClass("active");
  439. checkedInfo = $(this).find(".infoId").html();
  440. // alert( checkedInfo);
  441. });
  442. //身份证号回填生日
  443. $("input[name='docId']").blur(function () {
  444. var that = $(this);
  445. var inputdocid = $(this).val().trim();
  446. var docselected = that.parent().prev();
  447. var bthdayinput = that.parent().next();
  448. var valtype = docselected.find("select[name='docType']").val();
  449. var valbthday = bthdayinput.find("input[name='birthDay']");
  450. if (inputdocid != null && inputdocid != "") {
  451. if (valtype == "NI") {
  452. var brithday = getBirthdayFromIdCard(inputdocid);
  453. valbthday.val(brithday);
  454. //valbthday.attr("disabled","disabled");
  455. } else {
  456. valbthday.val("");
  457. }
  458. }
  459. });
  460. function getBirthdayFromIdCard(idCard) {
  461. var birthday = "";
  462. if (idCard != null && idCard != "") {
  463. if (idCard.length == 15) {
  464. birthday = "19" + idCard.substr(6, 6);
  465. } else if (idCard.length == 18) {
  466. birthday = idCard.substr(6, 8);
  467. } else {
  468. alert("请输入正确的身份证号!");
  469. }
  470. ;
  471. birthday = birthday.replace(/(.{4})(.{2})/, "$1-$2-");
  472. }
  473. return birthday;
  474. }
  475. // 定义下单需要的数据
  476. var respsg = data.attachment.passengers;
  477. var psgList = new Array();
  478. var pname;
  479. var ptype;
  480. var docType;
  481. var docId;
  482. var birthDay;
  483. var psgItem;
  484. $(".quick-buy").on('click', function (data) {
  485. checkedInfo = $(".query-list tr.active").find(".infoId").html();
  486. // alert(checkedInfo);
  487. if ($(".query-list tr.active").length < 1) {
  488. var orderStr = '<li class="list-group-item" style="border: none;font-size: 16px;">请选择航班信息!</li>';
  489. var modHeader = '<h3 class="modal-title text-danger" id="gridSystemModalLabel">操作失败!</h3>';
  490. $(".modal-header button").next("h3").remove();
  491. $(".modal-header button").after(modHeader);
  492. $(".modal-footer .details").addClass("hide");
  493. $(".modal-body .list-group").html(orderStr);
  494. $('#orderinfoS').modal();
  495. return false;
  496. };
  497. psgList = [];
  498. //各种情况的数据
  499. if (respsg.length < 1) {
  500. pname = $(".passengers-list tr td").find(".pname").val();
  501. ptype = $(".passengers-list tr td").find(".ptype").val();
  502. docType = $(".passengers-list tr td").find(".docType").val();
  503. docId = $(".passengers-list tr td").find(".docId").val();
  504. birthDay = $(".passengers-list tr td").find(".birthDay").val();
  505. if (docId == null || docId == ""){
  506. var orderStr = '<li class="list-group-item" style="border: none;font-size: 16px;">请输入证件号码!</li>';
  507. var modHeader = '<h3 class="modal-title text-danger" id="gridSystemModalLabel">操作失败!</h3>';
  508. $(".modal-header button").next("h3").remove();
  509. $(".modal-header button").after(modHeader);
  510. $(".modal-footer .details").addClass("hide");
  511. $(".modal-body .list-group").html(orderStr);
  512. $('#orderinfoS').modal();
  513. return false;
  514. }
  515. psgItem = {
  516. "docType": docType,
  517. "docId": docId,
  518. "birthDay": birthDay,
  519. "Pname": pname,
  520. "ptype": ptype
  521. };
  522. psgList.push(psgItem);
  523. } else {
  524. var flag = true;
  525. for (var i = 0; i < respsg.length; i++) {
  526. if (respsg[i].docId == null || respsg[i].docId == "") {
  527. flag = false;
  528. } else {
  529. flag = true;
  530. }
  531. }
  532. if (flag) {
  533. //下单时,获取联系人信息
  534. for (var i = 0; i < $(".passengers-list tr").length; i++) {
  535. pname = $(".passengers-list tr").eq(i).find("td").find(".pname").html();
  536. ptype = $(".passengers-list tr").eq(i).find("td").find(".ptype").html();
  537. docType = $(".passengers-list tr").eq(i).find("td").find(".docType").html();
  538. docId = $(".passengers-list tr").eq(i).find("td").find(".docId").html();
  539. birthDay = $(".passengers-list tr").eq(i).find("td").find(".birthDay").html();
  540. if (docId == null || docId == ""){
  541. var orderStr = '<li class="list-group-item" style="border: none;font-size: 16px;">请输入证件号码!</li>';
  542. var modHeader = '<h3 class="modal-title text-danger" id="gridSystemModalLabel">操作失败!</h3>';
  543. $(".modal-header button").next("h3").remove();
  544. $(".modal-header button").after(modHeader);
  545. $(".modal-footer .details").addClass("hide");
  546. $(".modal-body .list-group").html(orderStr);
  547. $('#orderinfoS').modal();
  548. return false;
  549. }
  550. psgItem = {
  551. "docType": docType,
  552. "docId": docId,
  553. "birthDay": birthDay,
  554. "Pname": pname,
  555. "ptype": ptype
  556. };
  557. psgList.push(psgItem);
  558. }
  559. } else {
  560. //下单时,获取联系人信息
  561. for (var i = 0; i < $(".passengers-list tr").length; i++) {
  562. pname = $(".passengers-list tr").eq(i).find(".pname").val();
  563. ptype = $(".passengers-list tr").eq(i).find(".ptype").val();
  564. docType = $(".passengers-list tr").eq(i).find(".docType").val();
  565. docId = $(".passengers-list tr").eq(i).find(".docId").val();
  566. birthDay = $(".passengers-list tr").eq(i).find(".birthDay").val();
  567. if (docId == null || docId == ""){
  568. var orderStr = '<li class="list-group-item" style="border: none;font-size: 16px;">请输入证件号码!</li>';
  569. var modHeader = '<h3 class="modal-title text-danger" id="gridSystemModalLabel">操作失败!</h3>';
  570. $(".modal-header button").next().remove();
  571. $(".modal-header button").after(modHeader);
  572. $(".modal-footer .details").addClass("hide");
  573. $(".modal-body .list-group").html(orderStr);
  574. $('#orderinfoS').modal();
  575. return false;
  576. }
  577. //var data = $(".passengers-list tr").eq(i).find('.form-control').serialize();
  578. psgItem = {
  579. "docType": docType,
  580. "docId": docId,
  581. "birthDay": birthDay,
  582. "Pname": pname,
  583. "ptype": ptype
  584. };
  585. psgList.push(psgItem);
  586. }
  587. }
  588. ;
  589. }
  590. ;
  591. function GetJsonData() {
  592. var orderParams = {
  593. "uname": uname,
  594. "token": token,
  595. "infoId": checkedInfo,
  596. "passengers": psgList
  597. };
  598. return orderParams;
  599. };
  600. var send = {
  601. "uname": uname,
  602. "token": token,
  603. "infoId": checkedInfo,
  604. "passengers": psgList
  605. }
  606. console.log(send);
  607. $.ajax({
  608. type: "POST",
  609. // url:"http://192.168.1.19:16001/ticket/orderAndPayByParams",
  610. url: "http://www.zjh.free.ngrok.cc/ticket/orderAndPayByParams",
  611. async: false,
  612. //; charset=utf-8
  613. contentType: "application/json",
  614. data: JSON.stringify(send),
  615. dataType: "json",
  616. success: function (data) {
  617. console.log(data);
  618. if (data.status == 200) {
  619. var useOriginalPnr = "";
  620. if (data.attachment.useOriginalPnr) {
  621. useOriginalPnr = "是";
  622. } else {
  623. useOriginalPnr = "否";
  624. }
  625. var orderStr = '<li class="list-group-item">淘宝订单号:' + data.attachment.orderid + '</li>' +
  626. '<li class="list-group-item">支付宝交易流水号:' + data.attachment.alipayTradeNo + '</li>' +
  627. '<li class="list-group-item">订单实际支付金额:' + data.attachment.totalMoney + '</li>' +
  628. '<li class="list-group-item">该单是否使用了原PNR出票:' + useOriginalPnr + '</li>';
  629. var modHeader = '<h3 class="modal-title text-success" id="gridSystemModalLabel">操作成功!</h3>';
  630. $(".modal-header button").next().remove();
  631. $(".modal-header button").after(modHeader);
  632. $(".modal-footer .hide").removeClass("hide");
  633. $(".modal-body .list-group").html(orderStr);
  634. $(".modal-footer .details").attr("href", "./order-details.html?Id=" + data.attachment.orderid);
  635. $('#orderinfoS').modal();
  636. } else {
  637. var orderStr = '<li class="list-group-item" style="border: none;font-size: 16px;">'+data.attachment+'</li>';
  638. var modHeader = '<h3 class="modal-title text-danger" id="gridSystemModalLabel">操作失败!</h3>';
  639. $(".modal-header button").next("h3").remove();
  640. $(".modal-header button").after(modHeader);
  641. $(".modal-footer .details").addClass("hide");
  642. $(".modal-body .list-group").html(orderStr);
  643. $('#orderinfoS').modal();
  644. return false;
  645. }
  646. },
  647. error: function (XMLHttpRequest, textStatus, errorThrown) {
  648. console.log(XMLHttpRequest.responseText);
  649. console.log(XMLHttpRequest.readyState);
  650. console.log(textStatus);
  651. alert("系统出问题啦o(╥﹏╥)o......");
  652. }
  653. });
  654. });
  655. }
  656. }
  657. });
  658. }
  659. });
  660. /*$('.modalClose').on('click', function () {
  661. window.history.go(0);
  662. })*/
  663. });
  664. </script>
  665. </body>
  666. </html>