Преглед изворни кода

개선 #1040 [FRONT] 주문목록 기본 검색 기간 변경

card007 пре 4 година
родитељ
комит
9fd2e6d5da

+ 24 - 16
src/main/webapp/WEB-INF/views/mob/mypage/MypageCreListFormMob.html

@@ -31,7 +31,7 @@
 	<section class="content my_return"> <!-- 210409_수정 : class my_return 변경 -->
 		<div class="inner">
 			<div class="order_sort">
-				<a href="javascript:void(0);" class="od_date_btn">최근 3개월</a>
+				<a href="javascript:void(0);" class="od_date_btn">최근 1주일</a>
 				<a href="javascript:void(0);" class="od_status_btn">전체상태</a>
 			</div>
 		</div>
@@ -59,8 +59,9 @@
 		</div>
 		<div class="popup_con">
 			<div class="button_list clear">
+				<button type="button" class="on" onclick="fnSetSearchPeriod(-1);" period="-1"><span>최근 1주일</span></button>
 				<button type="button" onclick="fnSetSearchPeriod(1);" period="1"><span>최근 1개월</span></button>
-				<button type="button" class="on" onclick="fnSetSearchPeriod(3);" period="3"><span>최근 3개월</span></button>
+				<button type="button" onclick="fnSetSearchPeriod(3);" period="3"><span>최근 3개월</span></button>
 				<button type="button" onclick="fnSetSearchPeriod(6);" period="6"><span>최근 6개월</span></button>
 				<button type="button" onclick="fnSetSearchPeriod(9);" period="9"><span>최근 9개월</span></button>
 				<button type="button" onclick="fnSetSearchPeriod(12);" period="12"><span>최근 12개월</span></button>
@@ -129,6 +130,9 @@ $(document).ready(function() {
 		, "stDate" 			: ""
 		, "edDate" 			: ""
 	}
+	
+	// 주문 검색 기간 설정
+	fnSetInitPeriod();
 });
 
 //사파리 - event.persisted || 크롬 - window.performance.navigation.type 이 1이면 새로고침, 2면 페이지 이동을 통한 캐쉬페이징
