Parcourir la source

임시 커밋

card007 il y a 4 ans
Parent
commit
b6c2e4c749

+ 0 - 1
src/main/webapp/WEB-INF/views/mob/cart/CartListAjaxFormMob.html

@@ -516,7 +516,6 @@
 				</div>
 			</div>
 		</div>
-
 		<div class="inner wide">
 			<div class="od_calc_wrap" id="bottomOrderArea">
 				<button type="button" class="btn btn_dark"><span>합계 <em class="realOrderAmtText" th:text="${#numbers.formatInteger(order.sumRealPayAmt + order.totDelvFee, 1, 'COMMA')}">0</em>원</span></button>

+ 83 - 0
src/main/webapp/WEB-INF/views/mob/cart/CartListFormMob.html

@@ -20,12 +20,95 @@
 <th:block layout:fragment="content">
 
 	<script type="text/javascript" src="//wcs.naver.net/wcslog.js"></script>
+	<script type="text/javascript" th:src="${@environment.getProperty('naverPay.button.mobile.js.url')}" src="" charset="UTF-8"></script>
+	<form id="nPayForm" name="nPayForm"></form>
 
 	<main role="" id="" class="container od">
 		<section class="content shopping_bag" id="cartAjaxList">
 			<!-- 장바구니 내용 -->
 		</section>
 
+		<div class="inner" style="margin-top:10px;">
+			<th:block th:if="${sessionInfo != null and (sessionInfo.custId == 'xodud1202' or sessionInfo.custId == 'jsh77b' or sessionInfo.custId == 'card007')}">
+				<th:block th:with="buttonKey=${@environment.getProperty('naverPay.button.key')}">
+					<script th:inline="javascript">
+						if(!wcs_add) var wcs_add = {};
+						wcs_add["wa"] = [[${@environment.getProperty('naverPay.common.certification.key')}]];
+						wcs.inflow("style24.com");
+						wcs_do();
+					</script>
+
+					<script type="text/javascript" >
+						/*버튼설정*/
+						naver.NaverPayButton.apply({
+							BUTTON_KEY              : "[[${buttonKey}]]",       // 네이버페이에서 제공받은 버튼 인증 키 입력
+							TYPE                    : "MA",                      // 버튼 모음 종류 설정
+							COLOR                   : 1,                        // 버튼 모음의 색 설정
+							COUNT                   : 1,                        // 버튼 개수 설정. 구매하기 버튼만 있으면(장바구니 페이지) 1, 찜하기 버튼도 있으면(상품 상세 페이지) 2를 입력.
+							ENABLE                  : "Y",                      // 품절 등의 이유로 버튼 모음을 비활성화할 때에는 "N" 입력
+							BUY_BUTTON_HANDLER      : buy_nc,                   // 구매하기 버튼 이벤트 Handler 함수 등록, 품절인 경우 not_buy_nc 함수 사용
+							"":""
+						});
+						
+						/*네이버구매하기*/
+						function buy_nc() {
+							// 자사 일반 상품 정보
+							let cartSqArr = [];
+							
+							$("#cartListForm .cartInfo").each(function(idx, item) {
+								if ($(item).find('input[name=cartSqArr]').is(':checked')) {
+									cartSqArr.push($(item).find('input[name=cartSqArr]').val());
+								}
+							});
+							
+							// 네이버페이 주문형 결제
+							buy_nc_req(cartSqArr);
+							
+							return false;
+						}
+						
+						function buy_nc_req(cartSqArr) {
+							let data = {  cartSqArr : cartSqArr
+								, backUrl : location.href
+								, goodsUrl : _PAGE_GOODS_DETAIL
+							};
+							let jsonData = JSON.stringify(data);
+							
+							$.ajax( {
+								type		: "POST",
+								url 		: "/pg/nPayReq",
+								dataType 	: 'json',
+								data		: jsonData,
+								beforeSend : function(xhr, settings) {
+									xhr.setRequestHeader("AJAX"			, "true");
+									xhr.setRequestHeader('Accept'		, 'application/json');
+									xhr.setRequestHeader('Content-Type'	, 'application/json');
+								},
+								error: function(xhr, status, error) {
+									mcxDialog.alert(status + '; ' + error);
+								},
+								success : function(result) {
+									if (result.state == "sucess") {
+										enp('create', 'conversion', 'is24', { device: 'M', paySys: 'naverPay' });	// 모비온 네이버주문형 클릭시
+										document.nPayForm.action = result.npayOrderUrl + "/" + result.orderKey + "/" + result.resultNo;
+										document.nPayForm.submit();
+									} else {
+										mcxDialog.alert(result.message);
+									}
+								}
+							});
+						}
+						
+						<!-- 구매불가 -->
+						function not_buy_nc() {
+							mcxDialog.alert("죄송합니다. 네이버페이로 구매가 불가한 상품입니다.");
+							return false;
+						}
+					</script>
+				</th:block>
+			</th:block>
+		</div>
+
 		<th:block th:if="${cartSize>0}">
 			<div class="od_recommend" style="background-color:white;">
 				<h3>추천상품</h3>

+ 1 - 1
src/main/webapp/WEB-INF/views/mob/goods/GoodsDetailFormMob.html

