/* /js/destInputControl3-1.js */ var priceRangeArr = new Array(); // 디폴트 마일리지 % var milageDefaultRate = 0.1; // geoActionGateWay() 펑션의 콜백함수 지정 var callBackFunc = "geoActionCallback"; //var callBackFunc = "OrderFormSteps"; // 최종 지불금액 값 var finalPayPrice = ""; // currPage if(typeof currPage == "undefined") currPage=""; //else var currPage = ""; // autoSuggestResultLi.click() 의 콜백함수 지정 //var destSelectCallBackFunc = "OrderFormSteps"; /* 지명검색 자동완성 모듈.. 사용자 인풋이 발생하면 ajax 로 서버에 지명 질의를 하고, 리턴 json 으로 자동완성 리스트를 제시한다. 자동완성 항목중 하나가 클릭되면 해당 값으로 결정.. */ // keyUp 의 딜레이를 주기위해, delay 를 설정하는 람다함수를 선언... var delay = (function(){ var timer = 0; return function(callback, ms){ clearTimeout (timer); timer = setTimeout(callback, ms); }; })(); var searchInputVal = ""; var jsonSerialized = ""; $(document).ready( function() { // 세션스토리지에 검색 결과가 존재하면 그 주소지 검색을 디폴트로 만들어준다. if( sessionStorage.getItem("destAddressFullString") ) { // swapDisplay( $(".orderDestUnselected"), $(".orderDestSelected") ); } // else swapDisplay( $(".orderDestSelected"), $(".orderDestUnselected") ); /* 목적지 검색 input.focus 에 대응.. 스크롤 다운 */ $(document).on( "focus", "#pointNameSearchInput", function() { console.log("focus"); $('html, body').animate({ scrollTop: $(".inquiryHeadlineDest").offset().top -80 }, 500); $("#destInputGuideDiv").fadeOut(); }); $(document).on( "blur", "#pointNameSearchInput", function() { if( $("#destFullAddr").val()=="" ) $("#destInputGuideDiv").fadeIn(); }); /* 검색어 입력 keyup 에 반응하는 루틴... 그런데 서버속도가 많이 늦는다. */ $("#pointNameSearchInput").off().on( "keyup", function(e) { var keyCode = e.keyCode || e.which; if(e.keyCode == 13) { console.log("Enter pressed!!"); e.preventDefault(); $(this).blur(); } console.log("키 입력 감지....."); // destGeoId , destPointId 리셋... $("#destGeoId").val( '' ); $("#destPointId").val( '' ); //console.log("keyUp!!!" +$(this).val().length ); // 항목 입력값이 한글 1.5자 이상일 때... "길3" if($(this).val().length>=2) { /* 2018-12-23오후 11:50 // 구형 삼성폰 브라우저에서 인풋 한글 밸류를 핸들하는데 어처구니없는 버그가 있다. // 브라우저 레벨에서의 버그라서 처리할 방법이 없거나 어려울 듯... // $(this).blur() 해준 뒤 val() 을 다시 읽어오는 방법으로 우회가 가능할 것 같지만, // 이 버그가 발생하는 대상을 특정해서 실행시켜줄 트리거, 즉 대상 브라우저버전을 특정할 방도가 없다... 버그를 무시하기로 한다. or... Android ver 5 이하에서는 blur(), read() 를 하도록 해보자.... if( androidVersion < 5 ) { $("#pointNameSearchInput").val()+" "; searchInputVal = $("#pointNameSearchInput").val(); //$("#pointNameSearchInput").focus(); } else searchInputVal = $("#pointNameSearchInput").val(); $("#debugDiv").append( "입력값.." + searchInputVal + "" ); // 결론... 브라우저 레벨 맞고, 로우레벨이라 간단히 해결될 문제가 아니다..... 버그를 무시하기로 한다. */ // delay .... 모든 keyUp 에 대응하지 않도록 딜레이를 걸어준다. 0.6sec delay(function(){ searchInputVal = $("#pointNameSearchInput").val(); var serverActionUrl = $("#autoSuggestKeywordForm").attr("action"); serverActionUrl = "/ajax/POIv5.php"; var formStr = $("#autoSuggestKeywordForm").serialize()+"&callback=?"; //console.log("serverActionUrl: "+serverActionUrl +"?"+formStr ); $.getJSON( serverActionUrl, formStr, function(jsonObj) { console.log( "jsonObj.JSON : " +jsonObj.JSON ); $(".destinationFullAddressText").html('').slideUp(); if(typeof jsonObj === "object" && jsonObj.JSON != null ) { //console.log(jsonObj[0]); if( jsonObj.cathegory ) { // console.log("jsonObj[0].addressBunji: "+ jsonObj[0].addressBunji ); // #destInputGuideDiv 버블 안내가 다시 보여지지 않도록 제거 $("#destInputGuideDiv").remove(); // 이전 검색-선택 결과물 제거 $("#destSelectedResultDiv").html(""); $("#destSelectedResultDiv").slideUp("fast"); $(".searchResultDiv").slideUp(); $("#selectedDestinationAddress").slideUp(); showUpAutoSuggestList(jsonObj); } } else { console.log("찾은게 없다....."); failedAutoSuggestList(); //$("#autoSuggestResultUl").empty(); //$("#autoSuggestResultUl").append("
  • 찾은게 없다.
  • "); } } ); }, 500 ); } else { //console.log("왜 전부 지워지냐???"); $("#autoSuggestResultUl").html(''); } } ); /* 제안검색어 목록 클릭시.... 선택된 검색어의 풀어드레스/포인트명을 폼 값으로 인스턴스 시킨다. 화면을 스크롤시킨다. */ $(document).on( "click", ".autoSuggestResultLi", function() { // 파라메터로 전달하는 $("#autoSuggestResultUl > li") 를 셀렉트상태로 처리하는 일련의 Ajax 프로세스... var $selectedLI = $(this); // 자동완성목록 선택 액션 프로세스 이후 콜백되는 펑션.... // inquiryChargeFormAction 을 익스큐트 해주는 펑션을 콜백으로 지정해준다. destSelectCallBackFunc = ""; makeSelectAutoSuggestResultLi($selectedLI); // jQuery 오브젝트를 파라메터로 전달해준다. /* 2018-11-17오전 2:55 펑션으로 일원화 작업중... console.log("클릭 data-addressBunji : " +$(this).attr("data-addressBunji") ); if($(this).attr("data-addressBunji") ) { var paramStr = "addressBunji="+$(this).attr("data-addressBunji")+"&addressDoro="+$(this).attr("data-addressDoro") +"&pointName="+$(this).attr("data-pointName")+"&pointNameTail="+$(this).attr("data-pointNameTail") +"&xpos="+$(this).attr("data-xpos")+"&ypos="+$(this).attr("data-ypos") ; console.log("파라메터 paramStr : " + paramStr); paramStr = encodeURI(paramStr); $.getJSON( "/ajax/destPointSelectAction2.php?"+paramStr+"&callback=?", function(jsonObj) { console.log("선택 클릭 액션!!!"); if(typeof jsonObj === "object" && jsonObj != null ) { console.log("instanting geoId value: "+jsonObj.geoId); $("#destGeoId").val( jsonObj.geoId ); $("#destPointId").val( jsonObj.pointId ); // 콜백 펑션 호출 // 2016-12-06 19:03 // destInputControl.js 모듈을 land 와 order 에서 공동사용하고있다. // order 에서는 목록선택시 요금계산및 일련 프로세스가 트리거되어야 한다. // 여기서 excute 되는 destSelectCallBackFunc 는 order.html 에서 사전정의된다. if( typeof destSelectCallBackFunc !== "undefined" ) window[destSelectCallBackFunc](); // 2018-04-03오후 7:09 // QuickOrder 에서 요청될 때... if( currPage == "quickOrder" ) { // 선택된 목적지 ID 를 쿠키에 담고, 출력내용에 쿠키 블럭을 추가해준다. quickOrderAddDestination(jsonObj.geoId, jsonObj.pointId, selectedLIHtml); $("#quickOrderDestInputDiv").slideUp(); } else { // 선택 내용으로 디스플레이 변경.. $("#destSelectedResultDiv").html( selectedLIHtml ).css("padding","10px"); $(".autoSuggestResult").slideUp(); $("#destSelectedResultDiv").slideDown(); } } }); // 선택 밸류로 폼 일리먼트 값 변경 $("#destPointNameStr, .destPointName").val( $(this).find(".autoSuggestPointName").text()+' '+$(this).find(".autoSuggestPointNameTail").text() ); $("#destInputFullStr, .destFullAddr").val( $(this).find(".autoSuggestAddress").text() ); $("#destFullAddr").val( $(this).find(".autoSuggestAddress").text() ); //$(".destinationFullAddressText").slideDown(); //$("#pointNameSearchInput").addClass("approvedPointInput"); // 2018-03-20오후 4:24 } else { $("#pointNameSearchInput").removeClass("approvedPointInput"); } // Scroll up $('html, body').animate({ scrollTop: $(".inquireChargeFormHeadline").offset().top }, 500); */ } ); // 요금 인콰이어리 액션 버튼 클릭시... // 1. 요금 JSON 을 받아와 처리... --- // 2. 요금 구간별 통계 JSON 을 포함해서 받아와야 한다. // 3. inquiryRecentOrders JSON 을 받아와 출력에 채워준다. $(document).on("click", "#inquireChargeFormActionBtn", function(e) { e.preventDefault(); // 출발지 밸류가 준비되지 않은 상태일 때 ... if( $("#deptGeoId").val() =="" ) { if( confirm("출발지 정보를 찾을 수 없습니다. 단말기의 현재위치를 읽도록 허용하시겠습니까?") ) { ajaxLoadingScreenOn(); geoActionGateWay(callBackFunc); } } // 2018-11-17오전 1:14 // 목적지 자동완성 목록이 1개이고, $("#destGeoId").val() =="" 일 때.... /* autoSuggestResultUl > Li 의 카운트가 1이면 그 항목을 선택상태로 선택후 진행... 비동기 처리가 발생하므로 이 경우의 처리 프로세스의 시작-끝 을 별도로 분리해줘야 한다. 1. 자동완성목록이 1개이고 && 선택된 destGeoId 값이 없을 때... 2. 선택된 destGeoId 값이 없을 때... 3. 그 외... */ if( $("#autoSuggestResultUl > li").length == 1 && $("#destGeoId").val() =="" ) { console.log("도착지 오토서제스텬 갯수가 1개..."); // 파라메터로 전달하는 $("#autoSuggestResultUl > li") 를 셀렉트상태로 처리하는 일련의 Ajax 프로세스... var $selectedLI = $("#autoSuggestResultUl > li"); // 자동완성목록 선택 액션 프로세스 이후 콜백되는 펑션.... // inquiryChargeFormAction 을 익스큐트 해주는 펑션을 콜백으로 지정해준다. destSelectCallBackFunc = "makeInquireChargeFormAction"; makeSelectAutoSuggestResultLi($selectedLI); // jQuery 오브젝트를 파라메터로 전달해준다. // InquireChargeFormAction 를 최종상태까지 진행해주는 일련의 Ajax 프로세스.... //makeInquireChargeFormAction(); // 파라메터는 없다. } // 목적지 geoId 값이 준비되지 않는 상황.... 에러 알러트를 보여주고 종료.. else if( $("#destGeoId").val() =="" ) { if( $(".autoSuggestResultLi").length <1 ) alert("죄송합니다. 목적지 지명검색 결과가 없습니다. 다시 검색해주세요."); else alert("검색된 지명중 하나를 터치하여 선택해주세요."); ajaxLoadingScreenOff(); return; } // 그 외 모든 경우.... -- destGeoId 가 확보된 상태... // makeInquireChargeFormAction() 을 호출해준다. else { makeInquireChargeFormAction(); /* //[lbl] genResultBlock; ajaxLoadingScreenOn(); $("#loadingPopUpDiv").removeClass("display-none").center(); $("#loadingPopUpDiv .shortPopUpDivTxt1").text("구간 대리비를 조회중입니다.."); $(".orderDestSelected").slideDown(); var serverPHP = $("#inquireChargeForm").attr("action"); var serialized = $("#inquireChargeForm").serialize(); $.getJSON( serverPHP+"?"+serialized+"&callback=?", function(jsonObj) { //console.log("#inquireChargeForm getJSON 액션!!!"); // 서버의 보안레벨 검사를 통과하지 못했을 때... if( jsonObj.actionResult=="AuthFailed" ) ajaxAuthFailed(jsonObj); $("#loadingPopUpDiv").addClass("display-none"); $(".searchResultDiv").slideDown(); swapDisplay( ".inquiryUndoneDiv", ".inquiryDoneDiv" ); if( $("#searchResultShowDiv2").is(':visible') ) $("#selectChargeBlockH3Title").text("대리비 선택"); else $("#selectChargeBlockH3Title").text("먼저 대리비 조회를 해주세요"); //console.log("여기 오는가요.....???"); // 출력 데이터를 채워준다. fillDriveChargeDigits(jsonObj); // 2018-11-08오후 7:46 // 날씨 위젯을 추가해준다 : #inquiryResultSummaryUL.prepend() if(jsonObj.weatherStatus && jsonObj.upperPriceCnt) { var weatherIconStr = "
  • 지역상황:
  • "; $("#inquiryResultSummaryUL").prepend(weatherIconStr); $("#inquiryResultSummaryULConditionRemarkLI").removeClass("display-none"); if(jsonObj.weatherStatus) $(".conditionRemarkLIWeatherPenalty").removeClass("display-none"); } // 요금 통계 차트 Div 를 구성한다. pricePieUL jsonSerialized = serializeFirstDimJSON(jsonObj); $("#loadingPopUpDiv").removeClass("display-none"); $("#loadingPopUpDiv .shortPopUpDivTxt1").text("운행통계를 구성중입니다.."); setTimeout( function() { $("#loadingPopUpDiv").addClass("display-none"); if(jsonObj.driveChargeSummary.driveChargeTotalCnt>0) makePricePieUL(jsonObj); $(".loadingPopUpDiv").removeClass("display-none"); $("#loadingPopUpDiv .shortPopUpDivTxt1").text("구간 운행기록을 구성중입니다.."); setTimeout( function() { $("#loadingPopUpDiv").addClass("display-none"); makeCarousel(jsonObj); }, 3000 ); }, 3000 ); // Carousel 의 Headline 을 바꿔준다.. // postScripts JSON 을 받아와 출력해준다... getNfillPostScripts( $("#deptGeoId").val() ); }); */ } }); // 대리바구니담기 버튼 클릭시 -- gotoOrderIcon $(document).on("click", "#addToCartBtn", function() { var serverPHP = "/ajax/cartAction.php"; $.getJSON( serverPHP+"?mode=addCart&"+jsonSerialized+"&callback=?", function(jsonObj) { //console.log("cartAction 액션!!!"); if( jsonObj.actionResult=="OK" ) { shortPopUp( "대리바구니에 담았습니다." ); // shortPopUp 의 디폴트 버튼을 장바구니용 버튼셋으로 바꿔준다. $(".modalPopupButtonDiv").html("대리바구니 보기 닫기"); } else if( jsonObj.actionResult=="AuthFailed" ) shortPopUp( "허용되지 않는 요청입니다.", "Code No. "+jsonObj.ErrorCode ); else if( jsonObj.actionResult=="Duplicated" ) shortPopUp( "이미 바구니에 담긴 오더입니다.", "오더 수량은 대리바구니에서 변경하실 수 있습니다." ); }); }); // #quickOrderBtn 버튼 클릭 대응 $(document).on("click", "#goQuickOrderBtn", function() { document.location.href ="/order/quickOrder.html"; }); // #inquireAgainBtn (조회 다시하기) 버튼 클릭시... $(document).on("click", "#inquireAgainBtn", function() { $(".searchResultDiv, .inquieryResultChartDiv").slideUp(); $("#inquireChargeFormActionBtn").css("display","block"); $("#addToCartBtn, #goQuickOrderBtn, #inquireAgainBtn, #destinationUserInputSpan").css("display","none"); $(".orderDestSelected").slideUp(); $("#inquiryRecentOrdersSection").slideUp(); resetInquiryResult(); }); }); // Carousel 을 구성해준다. function makeCarousel(obj) { //console.log("makeCarousel 펑션 액션!!"); $("#recentOrdersCarouselFrameDiv").children().not('article:first').remove(); $( obj.wholeOrders ).each( function( ind, ea ) { //console.log("makeCarousel 의 루핑..."); //console.log("#carousel carouselEachBoxDeptAddrNPoints..." + ea.deptPoint ); //consoleLogObject( ea ); var $addedClone = $("#carouselEachBoxArchaeocytes").clone().attr("id","").removeClass("display-none").appendTo("#recentOrdersCarouselFrameDiv"); $addedClone.find(".carouselEachBoxDeptAddrNPoint").text( ea.deptPoint ); $addedClone.find(".carouselEachBoxDestAddrNPoint").text( ea.destPoint ); $addedClone.find(".carouselEachBoxDriveDistance").text( ea.driveDistance ); $addedClone.find(".carouselEachBoxDriveCharge").text( ea.driveCharge.format() ); $addedClone.find(".carouselEachBoxDriveDate").text( ea.driveDate ); } ); $(".recentOrdersHeadline").removeClass("display-none"); } // 요금 통계 차트 Div 를 구성한다. pricePieUL function makePricePieUL(obj) { //console.log("여기 펑션에도 오는가???"); $(".inquieryResultChartDiv").removeClass("display-none").slideDown(); var areaNames = obj.areaNames; $(".deptAreaName").text(obj.areaNames.deptArea); $(".destAreaName").text(obj.areaNames.destArea); $(".driveChargeTotalCnt").text(obj.driveChargeSummary.driveChargeTotalCnt); $(".minDriveDate").text(obj.driveChargeSummary.minDriveDate); //consoleLogObject(obj.areaNames); // 차트 비우고, $(".chartDataLeftUL").empty(); //$this->driveCharge[$i]['driveCharge']= $rows['driveCharge']; $( obj.driveChargeArr ).each( function( ind, ea ) { //consoleLogObject(ea); //console.log("루프 작동.... ind " + ind ); //console.log("루프 작동.... cnt " + ea.cnt ); //if( ind > 0 ) { var pr = ea.driveCharge; var cnt = ea.percent; $(".chartDataLeftUL").append("
  • "+pr.format()+"원
  • "); //console.log("li 가 추가되었다.... "+cnt); //consoleLogObject(ea2); //console.log("each 루프가 가동되었다."); //console.log("배열의 위치 접근을 못하고있다.. arrCnt " + ea.arrCnt ); //console.log("배열의 위치 접근을 못하고있다.. arrCnt " + ea[1].driveCharge ); //} //consoleLogObject(ea); } ); $("#driveChargeSuggested").val(obj.defaultPrice); //consoleLogObject(obj); //if( typeof pricePieChart == "undefined" ) pricePieChart = makeEasyPie( "#pricePie" ); pricePieChart = makeEasyPie( "#pricePie" ); var pieVal = $(".pricePieUL li:nth-child(1) " ).data("percent"); updateEasyPie( pricePieChart, pieVal, $(this).data("id") ); $(".pricePieUL li:nth-child(1) " ).siblings().removeClass("selected"); $(".pricePieUL li:nth-child(1) " ).addClass("selected"); //updateEasyPie( pricePieChart, $(".pricePieUL li:nth-child(1) " ).data("percent"), "pricePie" ); } // 자동완성 항목 리스트를 출력시킨다. // 서버 Json : geoId, pointId, pointName, pointAddress function showUpAutoSuggestList(jsonObj) { //console.log("펑션 호출....."); var queCathegory = jsonObj.cathegory; console.log( "queCathegory : " + queCathegory ); $("#autoSuggestResultUl").html(''); if(jsonObj.JSON.length>0) { $.each(jsonObj.JSON, function( key, eachArr ) { //console.log("리스트추가: "+ eachArr.pointName + eachArr.pointNameTail ); //console.log("리스트추가: "+ eachArr.addressBunji ); var pointNameLiStr = "", pointNameStr = "", pointNameJusoStr = "", pointNameDoroStr = ""; var firstCol = "", secondCol = "", thirdCol = ""; if( typeof eachArr.pointName!="undefined" && eachArr.pointName != null ) pointNameStr = eachArr.pointName; if( typeof eachArr.addressBunji!="undefined" && eachArr.addressBunji != null ) pointNameJusoStr = eachArr.addressBunji; if( typeof eachArr.addressDoro!="undefined" && eachArr.addressDoro != null ) pointNameDoroStr = eachArr.addressDoro; //console.log( "pointNameStr : "+pointNameStr ); //console.log( "pointNameJusoStr : "+pointNameJusoStr ); //console.log( "pointNameDoroStr : "+pointNameDoroStr ); if( queCathegory=="fullAddress" ) { firstCol = pointNameJusoStr; secondCol = pointNameStr; thirdCol = pointNameDoroStr; } else if( queCathegory=="dongRi" ) { firstCol =pointNameStr ; secondCol =pointNameJusoStr ; thirdCol = pointNameDoroStr; } else if( queCathegory=="doroAddress" || queCathegory=="doro" ) { firstCol = pointNameDoroStr; secondCol = pointNameStr; thirdCol = pointNameJusoStr; } else if( queCathegory=="kuEupMyun" || queCathegory=="dongRi" ) { firstCol = pointNameJusoStr; secondCol = pointNameStr; thirdCol = pointNameDoroStr; } else { firstCol = pointNameStr; secondCol = pointNameJusoStr; thirdCol = pointNameDoroStr; } $("#autoSuggestResultUl").append("
  • "+firstCol+""+secondCol+""+thirdCol+"
  • "); $("#autoSuggestResultUl").childTxtClass( searchInputVal,'red'); }); $(".autoSuggestResult").css("display","block"); $("#autoSuggestResultUl").slideDown(); } } // 자동완성 목록을 찾지 못했을 때.. function failedAutoSuggestList() { $("#autoSuggestResultUl, .destinationFullAddressText").html(''); $("#autoSuggestResultUl").append("
  • 죄송합니다. 검색결과가 없습니다. 목적지 동/리 검색으로 조회해주세요.
  • "); $(".autoSuggestResult, #autoSuggestResultUl").css("display","block"); $("#pointNameSearchInput").removeClass("approvedPointInput"); } // 파라메터로 전달하는 $("#autoSuggestResultUl > li") 를 셀렉트상태로 처리하는 일련의 Ajax 프로세스... // var $selectedLI = $("#autoSuggestResultUl > li"); function makeSelectAutoSuggestResultLi($selectedLI) { // jQuery 오브젝트를 파라메터로 전달해준다. // 클릭 시점의 유저인풋 스트링을 보관해둔다. var userInputStringFinal = $("#pointNameSearchInput").val(); //var selectedLIHtml = $selectedLI.html(); var selectedLIHtml = $selectedLI.html(); console.log( "selectedLIHtml 내용 : " +selectedLIHtml ); console.log( "selectedLIHtml 의 텍스트 : " + $selectedLI.find(".autoSuggestAddress").text() ); /* 2018-03-15오후 1:38 ver.5 */ console.log("클릭 data-addressBunji : " +$selectedLI.attr("data-addressBunji") ); if($selectedLI.attr("data-addressBunji") ) { var paramStr = "addressBunji="+$selectedLI.attr("data-addressBunji")+"&addressDoro="+$selectedLI.attr("data-addressDoro") +"&pointName="+$selectedLI.attr("data-pointName")+"&pointNameTail="+$selectedLI.attr("data-pointNameTail") +"&xpos="+$selectedLI.attr("data-xpos")+"&ypos="+$selectedLI.attr("data-ypos") ; console.log("파라메터 paramStr : " + paramStr); paramStr = encodeURI(paramStr); $.getJSON( "/ajax/destPointSelectAction2.php?"+paramStr+"&callback=?", function(jsonObj) { console.log("선택 클릭 액션!!!"); if(typeof jsonObj === "object" && jsonObj != null ) { console.log("instanting geoId value: "+jsonObj.geoId); $("#destGeoId").val( jsonObj.geoId ); $("#destPointId").val( jsonObj.pointId ); // 선택 밸류로 폼 일리먼트 값 변경 $("#destPointNameStr, .destPointName").val( $selectedLI.find(".autoSuggestPointName").text()+' '+$selectedLI.find(".autoSuggestPointNameTail").text() ); $("#destInputFullStr, .destFullAddr").val( $selectedLI.find(".autoSuggestAddress").text() ); $("#destFullAddr").val( $selectedLI.find(".autoSuggestAddress").text() ); //$(".destinationFullAddressText").slideDown(); //$("#pointNameSearchInput").addClass("approvedPointInput"); // 콜백 펑션 호출 // 2016-12-06 19:03 // destInputControl.js 모듈을 land 와 order 에서 공동사용하고있다. // order 에서는 목록선택시 요금계산및 일련 프로세스가 트리거되어야 한다. // 여기서 excute 되는 destSelectCallBackFunc 는 order.html 에서 사전정의된다. if( typeof destSelectCallBackFunc !== "undefined" && destSelectCallBackFunc !="" ) window[destSelectCallBackFunc](); console.log(" 액션의 콜백펑션네임 : " +destSelectCallBackFunc ) // 2018-04-03오후 7:09 // QuickOrder 에서 요청될 때... if( currPage == "quickOrder" ) { // 선택된 목적지 ID 를 쿠키에 담고, 출력내용에 쿠키 블럭을 추가해준다. quickOrderAddDestination(jsonObj.geoId, jsonObj.pointId, selectedLIHtml); $("#quickOrderDestInputDiv").slideUp(); } else { // 선택 내용으로 디스플레이 변경.. $("#destSelectedResultDiv").html( selectedLIHtml ).css("padding","10px"); $(".autoSuggestResult").slideUp(); $("#destSelectedResultDiv").slideDown(); } } }); } else { $("#pointNameSearchInput").removeClass("approvedPointInput"); } // Scroll up $('html, body').animate({ scrollTop: $(".inquireChargeFormHeadline").offset().top }, 500); } // 2018-11-17오전 2:03 // InquireChargeFormAction 를 최종상태까지 진행해주는 일련의 Ajax 프로세스.... function makeInquireChargeFormAction() { ajaxLoadingScreenOn(); $("#loadingPopUpDiv").removeClass("display-none").center(); $("#loadingPopUpDiv .shortPopUpDivTxt1").text("구간 대리비를 조회중입니다.."); $(".orderDestSelected").slideDown(); var serverPHP = $("#inquireChargeForm").attr("action"); var serialized = $("#inquireChargeForm").serialize(); $.getJSON( serverPHP+"?"+serialized+"&callback=?", function(jsonObj) { //console.log("#inquireChargeForm getJSON 액션!!!"); // 서버의 보안레벨 검사를 통과하지 못했을 때... if( jsonObj.actionResult=="AuthFailed" ) ajaxAuthFailed(jsonObj); $("#loadingPopUpDiv").addClass("display-none"); $(".searchResultDiv").slideDown(); swapDisplay( ".inquiryUndoneDiv", ".inquiryDoneDiv" ); if( $("#searchResultShowDiv2").is(':visible') ) $("#selectChargeBlockH3Title").text("대리비 선택"); else $("#selectChargeBlockH3Title").text("먼저 대리비 조회를 해주세요"); //console.log("여기 오는가요.....???"); // 출력 데이터를 채워준다. fillDriveChargeDigits(jsonObj); console.log("jsonObj.weatherStatus : " +jsonObj.weatherStatus); // 2018-11-08오후 7:46 // 날씨 위젯을 추가해준다 : #inquiryResultSummaryUL.prepend() && jsonObj.upperPriceCnt if(jsonObj.weatherStatus && jsonObj.weatherStatus!="Failed") { if(jsonObj.upperPriceCnt && jsonObj.weatherPenalty >= 0.4 ) { $("#weatherSeasonIconsLI").prepend(""); $("#weatherSeasonIconsLI, #inquiryResultSummaryULConditionRemarkLI").removeClass("display-none"); $(".conditionRemarkLIWeatherPenalty").removeClass("display-none"); } } // 2018-12-21오후 11:49 // 피크 시즌대의 UpperPrice 에 대한 아이콘과 알림을 활성화한다. if(jsonObj.seasonExtraAddedRate && jsonObj.seasonExtraAdded=="Yes") { if(jsonObj.upperPriceCnt && jsonObj.seasonExtraAddedRate >= 0.3 ) { $("#weatherSeasonIconsLI").prepend(""); $("#weatherSeasonIconsLI, #inquiryResultSummaryULConditionRemarkLI").removeClass("display-none"); $(".conditionRemarkLISeasonPenalty").removeClass("display-none"); } } // 요금 통계 차트 Div 를 구성한다. pricePieUL jsonSerialized = serializeFirstDimJSON(jsonObj); $("#loadingPopUpDiv").removeClass("display-none"); $("#loadingPopUpDiv .shortPopUpDivTxt1").text("운행통계를 구성중입니다.."); setTimeout( function() { $("#loadingPopUpDiv").addClass("display-none"); if(jsonObj.driveChargeSummary.driveChargeTotalCnt>0) makePricePieUL(jsonObj); $(".loadingPopUpDiv").removeClass("display-none"); $("#loadingPopUpDiv .shortPopUpDivTxt1").text("구간 운행기록을 구성중입니다.."); setTimeout( function() { $("#loadingPopUpDiv").addClass("display-none"); makeCarousel(jsonObj); }, 3000 ); }, 3000 ); // Carousel 의 Headline 을 바꿔준다.. // postScripts JSON 을 받아와 출력해준다... getNfillPostScripts( $("#deptGeoId").val() ); }); } // 받아온 요금을 html 에 채워넣는다. function fillDriveChargeDigits( obj ) { console.log("fillDriveChargeDigits 호출됨..." ); console.log("typeof odometer..." + typeof odometer ); var maxPrice = obj.priceRange3; if(obj.priceRange5) maxPrice = obj.priceRange5; else if(obj.priceRange4) maxPrice = obj.priceRange4; // $(".driveChargeDefault").text( obj.defaultPrice.format() ); $("#driveChargeSuggested").val(obj.defaultPrice); $("#driveChargeUserSelected").val(obj.defaultPrice); //console.log("#driveChargeSuggested value updated: "+obj.defaultPrice ); $(".driveDistance").text( obj.driveDistance ); $("input[name=driveDistance]").val( obj.driveDistance ); if(obj.driveTimeMin) { $(".driveTimeMin").text( obj.driveTimeMin ); $("input[name=driveTimeMin]").val( obj.driveTimeMin ); $(".driveTimeMinLI").removeClass("display-none"); } $(".searchResultDiv").slideDown(); $("ul.actions.fit li").css("display","table-cell"); $(".gotoOrderBtnLi").css("display","table-cell"); $("#inquireChargeFormActionBtn").css("display","none"); $("#addToCartBtn, #goQuickOrderBtn, #inquireAgainBtn").css("display","block").addClass(""); // odometer 이펙트로 받아온 밸류 인스턴스.. if( typeof odometer !== "undefined") { // setTimeout(function(){ //odometer.innerHTML = obj.defaultPrice; // odometer 가 클래스 매칭되는 모든 요소를 일괄 처리해주지 않더라. // 게다가 밸류 인스턴스도 안되게 인터셉트 하기 때문에, odometer 적용된 요소 하나하나 밸류를 넣어줘야 한다. console.log("obj.defaultPrice : " +obj.defaultPrice ); $(".driveChargeDefault, .orderSummaryChargeSum").text( obj.defaultPrice ); $("#driveChargeDigits").html( obj.defaultPrice ); if(typeof obj.priceRange0 !=="undefined") $(".driveChargeMin").text( obj.priceRange0.format() ); if(typeof maxPrice !="undefined") $(".driveChargeMax").text( maxPrice.format() ); //console.log("obj.defaultPrice 의 내용 : "+obj.defaultPrice); ajaxLoadingScreenOff(); // }, 600); } // 구버전.. odometer 없이 값만 인스턴스 해준다. else { $(".driveChargeDefault, .orderSummaryChargeSum").text( obj.defaultPrice ); $("#inquiryResultSelectesCharge").text( obj.defaultPrice ); if(typeof obj.priceRange0 != "undefined") $(".driveChargeMin").text( obj.priceRange0.format() ); $(".driveChargeMax").text( maxPrice.format() ); } // 선택가능 요금 어레이 준비 priceRangeArr.length = 0; if(obj.priceRange0) priceRangeArr[0]= obj.priceRange0; if(obj.priceRange1) priceRangeArr[1]= obj.priceRange1; if(obj.priceRange2) priceRangeArr[2]= obj.priceRange2; if(obj.priceRange3) priceRangeArr[3]= obj.priceRange3; if(obj.priceRange4) priceRangeArr[4]= obj.priceRange4; if(obj.priceRange5) priceRangeArr[5]= obj.priceRange5; //makeChargeAdjuster(priceRangeArr); //console.log("priceRange0: "+priceRangeArr[0]); //$(".chargeAdjuster").css("display","inline"); //$("#driveChargeDigits").text( $("#driveChargeDigits").text().format() ); // 예정 마일리지 업데이트 var milageWillGiven = calcMilage($("#driveChargeUserSelected").val(), priceRangeArr); $("#milageWillBeGivenStr").text( milageWillGiven.format() ); $("#milageWillBeGivenInput").val(milageWillGiven); // 최종 결제금액 값과 출력을 무결하게 유지한다. //makeFinalPayPrice(); // 여기서는 요금쿼리의 첫번째 스텝이므로, 최종지불금액은 단순계산금액으로 간단히 인스턴스해준다. // 최종지불금액 업데이트 finalPayPrice = $("#driveChargeUserSelected").val(); if(typeof finalPayPrice != "undefined" && finalPayPrice.length > 3) $("#finalPayPriceStr").text( finalPayPrice.format() ); //console.log("펑션 fillDriveChargeDigits 의 마지막"); } // 요금검색 결과를 리셋한다. function resetInquiryResult() { $(".driveDistance, .driveChargeDefault, .driveChargeMin, .driveChargeMaxm .odometer-inside ").html('0'); //$(".prependedLI").remove(); $("#weatherSeasonIconsLI").empty(); $("#inquiryResultSummaryULConditionRemarkLI").addClass("display-none"); //console.log("reset called!!!"); } // 선택된 금액에 대해 차별적인 마일리지를 리턴한다. function calcMilage(price, priceRangeArr) { price = parseInt(price); var len = priceRangeArr.length; if(priceRangeArr[0]==price) return Math.round( price*( milageDefaultRate*0.005 ) )*100; else if(priceRangeArr[1]==price && priceRangeArr[4]) return Math.round( price*( milageDefaultRate*0.0075 ) )*100; else return price*milageDefaultRate; } // JSON 의 일차원 배열들만 serialize 해준다. function serializeFirstDimJSON(obj) { var serializedStr = ""; $.each( obj, function(ky, vl) { //console.log( "typeof : "+ky+" : " + typeof vl ); if(typeof vl !== "object") serializedStr += ky+"="+vl+"&"; }); return serializedStr; } // 서버의 보안레벨 검사를 통과하지 못했을 때... function ajaxAuthFailed(jsonObj) { shortPopUp( "요청이 서버의 보안 검사를 통과하지 못하였습니다.", "Code No. "+jsonObj.ErrorCode ); } // 엘리먼트 자식요소의 모든 매칭 텍스트에 class 를 부여한다. // 자동완성 하위 매칭 텍스트에 class 를 추가해줄 때 사용. /**** usage: $(selector).childTxtClass( searchInputVal,'red'); ****/ jQuery.fn.childTxtClass = function (pattern, className) { var regex = new RegExp("#" + pattern + "#", "g"); this.children().filter( function() { return this.innerHTML.match(regex); }).addClass(className); return this; }