Files
supplier-dispatch-h5/node_modules/.cache/babel-loader/dd4ca20867979c54529c01a23d9671afffeead2be442e838e7ad075a0ed344d0.json
2023-08-11 10:45:20 +08:00

1 line
8.3 KiB
JSON

{"ast":null,"code":"import { searchFun } from '@/utils/map';\nimport { leftCopy } from '@/utils/common';\nexport default {\n name: \"addressMap\",\n data() {\n return {\n map: '',\n mapPosition: 60,\n source: '',\n keyword: '',\n addressList: [],\n activeIndex: undefined\n };\n },\n watch: {\n keyword() {\n this.searchHandler();\n }\n },\n created() {\n this.source = this.$route.query.source || '';\n console.log('this.source', this.source);\n },\n async mounted() {\n await this.initMap();\n },\n methods: {\n chooseHandler(item, index) {\n this.activeIndex = index;\n console.log('item', item);\n },\n successHandler() {\n const orderInfo = this.$store.getters.order.orderInfo;\n if (this.source == 'address') {\n // 事发地地址\n if (orderInfo) {\n leftCopy(orderInfo, {\n startLat: '',\n startLng: '',\n startPoiAddress: ''\n });\n }\n } else if (this.source == 'dest') {// 目的地地址\n }\n },\n initMap() {\n // 初始化地图\n let orderInfo = this.$store.getters.order.orderInfo;\n console.log('orderInfo', orderInfo);\n this.map = new AMap.Map('mapId', {\n viewMode: '2D',\n // 默认使用 2D 模式\n zoom: 11,\n //初始化地图层级\n center: [orderInfo.startLng, orderInfo.startLat] //初始化地图中心点\n });\n },\n\n async searchHandler() {\n // 根据当前定位城市搜索,将选中的地址清空\n let localCityCode = this.$store.getters.order.localCityCode;\n this.addressList = await searchFun(this.map, localCityCode, this.keyword);\n this.activeIndex = undefined;\n }\n }\n};","map":{"version":3,"names":["searchFun","leftCopy","name","data","map","mapPosition","source","keyword","addressList","activeIndex","undefined","watch","searchHandler","created","$route","query","console","log","mounted","initMap","methods","chooseHandler","item","index","successHandler","orderInfo","$store","getters","order","startLat","startLng","startPoiAddress","AMap","Map","viewMode","zoom","center","localCityCode"],"sources":["src/views/index/addressMap.vue"],"sourcesContent":["<template>\r\n <div>\r\n <div class=\"map_wrap\" id=\"mapId\" :style=\"{ bottom: mapPosition + '%' }\">\r\n </div>\r\n <div class=\"button_wrap\">\r\n <div class=\"cancel_btn\">取消</div>\r\n <div class=\"confirm_btn\" @click=\"successHandler\">完成</div>\r\n </div>\r\n <div class=\"search_wrap\" :style=\"{ height: mapPosition + '%' }\">\r\n <div class=\"section\">\r\n <input type=\"text\" v-model=\"keyword\" @change=\"searchHandler\" placeholder=\"请输入地址\" />\r\n </div>\r\n <div class=\"server_list\">\r\n <div class=\"text_box\" v-for=\"(item, index) in addressList\" @click=\"chooseHandler(item, index)\" :class=\"{'active': index == activeIndex}\">\r\n <div class=\"address_name\">{{ item.name }}</div>\r\n <div class=\"address_detail\">{{ ( item.district || '' ) + ( item.address || '' ) }}</div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</template>\r\n\r\n<script>\r\n import { searchFun } from '@/utils/map'\r\n import { leftCopy } from '@/utils/common'\r\n export default {\r\n name: \"addressMap\",\r\n data() {\r\n return {\r\n map: '',\r\n mapPosition: 60,\r\n source: '',\r\n keyword: '',\r\n addressList: [],\r\n activeIndex: undefined,\r\n }\r\n },\r\n watch: {\r\n keyword() {\r\n this.searchHandler()\r\n }\r\n },\r\n created() {\r\n this.source = this.$route.query.source || ''\r\n console.log('this.source', this.source)\r\n },\r\n async mounted() {\r\n await this.initMap()\r\n },\r\n methods: {\r\n chooseHandler(item, index) {\r\n this.activeIndex = index;\r\n console.log('item', item)\r\n },\r\n successHandler() {\r\n const orderInfo = this.$store.getters.order.orderInfo\r\n if( this.source == 'address') { // 事发地地址\r\n if ( orderInfo ) {\r\n leftCopy(orderInfo, {\r\n startLat: '',\r\n startLng: '',\r\n startPoiAddress: '',\r\n })\r\n }\r\n } else if( this.source == 'dest' ) { // 目的地地址\r\n\r\n }\r\n },\r\n initMap() { // 初始化地图\r\n let orderInfo = this.$store.getters.order.orderInfo\r\n console.log('orderInfo', orderInfo)\r\n this.map = new AMap.Map('mapId', {\r\n viewMode: '2D', // 默认使用 2D 模式\r\n zoom:11, //初始化地图层级\r\n center: [orderInfo.startLng, orderInfo.startLat] //初始化地图中心点\r\n })\r\n },\r\n async searchHandler() { // 根据当前定位城市搜索,将选中的地址清空\r\n let localCityCode = this.$store.getters.order.localCityCode\r\n this.addressList = await searchFun(this.map, localCityCode, this.keyword)\r\n this.activeIndex = undefined\r\n }\r\n }\r\n }\r\n</script>\r\n\r\n<style scoped lang=\"less\">\r\n .map_wrap {\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n z-index: -1;\r\n }\r\n .button_wrap {\r\n width: 100%;\r\n padding: 5px;\r\n box-sizing: border-box;\r\n zoom: 1;\r\n .cancel_btn {\r\n width: 50px;\r\n height: 27px;\r\n background: #F37877;\r\n font-size: 12px;\r\n text-align: center;\r\n line-height: 27px;\r\n color: #fff;\r\n border-radius: 3px;\r\n float: left;\r\n }\r\n .confirm_btn {\r\n width: 50px;\r\n height: 27px;\r\n background: rgba(5,193,98,1);\r\n font-size: 12px;\r\n text-align: center;\r\n line-height: 27px;\r\n color: #fff;\r\n border-radius: 3px;\r\n float: right;\r\n }\r\n }\r\n .search_wrap {\r\n background-color: #fff;\r\n position: absolute;\r\n width: 100%;\r\n bottom: 0;\r\n left: 0;\r\n overflow: auto;\r\n .section {\r\n height: 35px;\r\n width: 100%;\r\n background-color: #fff;\r\n position: fixed;\r\n /*top: calc(50% - 10px);*/\r\n padding-top: 10px;\r\n input {\r\n width: 90%;\r\n margin: 0 auto;\r\n display: block;\r\n border: none;\r\n height: 30px;\r\n border-radius: 3px;\r\n padding: 0 10px;\r\n background: #e2e0e0;\r\n font-size: 14px;\r\n }\r\n }\r\n .server_list {\r\n overflow-y: auto;\r\n padding-top: 30px;\r\n .text_box {\r\n margin: 10px 25px;\r\n padding-top: 10px;\r\n .address_name {\r\n font-size: 14px !important;\r\n color: rgba(0,0,0,0.8);\r\n }\r\n .address_detail {\r\n margin-top: 3px;\r\n color: #c3c3c3 !important;\r\n font-size: 12px !important;\r\n }\r\n }\r\n .active {\r\n .address_name {\r\n color: green !important;\r\n }\r\n .address_detail {\r\n color: green !important;\r\n }\r\n }\r\n }\r\n }\r\n</style>\r\n"],"mappings":"AAuBA,SAAAA,SAAA;AACA,SAAAC,QAAA;AACA;EACAC,IAAA;EACAC,KAAA;IACA;MACAC,GAAA;MACAC,WAAA;MACAC,MAAA;MACAC,OAAA;MACAC,WAAA;MACAC,WAAA,EAAAC;IACA;EACA;EACAC,KAAA;IACAJ,QAAA;MACA,KAAAK,aAAA;IACA;EACA;EACAC,QAAA;IACA,KAAAP,MAAA,QAAAQ,MAAA,CAAAC,KAAA,CAAAT,MAAA;IACAU,OAAA,CAAAC,GAAA,qBAAAX,MAAA;EACA;EACA,MAAAY,QAAA;IACA,WAAAC,OAAA;EACA;EACAC,OAAA;IACAC,cAAAC,IAAA,EAAAC,KAAA;MACA,KAAAd,WAAA,GAAAc,KAAA;MACAP,OAAA,CAAAC,GAAA,SAAAK,IAAA;IACA;IACAE,eAAA;MACA,MAAAC,SAAA,QAAAC,MAAA,CAAAC,OAAA,CAAAC,KAAA,CAAAH,SAAA;MACA,SAAAnB,MAAA;QAAA;QACA,IAAAmB,SAAA;UACAxB,QAAA,CAAAwB,SAAA;YACAI,QAAA;YACAC,QAAA;YACAC,eAAA;UACA;QACA;MACA,gBAAAzB,MAAA;MAAA;IAGA;IACAa,QAAA;MAAA;MACA,IAAAM,SAAA,QAAAC,MAAA,CAAAC,OAAA,CAAAC,KAAA,CAAAH,SAAA;MACAT,OAAA,CAAAC,GAAA,cAAAQ,SAAA;MACA,KAAArB,GAAA,OAAA4B,IAAA,CAAAC,GAAA;QACAC,QAAA;QAAA;QACAC,IAAA;QAAA;QACAC,MAAA,GAAAX,SAAA,CAAAK,QAAA,EAAAL,SAAA,CAAAI,QAAA;MACA;IACA;;IACA,MAAAjB,cAAA;MAAA;MACA,IAAAyB,aAAA,QAAAX,MAAA,CAAAC,OAAA,CAAAC,KAAA,CAAAS,aAAA;MACA,KAAA7B,WAAA,SAAAR,SAAA,MAAAI,GAAA,EAAAiC,aAAA,OAAA9B,OAAA;MACA,KAAAE,WAAA,GAAAC,SAAA;IACA;EACA;AACA"},"metadata":{},"sourceType":"module","externalDependencies":[]}