@@ -1088,7 +1088,7 @@
 									/*버튼설정*/
 									naver.NaverPayButton.apply({
 										BUTTON_KEY              : "[[${buttonKey}]]",       // 네이버페이에서 제공받은 버튼 인증 키 입력
-										TYPE                    : "MA",                      // 버튼 모음 종류 설정
+										TYPE                    : "MA",                     // 버튼 모음 종류 설정
 										COLOR                   : 1,                        // 버튼 모음의 색 설정
 										COUNT                   : 2,                        // 버튼 개수 설정. 구매하기 버튼만 있으면(장바구니 페이지) 1, 찜하기 버튼도 있으면(상품 상세 페이지) 2를 입력.
 										ENABLE                  : "Y",                      // 품절 등의 이유로 버튼 모음을 비활성화할 때에는 "N" 입력

+ 81 - 1
src/main/webapp/WEB-INF/views/web/cart/CartListFormWeb.html

@@ -25,6 +25,8 @@
     <script type="text/javascript" th:src="${@environment.getProperty('pg.kcp.js.url')}" src=""></script>
     <script type="text/javascript" src="/biz/payment.js"></script>
 	<script type="text/javascript" src="//wcs.naver.net/wcslog.js"></script>
+	<script type="text/javascript" th:src="${@environment.getProperty('naverPay.button.mobile.js.url')}" src="" charset="UTF-8"></script>
+	<form id="nPayForm" name="nPayForm"></form>
 
 	<!--  container -->
 	<div id="container" class="container od">
@@ -43,6 +45,84 @@
 				<div id="cartAjaxList" class="cont_body">
 					<!-- 장바구니 내용 -->
 				</div>
+				<th:block th:if="${sessionInfo != null and (sessionInfo.custId == 'xodud1202' or sessionInfo.custId == 'jsh77b' or sessionInfo.custId == 'card007')}">
+					<div style="margin-top:10px;">
+						<th:block th:with="buttonKey=${@environment.getProperty('naverPay.button.key')}">
+							<script type="text/javascript" th:src="${@environment.getProperty('naverPay.button.pc.js.url')}" src="" charset="UTF-8"></script>
+
+							<script th:inline="javascript">
+								if(!wcs_add) var wcs_add = {};
+								wcs_add["wa"] = [[${@environment.getProperty('naverPay.common.certification.key')}]];
+								wcs.inflow("style24.com");
+								wcs_do();
+							</script>
+
+							<script type="text/javascript">
+								/*버튼설정*/
+								naver.NaverPayButton.apply({
+									BUTTON_KEY              : "[[${buttonKey}]]",       // 네이버페이에서 제공받은 버튼 인증 키 입력
+									TYPE                    : "C",                      // 버튼 모음 종류 설정
+									COLOR                   : 1,                        // 버튼 모음의 색 설정
+									COUNT                   : 1,                        // 버튼 개수 설정. 구매하기 버튼만 있으면(장바구니 페이지) 1, 찜하기 버튼도 있으면(상품 상세 페이지) 2를 입력.
+									ENABLE                  : "Y",                      // 품절 등의 이유로 버튼 모음을 비활성화할 때에는 "N" 입력
+									BUY_BUTTON_HANDLER      : buy_nc,                   // 구매하기 버튼 이벤트 Handler 함수 등록, 품절인 경우 not_buy_nc 함수 사용
+									"":""
+								});
+								
+								/*네이버구매하기*/
+								function buy_nc() {
+									let cartSqArr = []
+									$("#cartListForm input[name=cartSqArr]:checked").each(function() {
+										cartSqArr.push($(this).val());
+									});
+									
+									buy_nc_req(cartSqArr);
+								}
+								
+								function buy_nc_req(cartSqArr) {
+									let data = {  cartSqArr : cartSqArr
+										, backUrl : location.href
+										, goodsUrl : _PAGE_GOODS_DETAIL
+									};
+									let jsonData = JSON.stringify(data);
+									
+									$.ajax( {
+										type		: "POST",
+										url 		: "/pg/nPayReq",
+										dataType 	: 'json',
+										data		: jsonData,
+										beforeSend : function(xhr, settings) {
+											xhr.setRequestHeader("AJAX"			, "true");
+											xhr.setRequestHeader('Accept'		, 'application/json');
+											xhr.setRequestHeader('Content-Type'	, 'application/json');
+										},
+										error: function(xhr, status, error) {
+											mcxDialog.alert(status + '; ' + error);
+										},
+										success : function(result) {
+											if (result.state == "sucess") {
+												enp('create', 'conversion', 'is24', { device: 'W', paySys: 'naverPay' });	// 모비온 네이버주문형 클릭시
+												window.open('about:blank', 'popupView');
+												document.nPayForm.target = 'popupView';
+												document.nPayForm.action = result.npayOrderUrl + "/" + result.orderKey + "/" + result.resultNo;
+												document.nPayForm.submit();
+											} else {
+												mcxDialog.alert(result.message);
+											}
+										}
+									});
+								}
+								
+								<!-- 구매불가 -->
+								function not_buy_nc() {
+									mcxDialog.alert("죄송합니다. 네이버페이로 구매가 불가한 상품입니다.");
+									return false;
+								}
+								//]]>
+							</script>
+						</th:block>
+					</div>
+				</th:block>
 			</div>
 
 			<th:block th:if="${cartSize>0}">
@@ -183,7 +263,7 @@
             dataType : 'html',
             success : function(result) {
                 if (result != null) {
-                	$("#cartListForm").remove();
+                    $("#cartListForm").remove();
                     $("#cartAjaxList").html(result);
                 }
             }