@@ -214,22 +218,26 @@ var fnGetInfiniteScrollDataList = function() {
 
 //검색기간 버튼 클릭 이벤트 처리
 var fnSetSearchPeriod = function(period) {
-	let date 		= new Date();
-	let edDate 		= getFormatDate(date);
-	
-	let day = date.getDate();
-	let lastDay = (new Date(date.getFullYear(), (date.getMonth() + 1) - period, 0)).getDate();
-	
-	if (day - lastDay > 0) {
-		date.setDate(date.getDate() - (day - lastDay));
+	if (period == -1) {
+		fnSetInitPeriod();
+	} else {
+		let date = new Date();
+		let edDate = getFormatDate(date);
+		
+		let day = date.getDate();
+		let lastDay = (new Date(date.getFullYear(), (date.getMonth() + 1) - period, 0)).getDate();
+		
+		if (day - lastDay > 0) {
+			date.setDate(date.getDate() - (day - lastDay));
+		}
+		
+		date.setMonth(date.getMonth() - period);
+		let stDate = getFormatDate(date);
+		
+		$('#searchForm input[name=edDate]').val(edDate);
+		$('#searchForm input[name=stDate]').val(stDate);
 	}
-	
-	date.setMonth(date.getMonth() - period);
-	let stDate 		= getFormatDate(date);
 
-	$('#searchForm input[name=edDate]').val(edDate);
-	$('#searchForm input[name=stDate]').val(stDate);
-	
 	// 인피니티스크롤 초기화
 	fnMypageCreListInfiniteScrollInit();
 	

+ 24 - 16
src/main/webapp/WEB-INF/views/mob/mypage/MypageOrderListFormMob.html

@@ -93,7 +93,7 @@
 		<th:block th:if="${mypageMainYn} == 'N'">
 			<div class="inner">
 				<div class="order_sort">
-					<a href="javascript:void(0);" class="od_date_btn">최근 3개월</a>
+					<a href="javascript:void(0);" class="od_date_btn">최근 1주일</a>
 					<a href="javascript:void(0);" class="od_status_btn">전체상태</a>
 				</div>
 			</div>
@@ -141,8 +141,9 @@
 		</div>
 		<div class="popup_con">
 			<div class="button_list clear">
+				<button type="button" class="on" onclick="fnSetSearchPeriod(-1);" period="-1"><span>최근 1주일</span></button>
 				<button type="button" onclick="fnSetSearchPeriod(1);" period="1"><span>최근 1개월</span></button>
-				<button type="button" class="on" onclick="fnSetSearchPeriod(3);" period="3"><span>최근 3개월</span></button>
+				<button type="button" onclick="fnSetSearchPeriod(3);" period="3"><span>최근 3개월</span></button>
 				<button type="button" onclick="fnSetSearchPeriod(6);" period="6"><span>최근 6개월</span></button>
 				<button type="button" onclick="fnSetSearchPeriod(9);" period="9"><span>최근 9개월</span></button>
 				<button type="button" onclick="fnSetSearchPeriod(12);" period="12"><span>최근 12개월</span></button>
@@ -216,6 +217,9 @@ $(document).ready(function() {
 	if (mypageMainYn == 'Y') {
 		$('#htopSub').addClass('my_main');
 	}
+
+	// 주문 검색 기간 설정
+	fnSetInitPeriod();
 });
 
 //사파리 - event.persisted || 크롬 - window.performance.navigation.type 이 1이면 새로고침, 2면 페이지 이동을 통한 캐쉬페이징
@@ -319,22 +323,26 @@ var fnGetInfiniteScrollDataList = function() {
 
 // 검색기간 버튼 클릭 이벤트 처리
 var fnSetSearchPeriod = function(period) {
-	let date 		= new Date();
-	let edDate 		= getFormatDate(date);
-	
-	let day = date.getDate();
-	let lastDay = (new Date(date.getFullYear(), (date.getMonth() + 1) - period, 0)).getDate();
-	
-	if (day - lastDay > 0) {
-		date.setDate(date.getDate() - (day - lastDay));
+	if (period == -1) {
+		fnSetInitPeriod();
+	} else {
+		let date = new Date();
+		let edDate = getFormatDate(date);
+		
+		let day = date.getDate();
+		let lastDay = (new Date(date.getFullYear(), (date.getMonth() + 1) - period, 0)).getDate();
+		
+		if (day - lastDay > 0) {
+			date.setDate(date.getDate() - (day - lastDay));
+		}
+		
+		date.setMonth(date.getMonth() - period);
+		let stDate = getFormatDate(date);
+		
+		$('#searchForm input[name=edDate]').val(edDate);
+		$('#searchForm input[name=stDate]').val(stDate);
 	}
-	
-	date.setMonth(date.getMonth() - period);
-	let stDate 		= getFormatDate(date);
 
-	$('#searchForm input[name=edDate]').val(edDate);
-	$('#searchForm input[name=stDate]').val(stDate);
-	
 	// 인피니티스크롤 초기화
 	fnMypageOrderListInfiniteScrollInit();
 	

+ 24 - 16
src/main/webapp/WEB-INF/views/mob/mypage/NoMemberCreListFormMob.html

@@ -46,7 +46,7 @@
 
 		<div class="inner">
 			<div class="order_sort">
-				<a href="javascript:void(0);" class="od_date_btn">최근 3개월</a>
+				<a href="javascript:void(0);" class="od_date_btn">최근 1주일</a>
 				<a href="javascript:void(0);" class="od_status_btn">전체상태</a>
 			</div>
 		</div>
@@ -74,8 +74,9 @@
 		</div>
 		<div class="popup_con">
 			<div class="button_list clear">
+				<button type="button" class="on" onclick="fnSetSearchPeriod(-1);" period="-1"><span>최근 1주일</span></button>
 				<button type="button" onclick="fnSetSearchPeriod(1);" period="1"><span>최근 1개월</span></button>
-				<button type="button" class="on" onclick="fnSetSearchPeriod(3);" period="3"><span>최근 3개월</span></button>
+				<button type="button" onclick="fnSetSearchPeriod(3);" period="3"><span>최근 3개월</span></button>
 				<button type="button" onclick="fnSetSearchPeriod(6);" period="6"><span>최근 6개월</span></button>
 				<button type="button" onclick="fnSetSearchPeriod(9);" period="9"><span>최근 9개월</span></button>
 				<button type="button" onclick="fnSetSearchPeriod(12);" period="12"><span>최근 12개월</span></button>
@@ -148,6 +149,9 @@ $(document).ready(function() {
 		, "ordNm"			: ordNm
 		, "ordPhnno"		: ordPhnno
 	}
+	
+	// 주문 검색 기간 설정
+	fnSetInitPeriod();
 });
 
 //사파리 - event.persisted || 크롬 - window.performance.navigation.type 이 1이면 새로고침, 2면 페이지 이동을 통한 캐쉬페이징
@@ -233,22 +237,26 @@ var fnGetInfiniteScrollDataList = function() {
 
 //검색기간 버튼 클릭 이벤트 처리
 var fnSetSearchPeriod = function(period) {
-	let date 		= new Date();
-	let edDate 		= getFormatDate(date);
-	
-	let day = date.getDate();
-	let lastDay = (new Date(date.getFullYear(), (date.getMonth() + 1) - period, 0)).getDate();
-	
-	if (day - lastDay > 0) {
-		date.setDate(date.getDate() - (day - lastDay));
+	if (period == -1) {
+		fnSetInitPeriod();
+	} else {
+		let date = new Date();
+		let edDate = getFormatDate(date);
+		
+		let day = date.getDate();
+		let lastDay = (new Date(date.getFullYear(), (date.getMonth() + 1) - period, 0)).getDate();
+		
+		if (day - lastDay > 0) {
+			date.setDate(date.getDate() - (day - lastDay));
+		}
+		
+		date.setMonth(date.getMonth() - period);
+		let stDate = getFormatDate(date);
+		
+		$('#searchForm input[name=edDate]').val(edDate);
+		$('#searchForm input[name=stDate]').val(stDate);
 	}
-	
-	date.setMonth(date.getMonth() - period);
-	let stDate 		= getFormatDate(date);
 
-	$('#searchForm input[name=edDate]').val(edDate);
-	$('#searchForm input[name=stDate]').val(stDate);
-	
 	// 인피니티스크롤 초기화
 	fnMypageCreListInfiniteScrollInit();
 	

+ 25 - 17
src/main/webapp/WEB-INF/views/mob/mypage/NoMemberOrderListFormMob.html

@@ -48,7 +48,7 @@
 
 		<div class="inner">
 			<div class="order_sort">
-				<a href="javascript:void(0);" class="od_date_btn">최근 3개월</a>
+				<a href="javascript:void(0);" class="od_date_btn">최근 1주일</a>
 				<a href="javascript:void(0);" class="od_status_btn">전체상태</a>
 			</div>
 		</div>
@@ -75,8 +75,9 @@
 		</div>
 		<div class="popup_con">
 			<div class="button_list clear">
+				<button type="button" class="on" onclick="fnSetSearchPeriod(-1);" period="3"><span>최근 1주일</span></button>
 				<button type="button" onclick="fnSetSearchPeriod(1);" period="1"><span>최근 1개월</span></button>
-				<button type="button" class="on" onclick="fnSetSearchPeriod(3);" period="3"><span>최근 3개월</span></button>
+				<button type="button" onclick="fnSetSearchPeriod(3);" period="3"><span>최근 3개월</span></button>
 				<button type="button" onclick="fnSetSearchPeriod(6);" period="6"><span>최근 6개월</span></button>
 				<button type="button" onclick="fnSetSearchPeriod(9);" period="9"><span>최근 9개월</span></button>
 				<button type="button" onclick="fnSetSearchPeriod(12);" period="12"><span>최근 12개월</span></button>
@@ -114,7 +115,7 @@ let ordNo			= [[${ordNo}]];
 let ordNm			= [[${ordNm}]];
 let ordPhnno		= [[${ordPhnno}]];
 var totalCnt		= [[${totalCnt}]];
-var isLogin = [[${isLogin}]];
+var isLogin			= [[${isLogin}]];
 var totalPage		= 0;
 var remainList		= 0;
 var jsonObj 		= {};
@@ -136,6 +137,9 @@ $(document).ready(function() {
 		, "ordNm"			: ordNm
 		, "ordPhnno"		: ordPhnno
 	}
+	
+	// 주문 검색 기간 설정
+	fnSetInitPeriod();
 });
 
 //사파리 - event.persisted || 크롬 - window.performance.navigation.type 이 1이면 새로고침, 2면 페이지 이동을 통한 캐쉬페이징
@@ -219,22 +223,26 @@ var fnGetInfiniteScrollDataList = function() {
 
 //검색기간 버튼 클릭 이벤트 처리
 var fnSetSearchPeriod = function(period) {
-	let date 		= new Date();
-	let edDate 		= getFormatDate(date);
-	
-	let day = date.getDate();
-	let lastDay = (new Date(date.getFullYear(), (date.getMonth() + 1) - period, 0)).getDate();
-	
-	if (day - lastDay > 0) {
-		date.setDate(date.getDate() - (day - lastDay));
+	if (period == -1) {
+		fnSetInitPeriod();
+	} else {
+		let date = new Date();
+		let edDate = getFormatDate(date);
+		
+		let day = date.getDate();
+		let lastDay = (new Date(date.getFullYear(), (date.getMonth() + 1) - period, 0)).getDate();
+		
+		if (day - lastDay > 0) {
+			date.setDate(date.getDate() - (day - lastDay));
+		}
+		
+		date.setMonth(date.getMonth() - period);
+		let stDate = getFormatDate(date);
+		
+		$('#searchForm input[name=edDate]').val(edDate);
+		$('#searchForm input[name=stDate]').val(stDate);
 	}
-	
-	date.setMonth(date.getMonth() - period);
-	let stDate 		= getFormatDate(date);
 
-	$('#searchForm input[name=edDate]').val(edDate);
-	$('#searchForm input[name=stDate]').val(stDate);
-	
 	// 인피니티스크롤 초기화
 	fnMypageOrderListInfiniteScrollInit();
 	

+ 4 - 2
src/main/webapp/WEB-INF/views/web/mypage/MypageCreListFormWeb.html

@@ -188,9 +188,11 @@
 		$('.select_custom.demand_status').each(function(index) {
 			new sCombo($(this));
 		});
-
+		
 		// 주문 검색 기간 설정
-		$('#rdi-month2').click();
+		// 2021.08.19 card007 초기 검색기간 최근 3개월 -> 최근 1주일로 변경
+		fnSetInitPeriod();
+		//$('#rdi-month2').click();
 
 		// Initialize a pagination
 		gagaPaging.init('searchForm', fnSearchCallback, 'paging', 10, 10);

+ 3 - 1
src/main/webapp/WEB-INF/views/web/mypage/MypageOrderListFormWeb.html

@@ -212,7 +212,9 @@
 		});
 
 		// 주문 검색 기간 설정
-		$('#rdi-month2').click();
+		// 2021.08.19 card007 초기 검색기간 최근 3개월 -> 최근 1주일로 변경
+		fnSetInitPeriod();
+		//$('#rdi-month2').click();
 
 		// Initialize a pagination
 		gagaPaging.init('searchForm', fnSearchCallback, 'paging', 10, 10);

+ 4 - 2
src/main/webapp/WEB-INF/views/web/mypage/NoMemberCreListFormWeb.html

@@ -191,9 +191,11 @@
 		$('.select_custom.demand_status').each(function(index) {
 			new sCombo($(this));
 		});
-
+		
 		// 주문 검색 기간 설정
-		$('#rdi-month2').click();
+		// 2021.08.19 card007 초기 검색기간 최근 3개월 -> 최근 1주일로 변경
+		fnSetInitPeriod();
+		//$('#rdi-month2').click();
 
 		// Initialize a pagination
 		gagaPaging.init('searchForm', fnSearchCallback, 'paging', 10, 10);

+ 4 - 2
src/main/webapp/WEB-INF/views/web/mypage/NoMemberOrderListFormWeb.html

@@ -182,9 +182,11 @@
 		$('.select_custom.order_status').each(function(index) {
 			new sCombo($(this));
 		});
-
+		
 		// 주문 검색 기간 설정
-		$('#rdi-month2').click();
+		// 2021.08.19 card007 초기 검색기간 최근 3개월 -> 최근 1주일로 변경
+		fnSetInitPeriod();
+		//$('#rdi-month2').click();
 
 		// Initialize a pagination
 		gagaPaging.init('searchForm', fnSearchCallback, 'paging', 10, 10);

+ 14 - 0
src/main/webapp/biz/mypage.js

@@ -550,3 +550,17 @@ function getFormatDate(date) {
 	
 	return year + '-' + month + '-' + day;
 }
+
+// 주문 및 취반교 초기 검색 기간 설정
+var fnSetInitPeriod = function() {
+	let date 		= new Date();
+	let edDate 		= getFormatDate(date);
+	
+	date.setDate(date.getDate() - 7);
+	let stDate 		= getFormatDate(date);
+	
+	$('#edDate').val(edDate);
+	$('#searchForm input[name=edDate]').val(edDate);
+	$('#stDate').val(stDate);
+	$('#searchForm input[name=stDate]').val(stDate);
+}