|
@@ -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;
|