|
|
@@ -346,24 +346,24 @@
|
|
|
</div>
|
|
|
<script th:inline="javascript">
|
|
|
/*<![CDATA[*/
|
|
|
- var mode = [[${mode}]];
|
|
|
- var cpnDetail = [[${cpnDetail}]];
|
|
|
- var cpnDtlRefvalSupplyCompList = [[${cpnDtlRefvalSupplyCompList}]];
|
|
|
- var cpnDtlRefvalApplyGoodsList = [[${cpnDtlRefvalApplyGoodsList}]];
|
|
|
- var cpnDtlRefvalCateList = [[${cpnDtlRefvalCateList}]];
|
|
|
- var cpnDtlRefvalBrandList = [[${cpnDtlRefvalBrandList}]];
|
|
|
+ var mode = [[${mode}]];
|
|
|
+ var cpnDetail = [[${cpnDetail}]];
|
|
|
+ var cpnDtlRefvalSupplyCompList = [[${cpnDtlRefvalSupplyCompList}]];
|
|
|
+ var cpnDtlRefvalApplyGoodsList = [[${cpnDtlRefvalApplyGoodsList}]];
|
|
|
+ var cpnDtlRefvalCateList = [[${cpnDtlRefvalCateList}]];
|
|
|
+ var cpnDtlRefvalBrandList = [[${cpnDtlRefvalBrandList}]];
|
|
|
var cpnDtlRefvalExceptGoodsList = [[${cpnDtlRefvalExceptGoodsList}]];
|
|
|
- var cpnDtlBurdenList = [[${cpnDtlBurdenList}]];
|
|
|
+ var cpnDtlBurdenList = [[${cpnDtlBurdenList}]];
|
|
|
|
|
|
var issueCnt = [[${issueCnt}]];
|
|
|
|
|
|
// 공통코드 리스트
|
|
|
- var ibSupplyComList = gagajf.convertToArray([[${ibSupplyCompList}]]);
|
|
|
- var formalGbList = gagajf.convertToArray([[${formalGbList}]]);
|
|
|
- var cateGbList = gagajf.convertToArray([[${cateGbList}]]);
|
|
|
- var delYnList = { "Y":"Yes", "N":"No" };
|
|
|
- var selfBrandList = gagajf.convertToArray([[${selfBrandList}]]);
|
|
|
- var siteCdList = gagajf.convertToArray([[${siteCdList}]]);
|
|
|
+ var ibSupplyComList = gagajf.convertToArray([[${ibSupplyCompList}]]);
|
|
|
+ var formalGbList = gagajf.convertToArray([[${formalGbList}]]);
|
|
|
+ var cateGbList = gagajf.convertToArray([[${cateGbList}]]);
|
|
|
+ var delYnList = { "Y":"Yes", "N":"No" };
|
|
|
+ var selfBrandList = gagajf.convertToArray([[${selfBrandList}]]);
|
|
|
+ var siteCdList = gagajf.convertToArray([[${siteCdList}]]);
|
|
|
|
|
|
// ag-grid 입점업체분담율 컬럼
|
|
|
var columnDefs = [
|
|
|
@@ -461,12 +461,12 @@
|
|
|
{ headerName: "삭제여부" , field: "delYn" , width: 120 , cellClass: 'text-center' , hide:true}
|
|
|
];
|
|
|
|
|
|
- var inComGridOptions = gagaAgGrid.getGridOptions(columnDefs);
|
|
|
- var cateGridOptions = gagaAgGrid.getGridOptions(cateSelColumnDefs);
|
|
|
- var goodsGridOptions = gagaAgGrid.getGridOptions(goodsSelColumnDefs);
|
|
|
- var brandGridOptions = gagaAgGrid.getGridOptions(brandSelColumnDefs);
|
|
|
- var supplyGridOptions = gagaAgGrid.getGridOptions(supplyColumnDefs);
|
|
|
- var excepGoodsGridOptions = gagaAgGrid.getGridOptions(excepGoodsColumnDefs);
|
|
|
+ var inComGridOptions = gagaAgGrid.getGridOptions(columnDefs);
|
|
|
+ var cateGridOptions = gagaAgGrid.getGridOptions(cateSelColumnDefs);
|
|
|
+ var goodsGridOptions = gagaAgGrid.getGridOptions(goodsSelColumnDefs);
|
|
|
+ var brandGridOptions = gagaAgGrid.getGridOptions(brandSelColumnDefs);
|
|
|
+ var supplyGridOptions = gagaAgGrid.getGridOptions(supplyColumnDefs);
|
|
|
+ var excepGoodsGridOptions = gagaAgGrid.getGridOptions(excepGoodsColumnDefs);
|
|
|
|
|
|
inComGridOptions.rowSelection = "multiple";
|
|
|
goodsGridOptions.rowSelection = "multiple";
|
|
|
@@ -701,6 +701,37 @@
|
|
|
mcxDialog.alert("1회발행 제한수량은 0보다 커야합니다.");
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
+ if ($('#CouponForm input:radio[name="rdoApplyScope"]:checked').val() == 'I') {
|
|
|
+ // 적용대상 체크
|
|
|
+ let targetCnt = 0;
|
|
|
+ let target1 = gagaAgGrid.getAllRowData(supplyGridOptions);
|
|
|
+ let target2 = gagaAgGrid.getAllRowData(brandGridOptions);
|
|
|
+ let target3 = gagaAgGrid.getAllRowData(cateGridOptions);
|
|
|
+ let target4 = gagaAgGrid.getAllRowData(goodsGridOptions);
|
|
|
+
|
|
|
+ targetCnt = target1.length + target2.length + target3.length + target4.length;
|
|
|
+
|
|
|
+ // 2021.08.23 브랜드 && 업체 and 조건 설정
|
|
|
+ if (target1.length > 0) {
|
|
|
+ if (target2.length < 1) {
|
|
|
+ mcxDialog.alert("적용대상 브랜드정보를 설정해주세요.");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (target2.length > 0) {
|
|
|
+ if (target1.length < 1) {
|
|
|
+ mcxDialog.alert("적용대상 업체정보를 설정해주세요.");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(targetCnt < 1){
|
|
|
+ mcxDialog.alert("적용대상을 설정해주세요.");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
@@ -734,54 +765,53 @@
|
|
|
sureBtnText: "확인",
|
|
|
sureBtnClick: function () {
|
|
|
var data = {
|
|
|
- cpnId : $('#CouponForm input[name=cpnId]').val()
|
|
|
- ,cpnNm : $('#CouponForm input[name=cpnNm]').val()
|
|
|
- ,cpnDesc : $('#CouponForm input[name=cpnDesc]').val()
|
|
|
- ,siteCd : $('#CouponForm select[name=siteCd]').val()
|
|
|
- ,cpnType : $('input:radio[name="rdoCpnType"]:checked').val()
|
|
|
- ,applyScope : $('input:radio[name="rdoApplyScope"]:checked').val()
|
|
|
- ,dcWay : $('input:radio[name="rdoDcWay"]:checked').val()
|
|
|
- ,dcPval : $('#CouponForm input[name=dcPval]').val().replaceAll(',','')
|
|
|
- ,dcMval : $('#CouponForm input[name=dcMval]').val().replaceAll(',','')
|
|
|
- ,dcAval : $('#CouponForm input[name=dcAval]').val().replaceAll(',','')
|
|
|
- ,maxDcAmt : $('#CouponForm input[name=maxDcAmt]').val().replaceAll(',','')
|
|
|
- ,pdGb : $('#CouponForm select[name=pdGb]').val()
|
|
|
- ,availStdt : $('#CouponForm input[name=availStdt]').val()
|
|
|
- ,availEddt : $('#CouponForm input[name=availEddt]').val()
|
|
|
- ,availDays : $('#CouponForm input[name=availDays]').val()
|
|
|
- ,custPubLimitQty : $('#CouponForm input[name=custPubLimitQty]').val().replaceAll(',','')
|
|
|
- ,totPubLimitQty : $('#CouponForm input[name=totPubLimitQty]').val().replaceAll(',','')
|
|
|
- ,onePubQty : $('#CouponForm input[name=onePubQty]').val().replaceAll(',','')
|
|
|
- ,downStdt : $('#CouponForm input[name=downStdt]').val()
|
|
|
- ,downEddt : $('#CouponForm input[name=downEddt]').val()
|
|
|
- ,buyLimitAmt : $('#CouponForm input[name=buyLimitAmt]').val().replaceAll(',','')
|
|
|
- ,cpnStat : $('input:radio[name="disCpnStat"]:checked').val()
|
|
|
- ,endAlimYn : 'N'
|
|
|
- ,firstOrdYn : 'N'
|
|
|
- ,downAblYn : 'Y'
|
|
|
- ,custJoinStdt : null
|
|
|
- ,custJoinEddt : null
|
|
|
- ,buyStdt : null
|
|
|
- ,buyEddt : null
|
|
|
- ,newCustYn : 'N'
|
|
|
- ,dcCdGb : 'G233_00'
|
|
|
- ,rdCpnNm : null
|
|
|
- ,usableCustGbArr : usableCustGbArr
|
|
|
- ,usableCustGradeArr : usableCustGradeArr
|
|
|
- ,payTypeArr : payTypeArr
|
|
|
- ,supplyCompList : gagaAgGrid.getAllRowData(supplyGridOptions)
|
|
|
- ,brandList : gagaAgGrid.getAllRowData(brandGridOptions)
|
|
|
- ,applyGoodsList : gagaAgGrid.getAllRowData(goodsGridOptions)
|
|
|
- ,exceptGoodsList : gagaAgGrid.getAllRowData(excepGoodsGridOptions)
|
|
|
- ,cateList : gagaAgGrid.getAllRowData(cateGridOptions)
|
|
|
- ,burdenList : gagaAgGrid.getAllRowData(inComGridOptions)
|
|
|
- ,mode : $('#CouponForm input[name=mode]').val()
|
|
|
- ,limitedTimeCpnList : null
|
|
|
- ,afChannelList : null
|
|
|
- ,scmYn : 'Y'
|
|
|
+ cpnId : $('#CouponForm input[name=cpnId]').val()
|
|
|
+ ,cpnNm : $('#CouponForm input[name=cpnNm]').val()
|
|
|
+ ,cpnDesc : $('#CouponForm input[name=cpnDesc]').val()
|
|
|
+ ,siteCd : $('#CouponForm select[name=siteCd]').val()
|
|
|
+ ,cpnType : $('input:radio[name="rdoCpnType"]:checked').val()
|
|
|
+ ,applyScope : $('input:radio[name="rdoApplyScope"]:checked').val()
|
|
|
+ ,dcWay : $('input:radio[name="rdoDcWay"]:checked').val()
|
|
|
+ ,dcPval : $('#CouponForm input[name=dcPval]').val().replaceAll(',','')
|
|
|
+ ,dcMval : $('#CouponForm input[name=dcMval]').val().replaceAll(',','')
|
|
|
+ ,dcAval : $('#CouponForm input[name=dcAval]').val().replaceAll(',','')
|
|
|
+ ,maxDcAmt : $('#CouponForm input[name=maxDcAmt]').val().replaceAll(',','')
|
|
|
+ ,pdGb : $('#CouponForm select[name=pdGb]').val()
|
|
|
+ ,availStdt : $('#CouponForm input[name=availStdt]').val()
|
|
|
+ ,availEddt : $('#CouponForm input[name=availEddt]').val()
|
|
|
+ ,availDays : $('#CouponForm input[name=availDays]').val()
|
|
|
+ ,custPubLimitQty : $('#CouponForm input[name=custPubLimitQty]').val().replaceAll(',','')
|
|
|
+ ,totPubLimitQty : $('#CouponForm input[name=totPubLimitQty]').val().replaceAll(',','')
|
|
|
+ ,onePubQty : $('#CouponForm input[name=onePubQty]').val().replaceAll(',','')
|
|
|
+ ,downStdt : $('#CouponForm input[name=downStdt]').val()
|
|
|
+ ,downEddt : $('#CouponForm input[name=downEddt]').val()
|
|
|
+ ,buyLimitAmt : $('#CouponForm input[name=buyLimitAmt]').val().replaceAll(',','')
|
|
|
+ ,cpnStat : $('input:radio[name="disCpnStat"]:checked').val()
|
|
|
+ ,endAlimYn : 'N'
|
|
|
+ ,firstOrdYn : 'N'
|
|
|
+ ,downAblYn : 'Y'
|
|
|
+ ,custJoinStdt : null
|
|
|
+ ,custJoinEddt : null
|
|
|
+ ,buyStdt : null
|
|
|
+ ,buyEddt : null
|
|
|
+ ,newCustYn : 'N'
|
|
|
+ ,dcCdGb : 'G233_00'
|
|
|
+ ,rdCpnNm : null
|
|
|
+ ,usableCustGbArr : usableCustGbArr
|
|
|
+ ,usableCustGradeArr : usableCustGradeArr
|
|
|
+ ,payTypeArr : payTypeArr
|
|
|
+ ,supplyCompList : gagaAgGrid.getAllRowData(supplyGridOptions)
|
|
|
+ ,brandList : gagaAgGrid.getAllRowData(brandGridOptions)
|
|
|
+ ,applyGoodsList : gagaAgGrid.getAllRowData(goodsGridOptions)
|
|
|
+ ,exceptGoodsList : gagaAgGrid.getAllRowData(excepGoodsGridOptions)
|
|
|
+ ,cateList : gagaAgGrid.getAllRowData(cateGridOptions)
|
|
|
+ ,burdenList : gagaAgGrid.getAllRowData(inComGridOptions)
|
|
|
+ ,mode : $('#CouponForm input[name=mode]').val()
|
|
|
+ ,limitedTimeCpnList : null
|
|
|
+ ,afChannelList : null
|
|
|
+ ,scmYn : 'Y'
|
|
|
};
|
|
|
var jsonData = JSON.stringify(data);
|
|
|
- console.log('jsonData::>>'+jsonData);
|
|
|
gagajf.ajaxJsonSubmit($('#CouponForm').prop('action'), jsonData, fnCouponSaveCollback);
|
|
|
}
|
|
|
});
|
|
|
@@ -873,7 +903,7 @@
|
|
|
$('#maxDcAmt').val(0);
|
|
|
|
|
|
if($("#CouponForm input[name=rdoCpnType]:checked").val() == 'G230_10'){
|
|
|
- $("#CouponForm .maxDcAmtArea").hide();
|
|
|
+ $("#CouponForm .maxDcAmtArea").show();
|
|
|
}else{
|
|
|
$("#CouponForm .maxDcAmtArea").show();
|
|
|
}
|
|
|
@@ -917,12 +947,13 @@
|
|
|
$("#CouponForm input:radio[name='rdoApplyScope']:radio[value=I]").prop('checked', true);
|
|
|
$("#CouponForm").find("input:radio[name='rdoApplyScope']").attr('disabled', true);
|
|
|
$("#CouponForm").find("input:radio[name='rdoApplyScope']").attr('readonly', true);
|
|
|
+
|
|
|
+ $("#CouponForm #endAlimYn").attr("disabled", true);
|
|
|
}else{
|
|
|
$("#CouponForm input:radio[name='rdoApplyScope']:radio[value=I]").prop('checked', true);
|
|
|
$("#CouponForm").find("input:radio[name='rdoApplyScope']").attr('disabled', false);
|
|
|
$("#CouponForm").find("input:radio[name='rdoApplyScope']").attr('readonly', false);
|
|
|
|
|
|
-
|
|
|
$("#CouponForm").find("input:radio[name='rdoDcWay']").attr('disabled', false);
|
|
|
$("#CouponForm").find("input:radio[name='rdoDcWay']").attr('readonly', false);
|
|
|
$('#CouponForm .maxDcAmtArea').show();
|
|
|
@@ -948,6 +979,8 @@
|
|
|
}else{
|
|
|
$('#CouponForm .maxDcAmtArea').show();
|
|
|
}
|
|
|
+
|
|
|
+ $("#CouponForm #endAlimYn").attr("disabled", false);
|
|
|
}
|
|
|
|
|
|
// 즉시할인쿠폰만 개별, 나머진 전체/개별
|
|
|
@@ -967,7 +1000,10 @@
|
|
|
|
|
|
// 브랜드 설정 / 브랜드 추가 콜백함수 (단수로 가져오므로 복수일 경우에 수정 확인 필요)
|
|
|
var fnSetPopupBrandInfo = function(result) {
|
|
|
- for(let i = 0 ; i < result.length ; i++) {
|
|
|
+
|
|
|
+ var brandCdArr = [];
|
|
|
+
|
|
|
+ for (let i = 0 ; i < result.length ; i++) {
|
|
|
let addChk = true, gridListValue = gagaAgGrid.getAllRowData(brandGridOptions); // 받아온 모든 데이터
|
|
|
|
|
|
// 받아온 data for
|
|
|
@@ -978,11 +1014,51 @@
|
|
|
// 중복되지 않은 데이터 리스트에 추가
|
|
|
if(addChk) {
|
|
|
gagaAgGrid.addRowData(brandGridOptions, {"brandCd" : result[i].brandCd, "brandEnm" : result[i].brandEnm, "supplyCompNm" : result[i].supplyCompNm});
|
|
|
+
|
|
|
+ // 2021.08.23 업체로정보로 브랜드정보 조회
|
|
|
+ brandCdArr.push(result[i].brandCd);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ // 2021.08.23 업체로정보로 브랜드정보 조회
|
|
|
+ // 적용대상 정보 로드
|
|
|
+ if (brandCdArr.length > 0) {
|
|
|
+
|
|
|
+ var jsonObj = {"brandCdArr" : brandCdArr};
|
|
|
+
|
|
|
+ $.ajax( {
|
|
|
+ type : "POST",
|
|
|
+ url : '/marketing/coupon/brandCdAndSupplyCompList',
|
|
|
+ data : JSON.stringify(jsonObj),
|
|
|
+ dataType : 'json',
|
|
|
+ beforeSend : function(xhr, settings) {
|
|
|
+ xhr.setRequestHeader("AJAX" , "true");
|
|
|
+ xhr.setRequestHeader('Accept' , 'application/json');
|
|
|
+ xhr.setRequestHeader('Content-Type' , 'application/json');
|
|
|
+ },
|
|
|
+ success : function(result) {
|
|
|
+ if (result != null) {
|
|
|
+ // 기존 리스트 데이터 for
|
|
|
+ for(let i = 0 ; i < result.returnList.length ; i++) {
|
|
|
+ let addChk = true, gridListValue = gagaAgGrid.getAllRowData(supplyGridOptions); // 받아온 모든 데이터
|
|
|
+
|
|
|
+ // 받아온 data for
|
|
|
+ for (let j = 0 ; j < gridListValue.length ; j++) {
|
|
|
+ // 동일한 data는 추가하지 않음
|
|
|
+ if(gridListValue[j].supplyCompCd == result.returnList[i].supplyCompCd) { addChk = false; } // 중복체크
|
|
|
+ }
|
|
|
+
|
|
|
+ // 중복되지 않은 데이터 리스트에 추가
|
|
|
+ if(addChk) {
|
|
|
+ gagaAgGrid.addRowData(supplyGridOptions, {"supplyCompCd" : result.returnList[i].supplyCompCd, "supplyCompNm" : result.returnList[i].supplyCompNm});
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
-
|
|
|
// 적용대상 - 공급처 추가 버튼시
|
|
|
$('#btnSupplyAdd').on('click' , function (){
|
|
|
cfnOpenCompanyListPopup("fnSetPopupComapnyInfo" , "M" ,"","","N");
|
|
|
@@ -990,8 +1066,11 @@
|
|
|
|
|
|
// 공급업체 설정 / 업체 추가 콜백함수
|
|
|
var fnSetPopupComapnyInfo = function(result) {
|
|
|
+
|
|
|
+ var supplyCompCdArr = [];
|
|
|
+
|
|
|
// 기존 리스트 데이터 for
|
|
|
- for(let i = 0 ; i < result.length ; i++) {
|
|
|
+ for (let i = 0 ; i < result.length ; i++) {
|
|
|
let addChk = true, gridListValue = gagaAgGrid.getAllRowData(supplyGridOptions); // 받아온 모든 데이터
|
|
|
|
|
|
// 받아온 data for
|
|
|
@@ -1001,10 +1080,49 @@
|
|
|
}
|
|
|
|
|
|
// 중복되지 않은 데이터 리스트에 추가
|
|
|
- if(addChk) {
|
|
|
+ if (addChk) {
|
|
|
gagaAgGrid.addRowData(supplyGridOptions, {"supplyCompCd" : result[i].supplyCompCd, "supplyCompNm" : result[i].supplyCompNm});
|
|
|
+
|
|
|
+ // 2021.08.23 업체로정보로 브랜드정보 조회
|
|
|
+ supplyCompCdArr.push(result[i].supplyCompCd);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ // 2021.08.23 업체로정보로 브랜드정보 조회
|
|
|
+ // 적용대상 정보 로드
|
|
|
+ if (supplyCompCdArr.length > 0) {
|
|
|
+
|
|
|
+ var jsonObj = {"supplyCompCdArr" : supplyCompCdArr};
|
|
|
+
|
|
|
+ $.ajax( {
|
|
|
+ type : "POST",
|
|
|
+ url : '/marketing/coupon/supplyCompCdAndBrandList',
|
|
|
+ data : JSON.stringify(jsonObj),
|
|
|
+ dataType : 'json',
|
|
|
+ beforeSend : function(xhr, settings) {
|
|
|
+ xhr.setRequestHeader("AJAX" , "true");
|
|
|
+ xhr.setRequestHeader('Accept' , 'application/json');
|
|
|
+ xhr.setRequestHeader('Content-Type' , 'application/json');
|
|
|
+ },
|
|
|
+ success : function(result) {
|
|
|
+ if (result != null) {
|
|
|
+ for (let i = 0 ; i < result.returnList.length ; i++) {
|
|
|
+ let addChk = true, gridListValue = gagaAgGrid.getAllRowData(brandGridOptions); // 받아온 모든 데이터
|
|
|
+
|
|
|
+ // 받아온 data for
|
|
|
+ for (let j = 0 ; j < gridListValue.length ; j++) {
|
|
|
+ if (gridListValue[j].brandCd == result.returnList[i].brandCd) { addChk = false; } // 중복체크
|
|
|
+ }
|
|
|
+
|
|
|
+ // 중복되지 않은 데이터 리스트에 추가
|
|
|
+ if (addChk) {
|
|
|
+ gagaAgGrid.addRowData(brandGridOptions, {"brandCd" : result.returnList[i].brandCd, "brandEnm" : result.returnList[i].brandEnm});
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
// 적용대상 - 카테고리 추가시
|