|
@@ -131,11 +131,10 @@ Page({ |
|
@@ -131,11 +131,10 @@ Page({ |
|
131
|
if(!this.mapCtx) return;
|
131
|
if(!this.mapCtx) return;
|
|
132
|
this.mapCtx.getRegion({
|
132
|
this.mapCtx.getRegion({
|
|
133
|
success: (res) => {
|
133
|
success: (res) => {
|
|
134
|
- this.hasClickMoveToLocation = false
|
|
|
|
135
|
if (res.southwest.latitude) {
|
134
|
if (res.southwest.latitude) {
|
|
136
|
this.mapData.region = res
|
135
|
this.mapData.region = res
|
|
137
|
}
|
136
|
}
|
|
138
|
- ;
|
137
|
+ this.selectComponent('#filter-group').hide();
|
|
139
|
this.getSellers();
|
138
|
this.getSellers();
|
|
140
|
},
|
139
|
},
|
|
141
|
})
|
140
|
})
|
|
@@ -319,1033 +318,4 @@ Page({ |
|
@@ -319,1033 +318,4 @@ Page({ |
|
319
|
this.markertap({markerId:this.sellers[idx].id},false)
|
318
|
this.markertap({markerId:this.sellers[idx].id},false)
|
|
320
|
}
|
319
|
}
|
|
321
|
},
|
320
|
},
|
|
322
|
- back:function() {
|
|
|
|
323
|
- /*
|
|
|
|
324
|
- var mta = require('mta-wechat-analysis')
|
|
|
|
325
|
- import util from '../../utils/util';
|
|
|
|
326
|
- import App from '../../utils/api';
|
|
|
|
327
|
- import DA from './data';
|
|
|
|
328
|
- import reddot from '../../utils/reddot';
|
|
|
|
329
|
- import PubSub from '../../utils/PubSub'
|
|
|
|
330
|
- const {regeneratorRuntime} = global
|
|
|
|
331
|
- const mapScale = 15//18;
|
|
|
|
332
|
- const barHeight = 50;
|
|
|
|
333
|
- const transverseViewHeight = 253 + barHeight;
|
|
|
|
334
|
-
|
|
|
|
335
|
- const renNum = function () {
|
|
|
|
336
|
- let arr = []
|
|
|
|
337
|
- for (let i = 1; i <= 30; i++) {
|
|
|
|
338
|
- arr.push(i + '位')
|
|
|
|
339
|
- }
|
|
|
|
340
|
- return arr;
|
|
|
|
341
|
- }
|
|
|
|
342
|
- const cates_version = '?1.2';
|
|
|
|
343
|
- const hasSellerConcat = false;//变量存储所有商户
|
|
|
|
344
|
- const def_latitude = 39.684670;
|
|
|
|
345
|
- const def_longitude = 118.176300;
|
|
|
|
346
|
- */
|
|
|
|
347
|
- Page({
|
|
|
|
348
|
-
|
|
|
|
349
|
- /**
|
|
|
|
350
|
- * 页面的初始数据
|
|
|
|
351
|
- */
|
|
|
|
352
|
- data: {
|
|
|
|
353
|
- map: {
|
|
|
|
354
|
- latitude: def_latitude + 0.0001,
|
|
|
|
355
|
- longitude: def_longitude + 0.0001,
|
|
|
|
356
|
- scale: mapScale,
|
|
|
|
357
|
- height: 300,
|
|
|
|
358
|
- },
|
|
|
|
359
|
- markers: [],
|
|
|
|
360
|
- //polygons:{},
|
|
|
|
361
|
- //sellers:[],
|
|
|
|
362
|
- multiArray: ['全部菜系'],
|
|
|
|
363
|
- multiIndex: [0],
|
|
|
|
364
|
- //scrollIntoView:'',
|
|
|
|
365
|
- suggestion: {},
|
|
|
|
366
|
- hasSuggestion: false,//搜索返回
|
|
|
|
367
|
- current: 0,
|
|
|
|
368
|
- hasSellers: false,
|
|
|
|
369
|
- hasGetSellersEnd: false,
|
|
|
|
370
|
- hasSetActivity: false,
|
|
|
|
371
|
- tags: [
|
|
|
|
372
|
- {id: 1, name: '环境好'},
|
|
|
|
373
|
- {id: 2, name: '菜品有特色'},
|
|
|
|
374
|
- {id: 3, name: '超大包间'},
|
|
|
|
375
|
- ],
|
|
|
|
376
|
- listMoreCount: 0,
|
|
|
|
377
|
- hasSearchLimit: false,
|
|
|
|
378
|
- hasGetPos: false,
|
|
|
|
379
|
- },
|
|
|
|
380
|
- hasClickMoveToLocation: false,//点击回到我的位置
|
|
|
|
381
|
- hasSellerConcat: hasSellerConcat,
|
|
|
|
382
|
- transverseViewHeight: transverseViewHeight,//横向滚动高度,苹果要比安卓多20
|
|
|
|
383
|
- //qqmapsdk:null,
|
|
|
|
384
|
- sellers: [],
|
|
|
|
385
|
- sellersIds: [],
|
|
|
|
386
|
- sellersNow: [],//本次视图内商户
|
|
|
|
387
|
- searchAddrTop: 50,
|
|
|
|
388
|
- user: {
|
|
|
|
389
|
- latitude: def_latitude,
|
|
|
|
390
|
- longitude: def_longitude,
|
|
|
|
391
|
- },
|
|
|
|
392
|
- /**
|
|
|
|
393
|
- * 生命周期函数--监听页面加载
|
|
|
|
394
|
- */
|
|
|
|
395
|
- hasOnLoad: false,
|
|
|
|
396
|
- hasGetLocation: false,//定位信息
|
|
|
|
397
|
- hasAppHide: false,//app切至后台
|
|
|
|
398
|
- param: {},
|
|
|
|
399
|
- onLoad: async function (options) {
|
|
|
|
400
|
- this.reportTime = new Date()
|
|
|
|
401
|
-
|
|
|
|
402
|
- this.hasOnLoad = true;
|
|
|
|
403
|
- // this.qqmapsdk=new QQMapWX({
|
|
|
|
404
|
- // key: 'SDEBZ-I74W4-QLGUX-XXYXU-HIR23-3QFBJ'
|
|
|
|
405
|
- // });
|
|
|
|
406
|
- this.setData({
|
|
|
|
407
|
- multiArray: [['全部菜系'].concat(await DA.getCates())]
|
|
|
|
408
|
- })
|
|
|
|
409
|
- mta.Page.init({
|
|
|
|
410
|
- "appID": "500667280",
|
|
|
|
411
|
- "eventID": "500667287",
|
|
|
|
412
|
- "statPullDownFresh": true,
|
|
|
|
413
|
- "statShareApp": true,
|
|
|
|
414
|
- "statReachBottom": true,
|
|
|
|
415
|
- "lauchOpts": options, //渠道分析
|
|
|
|
416
|
- });
|
|
|
|
417
|
- PubSub.on(
|
|
|
|
418
|
- 'searchParam',
|
|
|
|
419
|
- data => {
|
|
|
|
420
|
- console.log('searchParam.msg', data)
|
|
|
|
421
|
- if (data.fun == 'tagsChange') {
|
|
|
|
422
|
- this.tagsChange(data.e);
|
|
|
|
423
|
- }
|
|
|
|
424
|
- if (data.fun == 'caixiActive') {
|
|
|
|
425
|
- this.caixiActive(data.e);
|
|
|
|
426
|
- }
|
|
|
|
427
|
- if (data.fun == 'setSuggestion') {
|
|
|
|
428
|
- this.setSuggestion(data.suggestion);
|
|
|
|
429
|
- }
|
|
|
|
430
|
- if (data.fun == 'moveToLocation') {
|
|
|
|
431
|
- this.moveToLocation();
|
|
|
|
432
|
- }
|
|
|
|
433
|
- if (data.fun == 'filterEvent') {
|
|
|
|
434
|
- this.filterEvent(data.e)
|
|
|
|
435
|
- }
|
|
|
|
436
|
- }
|
|
|
|
437
|
- )
|
|
|
|
438
|
- PubSub.on(
|
|
|
|
439
|
- 'appHide',
|
|
|
|
440
|
- data => {
|
|
|
|
441
|
- console.log('appHide');
|
|
|
|
442
|
- let pages = getCurrentPages();
|
|
|
|
443
|
- if (pages.length == 1) {//用户停留在首页
|
|
|
|
444
|
- this.hasGetLocation = false
|
|
|
|
445
|
- this.hasClickMoveToLocation = false
|
|
|
|
446
|
- this.hasAppHide = true
|
|
|
|
447
|
- }
|
|
|
|
448
|
- }
|
|
|
|
449
|
- )
|
|
|
|
450
|
- reddot.init()
|
|
|
|
451
|
- },
|
|
|
|
452
|
-
|
|
|
|
453
|
- /**
|
|
|
|
454
|
- * 生命周期函数--监听页面初次渲染完成
|
|
|
|
455
|
- */
|
|
|
|
456
|
- mapCtx: null,
|
|
|
|
457
|
- mapData: {
|
|
|
|
458
|
- lat: '',
|
|
|
|
459
|
- lng: '',
|
|
|
|
460
|
- latitude: 0,
|
|
|
|
461
|
- longitude: 0,
|
|
|
|
462
|
- scale: 18,
|
|
|
|
463
|
- hasRegionchange: false,
|
|
|
|
464
|
- region: {
|
|
|
|
465
|
- southwest: {},
|
|
|
|
466
|
- northeast: {},
|
|
|
|
467
|
- },
|
|
|
|
468
|
- },
|
|
|
|
469
|
- mapDataLast: null,//最后一次成功视角,防止地图视角丢失
|
|
|
|
470
|
- onReady: function () {
|
|
|
|
471
|
- if (wx.canIUse('reportPerformance')) {
|
|
|
|
472
|
- wx.reportPerformance(2002, new Date() - this.reportTime)
|
|
|
|
473
|
- }
|
|
|
|
474
|
- this.mapCtx = wx.createMapContext('map')
|
|
|
|
475
|
- // this.mapCtx.moveToLocation({
|
|
|
|
476
|
- // success:(res)=>{
|
|
|
|
477
|
- // console.log('moveToLocation',res)
|
|
|
|
478
|
- // }
|
|
|
|
479
|
- // })
|
|
|
|
480
|
- },
|
|
|
|
481
|
- /**
|
|
|
|
482
|
- * 生命周期函数--监听页面显示
|
|
|
|
483
|
- */
|
|
|
|
484
|
- onShow: async function (e) {
|
|
|
|
485
|
- if (typeof this.getTabBar === 'function' &&
|
|
|
|
486
|
- this.getTabBar()) {
|
|
|
|
487
|
- this.getTabBar().setData({
|
|
|
|
488
|
- selected: 0
|
|
|
|
489
|
- })
|
|
|
|
490
|
- }
|
|
|
|
491
|
- console.log({
|
|
|
|
492
|
- 'this.hasGetLocation': this.hasGetLocation,
|
|
|
|
493
|
- 'this.hasOnLoad': this.hasOnLoad,
|
|
|
|
494
|
- 'this.hasClickMoveToLocation': this.hasClickMoveToLocation,
|
|
|
|
495
|
- 'this.data.hasSuggestion': this.data.hasSuggestion,
|
|
|
|
496
|
- })
|
|
|
|
497
|
- this.getClassNameFlag = true;
|
|
|
|
498
|
- //this.getPos();
|
|
|
|
499
|
- if (this.data.hasSuggestion) return;
|
|
|
|
500
|
- if (!this.hasOnLoad && this.hasGetLocation) return;
|
|
|
|
501
|
- this.hasOnLoad = false;
|
|
|
|
502
|
- //导航栏自适应
|
|
|
|
503
|
- let systemInfo = wx.getSystemInfoSync();
|
|
|
|
504
|
- console.log('systemInfo:', systemInfo)
|
|
|
|
505
|
- let reg = /ios/i;
|
|
|
|
506
|
- let pt = 20;//导航状态栏上内边距
|
|
|
|
507
|
- let h = 44;//导航状态栏高度
|
|
|
|
508
|
- if (reg.test(systemInfo.system)) {
|
|
|
|
509
|
- pt = systemInfo.statusBarHeight;
|
|
|
|
510
|
- h = 44;
|
|
|
|
511
|
- if (systemInfo.pixelRatio > 2) {
|
|
|
|
512
|
- this.transverseViewHeight = transverseViewHeight + 26;
|
|
|
|
513
|
- }
|
|
|
|
514
|
- } else {
|
|
|
|
515
|
- if (/xiaomi/i.test(systemInfo.brand)) {
|
|
|
|
516
|
- this.transverseViewHeight = transverseViewHeight + 15;
|
|
|
|
517
|
- } else {
|
|
|
|
518
|
- this.transverseViewHeight = transverseViewHeight - 15;
|
|
|
|
519
|
- }
|
|
|
|
520
|
- pt = systemInfo.statusBarHeight;
|
|
|
|
521
|
- h = 48;
|
|
|
|
522
|
- }
|
|
|
|
523
|
- console.log('onShow', systemInfo, systemInfo.windowHeight, systemInfo.windowHeight - this.transverseViewHeight)
|
|
|
|
524
|
- this.setData({
|
|
|
|
525
|
- [`map.height`]: systemInfo.windowHeight - this.transverseViewHeight,
|
|
|
|
526
|
- statusBarHeight: pt,
|
|
|
|
527
|
- titleBarHeight: h,
|
|
|
|
528
|
- })
|
|
|
|
529
|
- //this.getPos(systemInfo);
|
|
|
|
530
|
- this.systemInfo = systemInfo
|
|
|
|
531
|
- //this.selectComponent('#getpos').getPos();
|
|
|
|
532
|
- if (!this.hasClickMoveToLocation) {
|
|
|
|
533
|
- //this.getMarkers();
|
|
|
|
534
|
- //this.timeoutGetMarkers();
|
|
|
|
535
|
- }
|
|
|
|
536
|
-
|
|
|
|
537
|
- },
|
|
|
|
538
|
-
|
|
|
|
539
|
- /**
|
|
|
|
540
|
- * 生命周期函数--监听页面隐藏
|
|
|
|
541
|
- */
|
|
|
|
542
|
- onHide: function (e) {
|
|
|
|
543
|
- util.elog(null, '离开地图页')
|
|
|
|
544
|
- },
|
|
|
|
545
|
-
|
|
|
|
546
|
- /**
|
|
|
|
547
|
- * 生命周期函数--监听页面卸载
|
|
|
|
548
|
- */
|
|
|
|
549
|
- onUnload: function () {
|
|
|
|
550
|
- PubSub.off('searchParam')
|
|
|
|
551
|
- PubSub.off('appHide')
|
|
|
|
552
|
- },
|
|
|
|
553
|
-
|
|
|
|
554
|
- /**
|
|
|
|
555
|
- * 页面相关事件处理函数--监听用户下拉动作
|
|
|
|
556
|
- */
|
|
|
|
557
|
- onPullDownRefresh: function () {
|
|
|
|
558
|
-
|
|
|
|
559
|
- },
|
|
|
|
560
|
-
|
|
|
|
561
|
- /**
|
|
|
|
562
|
- * 页面上拉触底事件的处理函数
|
|
|
|
563
|
- */
|
|
|
|
564
|
- onReachBottom: function () {
|
|
|
|
565
|
-
|
|
|
|
566
|
- },
|
|
|
|
567
|
-
|
|
|
|
568
|
- /**
|
|
|
|
569
|
- * 用户点击右上角分享
|
|
|
|
570
|
- */
|
|
|
|
571
|
- onShareAppMessage: function () {
|
|
|
|
572
|
- return {
|
|
|
|
573
|
- title: '请客订包间,就上周到安排'
|
|
|
|
574
|
- }
|
|
|
|
575
|
- },
|
|
|
|
576
|
- onpos(e) {
|
|
|
|
577
|
- console.log('onpos', e);
|
|
|
|
578
|
- let res = e.detail;
|
|
|
|
579
|
- if (!res.latitude) return this.timeoutGetMarkers();
|
|
|
|
580
|
- this.hasGetLocation = true;
|
|
|
|
581
|
- this.sellersIds = []
|
|
|
|
582
|
- this.sellers = []
|
|
|
|
583
|
- let map = this.data.map;
|
|
|
|
584
|
- map.latitude = res.latitude;
|
|
|
|
585
|
- map.longitude = res.longitude;
|
|
|
|
586
|
- map.scale = mapScale;
|
|
|
|
587
|
- this.user.latitude = res.latitude;
|
|
|
|
588
|
- this.user.longitude = res.longitude;
|
|
|
|
589
|
- map.height = this.systemInfo.windowHeight - this.transverseViewHeight
|
|
|
|
590
|
- let sdobj = {
|
|
|
|
591
|
- map: map,
|
|
|
|
592
|
- hasSuggestion: false,
|
|
|
|
593
|
- }
|
|
|
|
594
|
- if (!this.hasSellerConcat) {
|
|
|
|
595
|
- sdobj.markers = []
|
|
|
|
596
|
- }
|
|
|
|
597
|
- this.setData(sdobj)
|
|
|
|
598
|
- this.timeoutGetMarkers()
|
|
|
|
599
|
- /*
|
|
|
|
600
|
- if(this.mapCtx){
|
|
|
|
601
|
- //this.mapCtx.moveToLocation();
|
|
|
|
602
|
- this.mapCtx.getRegion({
|
|
|
|
603
|
- success:(res)=>{
|
|
|
|
604
|
- console.log('onpos.getRegion',res)
|
|
|
|
605
|
- if(this.mapData.region.southwest.latitude) {
|
|
|
|
606
|
- this.mapData.region = res
|
|
|
|
607
|
- this.timeoutGetMarkers()
|
|
|
|
608
|
- }
|
|
|
|
609
|
- },
|
|
|
|
610
|
- })
|
|
|
|
611
|
- }
|
|
|
|
612
|
- */
|
|
|
|
613
|
- },
|
|
|
|
614
|
- regionchange(e) {
|
|
|
|
615
|
- if (e.type != 'end') return;
|
|
|
|
616
|
- console.log('regionchange', e)
|
|
|
|
617
|
- if (typeof this.mapCtx == 'undefined' || !this.mapCtx) return;
|
|
|
|
618
|
- this.getClassNameFlag = true;
|
|
|
|
619
|
- this.mapCtx.getScale({
|
|
|
|
620
|
- success: (res) => {
|
|
|
|
621
|
- this.mapData.scale = res.scale;
|
|
|
|
622
|
- console.log('regionchange.getScale', res, this.data.map.scale)
|
|
|
|
623
|
- },
|
|
|
|
624
|
- })
|
|
|
|
625
|
- this.mapCtx.getCenterLocation({
|
|
|
|
626
|
- success: (res) => {
|
|
|
|
627
|
- console.log('regionchange.getCenterLocation', res)
|
|
|
|
628
|
- this.mapData.latitude = res.latitude;
|
|
|
|
629
|
- this.mapData.longitude = res.longitude;
|
|
|
|
630
|
- if (this.mapData.lat == '' && res.latitude.toString().length > 6 && res.longitude.toString().length > 6) {
|
|
|
|
631
|
- this.mapData.lat = res.latitude;
|
|
|
|
632
|
- this.mapData.lng = res.longitude;
|
|
|
|
633
|
- }
|
|
|
|
634
|
- },
|
|
|
|
635
|
- });
|
|
|
|
636
|
- this.mapCtx.getRegion({
|
|
|
|
637
|
- success: (res) => {
|
|
|
|
638
|
- console.log('regionchange.getRegion', res.southwest.latitude, this.mapData.region.southwest.latitude, res)
|
|
|
|
639
|
- this.hasClickMoveToLocation = false
|
|
|
|
640
|
- if (res.southwest.latitude) {
|
|
|
|
641
|
- this.mapData.region = res
|
|
|
|
642
|
- }
|
|
|
|
643
|
- ;
|
|
|
|
644
|
- this.timeoutGetMarkers();
|
|
|
|
645
|
- },
|
|
|
|
646
|
- })
|
|
|
|
647
|
- },
|
|
|
|
648
|
- setTimeoutGetMarkers: '',
|
|
|
|
649
|
- timeoutGetMarkers() {//延时获取
|
|
|
|
650
|
- if (this.setTimeoutGetMarkers) {
|
|
|
|
651
|
- clearTimeout(this.setTimeoutGetMarkers);
|
|
|
|
652
|
- this.setTimeoutGetMarkers = '';
|
|
|
|
653
|
- }
|
|
|
|
654
|
- this.setTimeoutGetMarkers = setTimeout(() => {
|
|
|
|
655
|
- this.getMarkers();
|
|
|
|
656
|
- }, 300)
|
|
|
|
657
|
- },
|
|
|
|
658
|
- mapUpdated(e) {
|
|
|
|
659
|
- console.log('mapUpdated', e)
|
|
|
|
660
|
- if (typeof this.mapCtx == 'undefined' || !this.mapCtx) return;
|
|
|
|
661
|
- this.getClassNameFlag = true;
|
|
|
|
662
|
- this.mapCtx.getScale({
|
|
|
|
663
|
- success: (res) => {
|
|
|
|
664
|
- this.mapData.scale = res.scale;
|
|
|
|
665
|
- console.log('mapUpdated.getScale', res, this.data.map.scale)
|
|
|
|
666
|
- },
|
|
|
|
667
|
- })
|
|
|
|
668
|
- this.mapCtx.getCenterLocation({
|
|
|
|
669
|
- success: (res) => {
|
|
|
|
670
|
- console.log('mapUpdated.getCenterLocation', res)
|
|
|
|
671
|
- this.mapData.latitude = res.latitude;
|
|
|
|
672
|
- this.mapData.longitude = res.longitude;
|
|
|
|
673
|
- if (this.mapData.lat == '' && res.latitude.toString().length > 6 && res.longitude.toString().length > 6) {
|
|
|
|
674
|
- this.mapData.lat = res.latitude;
|
|
|
|
675
|
- this.mapData.lng = res.longitude;
|
|
|
|
676
|
- }
|
|
|
|
677
|
- },
|
|
|
|
678
|
- });
|
|
|
|
679
|
- this.mapCtx.getRegion({
|
|
|
|
680
|
- success: (res) => {
|
|
|
|
681
|
- if (this.mapData.region.southwest.latitude == '' || !res.southwest.latitude) return;
|
|
|
|
682
|
- console.log('mapUpdated.getRegion', [res.southwest.latitude, this.mapData.region.southwest.latitude])
|
|
|
|
683
|
- this.mapData.region = res
|
|
|
|
684
|
- //this.timeoutGetMarkers();
|
|
|
|
685
|
- },
|
|
|
|
686
|
- })
|
|
|
|
687
|
- this.setData({
|
|
|
|
688
|
- hasBoost: true,
|
|
|
|
689
|
- })
|
|
|
|
690
|
- },
|
|
|
|
691
|
- hasMarkertap: false,
|
|
|
|
692
|
- markertap(e, flag = true) {
|
|
|
|
693
|
- if (e.markerId == 'location' || e.markerId == 'locationMe') return;
|
|
|
|
694
|
- this.hasMarkertap = false
|
|
|
|
695
|
- let markers = this.data.markers;
|
|
|
|
696
|
- console.log('markertap', e)
|
|
|
|
697
|
- this.activeSellerID = e.markerId
|
|
|
|
698
|
- let bl = 1.2;
|
|
|
|
699
|
- let current = 0, hasCurrent = true;
|
|
|
|
700
|
- markers.forEach((m, i) => {
|
|
|
|
701
|
- m.iconPath = m.iconPath.replace('/cates-active/', '/cates/')
|
|
|
|
702
|
- m.zIndex = m.zIndexBak
|
|
|
|
703
|
- if (m.width == 20 * bl) {
|
|
|
|
704
|
- m.width = 20;
|
|
|
|
705
|
- m.height = 25;
|
|
|
|
706
|
- }
|
|
|
|
707
|
- if (m.width == 12) {
|
|
|
|
708
|
- m.width = 8;
|
|
|
|
709
|
- m.height = 8;
|
|
|
|
710
|
- }
|
|
|
|
711
|
- if (m.callout) {
|
|
|
|
712
|
- m.callout.borderColor = '#cccccc';
|
|
|
|
713
|
- m.callout.bgColor = '#fefefe';
|
|
|
|
714
|
- m.callout.color = '#353535';
|
|
|
|
715
|
- m.callout.display = m.calloutDisplay;
|
|
|
|
716
|
- }
|
|
|
|
717
|
- if (m.id == e.markerId) {
|
|
|
|
718
|
- m.iconPath = m.iconPath.replace('/cates/', '/cates-active/')
|
|
|
|
719
|
- if (m.width == 20) {
|
|
|
|
720
|
- m.width = 20 * bl;
|
|
|
|
721
|
- m.height = 25 * bl;
|
|
|
|
722
|
- } else {
|
|
|
|
723
|
- m.width = 12;
|
|
|
|
724
|
- m.height = 12;
|
|
|
|
725
|
- }
|
|
|
|
726
|
- m.zIndex = 9999
|
|
|
|
727
|
- if (m.callout) {
|
|
|
|
728
|
- m.callout.borderColor = '#F05522';
|
|
|
|
729
|
- m.callout.bgColor = '#F05522';
|
|
|
|
730
|
- m.callout.color = '#fefefe';
|
|
|
|
731
|
- m.callout.display = 'ALWAYS';
|
|
|
|
732
|
- }
|
|
|
|
733
|
- hasCurrent = false
|
|
|
|
734
|
- if ("markertap" == e.type) {
|
|
|
|
735
|
- util.elog({id: m.seller.id, sellername: m.seller.sellername}, '点击地图区域的店铺标记')
|
|
|
|
736
|
- }
|
|
|
|
737
|
-
|
|
|
|
738
|
- }
|
|
|
|
739
|
- if (m.display != 'none' && hasCurrent) {
|
|
|
|
740
|
- current++
|
|
|
|
741
|
- }
|
|
|
|
742
|
- })
|
|
|
|
743
|
- let obj = {
|
|
|
|
744
|
- markers: markers,
|
|
|
|
745
|
- };
|
|
|
|
746
|
- console.log('markertap::current,', current);
|
|
|
|
747
|
- if (flag) {
|
|
|
|
748
|
- //obj.scrollIntoView='seller-'+e.markerId;
|
|
|
|
749
|
- obj.current = current;
|
|
|
|
750
|
- //this.hasMarkertap=true;
|
|
|
|
751
|
- }
|
|
|
|
752
|
- this.setData(obj)
|
|
|
|
753
|
- },
|
|
|
|
754
|
- hasInRegionFlag: false,
|
|
|
|
755
|
- hasInRegion() {//定位是否在地图视野内
|
|
|
|
756
|
- let map = this.mapData;
|
|
|
|
757
|
- if (!map.region.northeast.latitude || !map.region.northeast.longitude) {//未获得视野
|
|
|
|
758
|
- if (this.mapDataLast) {
|
|
|
|
759
|
- this.mapData = this.mapDataLast
|
|
|
|
760
|
- }
|
|
|
|
761
|
- return {flag: false, msg: '未获得视野', map: map, mapDataLast: this.mapDataLast};
|
|
|
|
762
|
- }
|
|
|
|
763
|
- if (!map.region.southwest.latitude || !map.region.southwest.longitude) {//未获得视野
|
|
|
|
764
|
- if (this.mapDataLast) {
|
|
|
|
765
|
- this.mapData = this.mapDataLast
|
|
|
|
766
|
- }
|
|
|
|
767
|
- return {flag: false, msg: '未获得视野', map: map, mapDataLast: this.mapDataLast};
|
|
|
|
768
|
- }
|
|
|
|
769
|
- this.mapDataLast = JSON.parse(JSON.stringify(this.mapData));
|
|
|
|
770
|
- if (this.hasInRegionFlag) return {flag: true, msg: '二次获取'};
|
|
|
|
771
|
- if (!this.user.latitude) return {flag: false, msg: '用户无定位'};//用户无定位
|
|
|
|
772
|
- //if(this.user.latitude==def_latitude && this.user.longitude==def_longitude) return false;//默认位置
|
|
|
|
773
|
- ///判断定位 首次 进入视野
|
|
|
|
774
|
- if ((this.user.latitude > map.region.southwest.latitude
|
|
|
|
775
|
- && this.user.longitude > map.region.southwest.longitude
|
|
|
|
776
|
- && this.user.latitude < map.region.northeast.latitude
|
|
|
|
777
|
- && this.user.longitude < map.region.northeast.longitude) || this.data.hasSuggestion) {
|
|
|
|
778
|
- this.hasInRegionFlag = true;
|
|
|
|
779
|
- return {flag: true, msg: '用户首次或搜索地标'};
|
|
|
|
780
|
- } else {
|
|
|
|
781
|
- //视野不匹配
|
|
|
|
782
|
- this.mapCtx.getRegion({
|
|
|
|
783
|
- success: (res) => {
|
|
|
|
784
|
- console.log('hasInRegion.getRegion', res)
|
|
|
|
785
|
- this.mapData.region = res
|
|
|
|
786
|
- },
|
|
|
|
787
|
- })
|
|
|
|
788
|
- }
|
|
|
|
789
|
- return {flag: false, msg: '视野不匹配'};
|
|
|
|
790
|
- },
|
|
|
|
791
|
- async getMarkers() {
|
|
|
|
792
|
- let cmap = this.data.map;
|
|
|
|
793
|
- let map = this.mapData;
|
|
|
|
794
|
- //console.log('getMarkers',map.region);
|
|
|
|
795
|
- let region = this.hasInRegion();
|
|
|
|
796
|
- console.log('this.hasInRegion', region)
|
|
|
|
797
|
- if (!region.flag) {
|
|
|
|
798
|
- return setTimeout(() => {
|
|
|
|
799
|
- this.getMarkers();
|
|
|
|
800
|
- }, 300)
|
|
|
|
801
|
- }
|
|
|
|
802
|
- let markers = [];
|
|
|
|
803
|
- let param = {
|
|
|
|
804
|
- lat: this.user.latitude == def_latitude ? '' : this.user.latitude,
|
|
|
|
805
|
- lng: this.user.longitude == def_longitude ? '' : this.user.longitude,
|
|
|
|
806
|
- offset: 0,
|
|
|
|
807
|
- rows: 50,
|
|
|
|
808
|
- distance: 100000,
|
|
|
|
809
|
- map: JSON.stringify({...this.mapData.region, scale: this.mapData.scale >= 19 ? 20 : this.mapData.scale})
|
|
|
|
810
|
- }
|
|
|
|
811
|
- if (this.data.multiIndex[0] > 0) {
|
|
|
|
812
|
- param.cuisine = await DA.getCatesID(this.data.multiIndex[0] - 1);
|
|
|
|
813
|
- }
|
|
|
|
814
|
- let tags = [];
|
|
|
|
815
|
- this.data.tags.forEach(t => {
|
|
|
|
816
|
- if (t.active) {
|
|
|
|
817
|
- tags.push(t.id)
|
|
|
|
818
|
- }
|
|
|
|
819
|
- })
|
|
|
|
820
|
- if (tags.length > 0) {
|
|
|
|
821
|
- param.tags = tags;
|
|
|
|
822
|
- }
|
|
|
|
823
|
- if (param.lat) {
|
|
|
|
824
|
- param.centre_pos = `${param.lat},${param.lng}`
|
|
|
|
825
|
- } else {
|
|
|
|
826
|
- let lat = (this.mapData.region.southwest.latitude + this.mapData.region.northeast.latitude) / 2
|
|
|
|
827
|
- let lng = (this.mapData.region.southwest.longitude + this.mapData.region.northeast.longitude) / 2
|
|
|
|
828
|
- param.centre_pos = `${lat},${lng}`
|
|
|
|
829
|
- }
|
|
|
|
830
|
- if (this.data.hasSuggestion) {
|
|
|
|
831
|
- param.centre_pos = `${this.data.suggestion.latitude},${this.data.suggestion.longitude}`
|
|
|
|
832
|
- }
|
|
|
|
833
|
- if (this.findSellerData) {
|
|
|
|
834
|
- param = Object.assign(param, this.findSellerData.paramObj)
|
|
|
|
835
|
- }
|
|
|
|
836
|
- if (this.filterParams) {//人均过滤
|
|
|
|
837
|
- let filterParams = this.filterParams.min + ',' + this.filterParams.max
|
|
|
|
838
|
- if (this.filterParams.min == this.filterParams.max && this.filterParams.min == 300) {
|
|
|
|
839
|
- filterParams = this.filterParams.min + ',' + parseInt(new Date() / 1000)
|
|
|
|
840
|
- }
|
|
|
|
841
|
- param.average = filterParams
|
|
|
|
842
|
- }
|
|
|
|
843
|
- //this.selectComponent('#list').getList(param);
|
|
|
|
844
|
- this.param = param;
|
|
|
|
845
|
- let now_sid = [];
|
|
|
|
846
|
- App.Customer.SellerList(param).then(async res => {
|
|
|
|
847
|
- //this.mapData.region.southwest.latitude='';
|
|
|
|
848
|
- if (res.ret == 200) {
|
|
|
|
849
|
- let sellersList = res.data.list;
|
|
|
|
850
|
- let sellersLength = sellersList.length;
|
|
|
|
851
|
- sellersList.forEach((seller, si) => {
|
|
|
|
852
|
- now_sid.push(seller.id);
|
|
|
|
853
|
- let hasMark = false;
|
|
|
|
854
|
- if (this.sellersIds._indexOf(seller.id) < 0) {
|
|
|
|
855
|
- // if(seller.distance || seller.distance===0){
|
|
|
|
856
|
- // seller.distance=parseInt(seller.distance);
|
|
|
|
857
|
- // if(seller.distance>1000){
|
|
|
|
858
|
- // seller.distance=(seller.distance/1000).toFixed(2)+'km'
|
|
|
|
859
|
- // }else{
|
|
|
|
860
|
- // seller.distance+='m';
|
|
|
|
861
|
- // }
|
|
|
|
862
|
- // }
|
|
|
|
863
|
- if (this.hasSellerConcat) {
|
|
|
|
864
|
- this.sellersIds.push(seller.id);
|
|
|
|
865
|
- }
|
|
|
|
866
|
- hasMark = true;
|
|
|
|
867
|
- }
|
|
|
|
868
|
- if (hasMark) {
|
|
|
|
869
|
- if (this.findSellerData) {
|
|
|
|
870
|
- seller.findSellerParamObj = this.findSellerData.paramObj
|
|
|
|
871
|
- }
|
|
|
|
872
|
- let marker = {
|
|
|
|
873
|
- id: seller.id,
|
|
|
|
874
|
- iconPath: "http://nosqn.colorcun.com/custom/lite-online/cates/circle1x5.png" + cates_version,
|
|
|
|
875
|
- latitude: seller.lat,
|
|
|
|
876
|
- longitude: seller.long,
|
|
|
|
877
|
- width: 8,
|
|
|
|
878
|
- height: 8,
|
|
|
|
879
|
- //title:seller.seller_name,
|
|
|
|
880
|
- zIndex: sellersLength - si,
|
|
|
|
881
|
- zIndexBak: sellersLength - si,
|
|
|
|
882
|
- seller: seller,
|
|
|
|
883
|
- };
|
|
|
|
884
|
- marker.callout = {
|
|
|
|
885
|
- content: ' ' + seller.sellername + ' ',
|
|
|
|
886
|
- color: '#353535',
|
|
|
|
887
|
- fontSize: 12,
|
|
|
|
888
|
- borderWidth: 1,
|
|
|
|
889
|
- borderColor: '#cccccc',
|
|
|
|
890
|
- borderRadius: 50,
|
|
|
|
891
|
- bgColor: '#fefefe',
|
|
|
|
892
|
- padding: 5,
|
|
|
|
893
|
- textAlign: 'left',
|
|
|
|
894
|
- display: 'BYCLICK',
|
|
|
|
895
|
- };
|
|
|
|
896
|
- marker.calloutDisplay = 'BYCLICK';
|
|
|
|
897
|
- if (seller.mode.length > 0) {
|
|
|
|
898
|
- seller.mode.forEach(x => {
|
|
|
|
899
|
- if (x.id == 1) {//大图标
|
|
|
|
900
|
- marker.iconPath = "http://nosqn.colorcun.com/custom/lite-online/cates/其他菜品.png";
|
|
|
|
901
|
- if (seller.cate.length > 0) {
|
|
|
|
902
|
- marker.iconPath = seller.cate[0].icon
|
|
|
|
903
|
- }
|
|
|
|
904
|
- marker.iconPath = marker.iconPath.replace(/\/cates\/(.*)\.png/, function ($0, $1) {
|
|
|
|
905
|
- return '/cates/' + encodeURI($1) + '.png'
|
|
|
|
906
|
- })
|
|
|
|
907
|
- marker.iconPath += cates_version
|
|
|
|
908
|
- marker.width = 20;
|
|
|
|
909
|
- marker.height = 25;
|
|
|
|
910
|
- }
|
|
|
|
911
|
- if (x.id == 2) {//商家名
|
|
|
|
912
|
- marker.callout.display = 'ALWAYS';
|
|
|
|
913
|
- marker.calloutDisplay = 'ALWAYS';
|
|
|
|
914
|
- }
|
|
|
|
915
|
- })
|
|
|
|
916
|
- }
|
|
|
|
917
|
- markers.push(marker)
|
|
|
|
918
|
- }
|
|
|
|
919
|
- })
|
|
|
|
920
|
- } else {
|
|
|
|
921
|
- console.log('接口报错了');
|
|
|
|
922
|
- }
|
|
|
|
923
|
- this.sellersNow = now_sid;
|
|
|
|
924
|
- let obj = {
|
|
|
|
925
|
- hasSellers: now_sid.length > 0,
|
|
|
|
926
|
- hasGetSellersEnd: true,
|
|
|
|
927
|
- hasSearchLimit: (tags.length > 0 || this.data.multiIndex[0] > 0) || this.findSellerData,
|
|
|
|
928
|
- listMoreCount: res.data.flag
|
|
|
|
929
|
- }
|
|
|
|
930
|
- if (this.hasSellerConcat) {
|
|
|
|
931
|
- obj.markers = this.data.markers.concat(markers);
|
|
|
|
932
|
- } else {
|
|
|
|
933
|
- obj.markers = markers;
|
|
|
|
934
|
- }
|
|
|
|
935
|
- obj.markers.forEach(mk => {
|
|
|
|
936
|
- //mk.display='none';
|
|
|
|
937
|
- if (now_sid._indexOf(mk.id) > -1) {
|
|
|
|
938
|
- mk.display = '';
|
|
|
|
939
|
- }
|
|
|
|
940
|
- })
|
|
|
|
941
|
- obj.markers = await this.setLocationMarker(obj.markers);
|
|
|
|
942
|
- this.setData(obj)
|
|
|
|
943
|
- if (now_sid.length > 0) {
|
|
|
|
944
|
- setTimeout(() => {
|
|
|
|
945
|
- this.markertap({
|
|
|
|
946
|
- markerId: now_sid._indexOf(this.activeSellerID) < 0 ? now_sid[0] : this.activeSellerID
|
|
|
|
947
|
- }, true)
|
|
|
|
948
|
- }, 100)
|
|
|
|
949
|
- }
|
|
|
|
950
|
- this.IsSetActivity();
|
|
|
|
951
|
- })
|
|
|
|
952
|
-
|
|
|
|
953
|
- },
|
|
|
|
954
|
- //seller box 通知
|
|
|
|
955
|
- sellerBoxEvent(e) {
|
|
|
|
956
|
- wx.showTabBar();
|
|
|
|
957
|
- },
|
|
|
|
958
|
- moveToLocation() {
|
|
|
|
959
|
- this.hasClickMoveToLocation = true
|
|
|
|
960
|
- if (this.user.latitude == def_latitude && this.user.longitude == def_longitude) {
|
|
|
|
961
|
- this.selectComponent('#getpos').getPos(true);
|
|
|
|
962
|
- return;
|
|
|
|
963
|
- }
|
|
|
|
964
|
- this.sellersIds = []
|
|
|
|
965
|
- this.sellers = []
|
|
|
|
966
|
- let map = this.data.map;
|
|
|
|
967
|
- map.latitude = this.user.latitude;
|
|
|
|
968
|
- map.longitude = this.user.longitude;
|
|
|
|
969
|
- map.scale = mapScale;
|
|
|
|
970
|
- map.height = this.systemInfo.windowHeight - this.transverseViewHeight
|
|
|
|
971
|
- let sdobj = {
|
|
|
|
972
|
- map: map,
|
|
|
|
973
|
- hasSuggestion: false,
|
|
|
|
974
|
- hasGetSellersEnd: false,
|
|
|
|
975
|
- }
|
|
|
|
976
|
- if (!this.hasSellerConcat) {
|
|
|
|
977
|
- sdobj.markers = []
|
|
|
|
978
|
- }
|
|
|
|
979
|
- this.setData(sdobj)
|
|
|
|
980
|
- this.mapCtx.moveToLocation({
|
|
|
|
981
|
- success: (res) => {
|
|
|
|
982
|
- console.log('moveToLocation', res)
|
|
|
|
983
|
- }
|
|
|
|
984
|
- })
|
|
|
|
985
|
- },
|
|
|
|
986
|
- bindMultiPickerChange(e) {
|
|
|
|
987
|
- console.log(e);
|
|
|
|
988
|
- let val = util.val(e);
|
|
|
|
989
|
- this.setData({
|
|
|
|
990
|
- multiIndex: val
|
|
|
|
991
|
- })
|
|
|
|
992
|
- this.hasSellerConcat = hasSellerConcat;
|
|
|
|
993
|
- this.sellersIds = [];
|
|
|
|
994
|
- if (val[0] > 0) {
|
|
|
|
995
|
- this.hasSellerConcat = false;
|
|
|
|
996
|
- } else {
|
|
|
|
997
|
- if (!this.hasSellerConcat) {
|
|
|
|
998
|
- this.setData({
|
|
|
|
999
|
- markers: []
|
|
|
|
1000
|
- })
|
|
|
|
1001
|
- }
|
|
|
|
1002
|
- }
|
|
|
|
1003
|
- setTimeout(() => {
|
|
|
|
1004
|
- this.getMarkers();
|
|
|
|
1005
|
- }, 0)
|
|
|
|
1006
|
- },
|
|
|
|
1007
|
- setSuggestion(suggestion) {
|
|
|
|
1008
|
- let map = this.data.map;
|
|
|
|
1009
|
- //let pos=DA.gcj02towgs84(suggestion.longitude,suggestion.latitude)
|
|
|
|
1010
|
- map.latitude = suggestion.latitude
|
|
|
|
1011
|
- map.longitude = suggestion.longitude
|
|
|
|
1012
|
- if (suggestion.type == -1) {//平台商户
|
|
|
|
1013
|
- this.activeSellerID = suggestion.id
|
|
|
|
1014
|
- map.scale = 20
|
|
|
|
1015
|
- } else {
|
|
|
|
1016
|
- map.scale = mapScale
|
|
|
|
1017
|
- }
|
|
|
|
1018
|
- this.sellersIds = []
|
|
|
|
1019
|
- this.sellers = []
|
|
|
|
1020
|
- let sdobj = {
|
|
|
|
1021
|
- map: map,
|
|
|
|
1022
|
- hasSuggestion: true,
|
|
|
|
1023
|
- suggestion: suggestion,
|
|
|
|
1024
|
- hasGetSellersEnd: false,
|
|
|
|
1025
|
- }
|
|
|
|
1026
|
- if (!this.hasSellerConcat) {
|
|
|
|
1027
|
- sdobj.markers = []
|
|
|
|
1028
|
- }
|
|
|
|
1029
|
- //this.findSellerData=null//清理搜索
|
|
|
|
1030
|
- this.setData(sdobj)
|
|
|
|
1031
|
- },
|
|
|
|
1032
|
-
|
|
|
|
1033
|
- getClassNameFlag: true,
|
|
|
|
1034
|
- activeSellerID: '',
|
|
|
|
1035
|
- bindscroll(e) {
|
|
|
|
1036
|
- if (!this.getClassNameFlag) return;
|
|
|
|
1037
|
- this.getClassNameFlag = false;
|
|
|
|
1038
|
- let w = e.detail.scrollWidth / this.sellers.length;
|
|
|
|
1039
|
- let i = Math.round(e.detail.scrollLeft / w);
|
|
|
|
1040
|
- console.log(e.detail, this.sellers, i);
|
|
|
|
1041
|
- if (this.activeSellerID != this.sellers[i].id) {
|
|
|
|
1042
|
- this.activeSellerID = this.sellers[i];
|
|
|
|
1043
|
- this.markertap({
|
|
|
|
1044
|
- markerId: this.sellers[i].id
|
|
|
|
1045
|
- }, false)
|
|
|
|
1046
|
- }
|
|
|
|
1047
|
- let that = this;
|
|
|
|
1048
|
- setTimeout(function () {
|
|
|
|
1049
|
- that.getClassNameFlag = true;
|
|
|
|
1050
|
- }, 300)
|
|
|
|
1051
|
- },
|
|
|
|
1052
|
- bindtransition(e) {
|
|
|
|
1053
|
- if (this.hasMarkertap) {
|
|
|
|
1054
|
- this.hasMarkertap = false;
|
|
|
|
1055
|
- return;
|
|
|
|
1056
|
- }
|
|
|
|
1057
|
- let i = e.detail.current
|
|
|
|
1058
|
- if (typeof this.data.markers[i] == 'undefined') return;
|
|
|
|
1059
|
- this.activeSellerID = this.data.markers[i].id
|
|
|
|
1060
|
- console.log('bindtransition', this.sellersNow, e.detail.current, this.sellersNow[e.detail.current], this.activeSellerID);
|
|
|
|
1061
|
- // this.activeSellerID=this.sellersNow[i];
|
|
|
|
1062
|
- // this.markertap({
|
|
|
|
1063
|
- // markerId:this.activeSellerID
|
|
|
|
1064
|
- // },false)
|
|
|
|
1065
|
- this.markertap({
|
|
|
|
1066
|
- markerId: this.activeSellerID
|
|
|
|
1067
|
- }, false)
|
|
|
|
1068
|
- },
|
|
|
|
1069
|
- gotoDetail(e) {
|
|
|
|
1070
|
- wx.navigateTo({
|
|
|
|
1071
|
- url: '/pages/reserve/detail?id=' + util.attr(e, 'sid')
|
|
|
|
1072
|
- })
|
|
|
|
1073
|
- util.elog({sid: util.attr(e, 'sid')}, '点击橱窗中的商家,进入店铺详情')
|
|
|
|
1074
|
- },
|
|
|
|
1075
|
- IsSetActivity() {
|
|
|
|
1076
|
- let cmap = this.data.map;
|
|
|
|
1077
|
- App.Customer.IsSetActivity({lat: cmap.latitude, lng: cmap.longitude, distance: 50}).then(res => {
|
|
|
|
1078
|
- this.setData({
|
|
|
|
1079
|
- hasSetActivity: res.data == 1,
|
|
|
|
1080
|
- })
|
|
|
|
1081
|
- })
|
|
|
|
1082
|
- },
|
|
|
|
1083
|
- a2lshow(e) {
|
|
|
|
1084
|
- //console.log('a2lshow',e)
|
|
|
|
1085
|
- let ds = this.selectComponent('#ds');
|
|
|
|
1086
|
- if (!ds) {
|
|
|
|
1087
|
- return setTimeout(() => {
|
|
|
|
1088
|
- this.a2lshow(e)
|
|
|
|
1089
|
- }, 500)
|
|
|
|
1090
|
- }
|
|
|
|
1091
|
- ds.setA2LHeight(e.type == 'hide' ? 0 : 40);
|
|
|
|
1092
|
- },
|
|
|
|
1093
|
- async setMapRegion() {
|
|
|
|
1094
|
- return new Promise((success, fail) => {
|
|
|
|
1095
|
- if (this.mapCtx) {
|
|
|
|
1096
|
- this.mapCtx.getRegion({
|
|
|
|
1097
|
- success: (res) => {
|
|
|
|
1098
|
- if (res.southwest.latitude) {
|
|
|
|
1099
|
- this.mapData.region = res
|
|
|
|
1100
|
- success()
|
|
|
|
1101
|
- }
|
|
|
|
1102
|
- },
|
|
|
|
1103
|
- fail: () => {
|
|
|
|
1104
|
- fail()
|
|
|
|
1105
|
- }
|
|
|
|
1106
|
- })
|
|
|
|
1107
|
- } else {
|
|
|
|
1108
|
- fail()
|
|
|
|
1109
|
- }
|
|
|
|
1110
|
- })
|
|
|
|
1111
|
- },
|
|
|
|
1112
|
- async setLocationMarker(markers) {
|
|
|
|
1113
|
- try {
|
|
|
|
1114
|
- await this.setMapRegion();
|
|
|
|
1115
|
- } catch (e) {
|
|
|
|
1116
|
- this.timeoutGetMarkers()
|
|
|
|
1117
|
- return []
|
|
|
|
1118
|
- }
|
|
|
|
1119
|
-
|
|
|
|
1120
|
- let map = this.mapData;
|
|
|
|
1121
|
- let mks = []
|
|
|
|
1122
|
- let matchPosNum = 1
|
|
|
|
1123
|
- if (markers.length > 0) {
|
|
|
|
1124
|
- markers.forEach(mk => {
|
|
|
|
1125
|
- if (mk.id != 'location' && mk.id != 'locationMe'
|
|
|
|
1126
|
- && mk.latitude > map.region.southwest.latitude
|
|
|
|
1127
|
- && mk.longitude > map.region.southwest.longitude
|
|
|
|
1128
|
- && mk.latitude < map.region.northeast.latitude
|
|
|
|
1129
|
- && mk.longitude < map.region.northeast.longitude) {
|
|
|
|
1130
|
- mks.push(mk);
|
|
|
|
1131
|
- }
|
|
|
|
1132
|
- })
|
|
|
|
1133
|
- }
|
|
|
|
1134
|
- if (mks.length - markers.length < 0) {
|
|
|
|
1135
|
- this.timeoutGetMarkers()
|
|
|
|
1136
|
- return []
|
|
|
|
1137
|
- }
|
|
|
|
1138
|
-
|
|
|
|
1139
|
- if (this.data.hasSuggestion) {
|
|
|
|
1140
|
- map = this.data.suggestion
|
|
|
|
1141
|
- mks.push({
|
|
|
|
1142
|
- id: 'location',
|
|
|
|
1143
|
- iconPath: "http://nosqn.colorcun.com/reserve/images/location.png" + cates_version,
|
|
|
|
1144
|
- latitude: map.latitude,
|
|
|
|
1145
|
- longitude: map.longitude,
|
|
|
|
1146
|
- width: 20,
|
|
|
|
1147
|
- height: 25,
|
|
|
|
1148
|
- })
|
|
|
|
1149
|
- }
|
|
|
|
1150
|
- mks.push({
|
|
|
|
1151
|
- id: 'locationMe',
|
|
|
|
1152
|
- iconPath: "http://nosqn.colorcun.com/reserve/images/lme.png" + cates_version,
|
|
|
|
1153
|
- latitude: this.user.latitude,
|
|
|
|
1154
|
- longitude: this.user.longitude,
|
|
|
|
1155
|
- width: 18,
|
|
|
|
1156
|
- height: 30,
|
|
|
|
1157
|
- })
|
|
|
|
1158
|
- return mks;
|
|
|
|
1159
|
- },
|
|
|
|
1160
|
- tagsChange(e) {
|
|
|
|
1161
|
- if (this.data.listMoreCount < 1 && !this.data.hasSearchLimit) return
|
|
|
|
1162
|
- let id = util.attr(e, 'id');
|
|
|
|
1163
|
- let tags = this.data.tags;
|
|
|
|
1164
|
- let activeNum = 0;
|
|
|
|
1165
|
- tags.forEach(t => {
|
|
|
|
1166
|
- if (t.id == id) {
|
|
|
|
1167
|
- t.active = !t.active
|
|
|
|
1168
|
- }
|
|
|
|
1169
|
- if (t.active) {
|
|
|
|
1170
|
- activeNum++
|
|
|
|
1171
|
- }
|
|
|
|
1172
|
- })
|
|
|
|
1173
|
- this.setData({
|
|
|
|
1174
|
- tags: tags,
|
|
|
|
1175
|
- })
|
|
|
|
1176
|
- this.hasSellerConcat = hasSellerConcat;
|
|
|
|
1177
|
- this.sellersIds = [];
|
|
|
|
1178
|
- if (activeNum > 0) {
|
|
|
|
1179
|
- this.hasSellerConcat = false;
|
|
|
|
1180
|
- } else {
|
|
|
|
1181
|
- if (!this.hasSellerConcat) {
|
|
|
|
1182
|
- this.setData({
|
|
|
|
1183
|
- markers: []
|
|
|
|
1184
|
- })
|
|
|
|
1185
|
- }
|
|
|
|
1186
|
- }
|
|
|
|
1187
|
- setTimeout(() => {
|
|
|
|
1188
|
- this.getMarkers();
|
|
|
|
1189
|
- }, 0)
|
|
|
|
1190
|
-
|
|
|
|
1191
|
- },
|
|
|
|
1192
|
- caixiActive(e) {
|
|
|
|
1193
|
- console.log('caixiActive', e);
|
|
|
|
1194
|
- this.bindMultiPickerChange({
|
|
|
|
1195
|
- detail: {
|
|
|
|
1196
|
- value: [e.detail]
|
|
|
|
1197
|
- }
|
|
|
|
1198
|
- })
|
|
|
|
1199
|
- },
|
|
|
|
1200
|
- caixiShow() {
|
|
|
|
1201
|
- if (this.data.listMoreCount < 1 && !this.data.hasSearchLimit) return
|
|
|
|
1202
|
- this.selectComponent('#caixi').show();
|
|
|
|
1203
|
- },
|
|
|
|
1204
|
- listEvent(e) {
|
|
|
|
1205
|
- let d = e.detail
|
|
|
|
1206
|
- console.log('listEvent', e);
|
|
|
|
1207
|
- if (d.type == "getListEnd") {
|
|
|
|
1208
|
- this.setData({
|
|
|
|
1209
|
- listMoreCount: d.total
|
|
|
|
1210
|
- });
|
|
|
|
1211
|
- } else if (d.type == 'caixiShow') {
|
|
|
|
1212
|
- this.caixiShow();
|
|
|
|
1213
|
- } else if (d.type == 'tagsChange') {
|
|
|
|
1214
|
- this.tagsChange(d.e);
|
|
|
|
1215
|
- }
|
|
|
|
1216
|
- },
|
|
|
|
1217
|
- listShow() {
|
|
|
|
1218
|
- //this.selectComponent('#list').show();
|
|
|
|
1219
|
- if (!this.param.map) return;
|
|
|
|
1220
|
- this.movableChangeInit()
|
|
|
|
1221
|
- wx.navigateTo({
|
|
|
|
1222
|
- url: util.http_build_query({
|
|
|
|
1223
|
- lat: this.param.lat == def_latitude ? '' : this.param.lat,
|
|
|
|
1224
|
- lng: this.param.lng == def_longitude ? '' : this.param.lng,
|
|
|
|
1225
|
- map: this.param.map,
|
|
|
|
1226
|
- multiIndex: this.data.multiIndex,
|
|
|
|
1227
|
- tags: this.param.tags,
|
|
|
|
1228
|
- centre_pos: this.param.centre_pos,
|
|
|
|
1229
|
- hasSuggestion: this.data.hasSuggestion ? 1 : '',
|
|
|
|
1230
|
- keyword: this.data.hasSuggestion ? this.data.suggestion.title : '',
|
|
|
|
1231
|
- filterParams: this.filterParams ? JSON.stringify(this.filterParams) : null,
|
|
|
|
1232
|
- }, './indexList'),
|
|
|
|
1233
|
- success: res => {
|
|
|
|
1234
|
- // 通过eventChannel向被打开页面传送数据
|
|
|
|
1235
|
- if (this.findSellerData) {
|
|
|
|
1236
|
- res.eventChannel.emit('acceptDataFromMapPage', this.findSellerData)
|
|
|
|
1237
|
- }
|
|
|
|
1238
|
- res.eventChannel.on('findSellerData', findSellerData => {
|
|
|
|
1239
|
- console.log('findSellerData', findSellerData)
|
|
|
|
1240
|
- this.findSellerData = findSellerData
|
|
|
|
1241
|
- setTimeout(() => {
|
|
|
|
1242
|
- this.getMarkers();
|
|
|
|
1243
|
- }, 0)
|
|
|
|
1244
|
- })
|
|
|
|
1245
|
- setTimeout(() => {
|
|
|
|
1246
|
- this.movableChangeInit()
|
|
|
|
1247
|
- this.hasListShow = false
|
|
|
|
1248
|
- }, 1500)
|
|
|
|
1249
|
- }
|
|
|
|
1250
|
- });
|
|
|
|
1251
|
- },
|
|
|
|
1252
|
- setTSLocal() {
|
|
|
|
1253
|
- let map = this.data.map;
|
|
|
|
1254
|
- map.latitude = def_latitude
|
|
|
|
1255
|
- map.longitude = def_longitude
|
|
|
|
1256
|
- map.scale = mapScale
|
|
|
|
1257
|
- this.sellersIds = []
|
|
|
|
1258
|
- this.sellers = []
|
|
|
|
1259
|
- let sdobj = {
|
|
|
|
1260
|
- map: map,
|
|
|
|
1261
|
- hasGetSellersEnd: false,
|
|
|
|
1262
|
- hasSuggestion: false,
|
|
|
|
1263
|
- suggestion: {},
|
|
|
|
1264
|
- }
|
|
|
|
1265
|
- if (!this.hasSellerConcat) {
|
|
|
|
1266
|
- sdobj.markers = []
|
|
|
|
1267
|
- }
|
|
|
|
1268
|
- this.setData(sdobj)
|
|
|
|
1269
|
- },
|
|
|
|
1270
|
- findSellerData: null,
|
|
|
|
1271
|
- findSeller() {
|
|
|
|
1272
|
- if (this.data.listMoreCount < 1 && !this.data.hasSearchLimit) return
|
|
|
|
1273
|
- wx.navigateTo({
|
|
|
|
1274
|
- url: './findSeller',
|
|
|
|
1275
|
- success: res => {
|
|
|
|
1276
|
- // 通过eventChannel向被打开页面传送数据
|
|
|
|
1277
|
- if (this.findSellerData) {
|
|
|
|
1278
|
- res.eventChannel.emit('acceptDataFromMapPage', this.findSellerData)
|
|
|
|
1279
|
- }
|
|
|
|
1280
|
- res.eventChannel.on('findSellerData', findSellerData => {
|
|
|
|
1281
|
- console.log('findSellerData', findSellerData)
|
|
|
|
1282
|
- this.findSellerData = findSellerData
|
|
|
|
1283
|
- setTimeout(() => {
|
|
|
|
1284
|
- this.getMarkers();
|
|
|
|
1285
|
- }, 0)
|
|
|
|
1286
|
- })
|
|
|
|
1287
|
- }
|
|
|
|
1288
|
- })
|
|
|
|
1289
|
- },
|
|
|
|
1290
|
- boostEvent(e) {
|
|
|
|
1291
|
- util.elog(e.detail, '强提醒')
|
|
|
|
1292
|
- if (e.detail.act == 'hide') {
|
|
|
|
1293
|
- this.setData({
|
|
|
|
1294
|
- hasGetPos: true,
|
|
|
|
1295
|
- })
|
|
|
|
1296
|
- this.selectComponent('#getpos').getPos();
|
|
|
|
1297
|
- }
|
|
|
|
1298
|
- },
|
|
|
|
1299
|
- elog(e) {
|
|
|
|
1300
|
- util.elog({attr: util.attr(e), detail: e.detail}, util.attr(e, 'ename') || '点击')
|
|
|
|
1301
|
- },
|
|
|
|
1302
|
- sbtrEvent(e) {
|
|
|
|
1303
|
- console.log(e);
|
|
|
|
1304
|
- if (e.detail.act == 'oncall') {
|
|
|
|
1305
|
- this.selectComponent('#as').show(e.detail.seller);
|
|
|
|
1306
|
- }
|
|
|
|
1307
|
- },
|
|
|
|
1308
|
- movableY0: 99,
|
|
|
|
1309
|
- movableY1: 0,
|
|
|
|
1310
|
- hasListShow: false,
|
|
|
|
1311
|
- movableChangeInit() {
|
|
|
|
1312
|
- this.movableY0 = 99
|
|
|
|
1313
|
- this.movableY1 = 0
|
|
|
|
1314
|
- },
|
|
|
|
1315
|
- movableChange(e) {
|
|
|
|
1316
|
- if (this.hasListShow) return;
|
|
|
|
1317
|
- if (this.movableY0 == 99) {
|
|
|
|
1318
|
- this.movableY0 = e.detail.y
|
|
|
|
1319
|
- } else {
|
|
|
|
1320
|
- if (e.detail.y != this.movableY0) {
|
|
|
|
1321
|
- console.log('movableChange', '上拉');
|
|
|
|
1322
|
- this.listShow();
|
|
|
|
1323
|
- this.movableChangeInit()
|
|
|
|
1324
|
- this.hasListShow = true
|
|
|
|
1325
|
- }
|
|
|
|
1326
|
- }
|
|
|
|
1327
|
- },
|
|
|
|
1328
|
- filterShow() {
|
|
|
|
1329
|
- this.selectComponent('#filter').show(this.filterParams);
|
|
|
|
1330
|
- },
|
|
|
|
1331
|
- filterParams: null,
|
|
|
|
1332
|
- filterEvent(e) {
|
|
|
|
1333
|
- console.log('filterEvent', e)
|
|
|
|
1334
|
- if (e.detail.type == 'clean') {
|
|
|
|
1335
|
- this.filterParams = null
|
|
|
|
1336
|
- this.setData({
|
|
|
|
1337
|
- filterParams: null,
|
|
|
|
1338
|
- })
|
|
|
|
1339
|
- } else {
|
|
|
|
1340
|
- this.filterParams = e.detail.data
|
|
|
|
1341
|
- this.setData({
|
|
|
|
1342
|
- filterParams: this.filterParams,
|
|
|
|
1343
|
- })
|
|
|
|
1344
|
- }
|
|
|
|
1345
|
- setTimeout(() => {
|
|
|
|
1346
|
- this.getMarkers();
|
|
|
|
1347
|
- }, 0)
|
|
|
|
1348
|
- },
|
|
|
|
1349
|
- })
|
|
|
|
1350
|
- }
|
|
|
|
1351
|
}) |
321
|
}) |