jsshin 5 rokov pred
rodič
commit
de9e277386

+ 11 - 0
src/main/java/com/style24/admin/biz/service/TsaCouponService.java

@@ -408,4 +408,15 @@ public class TsaCouponService {
 	public ArrayList<CustCoupon> getRandomCouponInfo(int cpnId) {
 		return couponDao.getRandomCouponInfo(cpnId);
 	}
+
+	/**
+	 * 회원상세 - 쿠폰발급
+	 * @param coupon - 쿠폰정보
+	 * @author jsshin
+	 * @since 2021. 1. 29
+	 */
+	@Transactional("shopTxnManager")
+	public void saveCouponIssue(CustCoupon coupon) {
+		couponDao.saveCouponCustPub(coupon);
+	}
 }

+ 14 - 1
src/main/java/com/style24/admin/biz/web/TsaMarketingController.java

@@ -950,7 +950,7 @@ public class TsaMarketingController extends TsaBaseController {
 	 * @param elementCustNo - 고객일련번호
 	 * @return ModelAndView
 	 * @author jsshin
-	 * @since 2021. 1. 8
+	 * @since 2021. 1. 28
 	 */
 	@GetMapping("/coupon/issue/popup/form")
 	@ResponseBody
@@ -979,4 +979,17 @@ public class TsaMarketingController extends TsaBaseController {
 		return mav;
 	}
 
+	/**
+	 * 회원상세 - 쿠폰발급
+	 * @param coupon - 쿠폰정보
+	 * @return GagaResponse
+	 * @author jsshin
+	 * @since 2021. 1. 29
+	 */
+	@PostMapping("/coupon/issue/save")
+	@ResponseBody
+	public GagaResponse saveCouponIssue(@RequestBody CustCoupon custCoupon) {
+		couponService.saveCouponIssue(custCoupon);
+		return super.ok(message.getMessage("SUCC_0006"));
+	}
 }

+ 0 - 1
src/main/java/com/style24/persistence/mybatis/shop/TsaCoupon.xml

@@ -292,7 +292,6 @@
 		SELECT A.CPN_ID                                               /*쿠폰ID*/
 		     , A.CPN_NM                                               /*쿠폰명*/
 		     , A.SITE_CD                                              /*사이트코드(공통코드G000)*/
-		     , A.USABLE_CUST_GB                                       /*사용가능고객구분(공통코드G100)*/
 		     , A.CPN_TYPE                                             /*쿠폰유형(공통코드G230)*/
 		     , A.DC_WAY                                               /*할인방식(공통코드G240)*/
 		     , A.DC_PVAL                                              /*할인값(PC). 할인방식이 금액이면 할인금액, 율이면 할인율*/

+ 166 - 24
src/main/webapp/WEB-INF/views/marketing/CouponIssuePopupForm.html

@@ -14,8 +14,11 @@
  * 1.0  2021.01.28   jsshin     최초 작성
  *******************************************************************************
  -->
-<div class="modalPopup" data-width="1200" id="popupCouponIssue">
-	<div class="panelStyle">
+<style>
+
+</style>
+<div class="modalPopup" data-width="600" id="popupCouponIssue">
+	<div id="panel" class="panelStyle">
 		<!-- TITLE -->
 		<div class="panelTitle">
 			<strong>쿠폰 발급</strong>
@@ -56,7 +59,7 @@
 							</td>
 							<th>쿠폰명</th>
 							<td>
-								<input type="text" name="cpnNm" maxlength="50" th:value="${cpnNm}"/>
+								<input type="text" name="cpnNm" maxlength="50"/>
 							</td>
 						</tr>
 					</tbody>
@@ -73,9 +76,75 @@
 
 		<!-- 리스트 영역 -->
 		<div class="panelContent">
