作者 朱振飞

提交

@@ -20,7 +20,7 @@ function openView(fmName, fmUrl, winTitle, winName, winUrl, fmParams, winParams) @@ -20,7 +20,7 @@ function openView(fmName, fmUrl, winTitle, winName, winUrl, fmParams, winParams)
20 localStorage.setItem(item,winParams[item]) 20 localStorage.setItem(item,winParams[item])
21 } 21 }
22 } 22 }
23 - window.location.href = winName+'.html' 23 + window.location.href = fmUrl+'.html'
24 // var options = { 24 // var options = {
25 // name: '', 25 // name: '',
26 // url: '', 26 // url: '',
@@ -170,27 +170,10 @@ @@ -170,27 +170,10 @@
170 </body> 170 </body>
171 171
172 </html> 172 </html>
173 -<!--<script src="https://webapi.amap.com/maps?v=1.4.8&key= ef53760bd959a4df08b7d4587280e642"></script>  
174 -<script type="text/javascript">  
175 - var map = new AMap.Map('container', {  
176 - center:[117.000923,36.675807],  
177 - zoom:11  
178 - });  
179 -</script>-->  
180 -<script>  
181 - var map = {}  
182 - window.onLoad = function() {  
183 - map = new AMap.Map('container');  
184 - }  
185 - var url = 'https://webapi.amap.com/maps?v=1.4.8&key=ef53760bd959a4df08b7d4587280e642&callback=onLoad';  
186 - var jsapi = document.createElement('script');  
187 - jsapi.charset = 'utf-8';  
188 - jsapi.src = url;  
189 - document.head.appendChild(jsapi);  
190 -</script> 173 +
191 <script type="text/javascript" src="../../assets/js/weui.min.js"></script> 174 <script type="text/javascript" src="../../assets/js/weui.min.js"></script>
192 <script type="text/javascript" src="../../assets/js/api.js"></script> 175 <script type="text/javascript" src="../../assets/js/api.js"></script>
193 -<script ty></script> 176 +<script type="text/javascript" src = 'https://webapi.amap.com/maps?v=1.4.4&test=true&key=ef53760bd959a4df08b7d4587280e642&&plugin=AMap.ToolBar,AMap.IndoorMap'></script>
194 <script type="text/javascript" src="../../assets/js/public.js"></script> 177 <script type="text/javascript" src="../../assets/js/public.js"></script>
195 <script type="text/javascript" src="../../assets/js/fastclick.js"></script> 178 <script type="text/javascript" src="../../assets/js/fastclick.js"></script>
196 <script> 179 <script>
@@ -203,6 +186,8 @@ @@ -203,6 +186,8 @@
203 <script type="text/javascript" src="https://cache.amap.com/lbs/static/PlaceSearchRender.js"></script> 186 <script type="text/javascript" src="https://cache.amap.com/lbs/static/PlaceSearchRender.js"></script>
204 <script type="text/javascript" src="https://cache.amap.com/lbs/static/addToolbar.js"></script> 187 <script type="text/javascript" src="https://cache.amap.com/lbs/static/addToolbar.js"></script>
205 <script> 188 <script>
  189 + var map = {}
  190 + map = new AMap.Map('container');
