(async () => { const $offlineStoreImageList = $('offline-store-image-list'); // 오프라인 스토어 이미지 리스트 const $offlineStoreInfo = $('offline-store-info'); // 오프라인 스토어 정보 let mapOption = {}; const storeSno = getUrlParam('storeSno'); // 매장 번호 // [Aaron] 오프라인 매장 조회 API const param = { method: 'GET', }; const { result: storeData, statusCode: storeStatusCode } = await callGeekApi( `/app/sbgolf-shop/${storeSno}`, param, ); if (storeStatusCode >= 400) { ShopbySkin.EventManager.fire('MODAL_ALERT_OPEN', { noticeType: 'CAUTION', message: '매장 정보를 찾을 수 없습니다.', onClose: () => { // document.location.href = '/pages/service/offline-store.html'; }, }); return; } storeData.additionalInfo = JSON.parse(storeData.additionalInfo); if (storeData?.additionalInfo?.offlineStoreImage) { storeData.additionalInfo.offlineStoreImage = storeData?.additionalInfo?.offlineStoreImage.filter((data) => { return data.type === 'slider'; }); } // [Aaron] 오프라인 스토어 이미지 리스트 렌더 const offlineStoreImageListHtml = renderHtml( $offlineStoreImageList, storeData, ); $offlineStoreImageList.append(offlineStoreImageListHtml); $offlineStoreImageList.velocity({ opacity: 1 }, { duration: 500 }); // END // [Aaron] 태그 배열화 storeData.tag = storeData.tag.split(',').map((data) => data.trim()); // [Aaron] 오프라인 스토어 정보 렌더 const offlineStoreInfo = renderHtml($offlineStoreInfo, storeData); $offlineStoreInfo.append(offlineStoreInfo); detailKakaoMap(storeData.sno, storeData.lat, storeData.lng); $offlineStoreInfo.velocity({ opacity: 1 }, { duration: 500 }); // END /** * [Aaron] 매장 상세 지도 생성 * @param shopSno // 매장 번호 * @param lat * @param lng */ function detailKakaoMap(shopSno, lat, lng, target) { const mapContainer = document.getElementById('map'); // 지도를 표시할 div mapOption = { center: new kakao.maps.LatLng(lat, lng), // 지도의 중심좌표 level: shopSno ? 5 : 12, // 지도의 확대 레벨 }; // 지도 생성 const map = new kakao.maps.Map(mapContainer, mapOption); const position = new kakao.maps.LatLng(lat, lng); // 마커 이미지 설정 const markerImageSrc = '/assets/images/geek/ico_location.svg'; const markerImageSize = new kakao.maps.Size(30, 30); const markerImageOption = { offset: new kakao.maps.Point(15, 30) }; const markerImage = new kakao.maps.MarkerImage( markerImageSrc, markerImageSize, markerImageOption, ); const marker = new kakao.maps.Marker({ position: position, image: markerImage, }); // 지도 중심 이동 map.setCenter(position); // 마커 표시 marker.setMap(map); if (!shopSno) return; // [Jay] 매장 영업시간 '/' 문자로 줄바꿈 처리를 위해 배열로 변환 /* const iwContent = `
`; */ const iwContent = `${storeData.shopName}`; const iwPosition = new kakao.maps.LatLng(lat, lng); // 인포윈도우 표시 위치 // 인포윈도우를 생성합니다 const infowindow = new kakao.maps.InfoWindow({ position: iwPosition, // content: iwContent, content: `