"use strict";const common_vendor=require("../../common/vendor.js");const common_assets=require("../../common/assets.js");const api_api=require("../../api/api.js");if(!Array){const _easycom_uni_transition2=common_vendor.resolveComponent("uni-transition");const _easycom_orderList2=common_vendor.resolveComponent("orderList");const _easycom_cc_myTabbar2=common_vendor.resolveComponent("cc-myTabbar");(_easycom_uni_transition2+_easycom_orderList2+_easycom_cc_myTabbar2)()}const _easycom_uni_transition=()=>"../../uni_modules/uni-transition/components/uni-transition/uni-transition.js";const _easycom_orderList=()=>"../../components/orderList/orderList.js";const _easycom_cc_myTabbar=()=>"../../uni_modules/cc-myTabbar/components/cc-myTabbar/cc-myTabbar.js";if(!Math){(_easycom_uni_transition+_easycom_orderList+_easycom_cc_myTabbar)()}const _sfc_main={__name:"index",setup(__props){let longitude=common_vendor.ref(113.675688);let latitude=common_vendor.ref(34.75527700365562);let mapContext=common_vendor.ref(null);let mapBox=common_vendor.ref(false);let mapLocationRef=common_vendor.ref();let infoDz=common_vendor.ref([]);let markList=common_vendor.ref([]);common_vendor.onLoad((async()=>{common_vendor.index.hideTabBar();mapContext.value=common_vendor.index.createMapContext("map");const{longitude:lon,latitude:lat}=await common_vendor.index.getLocation({type:"gcj02"});latitude.value=lat;longitude.value=lon;getInfo();setTimeout((()=>{mapLocation()}),300)}));let getInfo=async()=>{let _res=await api_api.aroundAreaMap({orderByType:1,lat:latitude.value,lon:longitude.value});let list=_res.map(((item,index)=>({id:item.id,longitude:item.location.lng,latitude:item.location.lat,iconPath:"/static/icon/marker-pointer.png",width:20,height:23,content:"2",gunUseCount:item.gunUseCount,gunCount:item.gunCount,distance:item.distance,customCallout:{display:"ALWAYS",anchorX:0,anchorY:-10}})));list.unshift({longitude:longitude.value,latitude:latitude.value,iconPath:"/static/icon/my-location-default.png",width:45,height:45,id:-1});markList.value=list};const mapLocation=()=>{const log=longitude.value;const lat=latitude.value;mapContext.value.moveToLocation({longitude:log,latitude:lat})};const regionchange=e=>{if(e.type=="end"){console.log(e);console.log(e.detail.scale);mapBox.value=false;mapLocationRefStep(false)}};const markerClick=async e=>{var _a;console.log(e,"eeeeeee");if(e.markerId==-1){return}common_vendor.index.showLoading();let _res=await api_api.infoAroundApi({id:e.markerId});let markerInfo=markList.value.find((val=>val.id==e.markerId));let data=(_a=_res==null?void 0:_res.priceList)==null?void 0:_a.find((val=>val.isCurrent==1));infoDz.value={..._res,distance:markerInfo.distance,priceAmount:data.totalAmount};console.log(infoDz,"infoDzinfoDz");common_vendor.index.hideLoading();mapBox.value=true;mapLocationRefStep(true)};const mapLocationRefStep=type=>{if(type){mapLocationRef.value.step({translateY:"-200rpx"},{timingFunction:"ease-in",duration:100})}else{mapLocationRef.value.step({translateY:"0rpx"},{timingFunction:"ease",duration:500})}mapLocationRef.value.run()};return(_ctx,_cache)=>({a:common_vendor.unref(longitude),b:common_vendor.o(markerClick),c:common_vendor.o(markerClick),d:common_vendor.o(regionchange),e:common_vendor.unref(markList),f:common_vendor.unref(latitude),g:common_assets._imports_0$1,h:common_vendor.o(mapLocation),i:()=>({r:mapLocationRef,k:"mapLocationRef"}),j:common_vendor.p({show:true}),k:common_vendor.p({toNav:true,Image:true,info:common_vendor.unref(infoDz),list:common_vendor.unref(infoDz).pictures}),l:common_vendor.p({modeClass:"fade",show:common_vendor.unref(mapBox)}),m:common_vendor.p({tabBarShow:1})})}};my.createPage(_sfc_main);
