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.
 
 
 
 

126 lines
4.4 KiB

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  6. <title>提交订单</title>
  7. <link rel="stylesheet" type="text/css" href="public/css/main.css"/>
  8. <link rel="stylesheet" type="text/css" href="public/css/master.css"/>
  9. <link rel="stylesheet" type="text/css" href="public/css/ui-base.css"/>
  10. <link rel="stylesheet" type="text/css" href="public/css/ui-box.css"/>
  11. <link rel="stylesheet" type="text/css" href="public/css/ui-color.css"/>
  12. <link rel="stylesheet" type="text/css" href="public/css/baidu.css"/>
  13. <style type="text/css">
  14. .r-result{
  15. margin: 0.15rem;
  16. background-color: #d6d8dd;
  17. }
  18. .r-result_img{
  19. width: 0.14rem;
  20. margin-left: 0.05rem;
  21. margin-right: 0.05rem;
  22. position: relative;
  23. top: 0.02rem;
  24. }
  25. </style>
  26. </head>
  27. <body class="bg_color">
  28. <div style="display: none;" id="l-map"></div>
  29. <div class="ub ui_p_a10 r-result ub-ae ui_radiu_all">
  30. <img class="r-result_img" src="public/images/ic_search.png"/>
  31. <div class="ub-f1" id="r-result"><input class="ulev1" style="width: 90%;" placeholder="请输入" type="text" id="suggestId" size="20" value="" /></div>
  32. <span style="color: #0076ff;" class="ulev1">取消</span>
  33. </div>
  34. <div id="searchResultPanel" style="border:1px solid #C0C0C0;width:150px;height:auto; display:none;"></div>
  35. <script src="public/js/jquery-2.2.4.min.js" type="text/javascript" charset="utf-8"></script>
  36. <script src="public/js/main.js" type="text/javascript" charset="utf-8"></script>
  37. <script src="public/js/rem.js" type="text/javascript" charset="utf-8"></script>
  38. <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=qnG9Q2oSgfGlwLUBeYBp7gTvFUCk31me"></script>
  39. <script type="text/javascript">
  40. //自动获取焦点
  41. $(document).ready(function(){
  42. $("#suggestId").focus();
  43. });
  44. // 百度地图API功能
  45. function G(id) {
  46. return document.getElementById(id);
  47. }
  48. var map = new BMap.Map("l-map");
  49. map.centerAndZoom("江苏",12); // 初始化地图,设置城市和地图级别。
  50. var ac = new BMap.Autocomplete( //建立一个自动完成的对象
  51. {"input" : "suggestId"
  52. ,"location" : map
  53. });
  54. ac.addEventListener("onhighlight", function(e) { //鼠标放在下拉列表上的事件
  55. var str = "";
  56. var _value = e.fromitem.value;
  57. var value = "";
  58. if (e.fromitem.index > -1) {
  59. value = _value.province + _value.city + _value.district + _value.street + _value.business;
  60. }
  61. str = "FromItem<br />index = " + e.fromitem.index + "<br />value = " + value;
  62. value = "";
  63. if (e.toitem.index > -1) {
  64. _value = e.toitem.value;
  65. value = _value.province + _value.city + _value.district + _value.street + _value.business;
  66. }
  67. str += "<br />ToItem<br />index = " + e.toitem.index + "<br />value = " + value;
  68. G("searchResultPanel").innerHTML = str;
  69. });
  70. var myValue;
  71. ac.addEventListener("onconfirm", function(e) { //鼠标点击下拉列表后的事件
  72. var _value = e.item.value;
  73. myValue = _value.province + _value.city + _value.district + _value.street + _value.business;
  74. G("searchResultPanel").innerHTML ="onconfirm<br />index = " + e.item.index + "<br />myValue = " + myValue;
  75. setPlace();
  76. var add_name = $("#suggestId").val();
  77. var myGeo = new BMap.Geocoder();
  78. var get_bus = getStorage("get_bus");
  79. myGeo.getPoint(add_name, function(point){
  80. if (point) {
  81. map.centerAndZoom(point, 16);
  82. map.addOverlay(new BMap.Marker(point));
  83. if(get_bus == "0"){
  84. setStorage("geton_name",add_name);
  85. setStorage("geton_point",point.lat +","+point.lng);
  86. window.location.href="submit_order.html";
  87. }else if(get_bus == "1"){
  88. setStorage("getoff_name",add_name);
  89. setStorage("getoff_point",point.lat +","+point.lng);
  90. window.location.href="submit_order.html";
  91. }
  92. }else{
  93. alert("您选择地址没有解析到结果!");
  94. }
  95. }, "北京市");
  96. });
  97. function setPlace(){
  98. map.clearOverlays(); //清除地图上所有覆盖物
  99. function myFun(){
  100. var pp = local.getResults().getPoi(0).point; //获取第一个智能搜索的结果
  101. map.centerAndZoom(pp, 18);
  102. map.addOverlay(new BMap.Marker(pp)); //添加标注
  103. }
  104. var local = new BMap.LocalSearch(map, { //智能搜索
  105. onSearchComplete: myFun
  106. });
  107. local.search(myValue);
  108. }
  109. </script>
  110. </body>
  111. </html>