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.
 
 
 
 
 
 

242 lines
7.9 KiB

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
  6. <link rel="stylesheet" type="text/css" href="css/main.css"/>
  7. <link rel="stylesheet" type="text/css" href="css/master.css"/>
  8. <link rel="stylesheet" type="text/css" href="css/ui-base.css"/>
  9. <link rel="stylesheet" type="text/css" href="css/ui-box.css"/>
  10. <link rel="stylesheet" type="text/css" href="css/ui-color.css"/>
  11. <style type="text/css">
  12. body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;}
  13. #golist {display: none;}
  14. @media (max-device-width: 780px){#golist{display: block !important;}}
  15. .infoBoxContent{
  16. font-size:0.12rem;
  17. width: 2.1rem;
  18. height: 0.523rem;
  19. background-image: url(images/img_shangchedian.png);
  20. background-repeat:no-repeat;
  21. background-size:2.1rem 0.523rem;
  22. left: -0.93rem;
  23. top: -0.25rem;
  24. }
  25. .div1{
  26. width: 1.63rem;
  27. margin: 0 0.05rem 0 0.1rem;
  28. float: left;
  29. top: -0.02rem;
  30. }
  31. .div2{
  32. width: 0.32rem;
  33. height: 0.46rem;
  34. float: left;
  35. color: #fff;
  36. margin-top: 0.09rem;
  37. text-align: center;
  38. top: -0.02rem;
  39. }
  40. .bus_info{
  41. position: fixed;
  42. top: 0.1rem;
  43. left: 0.1rem;
  44. right: 0.1rem;
  45. background-color: #fff;
  46. border: 1px solid #f0f2f6;
  47. border-radius: 0.03rem;
  48. box-shadow: 0 0 6px 0 rgba(60, 67, 79, 0.2);
  49. }
  50. .infoBox img{
  51. width: 0px!important;
  52. height: 0px!important;
  53. }
  54. </style>
  55. <script src="js/jquery-2.2.4.min.js" type="text/javascript" charset="utf-8"></script>
  56. <script src="js/main.js" type="text/javascript" charset="utf-8"></script>
  57. <script src="js/rem.js" type="text/javascript" charset="utf-8"></script>
  58. <script type="text/javascript" src="http://api.map.baidu.com/api?ak=7GGxAR5VERdkfGTHRzIzDw4qzKk6hZk3&v=2.0"></script>
  59. <script type="text/javascript" src="http://api.map.baidu.com/api?type=quick&ak=7GGxAR5VERdkfGTHRzIzDw4qzKk6hZk3&v=1.0"></script>
  60. <script type="text/javascript" src="js/InfoBox_min.js"></script>
  61. <title>我要找车</title>
  62. </head>
  63. <body>
  64. <div id="allmap"></div>
  65. <div class="bus_info">
  66. <div class="ub ub-ver">
  67. <div style="border-bottom: 1px solid #f0f2f6;" class="ub ub-ac">
  68. <div ontouchstart="show_bus()" style="padding: 0.13rem 0rem 0.1rem 0.15rem;" class="ub ub-ver ub-f1">
  69. <div id="name_and_nomber" class="ulev1 lightblack_color"></div>
  70. <div id="bus_type" class="commongray_color"></div>
  71. </div>
  72. <a id="call_phone" style="display: inline-block;" href="tel:"><img style="width: 0.16rem;top:0.02rem;position: relative;padding: 0.15rem 0.15rem 0.15rem 0.15rem;" src="images/a1/call_phone.png"/></a>
  73. </div>
  74. <div id="bus_pic" style="overflow: hidden;display: none;"><img id="bus_img" style="width: 3.55rem;height: 1.36rem;" src="images/a1/bus_pic.png"/></div>
  75. <div style="padding: 0.01rem 0;" ontouchstart="show_bus()" class="ub ub-pc"><img id="on_off" style="width: 0.12rem;" src="images/a1/enter_on.png"/></div>
  76. </div>
  77. </div>
  78. </body>
  79. </html>
  80. <script type="text/javascript">
  81. $(document).ready(function(){
  82. var order_id = getPar("order_id");
  83. var run_date = getPar("run_date");
  84. // var data = {
  85. // "flag": true,
  86. // "msg": "",
  87. // "url": "",
  88. // "code": "",
  89. // "data": {
  90. // "res": {
  91. // "address": "上海瑞金二路118号",
  92. // "res_id": "9196",
  93. // "res_name": "上海瑞金洲际酒店",
  94. // "longitude": "121.471058",
  95. // "latitude": "31.219127"
  96. // },
  97. // "bus": {
  98. // "bus_id": "1094",
  99. // "bus_no": "沪BT8050",
  100. // "driver_name": "龙涛",
  101. // "driver_mobile": "13916822100",
  102. // "bus_name": "暂无",
  103. // "color": "暂无",
  104. // "img_url": "images/a1/bus_pic.png",
  105. // "longitude": "121.505726738748",
  106. // "latitude": "31.2132681656562"
  107. // }
  108. // }
  109. // }
  110. // if(data.flag == true){
  111. // console.log(data);
  112. // $("#call_phone").attr("href","tel:"+data.data.bus.driver_mobile);
  113. // $("#name_and_nomber").html(data.data.bus.driver_name+'&nbsp;&nbsp;&nbsp;'+data.data.bus.bus_no);
  114. // $("#bus_type").text(data.data.bus.color+'·'+data.data.bus.bus_name);
  115. // $("#bus_img").attr("src",data.data.bus.img_url);
  116. // srarch_bus(data.data);
  117. // }else{
  118. // alert(data.msg);
  119. // }
  120. $.ajax({
  121. url:base_api+"weUser/journey/findCar",//请求地址
  122. type: "post", //请求方式
  123. data:{order_id:order_id,run_date:run_date},
  124. dataType: "json",
  125. async:false,
  126. success: function (data) {
  127. console.log(data);
  128. if(data.flag == true){
  129. console.log(data);
  130. $("#call_phone").attr("href","tel:"+data.data.bus.driver_mobile);
  131. $("#name_and_nomber").html(data.data.bus.driver_name+'&nbsp;&nbsp;&nbsp;'+data.data.bus.bus_no);
  132. $("#bus_type").text(data.data.bus.color+'·'+data.data.bus.bus_name);
  133. $("#bus_img").attr("src",data.data.bus.img_url);
  134. srarch_bus(data.data);
  135. }else{
  136. alert(data.msg);
  137. }
  138. },
  139. fail: function (data) {
  140. }
  141. });
  142. });
  143. function srarch_bus(data){
  144. // 百度地图API功能
  145. var map = new BMap.Map("allmap",{enableMapClick:false});
  146. //创建车、车站两个点
  147. var pt_station = new BMap.Point(data.res.longitude,data.res.latitude); //上车站坐标
  148. var pt_car = new BMap.Point(data.bus.longitude,data.bus.latitude); //车的坐标
  149. //map.addControl(new BMap.ZoomControl());
  150. // var sContent = '<span onclick="zzzz()" style="padding:5px;border:1px solid #ccc;display:inline-block;font-size:12px;">小黑</span><span style="padding:5px;border:1px solid #ccc;display:inline-block;font-size:12px;">小猛</span>';
  151. //设置上车站图片大小
  152. var img_station_opts = {
  153. imageSize: new BMap.Size(22,35)
  154. }
  155. //设置车图片大小
  156. var img_car_opts = {
  157. imageSize: new BMap.Size(29,38)
  158. }
  159. var myIcon_station = new BMap.Icon("images/ic_site.png", new BMap.Size(22,35),img_station_opts);
  160. var myIcon_car = new BMap.Icon("images/a1/ic_bus.png", new BMap.Size(29,38),img_car_opts);
  161. var marker1 = new BMap.Marker(pt_station,{icon:myIcon_station}); // 创建标注1 车站
  162. var marker2 = new BMap.Marker(pt_car,{icon:myIcon_car}); // 创建标注2 车
  163. map.addOverlay(marker1); // 将标注车站添加到地图中
  164. map.addOverlay(marker2); // 将标注车添加到地图中
  165. var points = [ //创建2个点
  166. pt_station,
  167. pt_car
  168. ];
  169. map.setViewport(points);
  170. var res_sdd = data.res.address;
  171. if(res_sdd.length>19){
  172. res_sdd = res_sdd.substring(0,19)+'...';
  173. }
  174. var html = ['<div class="infoBoxContent ub ub-ac">'
  175. + '<div class="div1">'
  176. + '<span style="color:#999999;">上车点:</span>'
  177. + '<span>'+res_sdd+'</span>'
  178. + '</div>'
  179. + '<div ontouchstart="zzzz('+data.res.latitude+','+data.res.longitude+')" class="div2">导<br>航</div>'
  180. + '</div>'];
  181. var infoBox = new BMapLib.InfoBox(map,html.join(""),{
  182. boxStyle:{
  183. width: "2.1rem",
  184. height: "0.533rem"
  185. },
  186. enableAutoPan: false,
  187. closeIconMargin: "0",
  188. closeIconUrl: "images/a1/rectangle.png",
  189. closeIconRight: "100px",
  190. align: INFOBOX_AT_TOP
  191. });
  192. infoBox.open(marker1);
  193. }
  194. //点击导航跳转百度地图
  195. function zzzz(latitude,longitude){
  196. var geolocation = new BMap.Geolocation();
  197. geolocation.getCurrentPosition(function(r){
  198. var alatlng={lat:r.point.lat,lng:r.point.lng}
  199. var blatlng={lat:latitude,lng:longitude}
  200. var start = {
  201. latlng:alatlng
  202. }
  203. var end = {
  204. latlng:blatlng
  205. }
  206. var opts = {
  207. mode:BMAP_MODE_DRIVING,
  208. region:"中国"
  209. }
  210. var ss = new BMap.RouteSearch();
  211. ss.routeCall(start,end,opts);
  212. },{enableHighAccuracy: true})
  213. }
  214. function show_bus(){
  215. if($("#on_off").attr("src")=="images/a1/enter_on.png"){
  216. $("#bus_pic").show();
  217. $("#on_off").attr("src","images/a1/enter_off.png");
  218. }else{
  219. $("#bus_pic").hide();
  220. $("#on_off").attr("src","images/a1/enter_on.png");
  221. }
  222. }
  223. </script>