import { storeDetail } from '../../api/other'; import { MAKE_PHONE_CALL } from '../../utils/util.js'; // import amapFile from '../../utils/amap-wx.130.js'; Page({ data: { dataInfo:{}, latitude:0, longitude:0 }, onLoad(options) { wx.getLocation({ type: 'wgs84', success: (res) => { this.setData({ latitude: res.latitude, longitude: res.longitude }) this.loadData(options.id) }, fail: (err) => { wx.showModal({ title: '提示', content: '获取定位失败,请检查是否开启定位权限', showCancel: false, confirmText: '我知道了' }) this.loadData(options.id) } }) }, async loadData(id){ const res = await storeDetail(id,{longitude:this.data.longitude,latitude:this.data.latitude}); if(res.code == 200){ this.setData({ dataInfo:res.data }) }else{ wx.showToast({ title: res.message || '加载失败', icon: 'none' }); } }, onAddress(){ wx.openLocation({ latitude: this.data.dataInfo.latitude * 1, // 纬度 longitude: this.data.dataInfo.longitude * 1, // 经度 name:this.data.dataInfo.name, address: this.data.dataInfo.address, }) // const myAmap = new amapFile.AMapWX({ key: '9570ea64f637d1744ec4944bc909176a' }); // myAmap.getPoiAround({ // success: data => { // console.log('周边POI:', data); // }, // fail: info => { // console.error(info); // } // }); }, onPhone(){ MAKE_PHONE_CALL(this.data.dataInfo.phone); }, })