PageSourceSearch

https://www.hotelnjoy.com/nm/common/may/js/abr/abr_room.js?timestamp=

js hotelnjoy.com collected 2026-10-09 01:15:28 UTC 17,106 bytes, 509 lines download raw bytes

1//v3버전
2
3function view_detail_img(_rcode){
4	
5	app.view_detail_img(_rcode);
6}
7
8
9
10var app = new Vue({
11	el: '#wrap',
12    data : {
13        itemList : [''], 
14		recommendHotel : ['aa'],
15        message : 'success',
16		customerHours :[''],
17		checkin : '',
18		checkout : '',
19		rcount : 1,
20		totalUseNum : 2,
21		couonList:[],
22		couponBG : ['banner-bg_beige', 'banner-bg_violet', 'banner-bg_red',  'banner-bg_iceblue',  'banner-bg_dark' ], 
23	},
24    methods : {
25    	iniRoomList : function(mode, search_step){
26    		
27		        mode = (mode)? mode : 'search';
28		        search_step = (search_step)? search_step : 1;
29
30		        $('#formRoom input[name="checkIn"]').val( $('#calendar_form [name="calendar_in"]').val() );
31		        $('#formRoom input[name="checkOut"]').val( $('#calendar_form [name="calendar_out"]').val() );
32		        $('#formRoom input[name="roomCount"]').val( $('#abrGuest input[name="comm_roomCount"]').val() );
33		        $('#formRoom input[name="adult"]').val( $('#abrGuest input[name="comm_adult"]').val() );
34		        $('#formRoom input[name="child"]').val( $('#abrGuest input[name="comm_child"]').val() );
35		        $('#formRoom input[name="childAges1"]').val( $('#abrGuest input[name="comm_childAges1"]').val() );
36		        $('#formRoom input[name="childAges2"]').val( $('#abrGuest input[name="comm_childAges2"]').val() );
37		        $('#formRoom input[name="childAges3"]').val( $('#abrGuest input[name="comm_childAges3"]').val() );
38		        $('#formRoom input[name="childAges4"]').val( $('#abrGuest input[name="comm_childAges4"]').val() );
39		        $('#formRoom input[name="search_step"]').val( search_step );
40		
41		        $.ajax({
42		            type : 'POST'
43		            , url : '/nm/abr_room/ajax_room/'
44		            , dataType : 'html'
45		            , data : $('#formRoom').serialize()
46		            , async : true
47		            , beforeSend : function() {
48						$("#loading").show();
49		                if (mode == 'search' && search_step == 1) {
50		                    searching_abr = true;
51		                    $('#roomBtn p').text('요금계산 중입니다.');
52		                    $('#roomLists').empty();
53		                }
54		            }
55		            , complete : function() { //어떻게 처리해야할지 ... ㅡㅡ;
56		            	$("#loading").hide();
57		            	app.checkin = app.calendarDateFormat(formRoom.checkIn.value);
58		            	app.checkout = app.calendarDateFormat(formRoom.checkOut.value);
59		            	app.rcount = formRoom.roomCount.value;
60
61						if(formRoom.roomCount.value > 1){
62							app.totalUseNum = 0;
63							var totalAdult= formRoom.adult.value.split(',');
64							var totalChild = formRoom.child.value.split(',');
65							
66							for(var i=0; i < formRoom.roomCount.value; i++){
67								app.totalUseNum += Number(totalAdult[i]);
68								app.totalUseNum += Number(totalChild[i]);
69								
70							}
71							
72						}else{
73							 app.totalUseNum =   Number(formRoom.adult.value) + Number(formRoom.child.value);
74						}
75		               
76		                
77		                searching_abr = false;
78
79						
80						$(".option .btn-more2").click(function () {
81							$(this).parent(".option").toggleClass("on");
82						});
83						$(".btn-more-option").click(function () {
84							$(this).parents(".option-warp").toggleClass("on");
85						});
86						$(".option-controll").click(function () {
87							$(this).parent(".option-text").toggleClass("on");
88						});
89
90
91						
92						
93						
94						$('.owl-carousel').owlCarousel({
95						items: 5,
96						margin: 10,
97						loop: true,
98						autoWidth: true,
99						responsive: {
100							678: {
101								mergeFit: true
102							},
103							1000: {
104								mergeFit: false
105							}
106						}
107						});
108	
109		            }
110		            , success : function(result) {
111							
112							$("#roomListArea").html(result);
113		            }
114		            , error : function(result) {
115		                searching_abr = false;
116		                $('#roomBtn p').text('검색된 객실이 없습니다.');
117		            }
118		        });
119
120    	},
121		getRoomDetail:function(_searchInx){
122			
123			formRoom.search_index.value = _searchInx;
124			
125			location.href = "/nm/abr_room/roomdetail?"+$('#formRoom').serialize();
126			
127			
128		},
129		showReview:function(){
130			
131			
132			   $.ajax({
133	                url : '/nm/board/ajax_board_list',
134	                type: "GET",
135	                data : {'v_pcode': board_form.v_pcode.value, 'v_offer': board_form.v_offer.value || ''},
136	                dataType : "json",
137					complete : function(){
138						lay_common_show($(".lay_review"),  true, false);
139					},
140	                success: function (resp){
141						reviewObj.reviewList_trip = (resp && resp.abr_trip && Array.isArray(resp.abr_trip.data)) ? resp.abr_trip.data : [];
142					},
143	                error: function(){
144						if (typeof reviewObj !== 'undefined') reviewObj.reviewList_trip = [];
145					}
146	            });
147			   
148			reviewObj.getReviewList();
149		
150		},
151		
152		showReviewList : function() {
153            reviewObj.getReviewList(); // js/roomviewComm.js
154        },
155        
156    	calendarDateFormat : function(dt) {
157            values = dt.split(/[^0-9]/);
158            year_tmp = values[0].substring(values[0].length-2, 4)
159            year = parseInt(values[0], 10);
160            month = parseInt(values[1], 10); // Month is zero based, so subtract 1
161            day = parseInt(values[2], 10);
162            format_dt = new Date(year, month - 1, day);
163            var yoil = new Array('일', '월', '화', '수', '목', '금', '토');
164            month = month < 10 ? "0" + month : month;
165            day = day < 10 ? "0" + day : day;
166
167            return year_tmp+"."+month + "." + day + "(" + yoil[format_dt.getDay()] + ")";
168        },
169		showCalendar : function(){
170			 calendar_focus(formRoom.checkIn.value, formRoom.checkOut.value);
171		     lay_common_show($('.lay_calendar'));
172
173		},
174		setRoomInfo : function(){
175			 if (searching_abr) {
176                return;
177            }
178            //$('#roomBtn').hide();
179            lay_common_show($('.lay_schRoomabr'), false, false);
180			
181		},
182		getAroundHotelList : function(_latitude, _longitude) {
183        	
184        	if(_latitude !== '' && _longitude!= ''){
185        		 
186        		
187        		$.ajax({
188                     type : "GET", 
189                     url : "/nm/abr_room/ajax_aroundHotel/",
190                     data : {'v_latitude' : _latitude, 'v_longitude':_longitude},
191                     dataType : "json",
192					 complete : function(){
193						
194						
195					
196					},
197                     success : function(data) {
198                    	 app.recommendHotel = data.list;
199                     },
200                     error : function(request, status, error) {
201
202                     }
203                 });
204        		
205        	}
206
207		
208           
209        },
210		sendLink : function(hotelName, imgUrl, webUrl, hotelAddr) {
211        	Kakao.Link.sendDefault({
212    	        objectType : 'feed',
213    	        content : {
214    	            title : hotelName,
215    	            description : '오늘의 추천 숙소!\n주소 : ' + hotelAddr,
216    	            imageUrl : imgUrl,
217    	            link : {
218    	                mobileWebUrl : "https://m.hotelnjoy.com" + webUrl,
219    	                webUrl : "https://www.hotelnjoy.com" + webUrl
220    	            }
221    	        },
222    	        buttons : [
223    	            {
224    	                title : '모바일 웹으로 보기',
225    	                link : {
226    	                        mobileWebUrl : "https://m.hotelnjoy.com" + webUrl,
227    	                        webUrl : "https://www.hotelnjoy.com" + webUrl
228    	                }
229    	            }
230    	        ]
231    	    });
232	
233        },
234 		showMaps : function() {
235			app.map_initialize(common_form.v_longitude.value, common_form.v_latitude.value);
236	
237            lay_common_show($('.lay_roomMap'), true, false);
238        },
239		getCouponList : function() {
240        	
241			if (common_form.v_userid.value == '') {
242			                lay_common_show($('.loginwarp'), true, false);
243			                return;
244			            	
245			  }
246		 
247		            $.ajax({
248		                type : "GET", 
249		                url : "/nm/abr_room/ajax_couponList/",
250		                data : { 'v_pcode' : formRoom.hotelCode.value, 'checkIn':formRoom.checkIn.value, 'checkOut':formRoom.checkOut.value},
251		                dataType : "json",
252		                success : function(data) {
253		                    if (data.rsCD == "05200") {
254		                    		coupon_app.couonList = data.alliancCouponList;
255		                            lay_common_show($('.lay_coupon'));
256		                            
257		                    }
258		                },
259		                error : function(request, status, error) {
260		
261		                }
262		            });
263
264        },
265		map_initialize : function(v_lng, v_lat){
266		
267		    var mapOptions = {
268		        center : {
269		                lat : parseFloat(v_lat),
270		                lng : parseFloat(v_lng)
271		        },
272		        zoom : 16,
273		        mapTypeId : google.maps.MapTypeId.ROADMAP,
274		        draggable : true
275		    }
276		
277		    var map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
278		    var marker = new google.maps.Marker({
279		        position : {
280		            lat : parseFloat(v_lat),
281		            lng : parseFloat(v_lng)
282		        },
283		        map : map,
284		        title : common_form.v_hotel_name.value,
285		        icon : {
286		            url : "https://www.hotelnjoy.com/nm/images/icon/ico_map_new.png",
287		        }
288		    });
289		
290		    var infowindow = new google.maps.InfoWindow({
291		        content : common_form.v_hotel_name.value,
292		        maxWidth : 300
293		    });
294		    marker.setMap(map);
295		    infowindow.open(map, marker);
296		
297		    google.maps.event.addListener(marker, 'click', function() {});
298		},
299		getCustomerCenter : function(){
300				
301        		$.ajax({
302                     type : "GET", 
303                     url : "/nm/abr_room/ajax_customerCenter/",
304                     dataType : "json",
305                     success : function(data) {
306						customerhous1 = data.m_abroadMent1;
307						customerhous2 = data.m_abroadMent2;
308						customerhous3 = data.m_abroadMent3;
309						
310						console.log(customerhous1);
311						console.log(customerhous2);
312						console.log(customerhous3);
313						
314						app.customerHours[0] = customerhous1;
315						app.customerHours[1] = customerhous2;
316						app.customerHours[2] = customerhous3;
317						
318						/*customerhous = data.kakaoMent.split('(');
319						
320						app.customerHours[0] = customerhous[0].split('\n');
321						app.customerHours[1] =  '(' + customerhous[1];*/
322						
323                     },
324                     error : function(request, status, error) {
325						
326                     }
327                 });
328        		
329
330		},
331		view_detail_img : function(_type){
332			
333			if(_type == 'main'){
334				 lay_common_show($('.detail-img-popup'), true, false);
335				
336			}
337		},
338		addWish : function (fav){ // //숙소 찜 등록/삭제
339
340		    var wishStatus = $('.heart').hasClass('on');
341		    var kind = '';
342		    var is_login = common_form.v_userid.value ? true : false;
343		
344		    if (!is_login) {
345		        lay_common_show($('.loginwarp'));
346		    } else {
347		        if (wishStatus) {
348		            kind = 'delete';
349		        } else {
350		            kind = 'add';
351		        }
352		
353		        $.ajax({
354		            url : '/nm/myp/ajax_event_wishReg'
355		            , type : 'GET'
356		            , data : {
357		                'v_pcode' : formRoom.hotelCode.value
358		                , 'kind' : kind
359		                , 'v_offer' : 'matei'
360		                , 'v_gubun' : 'abr'
361		                , 'v_image' : $("#mainImgArea > div").eq(0).find('img').attr('src')
362		            }
363		            , dataType : 'json'
364		            , contentType : 'application/json'
365		            , success : function(resp) {
366		                if (resp.rsCD == '07400') {
367		                    if (kind == 'delete') {
368		                        alertObj.alert_msg('관심숙소에서 삭제되었습니다.');
369		                    } else {
370		                        alertObj.alert_msg('관심숙소에 등록되었습니다.');
371		                    }
372		                  //  $('.fav').toggleClass('on');
373		                } else {
374		                    alertObj.alert_msg(resp.rsMSG);
375		                }
376		            }
377		        })
378		    }
379		},
380    	 promotionInfo : function(roomCode, offer){//객실리스트- 프로모션 정보
381    		 
382             $.ajax({
383                 url : '/nm/kor_view_may/ajax_promotionInfo',
384                 type : "GET",
385                 data : {
386                     "v_pcode" : rese_form.v_pcode.value,
387                     "v_tcode" : roomCode,
388                     'v_offer' : offer,
389                     'v_agent' : rese_form.v_agent.value
390                 },
391                 dataType : "json",
392                 contentType : "application/json",
393                 success : function(resp) {
394                     if (resp.rsCD == "03900") {
395                    	 promotion_app.roomPromotionList = resp.list;
396                         lay_common_show($('.promotion'), true, false);
397                     } else {
398                         alert(resp.rsMSG);
399                     }
400                 }
401             });
402         },
403    	payCheck : function(value){
404    		
405    		var offer = $(value).attr('offer');
406			var rcode = $(value).attr('rcode');
407			var tcode = $(value).attr('tcode');
408			var continuity = $(value).attr('r_type');
409			
410            rese_form.v_tcode.value = tcode;
411            rese_form.v_offer_pension.value = $(value).attr('roomKind')
412            rese_form.v_field.value = $(value).attr('field') == 'online' ? "N" : "Y";
413    		
414           
415            
416            if (continuity == "Y") {
417				var period  =  parseInt(parseInt(common_form.v_period.value));
418				var mindate = parseInt($(value).attr('mindate'));
419				var maxdate = parseInt($(value).attr('maxdate'));
420				
421				if (period >= mindate && period <=maxdate ) {
422					
423					if($(value).attr('field') == 'all'){
424		    			this.payTypeChoice();
425		    		}else{
426		    			this.rese();
427		    		}
428					
429				} else {
430					var ment = (mindate == maxdate)? mindate + '박' : '최소 ' + mindate + '박 ~ 최대 ' + maxdate + '박';
431					alert(ment + " 만 가능한 상품입니다.\n날짜를 다시 선택해 주세요.");
432					return;
433				}
434			}else{
435				
436				if($(value).attr('field') == 'all'){
437					 
438	    			this.payTypeChoice($(value).attr('totalPay'));
439	    		}else{
440	    			this.rese();
441	    		}
442				
443			}
444    		
445    	},
446    	rese : function() { //예약하기 
447    		
448    		$("#loading").show();
449    		this.detailInfo();
450        },
451        selectPayType : function( pay_at_hotel ){ //결제방식 선택
452            if( pay_at_hotel == "online" ) {
453                rese_form.v_field.value = "N";
454                $("#fieldPayButton").text( "여기서 결제할래요" );
455            } else {
456                rese_form.v_field.value = "Y";
457                $("#fieldPayButton").text( "호텔에서 결제할래요" );
458            }
459        },
460        detailInfo : function() { //포함사항
461        	
462        	$.ajax({
463                url : '/nm/kor_view_may/ajax_detail_info',
464                type : "GET",
465                data : $("#rese_form").serialize(),
466                dataType : "json",
467                contentType : "application/json",
468                success : function(resp) {
469                	
470                	roomListObj.pay(); 
471                },error : function(e){
472                	
473                }
474            })
475        },
476        pay : function() { //결제페이지
477        	//$("#loading").show();
478			if(rese_form.v_tcode.value.match('expedia') && rese_form.v_agent.value =='hotelscombined'){
479				rese_form.v_agent.value = 'hotelnjoy';
480				rese_form.ConversionID.value = '';
481			}
482        	rese_form.submit();
483        },
484        payTypeChoice : function(tmpPay){ //결제방식 선택 띄우기
485        	
486        	$(".fieldPayDetailPrice").text(tmpPay+"원" );
487        	
488        
489        	
490//        	if( rese_form.v_field.value == "Y"){
491//        		$("#customRadio1").attr('checked', true);
492//        	}else{
493//        		$("#customRadio2").attr('checked', true);
494//        		
495//        	}
496            lay_common_show($('.lay_paymentChoice') );
497        }
498				   
499    },
500    created : function() {
501      
502       this.iniRoomList('search');
503	   this.map_initialize(common_form.v_longitude.value, common_form.v_latitude.value); //구글맵 초기화
504	   this.getAroundHotelList(common_form.v_latitude.value, common_form.v_longitude.value);
505	   this.getCustomerCenter();
506 	   Kakao.init('40b2472ca09def4ab45491aa01ce9a3b');
507    }
508});
509

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.