-			<div id="gridCouponList" style="width: 100%; height: 470px" class="ag-theme-balham"></div>
+			<div id="gridCouponList" style="width: 100%; height: 250px" class="ag-theme-balham"></div>
+		</div>
+
+		<div class="panelContent">
+			<form id="couponIssueForm" name="couponIssueForm">
+				<input type="hidden" name="cpnId"/>
+				<input type="hidden" name="pdGb"/>
+				<input type="hidden" name="custNo"/>
+				<table class="frmStyle" aria-describedby="발급내용">
+					<colgroup>
+						<col style="width: 10%"/>
+						<col style="width: 40%"/>
+						<col style="width: 10%"/>
+						<col style="width: 40%"/>
+					</colgroup>
+					<tr id="availTermsTr">
+						<th class="availTerm">유효기간시작일시<em class="required" title="필수"></em></th>
+						<td class="availTerm">
+							<input type="text" name="availStdt" class="schDate w100" data-valid-name="유효기간시작일시"/>
+							<select name="availStHH" class="w80" data-valid-name="유효기간시작(시)"required="required">
+								<th:block th:each="num, index : ${#numbers.sequence(0, 23)}">
+									<option th:value="${#numbers.formatInteger(num, 2)}" th:text="|${#numbers.formatInteger(num, 2)}시|">시간</option>
+								</th:block>
+							</select>
+							<select name="availStMM" class="w80" data-valid-name="유효기간시작(분)" required="required">
+								<th:block th:each="num, index : ${#numbers.sequence(0, 59)}">
+									<option th:value="${#numbers.formatInteger(num, 2)}" th:text="|${#numbers.formatInteger(num, 2)}분|">분</option>
+								</th:block>
+							</select>
+						</td>
+
+						<th class="availTerm">유효기간종료일시<em class="required" title="필수"></em></th>
+						<td class="availTerm">
+							<input type="text" name="availEddt" class="schDate w200" data-valid-name="유효기간종료일시"/>
+							<select name="availEdHH" class="w80" data-valid-name="유효기간종료(시)">
+								<th:block th:each="num, index  : ${#numbers.sequence(0, 23)}">
+									<option th:value="${#numbers.formatInteger(num, 2)}" th:text="|${#numbers.formatInteger(num, 2)}시|">시간</option>
+								</th:block>
+							</select>
+							<select name="availEdMM" class="w80" data-valid-name="유효기간종료(분)">
+								<th:block th:each="num: ${#numbers.sequence(0, 59)}">
+									<option th:value="${#numbers.formatInteger(num, 2)}" th:text="|${#numbers.formatInteger(num, 2)}분|">분</option>
+								</th:block>
+							</select>
+						</td>
+					</tr>
+					<tr id="availDaysTr" style="display:none;">
+						<th>유효기간(일)</th>
+						<td><input type="text" name="availDays" data-valid-type="integer"></td>
+					</tr>
+					<tr>
+						<th>발급사유</th>
+						<td colspan="3">
+							<select name="pubReason" data-valid-name="발급사유" required>
+								<option th:if="${cpnPubReasonList}" th:each="oneData, status : ${cpnPubReasonList}" th:value="${oneData.cd}"
+										th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
+							</select>
+						</td>
+					</tr>
+					<tr>
+						<th>상세사유</th>
+						<td colspan="3">
+							<textarea name="pubReasonDtl" class="textareaR4" style="resize: none;"  data-valid-name="상세사유" required="required"></textarea>
+						</td>
+					</tr>
+				</table>
+			</form>
 		</div>
-		<!-- //리스트 영역 -->
+
 		
 		<!-- 버튼 배치 영역 -->
 		<ul class="panelBar">
@@ -128,22 +197,12 @@
 			headerName: "최고할인값", field: "maxDcAmt", width: 100, cellClass: "text-center",
 			cellRenderer: function(params) { return (!gagajf.isNull(params.value) ? gagaAgGrid.toAddComma(params.value) : '') + (params.data.dcWay == '10' ? '원' : '%'); }
 		},
