|
|
@@ -324,6 +324,7 @@
|
|
|
</tbody>
|
|
|
</table>
|
|
|
<div class="mdPopBtnB aR">
|
|
|
+ <button type="button" class="btn btn-info btn-lg" onclick="fnCustomerIssuePopUp();" th:if="${mode == 'U'}">쿠폰발행</button>
|
|
|
<button type="button" class="btn btn-info btn-lg" onclick="fnCouponCreate();" th:if="${mode == 'N'}">등록</button>
|
|
|
<button type="button" class="btn btn-info btn-lg" onclick="fnCouponUpdate();" th:if="${mode == 'U'}">수정</button>
|
|
|
</div>
|
|
|
@@ -426,7 +427,6 @@
|
|
|
<ul class="panelBar">
|
|
|
<li class="left">
|
|
|
<button type="button" class="btn btn-warning btn-lg" id="btnAddRow">행추가</button>
|
|
|
- <button type="button" class="btn btn-danger btn-lg" id="btnDeleteRow">행삭제</button>
|
|
|
</li>
|
|
|
</ul>
|
|
|
|
|
|
@@ -567,20 +567,19 @@
|
|
|
|
|
|
// 쿠폰 등록 버튼 클릭시
|
|
|
function fnCouponCreate(){
|
|
|
- // 필수값들 셋팅
|
|
|
- setReqValue();
|
|
|
-
|
|
|
- // 필수값 validation 체크
|
|
|
- if (!gagajf.validation('#CouponForm')) {
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- checkValidation();
|
|
|
-
|
|
|
mcxDialog.confirm('저장하시겠습니까?' , {
|
|
|
cancelBtnText:"취소",
|
|
|
sureBtnText:"확인",
|
|
|
sureBtnClick: function () {
|
|
|
+ gagajf.removeCommaAtNumberFormattedInput('#CouponForm');
|
|
|
+ // 필수값들 셋팅
|
|
|
+ setReqValue();
|
|
|
+ // 필수값 validation 체크
|
|
|
+ if (!gagajf.validation('#CouponForm')) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ checkValidation();
|
|
|
+
|
|
|
gagajf.ajaxFormSubmit($('#CouponForm').prop('action'), '#CouponForm', function() {
|
|
|
uifnPopupClose('CouponRegForm');
|
|
|
$('#btnSearch').trigger('click');
|
|
|
@@ -591,20 +590,19 @@
|
|
|
|
|
|
// 쿠폰 수정 시
|
|
|
function fnCouponUpdate(){
|
|
|
- // 필수값들 셋팅
|
|
|
- setReqValue();
|
|
|
- gagajf.removeCommaAtNumberFormattedInput('#CouponForm');
|
|
|
- // 필수값 validation 체크
|
|
|
- if (!gagajf.validation('#CouponForm')) {
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- checkValidation();
|
|
|
-
|
|
|
mcxDialog.confirm('수정하시겠습니까?' , {
|
|
|
cancelBtnText:"취소",
|
|
|
sureBtnText:"확인",
|
|
|
sureBtnClick: function () {
|
|
|
+ gagajf.removeCommaAtNumberFormattedInput('#CouponForm');
|
|
|
+ // 필수값들 셋팅
|
|
|
+ setReqValue();
|
|
|
+ // 필수값 validation 체크
|
|
|
+ if (!gagajf.validation('#CouponForm')) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ checkValidation();
|
|
|
+
|
|
|
$("#CouponForm input[name=cpnId]").prop("disabled", false);
|
|
|
$("#CouponForm input[name=cpnId]").attr("required", true);
|
|
|
$("#CouponForm input[name=cpnId]").attr("placeholder", "");
|
|
|
@@ -758,7 +756,39 @@
|
|
|
|
|
|
// 적용대상 - 브랜드 삭제 버튼시
|
|
|
$('#btnBrandDel').on('click' , function(){
|
|
|
- brandGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(brandGridOptions)});
|
|
|
+ var selectVal = brandGridOptions.api.getSelectedRows();
|
|
|
+
|
|
|
+ if(selectVal.length == 0) {
|
|
|
+ mcxDialog.alert("선택된 행이 없습니다");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 상세조회면 데이터까지 삭제
|
|
|
+ if(cpnDetail != null ) {
|
|
|
+ var removeVal = gagaAgGrid.removeRowData(brandGridOptions , false);
|
|
|
+ var cpnRefvalSqArr = [];
|
|
|
+
|
|
|
+ $.each(selectVal , function(idx , item){
|
|
|
+ cpnRefvalSqArr.push(item.cpnRefvalSq);
|
|
|
+ });
|
|
|
+
|
|
|
+ if(removeVal.length > 0) {
|
|
|
+ mcxDialog.confirm('삭제하시겠습니까?', {
|
|
|
+ cancelBtnText: "취소",
|
|
|
+ sureBtnText: "확인",
|
|
|
+ sureBtnClick: function(){
|
|
|
+ var data = { cpnRefvalSqArr : cpnRefvalSqArr
|
|
|
+ ,cpnId : cpnDetail.cpnId
|
|
|
+ };
|
|
|
+
|
|
|
+ var jsonData = JSON.stringify(data);
|
|
|
+ gagajf.ajaxJsonSubmit('/marketing/coupon/refval/update', jsonData);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 신규화면이면 그리드상 삭제
|
|
|
+ brandGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(brandGridOptions)});
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
// 적용대상 - 공급처 추가 버튼시
|
|
|
@@ -787,7 +817,37 @@
|
|
|
|
|
|
// 적용대상 - 공급처 삭제시시
|
|
|
$('#btnSupplyDel').on('click' , function () {
|
|
|
- supplyGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(supplyGridOptions)});
|
|
|
+ var selectVal = supplyGridOptions.api.getSelectedRows();
|
|
|
+
|
|
|
+ if(selectVal.length == 0) {
|
|
|
+ mcxDialog.alert("선택된 행이 없습니다");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(cpnDetail != null ) {
|
|
|
+ mcxDialog.confirm('삭제하시겠습니까?', {
|
|
|
+ cancelBtnText: "취소",
|
|
|
+ sureBtnText: "확인",
|
|
|
+ sureBtnClick: function(){
|
|
|
+ gagaAgGrid.removeRowData(supplyGridOptions , false);
|
|
|
+ var cpnRefvalSqArr = [];
|
|
|
+
|
|
|
+ $.each(selectVal , function(idx , item){
|
|
|
+ cpnRefvalSqArr.push(item.cpnRefvalSq);
|
|
|
+ });
|
|
|
+
|
|
|
+ var data = { cpnRefvalSqArr : cpnRefvalSqArr
|
|
|
+ ,cpnId : $('#CouponForm #cpnId').val()
|
|
|
+ };
|
|
|
+
|
|
|
+ var jsonData = JSON.stringify(data);
|
|
|
+ gagajf.ajaxJsonSubmit('/marketing/coupon/refval/update', jsonData);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ // 신규화면이면 그리드상 삭제
|
|
|
+ supplyGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(supplyGridOptions)});
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
// 적용대상 - 카테고리 추가시
|
|
|
@@ -816,7 +876,36 @@
|
|
|
|
|
|
// 적용대상 - 카테고리 삭제시
|
|
|
$('#btnCateDel').on('click' , function () {
|
|
|
- cateGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(cateGridOptions)});
|
|
|
+ var selectVal = cateGridOptions.api.getSelectedRows();
|
|
|
+
|
|
|
+ if(selectVal.length == 0) {
|
|
|
+ mcxDialog.alert("선택된 행이 없습니다");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(cpnDetail != null) {
|
|
|
+ mcxDialog.confirm('삭제하시겠습니까?', {
|
|
|
+ cancelBtnText: "취소",
|
|
|
+ sureBtnText: "확인",
|
|
|
+ sureBtnClick: function(){
|
|
|
+ gagaAgGrid.removeRowData(cateGridOptions , false);
|
|
|
+
|
|
|
+ var cpnRefvalSqArr = [];
|
|
|
+
|
|
|
+ $.each(selectVal , function(idx , item){
|
|
|
+ cpnRefvalSqArr.push(item.cpnRefvalSq);
|
|
|
+ });
|
|
|
+
|
|
|
+ var data = { cpnRefvalSqArr : cpnRefvalSqArr
|
|
|
+ ,cpnId : $('#CouponForm #cpnId').val()
|
|
|
+ };
|
|
|
+
|
|
|
+ var jsonData = JSON.stringify(data);
|
|
|
+ gagajf.ajaxJsonSubmit('/marketing/coupon/refval/update', jsonData);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ cateGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(cateGridOptions)});
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
// 적용대상 - 상품 추가시
|
|
|
@@ -831,42 +920,77 @@
|
|
|
|
|
|
// 적용대상 - 상품 삭제 시
|
|
|
$('#btnGoodsDel').on('click' , function () {
|
|
|
- goodsGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(goodsGridOptions)});
|
|
|
+ var selectVal = goodsGridOptions.api.getSelectedRows();
|
|
|
+
|
|
|
+ if(selectVal.length == 0) {
|
|
|
+ mcxDialog.alert("선택된 행이 없습니다");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(cpnDetail != null ) {
|
|
|
+ mcxDialog.confirm('삭제하시겠습니까?', {
|
|
|
+ cancelBtnText: "취소",
|
|
|
+ sureBtnText: "확인",
|
|
|
+ sureBtnClick: function(){
|
|
|
+ gagaAgGrid.removeRowData(goodsGridOptions , false);
|
|
|
+ var cpnRefvalSqArr = [];
|
|
|
+
|
|
|
+ $.each(selectVal , function(idx , item){
|
|
|
+ cpnRefvalSqArr.push(item.cpnRefvalSq);
|
|
|
+ });
|
|
|
+ var data = { cpnRefvalSqArr : cpnRefvalSqArr
|
|
|
+ ,cpnId : $('#CouponForm #cpnId').val()
|
|
|
+ };
|
|
|
+
|
|
|
+ var jsonData = JSON.stringify(data);
|
|
|
+ gagajf.ajaxJsonSubmit('/marketing/coupon/refval/update', jsonData);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ goodsGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(goodsGridOptions)});
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
// 적용대상 - 제외상품 추가시
|
|
|
- $('#btnExcepGoodsAdd').on('click' , function(result){
|
|
|
- gridAddGoodsList(excepGoodsGridOptions, result , "except");
|
|
|
+ $('#btnExcepGoodsAdd').on('click' , function(){
|
|
|
+ cfnOpenGoodsPopup("fnSetPopupExceptGoodsInfo");
|
|
|
});
|
|
|
+ // 적용 상품 리스트 콜백함수
|
|
|
+ var fnSetPopupExceptGoodsInfo = function(result) {
|
|
|
+ gridAddGoodsList(excepGoodsGridOptions, result , "except");
|
|
|
+ };
|
|
|
|
|
|
+ // 적용대상 - 제외상품 삭제시
|
|
|
$('#btnExcepGoodsDel').on('click' , function () {
|
|
|
- var selectVal = exceptGoodsGbList.api.getSelectedRows();
|
|
|
+ var selectVal = excepGoodsGridOptions.api.getSelectedRows();
|
|
|
|
|
|
if(selectVal.length == 0) {
|
|
|
mcxDialog.alert("선택된 행이 없습니다");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- var removeVal = gagaAgGrid.removeRowData(exceptGoodsGbList , false);
|
|
|
- var cpnRefvalSqArr = [];
|
|
|
-
|
|
|
- $.each(selectVal , function(idx , item){
|
|
|
- cpnRefvalSqArr.push(item.cpnRefvalSq);
|
|
|
- });
|
|
|
-
|
|
|
- if(removeVal.length > 0) {
|
|
|
+ if(cpnDetail != null ) {
|
|
|
mcxDialog.confirm('삭제하시겠습니까?', {
|
|
|
cancelBtnText: "취소",
|
|
|
sureBtnText: "확인",
|
|
|
sureBtnClick: function(){
|
|
|
+ gagaAgGrid.removeRowData(excepGoodsGridOptions , false);
|
|
|
+ var cpnRefvalSqArr = [];
|
|
|
+
|
|
|
+ $.each(selectVal , function(idx , item){
|
|
|
+ cpnRefvalSqArr.push(item.cpnRefvalSq);
|
|
|
+ });
|
|
|
+
|
|
|
var data = { cpnRefvalSqArr : cpnRefvalSqArr
|
|
|
- ,cpnId : $('#CouponForm #cpnId').val();
|
|
|
+ ,cpnId : $('#CouponForm #cpnId').val()
|
|
|
};
|
|
|
|
|
|
var jsonData = JSON.stringify(data);
|
|
|
+
|
|
|
gagajf.ajaxJsonSubmit('/marketing/coupon/refval/update', jsonData);
|
|
|
}
|
|
|
});
|
|
|
+ } else {
|
|
|
+ excepGoodsGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(excepGoodsGridOptions)});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
@@ -887,7 +1011,6 @@
|
|
|
|
|
|
// 중복되지 않은 데이터 리스트에 추가
|
|
|
if(addChk) {
|
|
|
- //gagaAgGrid.addRowData(OriginGridListOption, result[i], "goodsCd");
|
|
|
gagaAgGrid.addRowData(OriginGridListOption, {"goodsGb": goodsGbVal, "goodsCd" : result[i].goodsCd, "goodsNm" : result[i].goodsNm});
|
|
|
}
|
|
|
}
|
|
|
@@ -1018,6 +1141,10 @@
|
|
|
|
|
|
});
|
|
|
}
|
|
|
+ // 쿠폰발행팝업
|
|
|
+ function fnCustomerIssuePopUp(){
|
|
|
+ cfnCpnPubForCustPopup();
|
|
|
+ };
|
|
|
|
|
|
// 전송시 값 세팅
|
|
|
function setReqValue(){
|
|
|
@@ -1100,13 +1227,13 @@
|
|
|
$("#CouponForm input:radio[name='rdoDcWay']:radio[value=" + cpnDetail.dcWay + "]").prop('checked', true);
|
|
|
$("#CouponForm input:radio[name='rdoCpnType']:radio[value=" + cpnDetail.cpnType + "]").prop('checked', true);
|
|
|
$("#CouponForm input:radio[name='rdoApplyScope']:radio[value=" + cpnDetail.applyScope + "]").prop('checked', true);
|
|
|
- $("#CouponForm #dcPval").val(cpnDetail.dcPval.addComma());
|
|
|
- $("#CouponForm #dcMval").val(cpnDetail.dcMval.addComma());
|
|
|
- $("#CouponForm #dcAval").val(cpnDetail.dcAval.addComma());
|
|
|
- $("#CouponForm #maxDcAmt").val(cpnDetail.maxDcAmt.addComma());
|
|
|
- $("#CouponForm #totPubLimitQty").val(cpnDetail.totPubLimitQty.addComma());
|
|
|
- $("#CouponForm #custPubLimitQty").val(cpnDetail.custPubLimitQty.addComma());
|
|
|
- $("#CouponForm #onePubQty").val(cpnDetail.onePubQty.addComma());
|
|
|
+ $("#CouponForm #dcPval").val(cpnDetail.dcPval);
|
|
|
+ $("#CouponForm #dcMval").val(cpnDetail.dcMval);
|
|
|
+ $("#CouponForm #dcAval").val(cpnDetail.dcAval);
|
|
|
+ $("#CouponForm #maxDcAmt").val(cpnDetail.maxDcAmt);
|
|
|
+ $("#CouponForm #totPubLimitQty").val(cpnDetail.totPubLimitQty);
|
|
|
+ $("#CouponForm #custPubLimitQty").val(cpnDetail.custPubLimitQty);
|
|
|
+ $("#CouponForm #onePubQty").val(cpnDetail.onePubQty);
|
|
|
$("#CouponForm #usableCustGb").val(cpnDetail.usableCustGb).prop("selected", true);
|
|
|
$("#CouponForm #usableCustGrade").val(cpnDetail.usableCustGrade).prop("selected", true);
|
|
|
$("#CouponForm #endAlimYn").val(cpnDetail.endAlimYn).prop("selected", true);
|
|
|
@@ -1117,14 +1244,24 @@
|
|
|
$("#CouponForm #custJoinYn").val(cpnDetail.custJoinYn).prop("selected", true);
|
|
|
$("#CouponForm #pdGb").val(cpnDetail.pdGb).prop("selected", true);
|
|
|
$("#CouponForm #siteCd").val(cpnDetail.siteCd).prop("selected", true);
|
|
|
+ $("#CouponForm #afChannel").val(cpnDetail.afChannel).prop("selected", true);
|
|
|
$("#CouponForm #cpnNm").val(cpnDetail.cpnNm);
|
|
|
$("#CouponForm #downYn").val(cpnDetail.downYn);
|
|
|
- $("#CouponForm #buyLimitAmt").val(cpnDetail.buyLimitAmt.addComma());
|
|
|
+ $("#CouponForm #buyLimitAmt").val(cpnDetail.buyLimitAmt);
|
|
|
$("#CouponForm #cpnId").val(cpnDetail.cpnId);
|
|
|
+
|
|
|
+ /*
|
|
|
+ $("#CouponForm input:checkbox[name='cpnCreateType']").parent("label").addClass("formControl");
|
|
|
+ $("#CouponForm input:checkbox[name='cpnCreateType']").parent("label").prop('disabled', true);
|
|
|
+ $("#CouponForm input:checkbox[name='cpnCreateType']").addClass("formControl");
|
|
|
+ $("#CouponForm input:checkbox[name='cpnCreateType']").prop('disabled', true);
|
|
|
+ */
|
|
|
// 만약 쿠폰 발급한 내역이 있으면 쿠폰수정못하게 readonly , disabled 속성 추가
|
|
|
if (issueCnt > 0) {
|
|
|
$("#CouponForm #usableCustGb").attr('readonly', true);
|
|
|
$("#CouponForm #usableCustGb").attr('disabled', true);
|
|
|
+ $("#CouponForm #afChannel").attr('readonly', true);
|
|
|
+ $("#CouponForm #afChannel").attr('disabled', true);
|
|
|
$("#CouponForm #usableCustGrade").attr('readonly', true);
|
|
|
$("#CouponForm #usableCustGrade").attr('disabled', true);
|
|
|
$("#CouponForm #endAlimYn").attr('readonly', true);
|
|
|
@@ -1216,10 +1353,20 @@
|
|
|
$("#CouponForm #custJoinStMM").attr('disabled', true);
|
|
|
}
|
|
|
}
|
|
|
+ // 기본세팅
|
|
|
pdGbChange();
|
|
|
firstYnChange();
|
|
|
custJoinYnChange();
|
|
|
fnChangeAfLinkCdList();
|
|
|
+
|
|
|
+ // 제휴채널2뎁스 기본세팅
|
|
|
+ if(cpnDetail != null ) {
|
|
|
+ $("#CouponForm #afLinkCd").val(cpnDetail.afLinkCd).prop("selected", true);
|
|
|
+ if(issueCnt > 0 ) {
|
|
|
+ $("#CouponForm #afLinkCd").attr('readonly', true);
|
|
|
+ $("#CouponForm #afLinkCd").attr('disabled', true);
|
|
|
+ }
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
// 날짜분리 ( 시작/종료날짜구분(start , end) , 날짜String , 적용타겟대상 )
|
|
|
@@ -1238,7 +1385,7 @@
|
|
|
$("#CouponForm #"+targetGb+"EdMM").val(timeArr[1]);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ // 제한없음 문구 변경
|
|
|
$("input[name=totPubLimitQty],input[name=custPubLimitQty],input[name=buyLimitAmt],input[name=onePubQty]").change(function(){
|
|
|
if($(this).val() == "0"){
|
|
|
$("#"+$(this).attr("name")+"Span").html("*제한없음");
|
|
|
@@ -1251,6 +1398,11 @@
|
|
|
$("input[name=totPubLimitQty],input[name=custPubLimitQty],input[name=buyLimitAmt],input[name=onePubQty]").change();
|
|
|
}, 1);
|
|
|
|
|
|
+ // 콤마 찍어주기
|
|
|
+ $(function(){
|
|
|
+ setComma("CouponForm" , true);
|
|
|
+ });
|
|
|
+
|
|
|
function setComma(formId, pBoolean){
|
|
|
setTimeout(function(){
|
|
|
//숫자타입 콤마 찍어주기
|
|
|
@@ -1270,7 +1422,6 @@
|
|
|
});
|
|
|
}, 300);
|
|
|
}
|
|
|
-
|
|
|
/*]]>*/
|
|
|
</script>
|
|
|
</html>
|