微信の小さいプログラムはmapを使ってテンセントの地図apiと結びつけて検索の補完と近くを取得することを解決します


//テンセント地図ダウンロードsdk申請keyhttps://lbs.qq.com/qqmap_wx_jssdk/index.html
(あなたのコメントでOK、私はなぜコメントしていないのか見たい)すべてコピーして貼り付けるだけでOK、コメントを書いたあなたはきっと理解できます
html


  :{{district}}









css
/*      */
.hui{
  position: absolute;
  left: 0;
  bottom: 0;
  width: 30px;
  height: 30px;
}
/*    */
.zhen{
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%,-50%);
  width: 30px;
  height: 30px;
}
/*     */
.item{
  height: 40px;
  border-bottom: 1px solid #CCC
}
/*       iview */
.item view{
  font-size: 14px;
  color: #CCC;
}
/*    */
map{
  width: 100%;
  height: 300px;
}
/*     */
.input{
  border: 1px solid #CCC;
  border-radius: 5%;
  font-size: 16px;
  width: 98%;
  margin: 0 auto;
  margin-bottom: 10px;
}

js
//    sdk
var QQMapWX = require('../../txmap/qqmap-wx-jssdk.js');
//    API   (     )
var qqmapsdk;

Page({
  data: {
    //     
    latitude:"",
    longitude:"",
    district:""
    //       
    // markers: [{
    //   iconPath: "/img/11.jpg",
    //   id: 0,
    //   latitude: "",
    //   longitude: "",
    //   width: 20,
    //   height: 20,
    //   detail:"",
    //   show_map:true
    // }
    // ],

  },
  //       
  go_center(){
    this.mapCtx.moveToLocation()
    // this.nearby_search()
  },
  //       
  bindregionchange: function (e) {
    var that = this
    if (e.type == "begin") {
      return
    } else if (e.type == "end") {

      //           
      this.mapCtx.getCenterLocation({
        success: function (res) {
          //      
          that.nearby_search(res.latitude, res.longitude)
        }
        
      })
    }
  },
  //    input  
  getsuggest(e){
    let that = this
    this.setData({
      //       
      detail:e.detail.value,
      //    
      show_map:true
    })
    //       
    qqmapsdk.getSuggestion({
      //         keyword  
      keyword: e.detail.value, //        ,      , keyword:'KFC'
      success: function (res) {//        
        var sug = [];
        for (var i = 0; i < res.data.length; i++) {
          sug.push({ //       ,  sug   
            title: res.data[i].title,
            id: res.data[i].id,
            addr: res.data[i].address,
            city: res.data[i].city,
            district: res.data[i].district,
            latitude: res.data[i].location.lat,
            longitude: res.data[i].location.lng,
          });
          that.setData({ //  suggestion  ,               
            suggestion: sug
          });
        }
      
      },
      fail: function (error) {
        console.error(error);
      
      },
      complete: function (res) {

      }
    });
  },

  //              
  backfill: function (e) {
    let item = this.data.suggestion.find(item=>{
      return item.id == e.currentTarget.id
    })
    this.setData({
      latitude: item.latitude,
      longitude: item.longitude,
      show_map:false
    })
    this.nearby_search(item.latitude, item.longitude)
    
  },
  //          
  btn_bottom: function (e) {
    let item = this.data.suggestion1.find(item => {
      return item.id == e.currentTarget.id
    })
    this.setData({
      latitude: item.latitude,
      longitude: item.longitude,
    })

  },
  //    
  nearby_search: function (latitude,longitude) {
    var that = this;
    qqmapsdk.reverseGeocoder({
      location: {
        latitude: latitude,
        longitude: longitude,
      },
      get_poi: 1,
      poi_options: 'policy=2;radius=3000;page_size=20;page_index=1',
      success: function (res) {
        
        var sug = [];
        for (let i = 0; i < res.result.pois.length; i++) {
          sug.push({ //       ,  sug   
            title: res.result.pois[i].title,
            id: res.result.pois[i].id,
            addr: res.result.pois[i].address,
            city: res.result.pois[i].city,
            district: res.result.pois[i].district,
            latitude: res.result.pois[i].location.lat,
            longitude: res.result.pois[i].location.lng,
          });
          that.setData({
            //         
            suggestion1: sug,
            //      
            district:res.result.address
          });
        }
      },
      fail: function (res) {
      },
      complete: function (res) {
      }
    });

    
  },

  onLoad: function (options) {
    var that = this
    //        API   
    qqmapsdk = new QQMapWX({
      key: "BG4BZ-Q7DKU-RS5VO-44J37-I7OSQ-WNFL2"
    });
    //        loading
    wx.showLoading({
      title: "   ",
      mask: true
    })
    //    
    this.mapCtx = wx.createMapContext('ofoMap')
    //      
    wx.getLocation({
      type: 'gcj02',
      success(res) {
        const latitude = res.latitude
        const longitude = res.longitude
        // const speed = res.speed
        // const accuracy = res.accuracy
        //      
        that.setData({
          latitude,
          longitude,
          // "markers[0].latitude": latitude,
          // "markers[0].longitude": longitude
        })
        //  loading
        wx.hideLoading()
        //        
        that.nearby_search(latitude, longitude)
      }
    })


  },

  /**
   *       --          
   */
  onReady: function () {
    
  },


  /**
   *       --      
   */
  onShow: function () {
    
  },

  /**
   *       --      
   */
  onHide: function () {

  },

  /**
   *       --      
   */
  onUnload: function () {

  },

  /**
   *           --        
   */
  onPullDownRefresh: function () {

  },

  /**
   *              
   */
  onReachBottom: function () {

  },

  /**
   *          
   */
  onShareAppMessage: function () {

  }
})