-// 		{
-// 			headerName: "기간/일수", field: "pdGb", width: 100, cellClass: "text-center", hide: true,
-// 			cellRenderer: function(params) { return (params.value == 'P' ? '기간' : '일수'); }
-// 		},
-// 		{
-// 			headerName: "유효시작일시", field: "availStdt", width: 150, cellClass: "text-center", hide: true,
-// 			cellRenderer: function(params) { return !gagajf.isNull(params.value) ? gagaAgGrid.toDateTimeFormat(params.value) : ''; }
-// 		},
-// 		{
-// 			headerName: "유효종료일시", field: "availEddt", width: 150, cellClass: "text-center", hide: true,
-// 			cellRenderer: function(params) { return !gagajf.isNull(params.value) ? gagaAgGrid.toDateTimeFormat(params.value) : ''; }
-// 		},
-// 		{headerName: "유효일수", field: "availDays", width: 100, cellClass: "text-center", hide: true},
 		{
 			headerName: "유효기간", field: "availPeriod", width: 300, cellClass: "text-center",
-			cellRenderer: function(params) { return params.data.pdGb == 'P' ? gagaAgGrid.toDateTimeFormat(params.data.availStdt) + '~' + gagaAgGrid.toDateTimeFormat(params.data.availStdt) : gagaAgGrid.toAddComma(params.data.availDays) + '일'; }
+			cellRenderer: function(params) {
+				return params.data.pdGb == 'P' ? gagaAgGrid.toDateTimeFormat(params.data.availStdt)
+					+ '~' + gagaAgGrid.toDateTimeFormat(params.data.availStdt) : gagaAgGrid.toAddComma(params.data.availDays) + '일';
+			}
 		},
 		{headerName: "발행제한여부", field: "pubLimitYn", width: 100, cellClass: "text-center"},
 		{
@@ -169,7 +228,11 @@
 	
 	gridOptionsCouponList.rowSelection = 'single';
 	gridOptionsCouponList.rowMultiSelectWithClick = true; // 클릭으로 선택 가능
-	
+
+	// 셀 클릭 이벤트
+	gridOptionsCouponList.onCellClicked = function (event) {
+		fnBindCouponInfo(event.data);
+	};
 
 	// 조회
 	$('#btnSearchCouponRetrieve').on('click', function() {
@@ -180,19 +243,98 @@
 
 	// 발생
 	$('#btnIssueCoupon').on('click', function() {
-		var selectedData = gagaAgGrid.selectedRowData(gridOptionsCouponList);
+		let selectedData = gagaAgGrid.selectedRowData(gridOptionsCouponList);
 		if (selectedData.length == 0) {
 			mcxDialog.alert('선택된 쿠폰이 없습니다.');
 			return false;
 		}
 
+		if (!gagajf.validation('#couponIssueForm'))
+			return ;
+
+		let availStHH = $("#couponIssueForm select[name=availStHH]").val();
+		let availStMM = $("#couponIssueForm select[name=availStMM]").val();
+		let availEdHH = $("#couponIssueForm select[name=availEdHH]").val();
+		let availEdMM = $("#couponIssueForm select[name=availEdMM]").val();
+
+		let custCouponList = [];
+		let custCoupon = $("#couponIssueForm").serializeObject();
+		if (custCoupon.pdGb === 'P') {
+			if (gagajf.isNull(custCoupon.availStdt) && gagajf.isNull(custCoupon.availEddt)) {
+				mcxDialog.alert("유효 시작일시 / 유효 종료일시를 입력해주세요");
+				return;
+			}
+			custCoupon.availStdt = String(custCoupon.availStdt)+String(availStHH)+String(availStMM).replace('-', '');
+			custCoupon.availEddt = String(custCoupon.availEddt)+String(availEdHH)+String(availEdMM).replace('-', '');
+		}
+
+		if (custCoupon.pdGb === 'D') {
+			if (gagajf.isNull(custCoupon.availDays)) {
+				mcxDialog.alert("유효기간(일)을 입력해주세요");
+				return;
+			}
+		}
+
+
+		var action = "/marketing/coupon/issue/save";
+		mcxDialog.confirm("저장하시겠습니까?", {
+			cancelBtnText: "취소",
+			sureBtnText: "확인",
+			sureBtnClick: function () {
+				gagajf.ajaxJsonSubmit(action, JSON.stringify(custCoupon), fnIssueCouponCallBack);
+			}
+		});
+
 	});
-	
+
+	var fnIssueCouponCallBack = function () {
+		uifnPopupClose('popupCouponIssue');
+		fnSearchCoupon();
+	}
+
+
+
+	// 선택 쿠폰정보 셋팅
+	var fnBindCouponInfo = function(params) {
+		console.log('params', params);
+		$('#couponIssueForm input[name=cpnId]').val(params.cpnId);
+		$('#couponIssueForm input[name=pdGb]').val(params.pdGb);
+		$('#couponIssueForm input[name=availStdt]').val(gagaAgGrid.toDateFormat(params.availStdt));
+		$("#couponIssueForm select[name=availStHH]").val(params.availStdt.substring(8,10));
+		$("#couponIssueForm select[name=availStMM]").val(params.availStdt.substring(10,12));
+		$('#couponIssueForm input[name=availEddt]').val(gagaAgGrid.toDateFormat(params.availEddt));
+		$("#couponIssueForm select[name=availEdHH]").val(params.availEddt.substring(8,10));
+		$("#couponIssueForm select[name=availEdMM]").val(params.availEddt.substring(10,12));
+		$('#couponIssueForm input[name=availDays]').val(params.availDays);
+
+		//유효기간 숨김처리
+		if (params.pdGb === 'P') {
+			$("#availTermsTr").show();
+			$("#availDaysTr").hide();
+		} else if (params.pdGb === 'D') {
+			$("#availTermsTr").hide();
+			$("#availDaysTr").show();
+		}
+
+	}
+
+	var fnInitDataSet = function () {
+		let custNo = $(elementCustNo).val();
+		if(!gagajf.isNull(custNo)) {
+			$('#couponIssueForm input[name=custNo]').val(custNo);
+		}
+	};
+
 	$(document).ready(function() {
 		// Create a agGrid
 		gagaAgGrid.createGrid('gridCouponList', gridOptionsCouponList);
-		
-		$('#btnSearchCouponRetrieve').trigger('click');
+
+		fnInitDataSet();
+
+		//$('#panel').css({ width: 1200, height: 500 });
+
+		//$('#panel').attr('style', 'width: 1200 !important, height: 500 !important');
+
 	});
 /*]]>*/
 </script>

+ 5 - 5
src/main/webapp/WEB-INF/views/marketing/PointGrantPopupForm.html

@@ -38,7 +38,7 @@
 						<tr >
 							<th>사이트</th>
 							<td>
-								<select name="siteCd" data-valid-name="사이트" required>
+								<select name="siteCd" data-valid-name="사이트" required="required">
 									<option th:if="${siteCdList}" th:each="oneData, status : ${siteCdList}" th:value="${oneData.cd}" th:text="${oneData.cdNm}"></option>
 								</select>
 							</td>
@@ -46,7 +46,7 @@
 						<tr>
 							<th>포인트변경사유<em class="required" title="필수"></em></th>
 							<td>
-								<select name="occurGb" data-valid-name="포인트변경사유" required>
+								<select name="occurGb" data-valid-name="포인트변경사유" required="required">
 									<option value="">선택하세요</option>
 									<option th:if="${occurGbList}" th:each="oneData, status : ${occurGbList}" th:value="${oneData.cd}" th:text="${oneData.cdNm}"></option>
 								</select>
@@ -55,7 +55,7 @@
 						<tr>
 							<th>증감구분<em class="required" title="필수"></em></th>
 							<td>
-								<select id="signGb" name="signGb" data-valid-name="증감구분" required>
+								<select id="signGb" name="signGb" data-valid-name="증감구분" required="required">
 									<option value="">선택하세요</option>
 									<option value="+">증가</option>
 									<option value="-">감소</option>
@@ -71,13 +71,13 @@
 						<tr>
 							<th>적립포인트</th>
 							<td>
-								<input type="text" name="pntAmt" min="1" data-valid-name="적립포인트" data-valid-type="integer" maxlength="6" required/>
+								<input type="text" name="pntAmt" min="1" data-valid-name="적립포인트" data-valid-type="integer" maxlength="6" required="required"/>
 							</td>
 						</tr>
 						<tr>
 							<th>상세사유</th>
 							<td colspan="3">
-								<textarea name="occurDtlDesc" class="textareaR4" style="resize: none;" data-valid-name="상세사유" required></textarea>
+								<textarea name="occurDtlDesc" class="textareaR4" style="resize: none;" data-valid-name="상세사유" required="required"></textarea>
 							</td>
 						</tr>
 						</tbody>

+ 1 - 1
src/main/webapp/ux/css/admin.ui.css

@@ -599,7 +599,7 @@ hr {border:0; padding-bottom:10px;}/* 기본 여백 :10px */
 .w20 {width:20px !important;}
 .w50 {width:50px !important;}
 .w60 {width:60px !important;}
-.w70 {width:60px !important;}
+.w70 {width:70px !important;}
 .w80 {width:80px !important;}
 .w90 {width:80px !important;}
 .w100 {width:100px !important;}