206 var app = new Vue({ 191 var app = new Vue({
207 el: '#app', 192 el: '#app',
208 data: { 193 data: {
@@ -228,12 +213,11 @@ @@ -228,12 +213,11 @@
228 centerPoint: [] 213 centerPoint: []
229 }, 214 },
230 created: function() { 215 created: function() {
231 - loadEnd();  
232 - apiready = function() {  
233 - app.get_city();  
234 - app.getUsedAddress() 216 + // apiready = function() {
  217 + this.get_city();
  218 + this.getUsedAddress()
235 219
236 - } 220 + // }
237 221
238 // app.getNearBy(); 222 // app.getNearBy();
239 // app.cityname = getcity() ? getcity() : api.pageParam.cityname; 223 // app.cityname = getcity() ? getcity() : api.pageParam.cityname;
@@ -273,28 +257,26 @@ @@ -273,28 +257,26 @@
273 257
274 // 定位当前城市 258 // 定位当前城市
275 get_city: function() { 259 get_city: function() {
276 -  
277 - app.map = new AMap.Map('container', {});  
278 - app.map.plugin('AMap.Geolocation', function() { 260 + var app = this ;
  261 + // app.map = new AMap.Map('container', {});
  262 + map.plugin('AMap.Geolocation', function() {
279 var geolocation = new AMap.Geolocation({ 263 var geolocation = new AMap.Geolocation({
280 // 是否使用高精度定位,默认:true 264 // 是否使用高精度定位,默认:true
281 enableHighAccuracy: true, 265 enableHighAccuracy: true,
282 // 设置定位超时时间,默认:无穷大 266 // 设置定位超时时间,默认:无穷大
283 - timeout: 10000, 267 + timeout: 10000
284 }); 268 });
285 geolocation.getCurrentPosition(); 269 geolocation.getCurrentPosition();
286 AMap.event.addListener(geolocation, 'complete', onComplete) 270 AMap.event.addListener(geolocation, 'complete', onComplete)
287 AMap.event.addListener(geolocation, 'error', onError) 271 AMap.event.addListener(geolocation, 'error', onError)
288 -  
289 function onComplete(data) { 272 function onComplete(data) {
290 - // console.log(JSON.stringify(data));  
291 - 273 + alert(JSON.stringify(data));
292 app.cityname = data.addressComponent.province; 274 app.cityname = data.addressComponent.province;
293 console.log(app.cityname); 275 console.log(app.cityname);
294 app.lng = data.position.lng; 276 app.lng = data.position.lng;
295 app.lat = data.position.lat; 277 app.lat = data.position.lat;
296 - // console.log(app.lng);  
297 - // console.log(app.lat); 278 + // console.log(app.lng);
  279 + // console.log(app.lat);
298 // 280 //
299 // 获取附近地址 281 // 获取附近地址
300 app.map = new AMap.Map('container', {}); 282 app.map = new AMap.Map('container', {});
@@ -332,9 +314,47 @@ @@ -332,9 +314,47 @@
332 } 314 }
333 }) 315 })
334 }, 316 },
  317 + //获取当前坐标
  318 + getNowCity(){
  319 + mapObj = new AMap.Map('iCenter');
  320 + mapObj.plugin('AMap.Geolocation', function () {
  321 + geolocation = new AMap.Geolocation({
  322 + enableHighAccuracy: true,//是否使用高精度定位,默认:true
  323 + timeout: 10000, //超过10秒后停止定位,默认:无穷大
  324 + maximumAge: 0, //定位结果缓存0毫秒,默认:0
  325 + convert: true, //自动偏移坐标,偏移后的坐标为高德坐标,默认:true
  326 + showButton: true, //显示定位按钮,默认:true
  327 + buttonPosition: 'LB', //定位按钮停靠位置,默认:'LB',左下角
  328 + buttonOffset: new AMap.Pixel(10, 20),//定位按钮与设置的停靠位置的偏移量,默认:Pixel(10, 20)
  329 + showMarker: true, //定位成功后在定位到的位置显示点标记,默认:true
  330 + showCircle: true, //定位成功后用圆圈表示定位精度范围,默认:true
  331 + panToLocation: true, //定位成功后将定位到的位置作为地图中心点,默认:true
  332 + zoomToAccuracy:true //定位成功后调整地图视野范围使定位位置及精度范围视野内可见,默认:false
  333 + });
  334 + mapObj.addControl(geolocation);
  335 + geolocation.getCurrentPosition();
  336 + AMap.event.addListener(geolocation, 'complete', onComplete);//返回定位信息
  337 + AMap.event.addListener(geolocation, 'error', onError); //返回定位出错信息
  338 + });
  339 + function onComplete(obj){
  340 + var res = '经纬度:' + obj.position +
  341 + '\n精度范围:' + obj.accuracy +
  342 + '米\n定位结果的来源:' + obj.location_type +
  343 + '\n状态信息:' + obj.info +
  344 + '\n地址:' + obj.formattedAddress +
  345 + '\n地址信息:' + JSON.stringify(obj.addressComponent, null, 4);
  346 + alert(res);
  347 + }
  348 +
  349 + function onError(obj) {
  350 + alert(obj.info + '--' + obj.message);
  351 + console.log(obj);
  352 + }
  353 + },
335 354
336 // 获取搜索地址 355 // 获取搜索地址
337 getCity: function() { 356 getCity: function() {
  357 + var app = this;
338 if(app.keyword == '') { 358 if(app.keyword == '') {
339 app.address_show = true; 359 app.address_show = true;
340 } else { 360 } else {
@@ -355,7 +375,6 @@ @@ -355,7 +375,6 @@
355 locationList = result.poiList.pois 375 locationList = result.poiList.pois
356 // console.log(JSON.stringify(result)); 376 // console.log(JSON.stringify(result));
357 app.keywords = locationList; 377 app.keywords = locationList;
358 -  
359 if(status === 'complete' && result.info === 'OK') { 378 if(status === 'complete' && result.info === 'OK') {
360 placeSearchRender.autoRender({ 379 placeSearchRender.autoRender({
361 placeSearchInstance: placeSearch, 380 placeSearchInstance: placeSearch,
@@ -372,6 +391,7 @@ @@ -372,6 +391,7 @@
372 }, 391 },
373 // 搜索地址 392 // 搜索地址
374 search_word: function() { 393 search_word: function() {
  394 + var app = this;
375 if(app.keyword == '') { 395 if(app.keyword == '') {
376 toastMsg('请输入搜索内容') 396 toastMsg('请输入搜索内容')
377 } else { 397 } else {
@@ -187,13 +187,13 @@ @@ -187,13 +187,13 @@
187 appointment: function () { 187 appointment: function () {
188 var app = this 188 var app = this
189 if (app.cid == 5 || app.cid == 7 || app.cid == 8 || app.cid == 10) { 189 if (app.cid == 5 || app.cid == 7 || app.cid == 8 || app.cid == 10) {
190 - openView('doc_package_f', 'index/doc_package_f', app.care_name, 'doc_package_f', false, { 190 + openView('doc_package_f', '../index/doc_package_f', app.care_name, 'doc_package_f', false, {
191 id: app.id, 191 id: app.id,
192 cid: app.cid, 192 cid: app.cid,
193 cityname: app.cityname 193 cityname: app.cityname
194 }) 194 })
195 } else { 195 } else {
196 - openView('pay_form_f', 'index/pay_form_f', app.care_name, 'pay_form_f', false, { 196 + openView('pay_form_f', '../index/pay_form_f', app.care_name, 'pay_form_f', false, {
197 id: app.id, 197 id: app.id,
198 cityname: app.cityname, 198 cityname: app.cityname,
199 cid: app.cid 199 cid: app.cid
@@ -10,6 +10,13 @@ @@ -10,6 +10,13 @@
10 </head> 10 </head>
11 11
12 <body> 12 <body>
  13 +<header>
  14 + <div class="index_header">
  15 + <div class="close_left" @click.stop="close"><span class="iconfont icon-fanhui"></span></div>
  16 + <div>选择城市</div>
  17 + <div></div>
  18 + </div>
  19 +</header>
13 <div class="city"> 20 <div class="city">
14 <div class="city-wrapper city-wrapper-hook"> 21 <div class="city-wrapper city-wrapper-hook">
15 <div class="scroller-hook"> 22 <div class="scroller-hook">
@@ -96,10 +103,8 @@ @@ -96,10 +103,8 @@
96 var anchor = shortcutList[shortcutList.indexOf(touch.anchor) + delta]; 103 var anchor = shortcutList[shortcutList.indexOf(touch.anchor) + delta];
97 104
98 scrollTo(anchor); 105 scrollTo(anchor);
99 -  
100 e.preventDefault(); 106 e.preventDefault();
101 e.stopPropagation(); 107 e.stopPropagation();
102 -  
103 }); 108 });
104 109
105 function scrollTo(anchor) { 110 function scrollTo(anchor) {
  1 +<!DOCTYPE html>
  2 +<html lang="en">
  3 +<head>
  4 + <meta charset="UTF-8">
  5 + <title>Title</title>
  6 +</head>
  7 +<body>
  8 +<div class="log"></div>
  9 +<input type="number" placeholder="123132">
  10 +<script type="text/javascript" src = 'https://webapi.amap.com/maps?v=1.4.4&test=true&key=8e9d3050695ac868cc67257d84a5f740&plugin=AMap.ToolBar,AMap.IndoorMap'></script>
  11 +
  12 +<script type="text/javascript">
  13 + var log = document.getElementsByClassName('log')[0];
  14 + mapObj = new AMap.Map('iCenter');
  15 + mapObj.plugin('AMap.Geolocation', function () {
  16 + geolocation = new AMap.Geolocation({
  17 + enableHighAccuracy: true,//是否使用高精度定位,默认:true
  18 + timeout: 10000, //超过10秒后停止定位,默认:无穷大
  19 + maximumAge: 0, //定位结果缓存0毫秒,默认:0
  20 + convert: true, //自动偏移坐标,偏移后的坐标为高德坐标,默认:true
  21 + showButton: true, //显示定位按钮,默认:true
  22 + buttonPosition: 'LB', //定位按钮停靠位置,默认:'LB',左下角
  23 + buttonOffset: new AMap.Pixel(10, 20),//定位按钮与设置的停靠位置的偏移量,默认:Pixel(10, 20)
  24 + showMarker: true, //定位成功后在定位到的位置显示点标记,默认:true
  25 + showCircle: true, //定位成功后用圆圈表示定位精度范围,默认:true
  26 + panToLocation: true, //定位成功后将定位到的位置作为地图中心点,默认:true
  27 + zoomToAccuracy:true //定位成功后调整地图视野范围使定位位置及精度范围视野内可见,默认:false
  28 + });
  29 + mapObj.addControl(geolocation);
  30 + geolocation.getCurrentPosition();
  31 + AMap.event.addListener(geolocation, 'complete', function(obj){
  32 + var res = '经纬度:' + obj.position +
  33 + '\n精度范围:' + obj.accuracy +
  34 + '米\n定位结果的来源:' + obj.location_type +
  35 + '\n状态信息:' + obj.info +
  36 + '\n地址:' + obj.formattedAddress +
  37 + '\n地址信息:' + JSON.stringify(obj.addressComponent, null, 4);
  38 + console.log(res)
  39 + AMap.service(["AMap.PlaceSearch"], function() {
  40 + var placeSearch = new AMap.PlaceSearch({
  41 + pageSize: 10, // 每页10条
  42 + pageIndex: 1, // 获取第一页
  43 + city: res.province// 指定城市名(如果你获取不到城市名称,这个参数也可以不传,注释掉)
  44 + });
  45 +
  46 + // 第一个参数是关键字,这里传入的空表示不需要根据关键字过滤
  47 + // 第二个参数是经纬度,数组类型
  48 + // 第三个参数是半径,周边的范围
  49 + // 第四个参数为回调函数
  50 +
  51 + placeSearch.searchNearBy(app.cityname, [obj.position], 1000, function(status, result) {
  52 +
  53 + console.log(JSON.stringify(status))
  54 + if(result.info === 'OK') {
  55 + var locationList = result.poiList.pois; // 周边地标建筑列表
  56 + //console.log(JSON.stringify(locationList))
  57 + app.nearList = locationList          // 生成地址列表html
  58 + //           createLocationHtml(locationList);
  59 + } else {
  60 + console.log('获取位置信息失败!');
  61 + }
  62 + });
  63 + });
  64 + });//返回定位信息
  65 + AMap.event.addListener(geolocation, 'error', onError); //返回定位出错信息
  66 + });
  67 + function onComplete(obj){
  68 + var res = '经纬度:' + obj.position +
  69 + '\n精度范围:' + obj.accuracy +
  70 + '米\n定位结果的来源:' + obj.location_type +
  71 + '\n状态信息:' + obj.info +
  72 + '\n地址:' + obj.formattedAddress +
  73 + '\n地址信息:' + JSON.stringify(obj.addressComponent, null, 4);
  74 + console.log(res)
  75 + AMap.service(["AMap.PlaceSearch"], function() {
  76 + var placeSearch = new AMap.PlaceSearch({
  77 + pageSize: 10, // 每页10条
  78 + pageIndex: 1, // 获取第一页
  79 + city: res.province// 指定城市名(如果你获取不到城市名称,这个参数也可以不传,注释掉)
  80 + });
  81 +
  82 + // 第一个参数是关键字,这里传入的空表示不需要根据关键字过滤
  83 + // 第二个参数是经纬度,数组类型
  84 + // 第三个参数是半径,周边的范围
  85 + // 第四个参数为回调函数
  86 +
  87 + placeSearch.searchNearBy(app.cityname, [obj.position], 1000, function(status, result) {
  88 +
  89 + console.log(JSON.stringify(status))
  90 + if(result.info === 'OK') {
  91 + var locationList = result.poiList.pois; // 周边地标建筑列表
  92 + //console.log(JSON.stringify(locationList))
  93 + app.nearList = locationList          // 生成地址列表html
  94 + //           createLocationHtml(locationList);
  95 + } else {
  96 + console.log('获取位置信息失败!');
  97 + }
  98 + });
  99 + });
  100 + }
  101 +
  102 + function onError(obj) {
  103 + alert(obj.info + '--' + obj.message);
  104 + console.log(obj);
  105 + }
  106 +
  107 +</script>
  108 +
  109 +//获取位置按钮
  110 +<button class = 'bt' onclick='geo.getCurrentPosition()'>获取位置</button>
  111 +<button class = 'bt' onclick='geo.watchPosition()'>连续定位</button>
  112 +<button class = 'bt' onclick='geo.clearWatch()'>停止定位</button>
  113 +</body>
  114 +</html>
@@ -86,6 +86,122 @@ @@ -86,6 +86,122 @@
86 .doc_footer { 86 .doc_footer {
87 z-index: 0; 87 z-index: 0;
88 } 88 }
  89 + /*地址样式*/
  90 + .city_top {
  91 + position: fixed;
  92 + left: 0;
  93 + top: 0;
  94 + width: 100%;
  95 + display: flex;
  96 + align-items: center;
  97 + justify-content: space-between;
  98 + padding: 0.25rem;
  99 + font-size: 0.3rem;
  100 + color: #333;
  101 + border: 1px solid #f5f5f5;
  102 + background-color: #fff;
  103 + }
  104 +
  105 + .city_name_box {
  106 + display: flex;
  107 + align-items: center;
  108 + flex: 1;
  109 + }
  110 +
  111 + .city_name_box .iconfont {
  112 + margin: 0 0.1rem 0 0;
  113 + }
  114 +
  115 + .city_input {
  116 + flex: 3;
  117 + margin: 0 0.1rem 0 0.1rem;
  118 + background-color: #f2f2f2;
  119 + padding: 0 0 0 0.2rem;
  120 + border-radius: 0.1rem;
  121 + }
  122 +
  123 + .city_input input {
  124 + width: 100%;
  125 + padding: 0.2rem 0.25rem;
  126 + color: #333;
  127 + font-size: 0.26rem;
  128 + }
  129 +
  130 + .city_input input::-webkit-input-placeholder {
  131 + color: #aaa;
  132 + }
  133 +
  134 + .city_item {
  135 + padding: 0.3rem 0.25rem;
  136 + color: #999;
  137 + font-size: 0.26rem;
  138 + display: flex;
  139 + justify-content: space-between;
  140 + }
  141 +
  142 + .choose_box {
  143 + display: flex;
  144 + align-items: center;
  145 + justify-content: space-between;
  146 + font-size: 0.24rem;
  147 + color: #333;
  148 + padding: 0.2rem 0.25rem;
  149 + border-bottom: 1px solid #f2f2f2;
  150 + margin-top: 1.3rem;
  151 + }
  152 +
  153 + .position {
  154 + display: flex;
  155 + align-items: center;
  156 + }
  157 +
  158 + .position span {
  159 + margin-left: 0.2rem;
  160 + }
  161 +
  162 + .city_name {
  163 + color: #333;
  164 + font-size: 0.3rem;
  165 + }
  166 +
  167 + .city_address {
  168 + font-size: 0.26rem;
  169 + }
  170 +
  171 + .my_address {
  172 + margin: 0.25rem;
  173 + }
  174 +
  175 + .my_address .iconfont {
  176 + margin: 0 0.1rem 0 0;
  177 + color: #ccc;
  178 + }
  179 +
  180 + .address_title {
  181 + font-size: 14px;
  182 + color: #999;
  183 + }
  184 +
  185 + .choose_city {
  186 + font-size: 18px;
  187 + }
  188 +
  189 + .address_item {
  190 + color: #424242;
  191 + font-size: 16px;
  192 + padding: 0.26rem 0.5rem 0.26rem 0.2rem;
  193 + border-bottom: 1px solid #f2f2f2;
  194 + }
  195 + .city_container{
  196 + width: 100%;
  197 + height: 100%;
  198 + position: fixed;
  199 + left: 0;
  200 + top: 0;
  201 + z-index: 15;
  202 + background-color: #FFF;
  203 + overflow-y: auto;
  204 + }
89 </style> 205 </style>
90 <body> 206 <body>
91 <div id="loadStart"></div> 207 <div id="loadStart"></div>
@@ -115,10 +231,10 @@ @@ -115,10 +231,10 @@
115 <div class="service_icon"><span class="iconfont icon-yonghu"></span><span>服务对象</span></div> 231 <div class="service_icon"><span class="iconfont icon-yonghu"></span><span>服务对象</span></div>
116 <div class="service_input"><input type="text" placeholder="请输入姓名" v-model.trim="user_name"></div> 232 <div class="service_input"><input type="text" placeholder="请输入姓名" v-model.trim="user_name"></div>
117 </div> 233 </div>
118 - <div class="service_input_box" @click.stop="dateSelect" id="sever"> 234 + <div class="service_input_box" @click.stop="dateSelect" id="sever" >
119 <div class="service_icon"><span class="iconfont icon-shijian1"></span><span>服务时间</span></div> 235 <div class="service_icon"><span class="iconfont icon-shijian1"></span><span>服务时间</span></div>
120 - <div class="service_input"><span v-if="date_info" class="date_info">{{date_info}}</span><span v-else>{{default_date}}</span>  
121 - </div> 236 + <div class="service_input"><span v-if="date_info" class="date_info">{{date_info}}</span><span v-else>{{default_date}}</span></div>
  237 + <!--<input id="sever" autofocus placeholder="1" type="hidden">-->
122 </div> 238 </div>
123 <div class="service_input_box"> 239 <div class="service_input_box">
124 <div class="service_icon"><span class="iconfont icon-dianhua-1"></span><span>联系电话</span></div> 240 <div class="service_icon"><span class="iconfont icon-dianhua-1"></span><span>联系电话</span></div>
@@ -140,10 +256,10 @@ @@ -140,10 +256,10 @@
140 </div> 256 </div>
141 </div> 257 </div>
142 </div> 258 </div>
143 - <div class="service_input_box" @click="broSelect">  
144 - <div class="service_icon"><span  
145 - class="iconfont icon-baoyuefuwux"></span><span>出生日期</span></div>  
146 - <div class="service_input"><span v-if="broth_info" class="date_info">{{broth_info}}</span><span v-else>{{default_bro}}</span> 259 + <div class="service_input_box" @click="broSelect" id="broDate">
  260 + <div class="service_icon">
  261 + <span class="iconfont icon-baoyuefuwux"></span><span>出生日期</span></div>
  262 + <div class="service_input"><span v-if="broth_info" class="date_info">{{broth_info}}</span><span v-else>{{default_bro}}</span>
147 </div> 263 </div>
148 </div> 264 </div>
149 <div class="service_input_box" @click="openMap"> 265 <div class="service_input_box" @click="openMap">
@@ -163,8 +279,7 @@ @@ -163,8 +279,7 @@
163 <div v-if="is_idcard==0"></div> 279 <div v-if="is_idcard==0"></div>
164 <div v-else> 280 <div v-else>
165 <div class="service_input_box"> 281 <div class="service_input_box">
166 - <div class="service_icon"><span class="iconfont icon-credentials_icon"></span><span>身份证号</span>  
167 - </div> 282 + <div class="service_icon"><span class="iconfont icon-credentials_icon"></span><span>身份证号</span></div>
168 <div class="service_input"><input type="text" placeholder="输入身份证号码我们将为您投保" 283 <div class="service_input"><input type="text" placeholder="输入身份证号码我们将为您投保"
169 v-model.trim="user_id_card" maxlength="18"> 284 v-model.trim="user_id_card" maxlength="18">
170 </div> 285 </div>
@@ -255,6 +370,45 @@ @@ -255,6 +370,45 @@
255 <span class="doc_appointment" @click="appointment()">去 预 约</span> 370 <span class="doc_appointment" @click="appointment()">去 预 约</span>
256 </div> 371 </div>
257 </div> 372 </div>
  373 + <!--地址选择-->
  374 + <div class="city_container" v-if="city">
  375 + <div v-cloak>
  376 + <div id="container"></div>
  377 + <div class="city_top">
  378 + <div class="city_name_box" @click="choose_city_fun">
  379 + <span class="iconfont icon-dizhi"></span>
  380 + <div class="clamp1">{{cityname}}</div>
  381 + </div>:
  382 + <div class="city_input"><input type="search" placeholder="请输入你的服务地址" v-model="keyword" @input="getCity"></div>
  383 + <div class="main_color" @click="search_word">搜索</div>
  384 + </div>
  385 + <div class="choose_box" @click="choose_now">
  386 + <span class="choose_city">{{street}}</span>
  387 + <div class="main_color position"><span class="iconfont icon-zhongxindingwei"></span><span>重新定位</span></div>
  388 + </div>
  389 + <div v-if="address_show">
  390 + <div class="my_address">
  391 + <div class="address_title"><span class="iconfont icon-shouye"></span><span> 我的服务地址</span></div>
  392 + <div class="address_item nodata" v-if="user_address_list.length==0">暂无服务地址</div>
  393 + <div class="address_item" v-for="(item,index) in user_address_list" @click="choose_address(item.address,item.address_info,item.lon,item.lat)" v-else>
  394 + <span>{{item.address}}{{item.address_info}}</span>
  395 + </div>
  396 + </div>
  397 + <div class="my_address">
  398 + <div class="address_title"><span class="iconfont icon-dizhi"></span><span>我的附近地址</span></div>
  399 + <div class="address_item" v-for="(item,index) in nearList" @click="choose_address(item.address,'',item.lon,item.lat)">
  400 + <span>{{item.address}}</span>
  401 + </div>
  402 + </div>
  403 + </div>
  404 + <div v-for="(item,index) in keywords" class="city_item" @click="choose_address(item.address,item.name,item.lon,item.lat)" v-else>
  405 + <div>
  406 + <div class="city_name">{{item.name}}</div>
  407 + <div class="city_address">{{item.address}}</div>
  408 + </div>
  409 + </div>
  410 + </div>
  411 + </div>
258 </div> 412 </div>
259 </body> 413 </body>
260 </html> 414 </html>
@@ -270,6 +424,8 @@ @@ -270,6 +424,8 @@
270 <script type="text/javascript" src="../../assets/js/axios.min.js"></script> 424 <script type="text/javascript" src="../../assets/js/axios.min.js"></script>
271 <script type="text/javascript" src="../../assets/icon/iconfont.js"></script> 425 <script type="text/javascript" src="../../assets/icon/iconfont.js"></script>
272 <script type="text/javascript" src="../../assets/js/datePicker.js"></script> 426 <script type="text/javascript" src="../../assets/js/datePicker.js"></script>
  427 +<script type="text/javascript" src = 'https://webapi.amap.com/maps?v=1.4.4&test=true&key=ef53760bd959a4df08b7d4587280e642&&plugin=AMap.ToolBar,AMap.IndoorMap'></script>
  428 +
273 <script> 429 <script>
274 var app = new Vue({ 430 var app = new Vue({
275 el: '#app', 431 el: '#app',
@@ -325,15 +481,35 @@ @@ -325,15 +481,35 @@
325 ill_case: '', 481 ill_case: '',
326 unit: '', 482 unit: '',
327 pos: 'fixed', 483 pos: 'fixed',
  484 + city: true,
  485 + lat: '',
  486 + lng: '',
  487 + keyword: '',
  488 + keywords: [],
  489 + cities: [],
  490 + street: '',
  491 + nearList: [],
  492 + user_address_list: [],
  493 + address_show: true,
  494 + latitude: '',
  495 + longitude: '',
  496 + //经度
  497 + lng: '',
328 498
  499 + //纬度
  500 + lat: '',
  501 + map: {},
  502 + //经纬度
  503 + centerPoint: []
329 }, 504 },
330 created: function () { 505 created: function () {
331 var app = this; 506 var app = this;
332 - app.getUserIndexInfo();  
333 - $api.rmStorage('city');  
334 - app.id = localStorage.getItem('id');  
335 - app.applyInfo();  
336 - app.cityname = localStorage.getItem('cityName'); 507 + this.getUserIndexInfo();
  508 + this.id = localStorage.getItem('id');
  509 + this.applyInfo();
  510 + this.cityname = localStorage.getItem('cityName');
  511 + //获取当前地址
  512 + this.get_city()
337 513
338 // api.addEventListener({ 514 // api.addEventListener({
339 // name: 'choose_city' 515 // name: 'choose_city'
@@ -406,17 +582,52 @@ @@ -406,17 +582,52 @@
406 methods: { 582 methods: {
407 // 选择服务日期 583 // 选择服务日期
408 dateSelect: function () { 584 dateSelect: function () {
409 - api.openWin({  
410 - name: 'getSev_w',  
411 - url: '../common/getSev_w.html' 585 + // api.openWin({
  586 + // name: 'getSev_w',
  587 + // url: '../common/getSev_w.html'
  588 + // });
  589 +
  590 + var calendar = new datePicker();
  591 + calendar.init({
  592 + 'trigger': '#sever', /*按钮选择器,用于触发弹出插件*/
  593 + 'type': 'datetime', /*模式:date日期;datetime日期时间;time时间;ym年月;*/
  594 + // 'minDate':getTimeDetil(3), /*最小日期*/
  595 + 'minDate': formatDate(new Date(getTimeDetil(3)), 1), /*最小日期*/
  596 + 'maxDate': '', /*最大日期*/
  597 + 'onSubmit': function () {/*确认时触发事件*/
  598 + console.log(calendar.value);
  599 + if (checkDate(calendar.value, 1)) {
  600 + app.date_info = calendar.value;
  601 + calendar.onClose()
  602 + } else {
  603 + toastMsg('请选择3小时之后到7天之内的服务时间');
  604 + }
  605 + },
  606 + 'onClose': function () {/*取消时触发事件*/
  607 + // api.closeWin();
  608 + }
412 }); 609 });
413 }, 610 },
414 611
415 // 选择生日 612 // 选择生日
416 broSelect: function () { 613 broSelect: function () {
417 - api.openWin({  
418 - name: 'getBro_w',  
419 - url: '../common/getBro_w.html' 614 + var calendar = new datePicker();
  615 + calendar.init({
  616 + 'trigger': '#broDate', /*按钮选择器,用于触发弹出插件*/
  617 + 'type': 'date', /*模式:date日期;datetime日期时间;time时间;ym年月;*/
  618 + // 'minDate':getTimeDetil(3), /*最小日期*/
  619 + 'minDate': '', /*最小日期*/
  620 + 'maxDate': formatDate(new Date(), 1), /*最大日期*/
  621 + 'onSubmit': function () {/*确认时触发事件*/
  622 + console.log(calendar.value);
  623 + if (calendar.value) {
  624 + app.broth_info = calendar.value;
  625 + calendar.onClose()
  626 + }
  627 + },
  628 + 'onClose': function () {/*取消时触发事件*/
  629 + // api.closeWin();
  630 + }
420 }) 631 })
421 }, 632 },
422 // 上传证明 633 // 上传证明
@@ -433,11 +644,7 @@ @@ -433,11 +644,7 @@
433 "XX-Device-Type": getDevice(), 644 "XX-Device-Type": getDevice(),
434 'XX-Token': getToken() 645 'XX-Token': getToken()
435 }; 646 };
436 - console.log(header);  
437 -  
438 getRequest('post', 'portal/Goods/applyInfo', post, header).then(function (res) { 647 getRequest('post', 'portal/Goods/applyInfo', post, header).then(function (res) {
439 - console.log(JSON.stringify(res));  
440 - // alert(JSON.stringify(res))  
441 if (res.data.code == 1) { 648 if (res.data.code == 1) {
442 app.is_idcard = res.data.data.is_idcard; 649 app.is_idcard = res.data.data.is_idcard;
443 app.is_toolbar = res.data.data.is_toolbar; 650 app.is_toolbar = res.data.data.is_toolbar;
@@ -528,35 +735,225 @@ @@ -528,35 +735,225 @@
528 }, 735 },
529 // 选择服务地址 736 // 选择服务地址
530 openMap: function () { 737 openMap: function () {
531 - openView('choose_address', 'common/choose_address', '选择服务地址', 'choose_address', false, {cityname: app.cityname}); 738 + openView('choose_address', '../common/choose_address', '选择服务地址', 'choose_address', false, {cityname: app.cityname});
532 }, 739 },
533 // 获取协议 740 // 获取协议
534 openIsPro: function () { 741 openIsPro: function () {
535 var app = this; 742 var app = this;
536 app.isPro = !app.isPro; 743 app.isPro = !app.isPro;
537 window.location.href = '../common/tool_fm.html'; 744 window.location.href = '../common/tool_fm.html';
538 - // api.openFrame({  
539 - // bgColor: 'rgba(0,0,0,0.05)',  
540 - // name: 'tool_fm',  
541 - // url: '../common/tool_fm.html',  
542 - // bounces: false,  
543 - // animation: {  
544 - // type: "push",  
545 - // subType: "from_bottom",  
546 - // duration: 300  
547 - // },  
548 - // rect: {  
549 - // x: 0,  
550 - // y: 0,  
551 - // w: 'auto',  
552 - // h: 'auto'  
553 - // }  
554 - // })  
555 }, 745 },
556 // 去协议 746 // 去协议
557 getAgreement: function (name, id) { 747 getAgreement: function (name, id) {
558 openView('agree_content', 'common/agree_content', name, 'agree_content', false, {id: id}) 748 openView('agree_content', 'common/agree_content', name, 'agree_content', false, {id: id})
559 }, 749 },
  750 + //地址方法
  751 + // 获取我的服务地址
  752 + getUsedAddress: function() {
  753 + var header = {
  754 + "XX-Device-Type": getDevice(),
  755 + 'XX-Token': getToken()
  756 + };
  757 + console.log(header)
  758 + getRequest('post', 'portal/Goods/getUsedAddress', null, header).then(function(res) {
  759 + //alert(JSON.stringify(res));
  760 + if(res.data.code == 1) {
  761 + app.user_address_list = res.data.data;
  762 + toastMsg(res.data.msg)
  763 + }
  764 + loadEnd();
  765 + })
  766 + },
  767 + // 重新获取当前定位信息
  768 + choose_now: function() {
  769 + var app = this;
  770 + toastMsg('正在重新定位');
  771 + app.get_city();
  772 + setTimeout(function() {
  773 +// api.hideProgress();
  774 + }, 2000);
  775 + },
  776 +
  777 + // 定位当前城市
  778 + get_city: function() {
  779 + var app = this ;
  780 + map = new AMap.Map('container', {});
  781 + map.plugin('AMap.Geolocation', function() {
  782 + var geolocation = new AMap.Geolocation({
  783 + // 是否使用高精度定位,默认:true
  784 + enableHighAccuracy: true,
  785 + // 设置定位超时时间,默认:无穷大
  786 + timeout: 10000
  787 + });
  788 + geolocation.getCurrentPosition();
  789 + AMap.event.addListener(geolocation, 'complete', onComplete)
  790 + AMap.event.addListener(geolocation, 'error', onError)
  791 + function onComplete(data) {
  792 + alert(JSON.stringify(data));
  793 + app.cityname = data.addressComponent.province;
  794 + console.log(app.cityname);
  795 + app.lng = data.position.lng;
  796 + app.lat = data.position.lat;
  797 + app.street = data.addressComponent.street;
  798 + // console.log(app.lng);
  799 + // console.log(app.lat);
  800 + //
  801 + // 获取附近地址
  802 + app.map = new AMap.Map('container', {});
  803 + AMap.service(["AMap.PlaceSearch"], function() {
  804 + var placeSearch = new AMap.PlaceSearch({
  805 + pageSize: 10, // 每页10条
  806 + pageIndex: 1, // 获取第一页
  807 + city: app.cityname // 指定城市名(如果你获取不到城市名称,这个参数也可以不传,注释掉)
  808 + });
  809 +
  810 + // 第一个参数是关键字,这里传入的空表示不需要根据关键字过滤
  811 + // 第二个参数是经纬度,数组类型
  812 + // 第三个参数是半径,周边的范围
  813 + // 第四个参数为回调函数
  814 +
  815 + placeSearch.searchNearBy(app.cityname, [app.lng, app.lat], 1000, function(status, result) {
  816 +
  817 + console.log(JSON.stringify(status))
  818 + if(result.info === 'OK') {
  819 + var locationList = result.poiList.pois; // 周边地标建筑列表
  820 + //console.log(JSON.stringify(locationList))
  821 + app.nearList = locationList          // 生成地址列表html
  822 + //           createLocationHtml(locationList);
  823 + } else {
  824 + console.log('获取位置信息失败!');
  825 + }
  826 + });
  827 + });
  828 + }
  829 +
  830 + function onError(erro) {
  831 + console.log(erro)
  832 + // 定位出错
  833 + toastMsg('请开启定位功能')
  834 + }
  835 + })
  836 + },
  837 + //获取当前坐标
  838 + getNowCity(){
  839 + mapObj = new AMap.Map('iCenter');
  840 + mapObj.plugin('AMap.Geolocation', function () {
  841 + geolocation = new AMap.Geolocation({
  842 + enableHighAccuracy: true,//是否使用高精度定位,默认:true
  843 + timeout: 10000, //超过10秒后停止定位,默认:无穷大
  844 + maximumAge: 0, //定位结果缓存0毫秒,默认:0
  845 + convert: true, //自动偏移坐标,偏移后的坐标为高德坐标,默认:true
  846 + showButton: true, //显示定位按钮,默认:true
  847 + buttonPosition: 'LB', //定位按钮停靠位置,默认:'LB',左下角
  848 + buttonOffset: new AMap.Pixel(10, 20),//定位按钮与设置的停靠位置的偏移量,默认:Pixel(10, 20)
  849 + showMarker: true, //定位成功后在定位到的位置显示点标记,默认:true
  850 + showCircle: true, //定位成功后用圆圈表示定位精度范围,默认:true
  851 + panToLocation: true, //定位成功后将定位到的位置作为地图中心点,默认:true
  852 + zoomToAccuracy:true //定位成功后调整地图视野范围使定位位置及精度范围视野内可见,默认:false
  853 + });
  854 + mapObj.addControl(geolocation);
  855 + geolocation.getCurrentPosition();
  856 + AMap.event.addListener(geolocation, 'complete', onComplete);//返回定位信息
  857 + AMap.event.addListener(geolocation, 'error', onError); //返回定位出错信息
  858 + });
  859 + function onComplete(obj){
  860 + var res = '经纬度:' + obj.position +
  861 + '\n精度范围:' + obj.accuracy +
  862 + '米\n定位结果的来源:' + obj.location_type +
  863 + '\n状态信息:' + obj.info +
  864 + '\n地址:' + obj.formattedAddress +
  865 + '\n地址信息:' + JSON.stringify(obj.addressComponent, null, 4);
  866 + alert(res);
  867 + }
  868 +
  869 + function onError(obj) {
  870 + alert(obj.info + '--' + obj.message);
  871 + console.log(obj);
  872 + }
  873 + },
  874 +
  875 + // 获取搜索地址
  876 + getCity: function() {
  877 + var app = this;
  878 + if(app.keyword == '') {
  879 + app.address_show = true;
  880 + } else {
  881 + app.address_show = false;
  882 +
  883 + var aMap = api.require('aMap');
  884 + var placeSearchOptions = { //构造地点查询类
  885 + pageSize: 10,
  886 + pageIndex: 1,
  887 + city: app.cityname //城市
  888 + };
  889 + var placeSearch = new AMap.PlaceSearch(placeSearchOptions);
  890 + //关键字查询,您如果想修改结果展现效果,请参考页面:https://lbs.amap.com/fn/css-style/
  891 + placeSearch.search(app.keyword, callback);
  892 + var placeSearchRender = new Lib.AMap.PlaceSearchRender();
  893 +
  894 + function callback(status, result) {
  895 + locationList = result.poiList.pois
  896 +// console.log(JSON.stringify(result));
  897 + app.keywords = locationList;
  898 + if(status === 'complete' && result.info === 'OK') {
  899 + placeSearchRender.autoRender({
  900 + placeSearchInstance: placeSearch,
  901 + methodName: "search",
  902 + methodArgumments: [app.keyword, callback],
  903 + data: result,
  904 + map: map,
  905 + panel: "panel"
  906 + });
  907 + }
  908 + }
  909 + }
  910 +
  911 + },
  912 + // 搜索地址
  913 + search_word: function() {
  914 + var app = this;
  915 + if(app.keyword == '') {
  916 + toastMsg('请输入搜索内容')
  917 + } else {
  918 + app.getCity();
  919 + }
  920 + },
  921 + // 选择地址
  922 + choose_address: function(address, name, longitude, latitude) {
  923 + api.sendEvent({
  924 + name: 'choose_city',
  925 + extra: {
  926 + address: address,
  927 + name: name,
  928 + longitude: longitude,
  929 + latitude: latitude,
  930 + city: app.cityname
  931 + }
  932 + });
  933 + closeWindow();
  934 + },
  935 + // 切换城市
  936 + choose_city_fun: function() {
  937 + api.openWin({
  938 + url: '../index/city_win.html',
  939 + name: 'city_win'
  940 + });
  941 + $api.rmStorage('city')
  942 + },
  943 + getName: function(lon, lat) {
  944 + var aMap = api.require('aMap');
  945 + aMap.getNameFromCoords({
  946 + lon: lon,
  947 + lat: lat,
  948 + }, function(ret, err) {
  949 + if(ret.status) {
  950 + // alert(JSON.stringify(ret))
  951 + app.cityname = ret.city
  952 + } else {
  953 + // toastMsg(err.code);
  954 + }
  955 + });
  956 + },
560 // 去预约 957 // 去预约
561 appointment: function () { 958 appointment: function () {
562 var app = this; 959 var app = this;