| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260 |
- <!DOCTYPE html>
- <html lang="ko"
- xmlns:th="http://www.thymeleaf.org">
- <!--
- *******************************************************************************
- * @source : CouponPopupForm.html
- * @desc : 쿠폰 등록 팝업 화면
- *============================================================================
- * ISTYLE24
- * Copyright(C) 2020 TSIT, All rights reserved.
- *============================================================================
- * VER DATE AUTHOR DESCRIPTION
- * === =========== ========== =============================================
- * 1.0 2020.12.23 xyzp1539 최초 작성
- *******************************************************************************
- -->
- <div class="modalPopup" data-width="1200">
- <div class="panelStyle" style="height: 750px;">
- <div class="panelTitle">
- <h2 th:text="${'쿠폰 ' + (mode == 'N' ? '등록' : '수정')}">쿠폰등록</h2>
- <button type="button" class="close" onclick="uifnPopupClose('CouponRegForm')"><i class="fa fa-times"></i></button>
- </div>
- <div class="panelContent">
- <form id="CouponForm" name="CouponForm" action="#" th:action="@{'/marketing/coupon/save'}" >
- <input type="hidden" name="supplyCompList" id="supplyCompList">
- <input type="hidden" name="brandList" id="brandList">
- <input type="hidden" name="applyGoodsList" id="applyGoodsList">
- <input type="hidden" name="exceptGoodsList" id="excepGoodsList">
- <input type="hidden" name="burdenList" id="burdenList">
- <input type="hidden" name="cateList" id="cateList">
- <input type="hidden" name="rdCpnNm" id="rdCpnNm">
- <input type="hidden" name="cpnId" id="cpnId" th:if="${cpnDetail}" th:value="${cpnDetail.cpnId}">
- <div class="tabs">
- <div class="tabsNav">
- <ul>
- <li class="on"><a href="#coupontab1">기본정보</a></li>
- <li><a href="#coupontab2">적용대상</a></li>
- <li><a href="#coupontab3">입점업체분담율</a></li>
- <li class="randomCpnTab" style="display:none;"><a href="#coupontab4">시리얼및난수</a></li>
- <li class="limitedTimeCpnTab" style="display:none;"><a href="#coupontab5">선착순쿠폰</a></li> <!--style="display:none;"-->
- </ul>
- </div>
- <ul class="tabsCont">
- <li class="tab on" id="coupontab1">
- <div class="panelStyle">
- <table class="frmStyle">
- <colgroup>
- <col style="width:10%">
- <col style="width:45%;">
- <col style="width:10%">
- <col style="width:35%;">
- </colgroup>
- <tbody>
- <tr th:if="${cpnDetail}">
- <th>쿠폰번호</th>
- <td colspan="5">
- <span th:if="${cpnDetail}" th:text="${cpnDetail.cpnId}"></span>
- </td>
- </tr>
- <tr>
- <th>쿠폰명<em class="required" title="필수"></em></th>
- <td colspan="5">
- <input type="text" name="cpnNm" id="cpnNm" style="width: 70%;" required="required" data-valid-name="쿠폰명">
- </td>
- </tr>
- <tr>
- <th>쿠폰유형<em class="required" title="필수"></em></th>
- <td>
- <input type="hidden" id="cpnType" name="cpnType" required="required" data-valid-name="쿠폰유형">
- <label class="rdoBtn" th:if="${cpnTypeList}" th:each="oneData, status : ${cpnTypeList}"> <input type="radio" name="rdoCpnType" th:text="${oneData.cdNm}" th:value="${oneData.cd}"/></label>
- </td>
- <th class="limitedTimeCpnArea" style="display: none;">선착순쿠폰</th>
- <td class="limitedTimeCpnArea" style="display: none;">
- <label class="chkBox limitedTimeCpnBox" id="limitedTimeCpnBox"><input type="checkbox" name="limitedTimeCpnYn" id="limitedTimeCpnYn" value="N"/>선착순쿠폰</label>
- </td>
- </tr>
- <tr class="dcCdGb" style="display:none;">
- <th>할인쿠폰유형<em class="required" title="필수"></em></th>
- <td class="normalCol">
- <input type="hidden" id="dcCd" data-valid-name="할인쿠폰유형">
- <label class="rdoBtn" th:if="${dcCdList}" th:each="oneData, status : ${dcCdList}"> <input type="radio" name="dcCdGb" th:text="${oneData.cdNm}" th:value="${oneData.cd}"/></label>
- </td>
- <th class="randomCpnArea">난수생성수량<em class="required" title="필수"></em></th>
- <td class="randomCpnArea">
- <input type="text" name="randomCpnQty" class="w300" data-valid-name="난수생성수량" data-valid-type="numeric">
- </td>
- </tr>
- <tr class="serialCpnArea" style="display:none;">
- <th>시리얼쿠폰키워드<em class="required" title="필수"></em></th>
- <td>
- <input type="text" name="serialCpnNm" class="w300" maxlength="10" data-valid-name="시리얼쿠폰키워드">
- </td>
- <th>시리얼쿠폰발급수량<em class="required" title="필수"></em></th>
- <td>
- <input type="text" name="serialCpnQty" class="w300" data-valid-name="시리얼쿠폰발급수량" data-valid-type="numeric">
- </td>
- </tr>
- <tr>
- <th>사용가능고객구분<em class="required" title="필수"></em></th>
- <td>
- <label class="chkBox" th:if="${usableCustGbList}" th:each="oneData, status : ${usableCustGbList}">
- <input type="checkbox" name="usableCustGbArr" th:value="${oneData.cd}" th:text="${oneData.cdNm}"/>
- </label>
- </td>
- <th>사이트<em class="required" title="필수"></em></th>
- <td>
- <select name="siteCd" id="siteCd" required="required" data-valid-name="사이트">
- <option th:if="${siteCdList}" th:each="oneData , status : ${siteCdList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
- </select>
- </td>
- </tr>
- <tr>
- <th>사용고객등급구분<em class="required" title="필수"></em></th>
- <td>
- <label class="chkBox" th:if="${usableCustGradeList}" th:each="oneData, status : ${usableCustGradeList}">
- <input type="checkbox" name="usableCustGradeArr" th:value="${oneData.cd}" th:text="${oneData.cdNm}"/>
- </label>
- </td>
- <th>만료알림여부<em class="required" title="필수"></em></th>
- <td>
- <select name="endAlimYn" id="endAlimYn" required="required" data-valid-name="만료알림여부">
- <option value="Y">Y</option>
- <option value="N" selected="selected">N</option>
- </select>
- </td>
- </tr>
- <tr>
- <th>할인방식<em class="required" title="필수"></em></th>
- <td>
- <input type="hidden" name="dcWay" id="dcWay" required="required" data-valid-name="할인방식">
- <label class="rdoBtn" th:if="${dcWayList}" th:each="oneData, status : ${dcWayList}"> <input type="radio" name="rdoDcWay" th:text="${oneData.cdNm}" th:value="${oneData.cd}"/></label>
- </td>
- <th>구매제한금액<em class="required" title="필수"></em></th>
- <td>
- <input type="text" id="buyLimitAmt" name="buyLimitAmt" class="w200" required="required" value="0" style="text-align: right;" data-valid-name="구매제한금액" data-valid-type="numeric">원
- </td>
- </tr>
- <tr>
- <th>할인값(PC)<em class="required" title="필수"></em></th>
- <td>
- <input type="text" class="w200" id="dcPval" name="dcPval" value="0" required="required" data-valid-name="할인값(PC)" data-valid-type="numeric" style="text-align: right" onkeyup="fnDcValOnkeyUp(this);"><span id="dcPvalSpan">원</span>
- <button type="button" class="btn btn-default btn-lg" id="applySameValueBtn">동일적용</button>
- </td>
- <th>할인값(모바일웹)<em class="required" title="필수"></em></th>
- <td>
- <input type="text" class="w200" id="dcMval" name="dcMval" value="0" required="required" data-valid-name="할인값(모바일웹)" data-valid-type="numeric" style="text-align: right" onkeyup="fnDcValOnkeyUp(this);"><span id="dcMvalSpan">원</span>
- </td>
- </tr>
- <tr>
- <th>할인값(모바일앱)<em class="required" title="필수"></em></th>
- <td>
- <input type="text" class="w200" id="dcAval" name="dcAval" value="0" required="required" data-valid-name="할인값(모바일앱)" data-valid-type="numeric" style="text-align: right" onkeyup="fnDcValOnkeyUp(this);"><span id="dcAvalSpan">원</span>
- </td>
- <th class="maxDcAmtArea">최대할인금액<em class="required" title="필수"></em></th>
- <td class="maxDcAmtArea">
- <input type="text" class="w200" id="maxDcAmt" name="maxDcAmt" value="0" required="required" data-valid-name="최대할인금액" data-valid-type="numeric" style="text-align: right;"><span id="maxDcAmtSpan">원</span>
- </td>
- </tr>
- <tr>
- <th>다운로드시작일시<em class="required" title="필수"></em></th>
- <td>
- <input type="hidden" name="downStdt" id="downStdt" required="required" data-valid-name="다운로드시작일시">
- <input type="text" class="schDate w100" name="downStDay" id="downStDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
- <select name="downStHH" id="downStHH">
- <option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
- </select>
- <select name="downStMM" id="downStMM">
- <option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
- </select>
- <th>다운로드종료일시<em class="required" title="필수"></em></th>
- <td>
- <input type="hidden" id="downEddt" name="downEddt" required="required" data-valid-name="다운로드종료일시">
- <input type="text" class="schDate w100" name="downEdDay" id="downEdDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
- <select name="downEdHH" id="downEdHH" onclick="fnChangeEdHH(this);">
- <option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
- <option th:text="24시" th:value="24"></option>
- </select>
- <select name="downEdMM" id="downEdMM">
- <option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
- </select>
- </td>
- </tr>
- <tr>
- <th>기간/일수구분<em class="required" title="필수"></em></th>
- <td>
- <select name="pdGb" id="pdGb" onchange="pdGbChange(this)" required="required" data-valid-name="기간/일수구분">
- <option value="P">기간</option>
- <option value="D">일수</option>
- </select>
- </td>
- <th>적용범위<em class="required" title="필수"></em></th>
- <td>
- <input type="hidden" name="applyScope" id="applyScope" required="required" data-valid-name="적용범위">
- <label class="rdoBtn"> <input type="radio" name="rdoApplyScope" value="A"/>전체</label>
- <label class="rdoBtn"> <input type="radio" name="rdoApplyScope" value="I"/>개별</label>
- </td>
- </tr>
- <tr class="availDayTr" style="display: none;">
- <th>유효기간일수<em class="required" title="필수"></em></th>
- <td>
- <input type="text" name="availDays" id="availDays" class="w200" data-valid-name="유효기간일수">
- </td>
- </tr>
- <tr>
- <th class="availDateTr">유효기간시작일시<em class="required" title="필수"></em></th>
- <td class="availDateTr">
- <input type="hidden" name="availStdt" id="availStdt" data-valid-name="유효기간시작일시">
- <input type="text" class="schDate w100" name="availStDay" id="availStDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
- <select name="availStHH" id="availStHH">
- <option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
- </select>
- <select name="availStMM" id="availStMM">
- <option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
- </select>
- <th class="availDateTr">유효기간종료일시<em class="required" title="필수"></em></th>
- <td class="availDateTr">
- <input type="hidden" id="availEddt" name="availEddt" data-valid-name="유효기간종료일시">
- <input type="text" class="schDate w100" name="availEdDay" id="availEdDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
- <select name="availEdHH" id="availEdHH" onclick="fnChangeEdHH(this);">
- <option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
- <option th:text="24시" th:value="24"></option>
- </select>
- <select name="availEdMM" id="availEdMM">
- <option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
- </select>
- </td>
- </tr>
- <tr class="firstBuyTr">
- <th>첫구매여부<em class="required" title="필수"></em></th>
- <td>
- <select name="firstOrdYn" id="firstOrdYn" onchange="firstOrdYnChange(this)" required="required" data-valid-name="첫구매여부">
- <option value="Y">Y</option>
- <option value="N" selected="selected">N</option>
- </select>
- </td>
- </tr>
- <tr>
- <th class="buyDateTr">첫구매기간시작일시<em class="required" title="필수"></em></th>
- <td class="buyDateTr">
- <input type="hidden" name="buyStdt" id="buyStdt" data-valid-name="첫구매기간시작일시">
- <input type="text" class="schDate w100" name="buyStDay" id="buyStDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
- <select name="buyStHH" id="buyStHH">
- <option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
- </select>
- <select name="buyStMM" id="buyStMM">
- <option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
- </select>
- <th class="buyDateTr">첫구매기간종료일시<em class="required" title="필수"></em></th>
- <td class="buyDateTr">
- <input type="hidden" id="buyEddt" name="buyEddt" data-valid-name="첫구매기간종료일시">
- <input type="text" class="schDate w100" name="buyEdDay" id="buyEdDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
- <select name="buyEdHH" id="buyEdHH" onclick="fnChangeEdHH(this);">
- <option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
- <option th:text="24시" th:value="24"></option>
- </select>
- <select name="buyEdMM" id="buyEdMM">
- <option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
- </select>
- </td>
- </tr>
- <tr class="custJoinTr">
- <th>신규회원여부<em class="required" title="필수"></em></th>
- <td>
- <select name="newCustYn" id="newCustYn" onchange="newCustYnChange(this)" required="required" data-valid-name="신규회원여부">
- <option value="Y">Y</option>
- <option value="N" selected="selected">N</option>
- </select>
- </td>
- </tr>
- <tr>
- <th class="custJoinDateTr">신규회원기간시작일시<em class="required" title="필수"></em></th>
- <td class="custJoinDateTr">
- <input type="hidden" name="custJoinStdt" id="custJoinStdt" data-valid-name="신규회원기간시작일시">
- <input type="text" class="schDate w100" name="custJoinStDay" id="custJoinStDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
- <select name="custJoinStHH" id="custJoinStHH">
- <option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
- </select>
- <select name="custJoinStMM" id="custJoinStMM">
- <option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
- </select>
- <th class="custJoinDateTr">신규회원기간종료일시<em class="required" title="필수"></em></th>
- <td class="custJoinDateTr">
- <input type="hidden" id="custJoinEddt" name="custJoinEddt" data-valid-name="신규회원기간종료일시">
- <input type="text" class="schDate w100" name="custJoinEdDay" id="custJoinEdDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
- <select name="custJoinEdHH" id="custJoinEdHH" onclick="fnChangeEdHH(this);">
- <option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
- <option th:text="24시" th:value="24"></option>
- </select>
- <select name="custJoinEdMM" id="custJoinEdMM">
- <option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
- </select>
- </td>
- </tr>
- <tr class="dcCdCheck1">
- <th>총발행제한수량<em class="required" title="필수"></em></th>
- <td>
- <input type="text" class="w200" name="totPubLimitQty" id="totPubLimitQty" value="0" required="required" data-valid-name="총발행제한수량" data-valid-type="numeric" style="text-align: right;">개
- <label class="chkBox" id="chkBoxTotPubQty"><input type="checkbox" id="chkNoLimitTotPubLimitQty"/>제한없음</label>
- </td>
- <th>1인당발행제한수량<em class="required" title="필수"></em></th>
- <td>
- <input type="text" class="w200" name="custPubLimitQty" id="custPubLimitQty" value="0" required="required" data-valid-name="1인당발행제한수량" data-valid-type="numeric" style="text-align: right;">개
- <label class="chkBox" id="chkBoxCustPubQty"><input type="checkbox" id="chkNoLimitCustPubLimitQty"/>제한없음</label>
- </td>
- </tr>
- <tr>
- <th class="dcCdCheck2">1회발행수량<em class="required" title="필수"></em></th>
- <td class="dcCdCheck2">
- <input type="text" class="w200" name="onePubQty" id="onePubQty" value="1" required="required" data-valid-name="1회발행수량" data-valid-type="numeric" style="text-align: right;">개
- </td>
- <th>다운로드가능여부<em class="required" title="필수"></em></th>
- <td>
- <select name="downAblYn" id="downAblYn" required="required" data-valid-name="다운로드가능여부">
- <option value="Y">Y</option>
- <option value="Y" selected="selected">N</option>
- </select>
- </td>
- </tr>
- <!--<tr>
- <th>재발급여부<em class="required" title="필수"></em></th>
- <td>
- <select name="reissuance" id="reissuance" required="required" data-valid-name="재발급여부" >
- <option th:if="${reissuanceList}" th:each="oneData , status : ${reissuanceList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
- </select>
- </td>
- <th>다운로드구분<em class="required" title="필수"></em></th>
- <td>
- <select name="dnGb" id="dnGb" required="required" data-valid-name="다운로드구분">
- <option th:if="${dnGbList}" th:each="oneData , status:${dnGbList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
- </select>
- </td>
- </tr>-->
- <tr class="payTypeTr" style="display: none;">
- <th>결제수단<em class="required" title="필수"></em></th>
- <td colspan="5">
- <label class="chkBox" th:if="${payTypeList}" th:each="oneData, status : ${payTypeList}">
- <input type="checkbox" name="payTypeArr" th:value="${oneData.cd}" th:text="${oneData.cdNm}"/>
- </label>
- </td>
- </tr>
- <tr>
- <th>쿠폰상태<em class="required" title="필수"></em></th>
- <td>
- <label class="rdoBtn" th:if="${cpnStatList}" th:each="oneData, status : ${cpnStatList}" >
- <input type="radio" id="disCpnStat" name="disCpnStat" th:value="${oneData.cd}" th:text="${oneData.cdNm}" data-valid-name="상태" disabled="disabled"/>
- </label>
- <input type="hidden" id="cpnStat" name="cpnStat"/>
- </td>
- <th>제휴링크코드<em class="required" title="필수"></em></th>
- <td>
- <select name="afChannel" id="afChannel" onchange="fnChangeAfLinkCdList()" data-valid-name="제휴링크코드" required="required">
- <option th:if="${upperAfLinkCdList}" th:each="oneData , status : ${upperAfLinkCdList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
- </select>
- <select name="afLinkCd" id="afLinkCd">
- </select>
- </td>
- </tr>
- </tbody>
- </table>
- <!--<div class="mdPopBtnB aR">
- <button type="button" class="btn btn-info btn-lg" onclick="fnPubCustListPopUp();" th:if="${mode == 'U'}">발급받은회원</button>
- <button type="button" class="btn btn-info btn-lg" onclick="fnCustomerIssuePopUp();" th:if="${mode == 'U' && cpnDetail.dcCdGb == 'G233_00'}">쿠폰발행</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>-->
- </div>
- </li>
- <!-- 쿠폰적용대상-->
- <li class="tab" id="coupontab2" >
- <div class="panelStyle">
- <div class="inner-panelContent">
- <div class="panelContent">
- <div class="panelBar">
- <h4>적용 대상 상품 등록</h4>
- </div>
- <table class="frmStyle">
- <colgroup>
- <col style="width:15%;">
- <col style="width:85%;">
- </colgroup>
- <tbody>
- <tr>
- <th>공급처</th>
- <td>
- <div class="padding10 inner-tb-solid">
- <button type="button" class="btn btnRight btn-success btn-lg" id="btnSupplyAdd">공급처 추가</button>
- <button type="button" class="btn btnRight btn-success btn-lg" id="btnSupplyDel">선택삭제</button>
- <br/>
- <div id="supplyGridList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
- </div>
- </td>
- </tr>
- <tr>
- <th>브랜드</th>
- <td>
- <div class="padding10 inner-tb-solid">
- <button type="button" class="btn btnRight btn-success btn-lg" id="btnBrandAdd">브랜드 추가</button>
- <button type="button" class="btn btnRight btn-success btn-lg" id="btnBrandDel">선택삭제</button>
- <br/>
- <div id="brandGridList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
- </div>
- </td>
- </tr>
- <tr>
- <th>카테고리</th>
- <td>
- <div class="padding10 inner-tb-solid">
- <button type="button" class="btn btnRight btn-success btn-lg" id="btnCateAdd">카테고리 추가</button>
- <button type="button" class="btn btnRight btn-success btn-lg" id="btnCateDel">선택삭제</button>
- <br/>
- <div id="cateGridList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
- </div>
- </td>
- </tr>
- <tr>
- <th>적용상품</th>
- <td>
- <div class="padding10 inner-tb-solid">
- <button type="button" class="btn btnRight btn-success btn-lg" id="btnGoodsAdd">상품 추가</button>
- <button type="button" class="btn btnRight btn-success btn-lg" id="btnGoodsDel">선택삭제</button>
- <br/>
- <div id="goodsGridList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <div class="inner-panelContent">
- <div class="panelContent">
- <div class="panelBar">
- <h4>적용 대상 상품 등록</h4>
- </div>
- <table class="frmStyle">
- <colgroup>
- <col style="width:15%;">
- <col style="width:85%;">
- </colgroup>
- <tbody>
- <tr>
- <th>제외상품</th>
- <td>
- <div class="padding10 inner-tb-solid">
- <button type="button" class="btn btnRight btn-success btn-lg" id="btnExcepGoodsAdd">제외상품 추가</button>
- <button type="button" class="btn btnRight btn-success btn-lg" id="btnExcepGoodsDel">선택삭제</button>
- <br/>
- <div id="excepGoodsGridList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </li>
- <!-- 쿠폰적용대상끝-->
- <!-- 입점업체분담율-->
- <li class="tab" id="coupontab3">
- <div class="panelStyle">
- <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="btnDelRow">행삭제</button>
- </li>
- </ul>
- <div id="inComGridList" style="width: 100%; height: 570px" class="ag-theme-balham"></div>
- </div>
- </li>
- <!-- 입점업체분담끝-->
- <!-- 난수 및 네임쿠폰 설정 -->
- <li class="tab" id="coupontab4">
- <div class="panelStyle">
- <span>
- <div id="randomCpnList" style="width: 100%; height: 500px" class="ag-theme-balham"></div>
- </span>
- </div>
- </li>
- <!-- 난수 및 네임쿠폰 설정-->
- <!-- 선착순 쿠폰 설정 START -->
- <li class="tab" id="coupontab5">
- <div class="panelStyle">
- <span class="limitedTimeCpnSpan">
- <button type="button" class="btn btnRight btn-success btn-lg" id="btnAddLimitedTimeCpnRow">행추가</button>
- <button type="button" class="btn btnRight btn-success btn-lg" id="btnDelLimitedTimeCpnRow">행삭제</button>
- </span>
- <br/>
- <div id="limitedTimeCpnList" style="width: 100%; height: 500px" class="ag-theme-balham"></div>
- </div>
- </li>
- <!-- 선착순 쿠폰 설정 END -->
- </ul>
- </div>
- <div class="mdPopBtnB aR">
- <button type="button" class="btn btn-info btn-lg" onclick="fnPubCustListPopUp();" th:if="${mode == 'U'}">발급받은회원</button>
- <button type="button" class="btn btn-info btn-lg" onclick="fnCustomerIssuePopUp();" th:if="${mode == 'U' && cpnDetail.dcCdGb == 'G233_00'}">쿠폰발행</button> <!-- 난수유형과 시리얼 유형에서는 쿠폰발행기능 X -->
- <button type="button" class="btn btnRight btn-success btn-lg couponButton" id="btnCouponSave" onclick="fnCouponCreate();">등록</button>
- <button type="button" class="btn btnRight btn-success btn-lg couponButton" id="btnChangeStatIng" style="display: none;">진행</button>
- <button type="button" class="btn btnRight btn-success btn-lg couponButton" id="btnCouponDelete" style="display: none;">삭제</button>
- <button type="button" class="btn btnRight btn-success btn-lg couponButton" id="btnCouponStop" style="display: none;">중지</button>
- </div>
- </form>
- </div>
- </div>
- </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 cpnDtlRefvalExceptGoodsList = [[${cpnDtlRefvalExceptGoodsList}]];
- var cpnDtlBurdenList = [[${cpnDtlBurdenList}]];
- var randomCpnList = [[${randomCpnList}]];
- var issueCnt = [[${issueCnt}]];
- var cpnCustGbList = [[${cpnCustGbList}]];
- var cpnCustGradeList = [[${cpnCustGradeList}]];
- var cpnPayTypeList = [[${cpnPayTypeList}]];
- var limitedTimeCpnList = [[${limitedTimeCpnList}]];
- // 공통코드 리스트
- var ibSupplyComList = gagajf.convertToArray([[${ibSupplyCompList}]]);
- var formalGbList = gagajf.convertToArray([[${formalGbList}]]);
- var cateGbList = gagajf.convertToArray([[${cateGbList}]]);
- var delYnList = { "Y":"Yes", "N":"No" };
- var siteCdList = gagajf.convertToArray([[${siteCdList}]]);
- var selfBrandList = gagajf.convertToArray([[${selfBrandList}]]);
- // ag-grid 입점업체분담율 컬럼
- var columnDefs = [
- { headerName: "입점업체" , field:"supplyCompCd" , width:150, cellClass:"text-center" ,
- cellEditor: 'agRichSelectCellEditor',
- cellEditorParams: { values: gagaAgGrid.extractValues(ibSupplyComList) },
- valueFormatter: function (params) { return gagaAgGrid.lookupValue(ibSupplyComList, params.value); },
- valueParser: function (params) { return gagaAgGrid.lookupKey(ibSupplyComList, params.newValue);}
- } ,
- { headerName: "쿠폰분담율(%)", field:"burdenRate" , width:150, cellClass: "text-center" ,
- cellEditorParams: { maxlength: 10, required: true }
- } ,
- /*{ headerName: "삭제여부" , field: "delYn" , width:150, cellClass: "text-center" ,
- cellEditor: 'agRichSelectCellEditor',
- cellEditorParams: { values: gagaAgGrid.extractValues(delYnList) },
- valueFormatter: function (params) { return gagaAgGrid.lookupValue(delYnList, params.value); },
- valueParser: function (params) { return gagaAgGrid.lookupKey(delYnList, params.newValue); }
- } ,*/
- { headerName: "쿠폰번호" , field: "cpnId" , width: 120 , cellClass: 'text-center' , hide:true},
- { headerName: "삭제여부" , field: "delYn" , width: 120 , cellClass: 'text-center' , hide:true}
- ];
- // ag-grid 공급처 컬럼
- var supplyColumnDefs = [
- {width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
- { headerName : "공급업체코드" , field: "supplyCompCd" , width:150, cellClass: 'text-center'} ,
- { headerName: "공급업체명" , field: "supplyCompNm" , width:150, cellClass: 'text-center'},
- { headerName: "쿠폰대상일련번호" , field: "cpnRefvalSq" , width: 120 , cellClass: 'text-center' , hide:true},
- { headerName: "삭제여부" , field: "delYn" , width: 120 , cellClass: 'text-center' , hide:true}
- ];
- // ag-grid 브랜드 컬럼
- var brandSelColumnDefs = [
- {width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
- { headerName : "브랜드ID" , field: "brandCd" , width: 120, cellClass : 'text-center'} ,
- { headerName : "브랜드명" , field: "brandEnm" , width: 120, cellClass: 'text-center'} ,
- //{ headerName : "공급업체명", field: "supplyCompNm" , width: 150, cellClass: 'text-center' } ,
- { headerName: "쿠폰대상일련번호" , field: "cpnRefvalSq" , width: 120 , cellClass: 'text-center' , hide:true},
- { headerName: "삭제여부" , field: "delYn" , width: 120 , cellClass: 'text-center' , hide:true}
- ];
- // ag-grid 적용상품 컬럼
- var goodsSelColumnDefs = [
- {width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
- { headerName: "상품구분" , field: "goodsGb" , width: 100, cellClass: 'text-center'} ,
- { headerName: "Product ID" , field: "goodsCd" , width: 120, cellClass: 'text-center'},
- { headerName: "상품명" , field: "goodsNm" , width: 250 , cellClass: 'text-center'} ,
- { headerName: "쿠폰대상일련번호" , field: "cpnRefvalSq" , width: 120 , cellClass: 'text-center' , hide:true},
- { headerName: "삭제여부" , field: "delYn" , width: 120 , cellClass: 'text-center' , hide:true}
- ];
- // ag-grid 카테고리 컬럼
- var cateSelColumnDefs = [
- {width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
- { headerName: "사이트" , field: "siteCd" , width: 100 , cellClass: 'text-center' ,
- cellEditor: 'agRichSelectCellEditor',
- cellEditorParams: { values: gagaAgGrid.extractValues(siteCdList) },
- valueFormatter: function (params) { return gagaAgGrid.lookupValue(siteCdList, params.value); },
- valueParser: function (params) { return gagaAgGrid.lookupKey(siteCdList, params.newValue); }
- },
- { headerName: "카테고리구분" , field: "cateGb" , width: 100 , cellClass: 'text-center' ,
- cellEditor: 'agRichSelectCellEditor',
- cellEditorParams: { values: gagaAgGrid.extractValues(cateGbList) },
- valueFormatter: function (params) { return gagaAgGrid.lookupValue(cateGbList, params.value); },
- valueParser: function (params) { return gagaAgGrid.lookupKey(cateGbList, params.newValue); }
- },
- { headerName: "카테고리코드" , field: "cateNo" , width: 100 , cellClass: 'text-center'} ,
- { headerName: "카테고리명" , field: "cateNm" , width: 120 , cellClass: 'text-center'},
- { headerName: "이월/정상구분" , field: "formalGb" , width: 120 , cellClass: 'text-center',
- cellEditor: 'agRichSelectCellEditor',
- cellEditorParams: { values: gagaAgGrid.extractValues(formalGbList) },
- valueFormatter: function (params) { return gagaAgGrid.lookupValue(formalGbList, params.value); },
- valueParser: function (params) { return gagaAgGrid.lookupKey(formalGbList, params.newValue); }
- },
- { headerName: "브랜드명" , field:"brandCd" , width:150, cellClass: "text-center", required: true ,
- editable: true, cellEditor: 'agRichSelectCellEditor',
- cellEditorParams: { values: gagaAgGrid.extractValues(selfBrandList) },
- valueFormatter: function (params) { return gagaAgGrid.lookupValue(selfBrandList, params.value); },
- valueParser: function (params) { return gagaAgGrid.lookupKey(selfBrandList, params.newValue); }
- },
- { headerName: "쿠폰대상일련번호" , field: "cpnRefvalSq" , width: 120 , cellClass: 'text-center' , hide:true},
- { headerName: "삭제여부" , field: "delYn" , width: 120 , cellClass: 'text-center' , hide:true}
- ];
- // ag-grid 제외상품 컬럼
- var excepGoodsColumnDefs = [
- {width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
- { headerName: "상품구분" , field: "goodsGb" , width: 100, cellClass: 'text-center'} ,
- { headerName: "Product ID" , field: "goodsCd" , width: 120, cellClass: 'text-center'},
- { headerName: "상품명" , field: "goodsNm" , width: 250 , cellClass: 'text-center'} ,
- { headerName: "쿠폰대상일련번호" , field: "cpnRefvalSq" , width: 120 , cellClass: 'text-center' , hide:true},
- { headerName: "삭제여부" , field: "delYn" , width: 120 , cellClass: 'text-center' , hide:true}
- ];
- // ag-grid 시리얼 및 난수 리스트
- var randomCouponDefs = [
- { headerName : "생성쿠폰키워드" , field: "rdCpnNm" , width:150, cellClass: 'text-center'} ,
- { headerName: "지급고객번호" , field: "custNm" , width:150, cellClass: 'text-center'},
- { headerName: "고객아이디" , field: "custId" , width:150, cellClass: 'text-center'},
- { headerName: "고객명" , field: "custNm" , width:150, cellClass: 'text-center'},
- { headerName: "지급일" , field: "regDt" , width:150, cellClass: 'text-center'},
- { headerName: "쿠폰사용일" , field: "usedDt" , width:150, cellClass: 'text-center'}
- ];
- // 선착순 쿠폰 리스트
- var limitedTimeCpnDefs = [
- {width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
- { headerName: "쿠폰시퀀스", field: "cpnId", width: 150, cellClass: 'text-center'}, //, hide: true
- { headerName: "선착순쿠폰명" , field: "limitCpnNm" , width: 200, cellClass: 'text-center'
- ,cellEditorParams: { maxlength: 20}
- } ,
- { headerName: "시작일시" , field: "downStdt" , width: 200, cellClass: 'text-center'
- ,cellRenderer: function (params) { return gagaAgGrid.toDateTimeFormat(params.value); }
- },
- { headerName: "종료일시" , field: "downEddt" , width: 200 , cellClass: 'text-center'
- ,cellRenderer: function (params) { return gagaAgGrid.toDateTimeFormat(params.value); }
- } ,
- { headerName: "다운로드가능수량" , field: "downLimitQty" , width: 150 , cellClass: 'text-center'
- ,cellEditorParams: { maxlength: 4, validType: 'numeric'}
- },
- { headerName: "선착순시퀀스", field: "limitCpnId", width: 150, 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 randomCouponGridOptions = gagaAgGrid.getGridOptions(randomCouponDefs);
- var limitedTimeCpnGridOptions = gagaAgGrid.getGridOptions(limitedTimeCpnDefs);
- inComGridOptions.defaultColDef.editable = true;
- inComGridOptions.rowSelection = "multiple";
- goodsGridOptions.rowSelection = "multiple";
- supplyGridOptions.rowSelection = "multiple";
- excepGoodsGridOptions.rowSelection = "multiple";
- cateGridOptions.rowSelection = "multiple";
- brandGridOptions.rowSelection = "multiple";
- inComGridOptions.stopEditingWhenGridLosesFocus = true;
- limitedTimeCpnGridOptions.defaultColDef.editable = true;
- limitedTimeCpnGridOptions.rowSelection = "multiple";
- // 삭제버튼 클릭시
- // 1.공급업체
- $('#btnSupplyDel').on('click', function() {
- supplyGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(supplyGridOptions)});
- });
- // 2.브랜드
- $('#btnBrandDel').on('click', function() {
- brandGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(brandGridOptions)});
- });
- // 3.카테고리
- $('#btnCateDel').on('click', function() {
- cateGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(cateGridOptions)});
- });
- // 4.적용상품
- $('#btnGoodsDel').on('click', function() {
- goodsGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(goodsGridOptions)});
- });
- // 5.제외상품
- $('#btnExcepGoodsDel').on('click', function() {
- excepGoodsGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(excepGoodsGridOptions)});
- });
- // 6.입점업체
- $('#btnDelRow').on('click', function() {
- inComGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(inComGridOptions)});
- });
- // 7.선착순
- $('#btnDelLimitedTimeCpnRow').on('click', function() {
- limitedTimeCpnGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(limitedTimeCpnGridOptions)});
- });
- // 선착순 쿠폰 행추가
- $('#btnAddLimitedTimeCpnRow').on('click', function() {
- var data = { cpnId: 1 ,limitCpnNm: null, downStdt: null, downEddt: null, downLimitQty: null, limitCpnId: null };
- gagaAgGrid.addRowData(limitedTimeCpnGridOptions, data, "limitCpnNm");
- });
- // 선착순 쿠폰 행삭제
- /*$('#btnDelLimitedTimeCpnRow').on('click', function() {
- var selectedData = limitedTimeCpnGridOptions.api.getSelectedRows();
- if (selectedData.length == 0) {
- mcxDialog.alert('선택된 행이 없습니다.');
- return;
- }
- var removedData = gagaAgGrid.removeRowData(limitedTimeCpnGridOptions, false);
- var arrLimitCpnId = [];
- $.each(selectedData, function(idx, item) {
- arrLimitCpnId.push(item.limitCpnId);
- });
- if (removedData.length > 0) {
- mcxDialog.confirm('삭제하시겠습니까?', {
- cancelBtnText: "취소",
- sureBtnText: "확인",
- sureBtnClick: function(){
- var data = { arrLimitCpnId : arrLimitCpnId
- ,cpnId : $('#CouponForm input[name=cpnId]').val()
- };
- var jsonData = JSON.stringify(data);
- gagajf.ajaxJsonSubmit('/marketing/coupon/limitedtime/coupon/update', jsonData);
- }
- });
- }
- });
- */
- // 선착순 쿠폰 체크박스 클릭시
- $("#CouponForm #limitedTimeCpnBox").bind('click', function (){
- var chkBox= document.getElementById('limitedTimeCpnYn').checked;
- if(chkBox){ //true 체크가 되어있었는데 해제됐어 -> 탭을 숨겨
- $("#CouponForm .limitedTimeCpnTab").hide();
- $("#limitedTimeCpnYn").val("N");
- $("#CouponForm #totPubLimitQty").val(0);
- $("#CouponForm input[id=chkBoxTotPubQty]").prop("disabled", false);
- $("#CouponForm input[id=totPubLimitQty]").prop("disabled", false);
- $("#CouponForm input[id=chkNoLimitTotPubLimitQty]").parent("label").removeClass("checked");
- $("#CouponForm input[id=chkNoLimitTotPubLimitQty]").attr('readonly', false);
- $("#CouponForm input[id=chkNoLimitTotPubLimitQty]").prop('disabled', false);
- $("#CouponForm input[id=chkNoLimitTotPubLimitQty]").parent().prop('disabled', false);
- }else{ //false 체크가 안되어있었는데 체크됐어 -> 탭을 보여줘
- $("#CouponForm .limitedTimeCpnTab").show();
- $("#limitedTimeCpnYn").val("Y");
- $("#CouponForm #totPubLimitQty").val(0);
- $("#CouponForm input[id=chkBoxTotPubQty]").prop("disabled", true);
- $("#CouponForm input[id=totPubLimitQty]").prop("disabled", true);
- $("#CouponForm input[id=chkNoLimitTotPubLimitQty]").parent("label").addClass("checked");
- $("#CouponForm input[id=chkNoLimitTotPubLimitQty]").attr('readonly', true);
- $("#CouponForm input[id=chkNoLimitTotPubLimitQty]").prop('disabled', true);
- $("#CouponForm input[id=chkNoLimitTotPubLimitQty]").parent().prop('disabled', true);
- }
- });
- // 종료시간 클릭시
- var fnChangeEdHH = function (obj){
- var selectId = obj.id;
- var changeId = "";
- if(selectId == "downEdHH"){
- changeId = "downEdMM";
- }else if(selectId == "availEdHH"){
- changeId = "availEdMM";
- }else if(selectId == "buyEdHH"){
- changeId = "buyEdMM";
- }else{
- changeId = "custJoinEdMM";
- }
- if(obj.value == 24) {
- $("#CouponForm #"+changeId+" option").hide();
- $('#CouponForm #'+changeId+' option:first').show().prop("selected", true);
- } else {
- $("#CouponForm #"+changeId+" option").show();
- }
- };
- // 총발행 제한수량 -> 제한없음 처리
- $("#CouponForm #chkBoxTotPubQty").bind('click', function (){
- var chkBox= document.getElementById('chkNoLimitTotPubLimitQty').checked;
- if(chkBox){ //true 체크가 되어있었는데 해제됐어 -> 값0 inputbox disabled 해제
- $("#CouponForm #totPubLimitQty").val(0);
- $("#CouponForm input[id=totPubLimitQty]").prop("disabled", false);
- }else{ //false 체크가 안되어있었는데 체크됐어 -> 값0 inputbox disabled
- $("#CouponForm #totPubLimitQty").val(0);
- $("#CouponForm input[id=totPubLimitQty]").prop("disabled", true);
- }
- });
- // 1인당발행 제한수량 -> 제한없음 처리
- $("#CouponForm #chkBoxCustPubQty").bind('click', function (){
- var chkBox= document.getElementById('chkNoLimitCustPubLimitQty').checked;
- if(chkBox){ //true 체크가 되어있었는데 해제됐어 -> 값0 inputbox disabled 해제
- $("#CouponForm #custPubLimitQty").val(0);
- $("#CouponForm input[id=custPubLimitQty]").prop("disabled", false);
- }else{ //false 체크가 안되어있었는데 체크됐어 -> 값0 inputbox disabled
- $("#CouponForm #custPubLimitQty").val(0);
- $("#CouponForm input[id=custPubLimitQty]").prop("disabled", true);
- }
- });
- // 할인방식 할인율 일때, 할인값 체크
- var fnDcValOnkeyUp = function (obj){
- var inputName = $(obj).attr("name");
- var rdoDcWay = $('#CouponForm input:radio[name="rdoDcWay"]:checked').val();
- var dcVal = $("#CouponForm input[name="+inputName+"]").val();
- if(rdoDcWay == "G240_11"){
- if(dcVal > 100){
- mcxDialog.alert('할인율은 100을 넘을수 없습니다.');
- $("#CouponForm input[name="+inputName+"]").val('');
- $("#CouponForm input[name="+inputName+"]").focus();
- return;
- }
- }
- }
- // 할인값 동일적용
- $("#applySameValueBtn").bind('click change', function () {
- var cdPval = $("#CouponForm input[name=dcPval]").val();
- $("#CouponForm input[name=dcMval]").val(cdPval);
- $("#CouponForm input[name=dcAval]").val(cdPval);
- });
- // 쿠폰 등록 버튼 클릭시
- function fnCouponCreate(){
- mcxDialog.confirm('저장하시겠습니까?' , {
- cancelBtnText:"취소",
- sureBtnText:"확인",
- sureBtnClick: function () {
- gagajf.removeCommaAtNumberFormattedInput('#CouponForm');
- // 필수값들 셋팅
- setReqValue();
- // 필수값 validation 체크
- if (!gagajf.validation('#CouponForm')) {
- return false;
- }
- // 데이터 validation 체크
- if(!checkValidation()) {
- return false;
- }
- var usableCustGbArr = [];
- var chkCustGb = $('#CouponForm input:checkbox[name=usableCustGbArr]:checked');
- for(let i=0; i< chkCustGb.length; i++){
- usableCustGbArr.push(chkCustGb.eq(i).val());
- }
- var usableCustGradeArr = [];
- var chkCustGrade = $('#CouponForm input:checkbox[name=usableCustGradeArr]:checked');
- for(let i=0; i< chkCustGrade.length; i++){
- usableCustGradeArr.push(chkCustGrade.eq(i).val());
- }
- var payTypeArr = [];
- var chkPayType = $('#CouponForm input:checkbox[name=payTypeArr]:checked');
- for(let i=0; i< chkPayType.length; i++){
- payTypeArr.push(chkPayType.eq(i).val());
- }
- var data = {
- cpnId : $('#CouponForm input[name=cpnId]').val()
- ,cpnNm : $('#CouponForm input[name=cpnNm]').val()
- ,siteCd : $('#CouponForm select[name=siteCd]').val()
- ,afLinkCd : $('#CouponForm select[name=afLinkCd]').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()
- ,dcMval : $('#CouponForm input[name=dcMval]').val()
- ,dcAval : $('#CouponForm input[name=dcAval]').val()
- ,maxDcAmt : $('#CouponForm input[name=maxDcAmt]').val()
- ,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()
- ,totPubLimitQty : $('#CouponForm input[name=totPubLimitQty]').val()
- ,onePubQtyy : $('#CouponForm input[name=onePubQtyy]').val()
- ,downStdt : $('#CouponForm input[name=downStdt]').val()
- ,downEddt : $('#CouponForm input[name=downEddt]').val()
- ,buyLimitAmt : $('#CouponForm input[name=buyLimitAmt]').val()
- ,cpnStat : $('input:radio[name="disCpnStat"]:checked').val()
- ,endAlimYn : $('#CouponForm select[name=endAlimYn]').val()
- ,firstOrdYn : $('#CouponForm select[name=firstOrdYn]').val()
- ,downAblYn : $('#CouponForm select[name=downAblYn]').val()
- ,custJoinStdt : $('#CouponForm input[name=custJoinStdt]').val()
- ,custJoinEddt : $('#CouponForm input[name=custJoinEddt]').val()
- ,buyStdt : $('#CouponForm input[name=buyStdt]').val()
- ,buyEddt : $('#CouponForm input[name=buyEddt]').val()
- ,newCustYn : $('#CouponForm select[name=newCustYn]').val()
- ,afChannel : $('#CouponForm select[name=afChannel]').val()
- ,dcCdGb : $('input:radio[name="dcCdGb"]:checked').val()
- ,rdCpnNm : $('input:radio[name="rdCpnNm"]:checked').val()
- ,supplyCompList : gagaAgGrid.getAllRowData(supplyGridOptions)
- ,brandList : gagaAgGrid.getAllRowData(brandGridOptions)
- ,applyGoodsList : gagaAgGrid.getAllRowData(goodsGridOptions)
- ,exceptGoodsList : gagaAgGrid.getAllRowData(excepGoodsGridOptions)
- ,cateList : gagaAgGrid.getAllRowData(cateGridOptions)
- ,burdenList : gagaAgGrid.getAllRowData(inComGridOptions)
- ,usableCustGbArr : usableCustGbArr
- ,usableCustGradeArr : usableCustGradeArr
- ,payTypeArr : payTypeArr
- ,limitedTimeCpnList : gagaAgGrid.getAllRowData(limitedTimeCpnGridOptions)
- };
- var jsonData = JSON.stringify(data);
- gagajf.ajaxJsonSubmit($('#CouponForm').prop('action'), jsonData, fnCouponSaveCollback);
- }
- });
- }
- var fnCouponSaveCollback = function (result){
- uifnPopupClose('CouponRegForm');
- $('#btnSearch').trigger('click');
- }
- // 쿠폰 수정 시
- function fnCouponUpdate(){
- mcxDialog.confirm('수정하시겠습니까?' , {
- cancelBtnText:"취소",
- sureBtnText:"확인",
- sureBtnClick: function () {
- gagajf.removeCommaAtNumberFormattedInput('#CouponForm');
- // disabled 해제
- $("#CouponForm * ").attr("readonly" , false);
- $("#CouponForm * ").prop("disabled" , false);
- // 필수값들 셋팅
- setReqValue();
- // 필수값 validation 체크
- if (!gagajf.validation('#CouponForm')) {
- return false;
- }
- if(!checkValidation()) {
- return false;
- }
- gagajf.ajaxFormSubmit($('#CouponForm').prop('action'), '#CouponForm', function() {
- uifnPopupClose('CouponRegForm');
- $('#btnSearch').trigger('click');
- });
- }
- });
- }
- // disabled 해제
- function setDisabledFalse(){ debugger;
- }
- function checkValidation(){
- // 사용가능고객구분 체크박스 체크
- var usableCustGbCnt = $('#CouponForm input:checkbox[name=usableCustGbArr]').length;
- if(usableCustGbCnt<1){
- mcxDialog.alert("사용가능고객구분을 체크해주세요.");
- $('#CouponForm input:checkbox[name=usableCustGbArr]').focus();
- return false;
- }
- // 사용가능고객등급 체크박스 체크
- var usableCustGradeCnt = $('#CouponForm input:checkbox[name=usableCustGradeArr]').length;
- if(usableCustGradeCnt<1){
- mcxDialog.alert("사용가능고객등급을 체크해주세요.");
- $('#CouponForm input:checkbox[name=usableCustGradeArr]').focus();
- return false;
- }
- // 결제수단 체크박스 체크
- var payTypeCnt = $('#CouponForm input:checkbox[name=payTypeArr]').length;
- if(payTypeCnt<1){
- mcxDialog.alert("사용가능고객등급을 체크해주세요.");
- $('#CouponForm input:checkbox[name=payTypeArr]').focus();
- return false;
- }
- //신규가입 지급한다면 validation 체크
- if( $('#newCustYn option:selected').val() == "Y" ){
- var fromDate = $('#CouponForm input[name=custJoinStdt]').val();
- var toDate = $('#CouponForm input[name=custJoinEddt]').val();
- if (gagajf.isNull(fromDate) || gagajf.isNull(toDate)) {
- mcxDialog.alertC("신규가입기간 시작일자와 종료일자를 입력하세요.", {
- sureBtnText: "확인",
- sureBtnClick: function() {
- $('#CouponForm input[name=custJoinStdt]').focus();
- }
- });
- return false;
- }
- if (fromDate > toDate) {
- mcxDialog.alertC("등록 시작일자는 종료일자 보다 클 수 없습니다.", {
- sureBtnText: "확인",
- sureBtnClick: function() {
- $('#CouponForm input[name=custJoinEddt]').focus();
- }
- });
- return false;
- }
- }
- // 첫구매 지급하면 validation 체크
- if( $('#firstOrdYn option:selected').val() == "Y" ){
- var fromDate = $('#CouponForm input[name=buyStdt]').val();
- var toDate = $('#CouponForm input[name=buyEddt]').val();
- if (gagajf.isNull(fromDate) || gagajf.isNull(toDate)) {
- mcxDialog.alertC("신규가입기간 시작일자와 종료일자를 입력하세요.", {
- sureBtnText: "확인",
- sureBtnClick: function() {
- $('#CouponForm input[name=buyStdt]').focus();
- }
- });
- return false;
- }
- if (fromDate > toDate) {
- mcxDialog.alertC("등록 시작일자는 종료일자 보다 클 수 없습니다.", {
- sureBtnText: "확인",
- sureBtnClick: function() {
- $('#CouponForm input[name=buyEddt]').focus();
- }
- });
- return false;
- }
- }
- // 할인율 validation 체크 (100을 넘길수없음)
- if($('#dcWay').val() == 'G240_11') {
- if($('#dcPval').val() > 100) {
- mcxDialog.alert('PC할인율은 100을 초과할수없습니다.');
- $('#dcPval').focus();
- return false;
- } else if( $('#dcMval').val() > 100) {
- mcxDialog.alert('모바일(웹)할인율은 100을 초과할수없습니다.');
- $('#dcMval').focus();
- return false;
- } else if( $('#dcAval').val() > 100) {
- mcxDialog.alert('모바일(앱)할인율은 100을 초과할수없습니다.');
- $('#dcAval').focus();
- return false;
- }
- }
- // 할인쿠폰 유형에 따른 총 발행수량 수정 (주문서 쿠폰이고 난수쿠폰일 경우)
- if($('#CouponForm #cpnType').val() == "G230_20" && $('#CouponForm input:radio[name="dcCdGb"]:checked').val() == "G233_20") {
- if($("#CouponForm input[name=randomCpnQty]").val() == "" || $("#CouponForm input[name=randomCpnQty]").val() < 1) {
- mcxDialog.alert('쿠폰의 발급 수량을 입력해주세요.');
- $("#CouponForm input[name=randomCpnQty]").focus();
- return false;
- }
- if($("#CouponForm input[name=randomCpnQty]").val() > 10000) {
- mcxDialog.alert('쿠폰의 발급 수량은 10000장을 초과할 수 없습니다.');
- $("#CouponForm input[name=randomCpnQty]").focus();
- return false;
- }
- } else if ($('#CouponForm #cpnType').val() == "G230_20" && $('#CouponForm input:radio[name="dcCdGb"]:checked').val() == "G233_10") { // 주문서 쿠폰이고 시리얼 유형일 경우
- if($("#CouponForm input[name=serialCpnNm]").val().length > 10) {
- mcxDialog.alert('시리얼쿠폰키워드는 10글자를 넘을 수 없습니다.');
- $("#CouponForm input[name=serialCpnNm]").focus();
- return false;
- }
- if($("#CouponForm input[name=serialCpnQty]").val() == "" || $("#CouponForm input[name=serialCpnQty]").val() < 1) {
- mcxDialog.alert('쿠폰의 발급 수량을 입력해주세요.');
- $("#CouponForm input[name=serialCpnQty]").focus();
- return false;
- }
- if($("#CouponForm input[name=randomCpnQty]").val() > 10000) {
- mcxDialog.alert('쿠폰의 발급 수량은 10000장을 초과할 수 없습니다.');
- $("#CouponForm input[name=serialCpnQty]").focus();
- return false;
- }
- } else if ($('#CouponForm #cpnType').val() == "G230_11" && $("#limitedTimeCpnYn").val() == "Y") { // 상품쿠폰이고 선착순쿠폰 체크되어 있을때
- let cpnData = gagaAgGrid.getAllRowData(limitedTimeCpnGridOptions);
- if(cpnData.length < 1){
- mcxDialog.alert("선착순 쿠폰을 설정해주세요.");
- return false;
- }else{
- for(i=0; i<cpnData.length; i++){
- if(gagajf.isNull(cpnData[i].limitCpnNm)){
- mcxDialog.alert(i+1 + "번 행의 선착순 쿠폰명을 입력해주세요.");
- return false;
- }
- if(gagajf.isNull(cpnData[i].downStdt)){
- mcxDialog.alert(i+1 + "번 행의 선착순쿠폰 다운로드시작일을 입력해주세요.");
- return false;
- }
- if(gagajf.isNull(cpnData[i].downEddt)){
- mcxDialog.alert(i+1 + "번 행의 선착순쿠폰 다운로드종료일을 입력해주세요.");
- return false;
- }else{
- var tempEddt = cpnData[i].downEddt.replace(/[^0-9]/g, '');
- if(tempEddt.substr(8,14) == '000000'){
- tempEddt = tempEddt.substr(0,8)+'235959';
- cpnData[i].downEddt = tempEddt;
- }
- }
- if(gagajf.isNull(cpnData[i].downLimitQty)){
- mcxDialog.alert(i+1 + "번 행의 선착순쿠폰 다운로드가능수량을 입력해주세요.");
- return false;
- }else{
- if(cpnData[i].downLimitQty<1){
- mcxDialog.alert(i+1 + "번 행의 선착순쿠폰 다운로드가능수량을 1개이상 입력해주세요.");
- return false;
- }
- }
- }
- limitedTimeCpnGridOptions.api.setRowData(cpnData);
- }
- }
- return true;
- }
- // 할인방식 변경
- $("#CouponForm input[name=rdoDcWay]").bind('click change', function () {
- var radioValue = $(this).val();
- //발급이력이있으면 수정안됨
- if(issueCnt > 0 ) {
- return false;
- }
- if(radioValue == 'G240_10') {
- $('#dcPvalSpan').text("원");
- $('#dcMvalSpan').text("원");
- $('#dcAvalSpan').text("원");
- $('#dcPval').val(0);
- $('#dcMval').val(0);
- $('#dcAval').val(0);
- $('#maxDcAmt').val(0);
- $("#CouponForm .maxDcAmtArea").hide();
- } else {
- $('#dcPvalSpan').text("%");
- $('#dcMvalSpan').text("%");
- $('#dcAvalSpan').text("%");
- $('#dcPval').val(0);
- $('#dcMval').val(0);
- $('#dcAval').val(0);
- $('#maxDcAmt').val(0);
- $("#CouponForm .maxDcAmtArea").show();
- }
- });
- // 쿠폰 상태 변경
- $("#CouponForm input[name=rdoCpnType]").bind('click change', function () {
- var radioValue = $(this).val();
- if(mode == "U") {
- radioValue = cpnDetail.cpnType;
- }
- // 즉시할인 쿠폰일때
- if(radioValue == 'G230_10'){
- $('#CouponForm .custJoinTr').hide();
- $('#CouponForm .custJoinDateTr').hide();
- $('#CouponForm .firstBuyTr').hide();
- $('#CouponForm .buyDateTr').hide();
- $('#CouponForm .dcCdCheck1').hide();
- $('#CouponForm .limitedTimeCpnArea').hide();
- }else{
- if(radioValue == 'G230_11'){ // 상품쿠폰일때 선착순쿠폰 등록 가능
- $('#CouponForm .limitedTimeCpnArea').show();
- }else{
- $('#CouponForm .limitedTimeCpnArea').hide();
- }
- $('#CouponForm .custJoinTr').show();
- $('#CouponForm .firstBuyTr').show();
- $('#CouponForm .dcCdCheck1').show();
- }
- // 상품쿠폰 선택시 적용범위 개별로 변경 나머진 전체
- if(radioValue == 'G230_11') {
- $("input:radio[name='rdoApplyScope']:radio[value='I']").prop('checked', true);
- } else {
- $("input:radio[name='rdoApplyScope']:radio[value='A']").prop('checked', true);
- }
- // 주문서 쿠폰 선택시 결제수단 노출
- if(radioValue == 'G230_20') {
- $('#CouponForm .payTypeTr').show();
- $('#CouponForm #payType').attr('required' , true);
- $("#CouponForm .dcCdGb").show(); // 할인쿠폰유형 노출
- } else {
- $('#CouponForm .payTypeTr').hide();
- $('#CouponForm #payType').attr('required' , false );
- $("#CouponForm .dcCdGb").hide(); // 할인쿠폰유형 숨김
- $("#CouponForm input:radio[name='dcCdGb']:radio[value='G233_00']").prop('checked', true); // 주문서 쿠폰이 아닐 경우 일반 쿠폰으로 설정
- }
- $('#CouponForm #cpnType').val(radioValue);
- });
- // 할인 쿠폰 유형 변경
- $("#CouponForm input[name=dcCdGb]").bind('click change', function () {
- if(this.value == "G233_00") { // 일반 유형
- $("#CouponForm .dcCdCheck1").show();
- $("#CouponForm .dcCdCheck2").show();
- $("#CouponForm .serialCpnArea").hide();
- $("#CouponForm .randomCpnArea").hide();
- $("#CouponForm #newCustYn").parent().attr("colspan", "");
- $("#CouponForm .normalCol").attr("colspan", "5");
- $('#CouponForm input[name="serialCpnNm"]').attr('required' , false);
- $('#CouponForm input[name="serialCpnQty"]').attr('required' , false);
- $('#CouponForm input[name="randomCpnQty"]').attr('required' , false);
- } else {
- if(this.value == "G233_10") { // 시리얼 유형
- $("#CouponForm .serialCpnArea").show();
- $("#CouponForm .randomCpnArea").hide();
- $("#CouponForm .normalCol").attr("colspan", "5");
- $('#CouponForm input[name="serialCpnNm"]').attr('required' , true);
- $('#CouponForm input[name="serialCpnQty"]').attr('required' , true);
- $('#CouponForm input[name="randomCpnQty"]').attr('required' , false);
- } else { // 난수 유형
- $("#CouponForm .serialCpnArea").hide();
- $("#CouponForm .randomCpnArea").show();
- $("#CouponForm .normalCol").attr("colspan", "");
- $('#CouponForm input[name="serialCpnNm"]').attr('required' , false);
- $('#CouponForm input[name="serialCpnQty"]').attr('required' , false);
- $('#CouponForm input[name="randomCpnQty"]').attr('required' , true);
- }
- $("#CouponForm .dcCdCheck1").hide(); // 총발행제한수량, 1회발행수량, 1인당발행제한수량 숨김
- $("#CouponForm .dcCdCheck2").hide(); // 총발행제한수량, 1회발행수량, 1인당발행제한수량 숨김
- $("#CouponForm #newCustYn").parent().attr("colspan", "5"); // 총발행제한 수량을 없애면서 신규회원여부 colspan 수정
- }
- });
- // 적용대상 - 브랜드 추가 버튼시
- $('#btnBrandAdd').on('click' , function(){
- cfnOpenBrandListPopup("fnSetPopupBrandInfo", "M");
- });
- // 브랜드 설정 / 브랜드 추가 콜백함수 (단수로 가져오므로 복수일 경우에 수정 확인 필요)
- var fnSetPopupBrandInfo = function(result) {
- for(let i = 0 ; i < result.length ; i++) {
- let addChk = true, gridListValue = gagaAgGrid.getAllRowData(brandGridOptions); // 받아온 모든 데이터
- // 받아온 data for
- for(let j = 0 ; j < gridListValue.length ; j++) {
- if(gridListValue[j].brandCd == result[i].brandCd) { addChk = false; } // 중복체크
- }
- // 중복되지 않은 데이터 리스트에 추가
- if(addChk) {
- gagaAgGrid.addRowData(brandGridOptions, {"brandCd" : result[i].brandCd, "brandEnm" : result[i].brandEnm, "supplyCompNm" : result[i].supplyCompNm});
- }
- }
- };
- // 적용대상 - 브랜드 삭제 버튼시
- /*$('#btnBrandDel').on('click' , function(){
- var selectVal = brandGridOptions.api.getSelectedRows();
- if(selectVal.length == 0) {
- mcxDialog.alert("선택된 행이 없습니다");
- return;
- }
- if(cpnDetail != null ) {
- mcxDialog.confirm('삭제하시겠습니까?', {
- cancelBtnText: "취소",
- sureBtnText: "확인",
- sureBtnClick: function(){
- gagaAgGrid.removeRowData(brandGridOptions , false);
- var cpnRefvalSqArr = [];
- $.each(selectVal , function(idx , item){
- cpnRefvalSqArr.push(item.cpnRefvalSq);
- });
- 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)});
- }
- });
- */
- // 적용대상 - 공급처 추가 버튼시
- $('#btnSupplyAdd').on('click' , function (){
- cfnOpenCompanyListPopup("fnSetPopupComapnyInfo" , "M");
- });
- // 공급업체 설정 / 업체 추가 콜백함수
- var fnSetPopupComapnyInfo = function(result) {
- // 기존 리스트 데이터 for
- for(let i = 0 ; i < result.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[i].supplyCompCd) { addChk = false; } // 중복체크
- }
- // 중복되지 않은 데이터 리스트에 추가
- if(addChk) {
- gagaAgGrid.addRowData(supplyGridOptions, {"supplyCompCd" : result[i].supplyCompCd, "supplyCompNm" : result[i].supplyCompNm});
- }
- }
- };
- // 적용대상 - 공급처 삭제시시
- /*$('#btnSupplyDel').on('click' , function () {
- 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)});
- }
- });*/
- // 적용대상 - 카테고리 추가시
- $('#btnCateAdd').on('click' , function () {
- cfnOpenCategoryPopup("fnSetPopupCategoryInfo");
- });
- // 카테고리 추가 콜백 함수
- var fnSetPopupCategoryInfo = function (result) {
- // 기존 리스트 데이터 for
- for(let i = 0 ; i < result.length ; i++) {
- let addChk = true, gridListValue = gagaAgGrid.getAllRowData(cateGridOptions); // 받아온 모든 데이터
- // 받아온 data for
- for(let j = 0 ; j < gridListValue.length ; j++) {
- // 동일한 data는 추가하지 않음
- if(gridListValue[j].cateNo == result[i].cateNo) { addChk = false; } // 중복체크
- }
- // 중복되지 않은 데이터 리스트에 추가
- if(addChk) {
- gagaAgGrid.addRowData(cateGridOptions, {"siteCd":result[i].siteCd , "cateGb":result[i].cateGb , "cateNo":result[i].cateNo, "cateNm":result[i].cateNm , "formalGb":result[i].formalGb , "brandEnm":null});
- }
- }
- }
- // 적용대상 - 카테고리 삭제시
- /*$('#btnCateDel').on('click' , function () {
- 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)});
- }
- });
- */
- // 적용대상 - 상품 추가시
- $('#btnGoodsAdd').on('click' , function () {
- cfnOpenGoodsPopup("fnSetPopupApplyGoodsInfo");
- });
- // 적용 상품 리스트 콜백함수
- var fnSetPopupApplyGoodsInfo = function(result) {
- gridAddGoodsList(goodsGridOptions, result , "apply");
- };
- // 적용대상 - 상품 삭제 시
- /*$('#btnGoodsDel').on('click' , function () {
- 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(){
- cfnOpenGoodsPopup("fnSetPopupExceptGoodsInfo");
- });
- // 적용 상품 리스트 콜백함수
- var fnSetPopupExceptGoodsInfo = function(result) {
- gridAddGoodsList(excepGoodsGridOptions, result , "except");
- };
- // 적용대상 - 제외상품 삭제시
- /*$('#btnExcepGoodsDel').on('click' , function () {
- var selectVal = excepGoodsGridOptions.api.getSelectedRows();
- if(selectVal.length == 0) {
- mcxDialog.alert("선택된 행이 없습니다");
- return;
- }
- 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()
- };
- var jsonData = JSON.stringify(data);
- gagajf.ajaxJsonSubmit('/marketing/coupon/refval/update', jsonData);
- }
- });
- } else {
- excepGoodsGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(excepGoodsGridOptions)});
- }
- });
- */
- // ag-grid 상품관련 list 콜백함수
- function gridAddGoodsList(OriginGridListOption, result, gubun) {
- var goodsGbVal = "G800_10";
- if(gubun == 'except'){
- goodsGbVal = "G800_30";
- }
- for(let i = 0 ; i < result.length ; i++) {
- let addChk = true, gridListValue = gagaAgGrid.getAllRowData(OriginGridListOption); // 받아온 모든 데이터
- // 받아온 data for
- for(let j = 0 ; j < gridListValue.length ; j++) {
- if(gridListValue[j].goodsCd == result[i].goodsCd) { addChk = false; } // 중복체크
- }
- // 중복되지 않은 데이터 리스트에 추가
- if(addChk) {
- gagaAgGrid.addRowData(OriginGridListOption, {"goodsGb": goodsGbVal, "goodsCd" : result[i].goodsCd, "goodsNm" : result[i].goodsNm});
- }
- }
- }
- // 기간 일수 변경시
- function pdGbChange(pThis){
- var selectVal = $(pThis).val();
- if(typeof selectVal == "undefined") {
- if(mode == "U") {
- selectVal = cpnDetail.pdGb;
- } else {
- selectVal = "P";
- }
- }
- if(selectVal == "P") {
- $('.availDateTr').css('display' , '');
- $('.availDayTr').css('display' , 'none');
- $('#CouponForm #availDays').attr('required' , false);
- $('#CouponForm #availStDay').attr('required' , true);
- $('#CouponForm #availEdDay').attr('required' , true);
- $('#CouponForm #availStdt').attr('required' , true);
- $('#CouponForm #availEddt').attr('required' , true);
- } else {
- $('.availDateTr').css('display' , 'none');
- $('.availDayTr').css('display' , '');
- $('#CouponForm #availDays').attr('required' , true);
- $('#CouponForm #availStDay').attr('required' , false);
- $('#CouponForm #availEdDay').attr('required' , false);
- $('#CouponForm #availStdt').attr('required' , false);
- $('#CouponForm #availEddt').attr('required' , false);
- }
- }
- // 첫구매여부 변경시
- function firstOrdYnChange(pThis){
- var selectVal = $(pThis).val();
- if(typeof selectVal == "undefined") {
- if(mode == "U") {
- selectVal = cpnDetail.firstOrdYn;
- } else {
- selectVal = "N";
- }
- }
- if(selectVal == "Y" ) {
- $('.buyDateTr').css('display' , '');
- $('#buyStdt').attr('required' , true);
- $('#buyEddt').attr('required' , true);
- } else {
- $('.buyDateTr').css('display' , 'none');
- $('#buyStdt').attr('required' , false);
- $('#buyEddt').attr('required' , false);
- }
- }
- // 신규회원여부 변경시
- function newCustYnChange(pThis){
- var selectVal = $(pThis).val();
- if(typeof selectVal == "undefined") {
- if(mode == "U") {
- selectVal = cpnDetail.newCustYn;
- } else {
- selectVal = "N";
- }
- }
- if(selectVal == "Y" ) {
- $('.custJoinDateTr').css('display' , '');
- $('#custJoinStdt').attr('required' , true);
- $('#custJoinEddt').attr('required' , true);
- } else {
- $('.custJoinDateTr').css('display' , 'none');
- $('#custJoinStdt').attr('required' , false);
- $('#custJoinEddt').attr('required' , false);
- }
- }
- // 행추가시
- $('#btnAddRow').on('click' , function(){
- var data = { supplyCompCd: null , burdenRate : null , delYn : null};
- gagaAgGrid.addRowData(inComGridOptions , data , "supplyCompCd" );
- });
- // 행삭제시
- /*$('#btnDelRow').on('click' , function(){
- inComGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(inComGridOptions)});
- });*/
- // 제휴링크채널 수정 (제휴링크가 꼭필요한지 확인필요)
- function fnChangeAfLinkCdList(){
- var actionUrl = "/business/aflink/list" + '?' + $('#afChannel').serialize();
- var tag = "";
- $("#CouponForm #afLinkCd").children('option').remove();
- gagajf.ajaxJsonSubmit(actionUrl, '', function(data) {
- for (let i = 0; i < data.length; i++) {
- if (data[i].useYn == 'Y') {
- tag += '<option value="' + data[i].afLinkCd + '">[' + data[i].afLinkCd + '] ' + data[i].afLinkNm + '</option>';
- }
- }
- $("#CouponForm #afLinkCd").append(tag);
- $("#CouponForm #afLinkCd option:first").attr("selected" , "selected");
- });
- }
- // 발급받은회원 팝업
- var fnPubCustListPopUp = function (){
- let cpnId = $("#CouponForm #cpnId").val();
- var actionUrl = "/marketing/coupon/pubCust/popup/form?cpnId=" + cpnId;
- cfnOpenModalPopup(actionUrl, 'CpnPubCustListPopup');
- };
- // 쿠폰발행팝업
- function fnCustomerIssuePopUp(){
- cfnCpnPubForCustPopup();
- };
- // 전송시 값 세팅
- function setReqValue(){
- // 쿠폰유형값 세팅
- $('#CouponForm #cpnType').val($('#CouponForm input:radio[name="rdoCpnType"]:checked').val());
- // 할인방식값 세팅
- $('#CouponForm #dcWay').val($('#CouponForm input:radio[name="rdoDcWay"]:checked').val());
- // 적용범위값 세팅
- $('#CouponForm #applyScope').val($('#CouponForm input:radio[name="rdoApplyScope"]:checked').val());
- // 쿠폰상태
- $('#CouponForm input[name=cpnStat]').val($('input:radio[name="disCpnStat"]:checked').val());
- // 다운로드기간 세팅
- let downStdt = "";
- let downEddt = "";
- downStdt = $('#CouponForm input[name=downStDay]').val()+$('#CouponForm select[name=downStHH]').val()+$('#CouponForm select[name=downStMM]').val()+'00';
- if($('#CouponForm select[name=downEdHH]').val() == "24"){
- downEddt = $('#CouponForm input[name=downEdDay]').val()+'235959';
- }else{
- downEddt = $('#CouponForm input[name=downEdDay]').val()+$('#CouponForm select[name=downEdHH]').val()+$('#CouponForm select[name=downEdMM]').val()+'00';
- }
- downStdt = downStdt.replace(/[^0-9]/g, '');
- downEddt = downEddt.replace(/[^0-9]/g, '');
- $('#CouponForm #downStdt').val(downStdt);
- $('#CouponForm #downEddt').val(downEddt);
- // 유효기간 세팅
- let availStdt = "";
- let availEddt = "";
- if($("#CouponForm #pdGb").val() == 'P') {
- availStdt = $('#CouponForm input[name=availStDay]').val()+$('#CouponForm select[name=availStHH]').val()+$('#CouponForm select[name=availStMM]').val()+'00';
- if($('#CouponForm select[name=availEdHH]').val() == "24"){
- availEddt = $('#CouponForm input[name=availEdDay]').val()+'235959';
- }else{
- availEddt = $('#CouponForm input[name=availEdDay]').val()+$('#CouponForm select[name=availEdHH]').val()+$('#CouponForm select[name=availEdMM]').val()+'00';
- }
- availStdt = availStdt.replace(/[^0-9]/g, '');
- availEddt = availEddt.replace(/[^0-9]/g, '');
- $('#CouponForm #availStdt').val(availStdt);
- $('#CouponForm #availEddt').val(availEddt);
- $('#CouponForm #availDays').val('');
- } else {
- $('#CouponForm #availStdt').val('');
- $('#CouponForm #availEddt').val('');
- }
- // 첫구매기간세팅
- let buyStdt = "";
- let buyEddt = "";
- buyStdt = $('#CouponForm input[name=buyStDay]').val()+$('#CouponForm select[name=buyStHH]').val()+$('#CouponForm select[name=buyStMM]').val()+'00';
- if($('#CouponForm select[name=buyEdHH]').val() == "24"){
- buyEddt = $('#CouponForm input[name=buyEdDay]').val()+'235959';
- }else{
- buyEddt = $('#CouponForm input[name=buyEdDay]').val()+$('#CouponForm select[name=buyEdHH]').val()+$('#CouponForm select[name=buyEdMM]').val()+'00';
- }
- buyStdt = buyStdt.replace(/[^0-9]/g, '');
- buyEddt = buyEddt.replace(/[^0-9]/g, '');
- $('#CouponForm #buyStdt').val(buyStdt);
- $('#CouponForm #buyEddt').val(buyEddt);
- // 신규회원기간 세팅
- let custJoinStdt = "";
- let custJoinEddt = "";
- custJoinStdt = $('#CouponForm input[name=custJoinStDay]').val()+$('#CouponForm select[name=custJoinStHH]').val()+$('#CouponForm select[name=custJoinStMM]').val()+'00';
- if($('#CouponForm select[name=custJoinEdHH]').val() == "24"){
- custJoinEddt = $('#CouponForm input[name=custJoinEdDay]').val()+'235959';
- }else{
- custJoinEddt = $('#CouponForm input[name=custJoinEdDay]').val()+$('#CouponForm select[name=custJoinEdHH]').val()+$('#CouponForm select[name=custJoinEdMM]').val()+'00';
- }
- custJoinStdt = custJoinStdt.replace(/[^0-9]/g, '');
- custJoinEddt = custJoinEddt.replace(/[^0-9]/g, '');
- $('#CouponForm #custJoinStdt').val(custJoinStdt);
- $('#CouponForm #custJoinEddt').val(custJoinEddt);
- // 할인쿠폰 유형에 따른 총 발행수량 수정 (주문서 쿠폰이고 난수쿠폰일 경우)
- if($('#CouponForm #cpnType').val() == "G230_20" && $('#CouponForm input:radio[name="dcCdGb"]:checked').val() == "G233_20") {
- $('#CouponForm input[name="totPubLimitQty"]').val($('#CouponForm input[name="randomCpnQty"]').val()); // 총 발행수량 난수 생성수량으로 변경
- $('#CouponForm input[name="custPubLimitQty"]').val(1); // 1인당 발행제한수량 1개 고정
- $('#CouponForm input[name="onePubQty"]').val(1); // 1회발행수량 1개 고정
- } else if ($('#CouponForm #cpnType').val() == "G230_20" && $('#CouponForm input:radio[name="dcCdGb"]:checked').val() == "G233_10") { // 주문서 쿠폰이고 시리얼 유형일 경우
- $('#CouponForm input[name="rdCpnNm"]').val($('#CouponForm input[name="serialCpnNm"]').val()); // 시리얼유형쿠폰명 저장
- $('#CouponForm input[name="totPubLimitQty"]').val($('#CouponForm input[name="serialCpnQty"]').val()); // 총 발행수량 랜덤쿠폰발급수량으로 변경
- $('#CouponForm input[name="custPubLimitQty"]').val(1); // 1인당 발행제한수량 1개 고정
- $('#CouponForm input[name="onePubQty"]').val(1); // 1회발행수량 1개 고정
- }
- // 적용대상 - 공급처 그리드 전체값 세팅
- /*var supplyAllData = gagaAgGrid.getAllRowData(supplyGridOptions);
- var jsonSupplyCompData = JSON.stringify(supplyAllData);
- $('#CouponForm #supplyCompList').val(jsonSupplyCompData);*/
- $('#CouponForm #supplyCompList').val(gagaAgGrid.getAllRowData(supplyGridOptions));
- // 적용대상 - 브랜드 그리드 전체값 세팅
- /*var brandAllData = gagaAgGrid.getAllRowData(brandGridOptions);
- var jsonBrandData = JSON.stringify(brandAllData);
- $('#CouponForm #brandList').val(jsonBrandData);*/
- $('#CouponForm #brandList').val(gagaAgGrid.getAllRowData(brandGridOptions));
- // // 적용대상 - 카테고리 그리드 전체값 세팅
- /*var cateAllData = gagaAgGrid.getAllRowData(cateGridOptions);
- var jsonCateData = JSON.stringify(cateAllData);
- $('#CouponForm #cateList').val(jsonCateData);*/
- $('#CouponForm #cateList').val(gagaAgGrid.getAllRowData(cateGridOptions));
- // 적용대상 - 적용상품 그리드 전체값 세팅
- /*var goodsAllData = gagaAgGrid.getAllRowData(goodsGridOptions);
- var jsonGoodsData = JSON.stringify(goodsAllData);
- $('#CouponForm #applyGoodsList').val(jsonGoodsData);*/
- $('#CouponForm #applyGoodsList').val(gagaAgGrid.getAllRowData(goodsGridOptions));
- // 적용대상 - 제외상품 그리드 전체값 세팅
- /*var exceptGoodsAllData = gagaAgGrid.getAllRowData(excepGoodsGridOptions);
- var jsonExceptGoodsData = JSON.stringify(exceptGoodsAllData);
- $('#CouponForm #excepGoodsList').val(jsonExceptGoodsData);*/
- $('#CouponForm #excepGoodsList').val(gagaAgGrid.getAllRowData(excepGoodsGridOptions));
- // 입점업체분담율 그리드 전체값 세팅
- /*var inCompBurdenAllData = gagaAgGrid.getAllRowData(inComGridOptions);
- var jsonInCompBurdenData = JSON.stringify(inCompBurdenAllData);
- $('#CouponForm #burdenList').val(jsonInCompBurdenData);*/
- $('#CouponForm #burdenList').val(gagaAgGrid.getAllRowData(inComGridOptions));
- }
- $(document).ready(function() {
- gagaAgGrid.createGrid('inComGridList', inComGridOptions);
- gagaAgGrid.createGrid('brandGridList', brandGridOptions);
- gagaAgGrid.createGrid('cateGridList', cateGridOptions);
- gagaAgGrid.createGrid('supplyGridList', supplyGridOptions);
- gagaAgGrid.createGrid('goodsGridList', goodsGridOptions);
- gagaAgGrid.createGrid('excepGoodsGridList', excepGoodsGridOptions);
- gagaAgGrid.createGrid('randomCpnList', randomCouponGridOptions);
- gagaAgGrid.createGrid('limitedTimeCpnList', limitedTimeCpnGridOptions);
- // 일단 버튼 숨김
- $(".couponButton").hide();
- // 초기화시 데이터 세팅
- if (mode == "N") {
- $('input[name=rdoCpnType]').eq(0).attr("checked", true);
- $('input[name=dcCdGb]').eq(0).attr("checked", true);
- $('input[name=rdoDcWay]').eq(0).attr("checked", true);
- $('input[name=rdoApplyScope]').eq(0).attr("checked", true)
- $('#CouponForm #availEdHH option:last').attr("selected", "selected");
- $('#CouponForm #availEdMM option').hide();
- $('#CouponForm #availEdMM option:first').show().prop("selected", true);
- $('#downEdHH option:last').attr("selected", "selected");
- $('#downEdMM option').hide();
- $('#downEdMM option:first').show().prop("selected", true);
- $('#custJoinEdHH option:last').attr("selected", "selected");
- $('#custJoinEdMM option').hide();
- $('#custJoinEdMM option:first').show().prop("selected", true);
- $('#buyEdHH option:last').attr("selected", "selected");
- $('#buyEdMM option').hide();
- $('#buyEdMM option:first').show().prop("selected", true);
- $("#CouponForm #afChannel option:first").attr("selected" , "selected");
- $("#CouponForm .normalCol").attr("colspan", "5");
- $("#CouponForm .randomCpnArea").hide();
- $("#CouponForm .maxDcAmtArea").hide();
- $("input:radio[name='disCpnStat']:radio[value='G232_10']").prop('checked', true); // 선택하기
- if($('input:radio[name="rdoCpnType"]:checked').val() == 'G230_10'){
- $('#CouponForm .custJoinTr').hide();
- $('#CouponForm .custJoinDateTr').hide();
- $('#CouponForm .firstBuyTr').hide();
- $('#CouponForm .buyDateTr').hide();
- $('#CouponForm .dcCdCheck1').hide();
- }
- $("#btnCouponSave").show(); // 저장버튼
- $("#CouponForm .buttonSpan").show();
- } else {
- if(cpnDetail.cpnStat == "G232_10"){
- $("#btnCouponSave").show(); // 저장버튼
- $("#btnChangeStatIng").show(); // 진행버튼
- $("#btnCouponDelete").show(); // 삭제버튼
- $("#CouponForm .buttonSpan").show(); //행추가,삭제버튼
- }else if(cpnDetail.cpnStat == "G232_10"){
- $("#btnCouponSave").hide(); // 저장버튼
- $("#btnCouponStop").show(); // 중지버튼
- $("#btnCouponDelete").show(); // 삭제버튼
- $("#CouponForm .buttonSpan").hide(); //행추가,삭제버튼
- }else{
- $("#CouponForm .buttonSpan").hide(); //행추가,삭제버튼
- }
- if(cpnCustGbList.length > 0){
- var chkboxCnt = $('#CouponForm input:checkbox[name=usableCustGbArr]').length;
- var dataCnt = cpnCustGbList.length;
- for(let i=0; i<chkboxCnt; i++){
- for(let j=0; j<dataCnt; j++){
- var data = cpnCustGbList[j].usableCustGb;
- if($('#CouponForm input:checkbox[name=usableCustGbArr]').eq(i).val() == data){
- $('#CouponForm input:checkbox[name=usableCustGbArr]').eq(i).prop('checked', true);
- $("#CouponForm input:checkbox[name=usableCustGbArr]").eq(i).parent().addClass('checked');
- }
- }
- }
- }
- if(cpnCustGradeList.length > 0){
- var chkboxCnt = $('#CouponForm input:checkbox[name=usableCustGradeArr]').length;
- var dataCnt = cpnCustGradeList.length;
- for(let i=0; i<chkboxCnt; i++){
- for(let j=0; j<dataCnt; j++){
- var data = cpnCustGradeList[j].usableCustGrade;
- if($('#CouponForm input:checkbox[name=usableCustGradeArr]').eq(i).val() == data){
- $('#CouponForm input:checkbox[name=usableCustGradeArr]').eq(i).prop('checked', true);
- $("#CouponForm input:checkbox[name=usableCustGradeArr]").eq(i).parent().addClass('checked');
- }
- }
- }
- }
- if(cpnPayTypeList.length > 0){
- var chkboxCnt = $('#CouponForm input:checkbox[name=payTypeArr]').length;
- var dataCnt = cpnPayTypeList.length;
- for(let i=0; i<chkboxCnt; i++){
- for(let j=0; j<dataCnt; j++){
- var data = cpnPayTypeList[j].payType;
- if($('#CouponForm input:checkbox[name=payTypeArr]').eq(i).val() == data){
- $('#CouponForm input:checkbox[name=payTypeArr]').eq(i).prop('checked', true);
- $("#CouponForm input:checkbox[name=payTypeArr]").eq(i).parent().addClass('checked');
- }
- }
- }
- }
- // 수정모드시 그리드 세팅
- inComGridOptions.api.setRowData(cpnDtlBurdenList);
- supplyGridOptions.api.setRowData(cpnDtlRefvalSupplyCompList);
- goodsGridOptions.api.setRowData(cpnDtlRefvalApplyGoodsList);
- excepGoodsGridOptions.api.setRowData(cpnDtlRefvalExceptGoodsList);
- brandGridOptions.api.setRowData(cpnDtlRefvalBrandList);
- cateGridOptions.api.setRowData(cpnDtlRefvalCateList);
- randomCouponGridOptions.api.setRowData(randomCpnList);
- limitedTimeCpnGridOptions.api.setRowData(limitedTimeCpnList);
- // 기본정보 세팅
- $("#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);
- $("#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);
- $("#CouponForm #firstOrdYn").val(cpnDetail.firstOrdYn).prop("selected", true);
- $("#CouponForm #reissuance").val(cpnDetail.reissuance).prop("selected", true);
- $("#CouponForm #dnGb").val(cpnDetail.dnGb).prop("selected", true);
- //$("#CouponForm #cpnStat").val(cpnDetail.cpnStat).prop("selected", true);
- $("input:radio[name='disCpnStat']:radio[value="+cpnDetail.cpnStat+"]").prop('checked', true); // 선택하기
- $("#CouponForm #newCustYn").val(cpnDetail.newCustYn).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 #downAblYn").val(cpnDetail.downAblYn);
- $("#CouponForm #buyLimitAmt").val(cpnDetail.buyLimitAmt);
- $("#CouponForm #cpnId").val(cpnDetail.cpnId);
- if(limitedTimeCpnList.length>0 && cpnDetail.cpnType == "G230_11"){ //상품쿠폰이고 선착순쿠폰일때
- $("#CouponForm #limitedTimeCpnYn").val("Y");
- $("#CouponForm .limitedTimeCpnTab").show();
- $('#CouponForm .limitedTimeCpnArea').show();
- $("#CouponForm input[id=limitedTimeCpnYn]").parent("label").addClass("checked");
- $("#CouponForm input[id=limitedTimeCpnYn]").attr('readonly', true);
- $("#CouponForm input[id=limitedTimeCpnYn]").prop('disabled', true);
- $("#CouponForm input[id=limitedTimeCpnYn]").parent().prop('disabled', true);
- $("#CouponForm input[id=totPubLimitQty]").prop("disabled", true);
- $("#CouponForm input[id=chkNoLimitTotPubLimitQty]").parent("label").addClass("checked");
- $("#CouponForm input[id=chkNoLimitTotPubLimitQty]").attr('readonly', true);
- $("#CouponForm input[id=chkNoLimitTotPubLimitQty]").prop('disabled', true);
- $("#CouponForm input[id=chkNoLimitTotPubLimitQty]").parent().prop('disabled', true);
- }else{
- $("#CouponForm #limitedTimeCpnYn").val("N");
- $("#CouponForm .limitedTimeCpnTab").hide();
- $('#CouponForm .limitedTimeCpnArea').hide();
- }
- // 한번 저장되면 쿠폰유형, 할인쿠폰유형, 난수 생성수량, 시리얼명, 시리얼쿠폰발급수량 수정 불가 처리
- $("#CouponForm input:radio[name='rdoCpnType']").attr('readonly', true);
- $("#CouponForm input:radio[name='rdoCpnType']").prop('disabled', true);
- $("#CouponForm input:radio[name='rdoCpnType']").parent().prop('disabled', true);
- $("#CouponForm input:radio[name='dcCdGb']").attr('readonly', true);
- $("#CouponForm input:radio[name='dcCdGb']").prop('disabled', true);
- $("#CouponForm input:radio[name='dcCdGb']").parent().prop('disabled', true);
- $("#CouponForm input:radio[name='dcCdGb']:radio[value=" + cpnDetail.dcCdGb + "]").prop('checked', true);
- $("#CouponForm input[name='serialCpnNm']").prop("disabled", true);
- $("#CouponForm input[name='serialCpnQty']").prop("disabled", true);
- $("#CouponForm input[name='randomCpnQty']").prop("disabled", true);
- // 즉시할인 쿠폰이면
- if(cpnDetail.cpnType == "G230_10") {
- $('#CouponForm .custJoinTr').hide();
- $('#CouponForm .custJoinDateTr').hide();
- $('#CouponForm .firstBuyTr').hide();
- $('#CouponForm .buyDateTr').hide();
- $('#CouponForm .dcCdCheck1').hide();
- }else{
- $('#CouponForm .custJoinTr').show();
- $('#CouponForm .custJoinDateTr').show();
- $('#CouponForm .firstBuyTr').show();
- $('#CouponForm .buyDateTr').show();
- $('#CouponForm .dcCdCheck1').show();
- }
- // 할인방식이 할인율이면 최대할인금액 노출
- if(cpnDetail.dcWay == "G240_11"){
- $("#CouponForm .maxDcAmtArea").show();
- }
- // 주문서 쿠폰이면 할인쿠폰유형 노출
- if(cpnDetail.cpnType == "G230_20") {
- $("#CouponForm .dcCdGb").show();
- }
- // 할인코드유형이 일반유형이 아니면
- if(cpnDetail.dcCdGb != "G233_00" ) {
- $("#CouponForm .randomCpnTab").show(); // 시리얼 및 난수 TAB 노출
- $("#CouponForm .dcCdCheck1").hide(); // 총발행제한수량, 1회발행수량, 1인당발행제한수량 숨김
- $("#CouponForm .dcCdCheck2").hide(); // 총발행제한수량, 1회발행수량, 1인당발행제한수량 숨김
- if(cpnDetail.dcCdGb == "G233_10") { // 시리얼 유형
- $("#CouponForm input[name='serialCpnQty']").val(cpnDetail.totPubLimitQty);
- $("#CouponForm input[name='serialCpnNm']").val(cpnDetail.rdCpnNm);
- $("#CouponForm .normalCol").attr("colspan", "5");
- $("#CouponForm .serialCpnArea").show();
- $("#CouponForm .randomCpnArea").hide();
- } else if (cpnDetail.dcCdGb == "G233_20") {
- $("#CouponForm input[name='randomCpnQty']").val(cpnDetail.totPubLimitQty);
- $("#CouponForm .normalCol").attr("colspan", "");
- $("#CouponForm .randomCpnArea").show();
- $("#CouponForm .serialCpnArea").hide();
- }
- }
- // 쿠폰다운 날짜
- let edDtArr;
- if(!gagajf.isNull(cpnDetail.downEddt)){
- edDtArr = cpnDetail.downEddt.split(" ");
- if(edDtArr[1] == "23:59:59") {
- edHour = "24";
- edMinute = "00";
- $("#CouponForm #downEdMM option").hide();
- $('#CouponForm #downEdMM option:first').show().prop("selected", true);
- }
- }
- // 유효 날짜
- let availEdDtArr;
- if(!gagajf.isNull(cpnDetail.availEddt)){
- availEdDtArr = cpnDetail.availEddt.split(" ");
- if(availEdDtArr[1] == "23:59:59") {
- edHour = "24";
- edMinute = "00";
- $("#CouponForm #availEdMM option").hide();
- $('#CouponForm #availEdMM option:first').show().prop("selected", true);
- }
- }
- // 첫구매 날짜
- let firstBuyEdDtArr;
- if(!gagajf.isNull(cpnDetail.buyEddt)){
- firstBuyEdDtArr = cpnDetail.buyEddt.split(" ");
- if(firstBuyEdDtArr[1] == "23:59:59") {
- edHour = "24";
- edMinute = "00";
- $("#CouponForm #buyEdMM option").hide();
- $('#CouponForm #buyEdMM option:first').show().prop("selected", true);
- }
- }
- // 신규가입 날짜
- let custJoinEdDtArr;
- if(!gagajf.isNull(cpnDetail.custJoinEddt)){
- custJoinEdDtArr = cpnDetail.custJoinEddt.split(" ");
- if(custJoinEdDtArr[1] == "23:59:59") {
- edHour = "24";
- edMinute = "00";
- $("#CouponForm #custJoinEdMM option").hide();
- $('#CouponForm #custJoinEdMM option:first').show().prop("selected", true);
- }
- }
- /*
- $("#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);
- $("#CouponForm #endAlimYn").attr('disabled', true);
- $("#CouponForm #firstOrdYn").attr('readonly', true);
- $("#CouponForm #firstOrdYn").attr('disabled', true);
- $("#CouponForm #reissuance").attr('readonly', true);
- $("#CouponForm #reissuance").attr('disabled', true);
- $("#CouponForm #dnGb").attr('readonly', true);
- $("#CouponForm #dnGb").attr('disabled', true);
- $("#CouponForm #newCustYn").attr('readonly', true);
- $("#CouponForm #newCustYn").attr('disabled', true);
- $("#CouponForm #pdGb").attr('readonly', true);
- $("#CouponForm #pdGb").attr('disabled', true);
- $("#CouponForm #downAblYn").attr('readonly', true);
- $("#CouponForm #downAblYn").attr('disabled', true);
- $("#CouponForm #siteCd").attr('readonly', true);
- $("#CouponForm #siteCd").attr('disabled', true);
- $("#CouponForm #cpnNm").attr('readonly', true);
- $("#CouponForm #cpnNm").attr('disabled', true);
- $("#CouponForm #dcPval").attr('readonly', true);
- $("#CouponForm #dcPval").attr('disabled', true);
- $("#CouponForm #dcMval").attr('readonly', true);
- $("#CouponForm #dcMval").attr('disabled', true);
- $("#CouponForm #dcAval").attr('readonly', true);
- $("#CouponForm #dcAval").attr('disabled', true);
- $("#CouponForm #maxDcAmt").attr('readonly', true);
- $("#CouponForm #maxDcAmt").attr('disabled', true);
- $("#CouponForm #totPubLimitQty").attr('readonly', true);
- $("#CouponForm #totPubLimitQty").attr('disabled', true);
- $("#CouponForm #custPubLimitQty").attr('readonly', true);
- $("#CouponForm #custPubLimitQty").attr('disabled', true);
- $("#CouponForm #onePubQty").attr('readonly', true);
- $("#CouponForm #onePubQty").attr('disabled', true);
- $("#CouponForm #downStDay").attr('readonly', true);
- $("#CouponForm #downStDay").attr('disabled', true);
- $("#CouponForm #downStHH").attr('readonly', true);
- $("#CouponForm #downStHH").attr('disabled', true);
- $("#CouponForm #downStMM").attr('readonly', true);
- $("#CouponForm #downStMM").attr('disabled', true);
- $("#CouponForm #buyLimitAmt").attr('readonly', true);
- $("#CouponForm input:radio[name='rdoDcWay']").attr('readonly', true);
- $("#CouponForm input:radio[name='rdoApplyScope']").attr('readonly', true);
- $("#CouponForm .rdoBtn").css('cursor', 'auto');
- $("#CouponForm #cpnId").attr('readonly', true);
- $("#CouponForm #cpnId").attr('disabled', true);
- $("#CouponForm input:checkbox[name='cpnCreateType']").attr('readonly', true);
- $("#CouponForm input:checkbox[name='cpnCreateType']").attr('disabled', true);
- $("#CouponForm input:checkbox[name=cpnCreateType]").attr('checked', true);
- $("#CouponForm input:checkbox[name=cpnCreateType]").parent().addClass('checked');
- }
- // 다운로드기간 세팅
- splitDate("start", cpnDetail.downStdt, "down");
- splitDate("end", cpnDetail.downEddt, "down");
- // 유효기간이 날짜인경우 날짜 세팅
- if (cpnDetail.pdGb == "P") {
- splitDate("start", cpnDetail.availStdt, "avail");
- splitDate("end", cpnDetail.availEddt, "avail");
- if(issueCnt > 0) {
- $("#CouponForm #availStDay").attr('readonly', true);
- $("#CouponForm #availStDay").attr('disabled', true);
- $("#CouponForm #availStHH").attr('readonly', true);
- $("#CouponForm #availStHH").attr('disabled', true);
- $("#CouponForm #availStMM").attr('readonly', true);
- $("#CouponForm #availStMM").attr('disabled', true);
- }
- } else {
- $("#CouponForm #availDays").val(cpnDetail.availDays);
- $('#CouponForm #availEdHH option:last').attr("selected", "selected");
- $('#CouponForm #availEdMM option:last').attr("selected", "selected");
- }
- // 첫구매여부 적용하는 경우 날짜 세팅
- if (cpnDetail.firstOrdYn == "Y") {
- splitDate("start", cpnDetail.buyStdt, "buy");
- splitDate("end", cpnDetail.buyEddt, "buy");
- if(issueCnt > 0) {
- $("#CouponForm #buyStDay").attr('readonly', true);
- $("#CouponForm #buyStDay").attr('disabled', true);
- $("#CouponForm #buyStHH").attr('readonly', true);
- $("#CouponForm #buyStHH").attr('disabled', true);
- $("#CouponForm #buyStMM").attr('readonly', true);
- $("#CouponForm #buyStMM").attr('disabled', true);
- }
- }
- // 신규회원여부 적용하는 경우 날짜 세팅
- if (cpnDetail.newCustYn == "Y") {
- splitDate("start", cpnDetail.custJoinStdt, "custJoin");
- splitDate("end", cpnDetail.custJoinEddt, "custJoin");
- if(issueCnt > 0) {
- $("#CouponForm #custJoinStDay").attr('readonly', true);
- $("#CouponForm #custJoinStDay").attr('disabled', true);
- $("#CouponForm #custJoinStHH").attr('readonly', true);
- $("#CouponForm #custJoinStHH").attr('disabled', true);
- $("#CouponForm #custJoinStMM").attr('readonly', true);
- $("#CouponForm #custJoinStMM").attr('disabled', true);
- }
- }
- }
- // 기본세팅
- pdGbChange();
- firstOrdYnChange();
- newCustYnChange();
- 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 , 적용타겟대상 )
- function splitDate(stedGb , date , targetGb ){
- var str = date;
- var dateStr = str.split(' ');
- var timeArr = dateStr[1].split(':');
- if(stedGb == "start") {
- $("#CouponForm #"+targetGb+"StDay").val(dateStr[0]);
- $("#CouponForm #"+targetGb+"StHH").val(timeArr[0]);
- $("#CouponForm #"+targetGb+"StMM").val(timeArr[1]);
- } else {
- $("#CouponForm #"+targetGb+"EdDay").val(dateStr[0]);
- $("#CouponForm #"+targetGb+"EdHH").val(timeArr[0]);
- $("#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("*제한없음");
- }else{
- $("#"+$(this).attr("name")+"Span").html("");
- }
- $("#"+$(this).attr("name")+"Span").css("color", "red");
- });
- setTimeout(function(){
- $("input[name=totPubLimitQty],input[name=custPubLimitQty],input[name=buyLimitAmt],input[name=onePubQty]").change();
- }, 1);
- // 콤마 찍어주기
- $(function(){
- setComma("CouponForm" , true);
- });
- function setComma(formId, pBoolean){
- setTimeout(function(){
- //숫자타입 콤마 찍어주기
- $("#"+formId+" [data-valid-type=numeric]").each(function(){
- $(this).change(function(){
- if(pBoolean){
- $(this).val($(this).val().addComma());
- }else{
- $(this).val($(this).val().removeComma());
- }
- });
- if(pBoolean){
- $(this).val($(this).val().addComma());
- }else{
- $(this).val($(this).val().removeComma());
- }
- });
- }, 300);
- }
- // 진행 버튼 클릭
- $("#btnChangeStatIng").on("click", function() {
- mcxDialog.confirmC("쿠폰을 진행하시겠습니까?<br/>진행 후에는 수정이 제한될 수 있습니다.", {
- btn: confirmBtnText,
- btnClick: function(index) {
- if(index == 1) {
- let data = { cpnStat : "G232_11" // 진행
- , cpnId : $('#CouponForm input[name=cpnId]').val()
- }
- var jsonData = JSON.stringify(data);
- gagajf.ajaxJsonSubmit('/marketing/coupon/changeStat', jsonData, fnCouponSaveCollback);
- }
- }
- });
- });
- // 중지 버튼 클릭
- $("#btnCouponStop").on("click", function() {
- mcxDialog.confirmC("쿠폰 진행을 중지하시겠습니까?<br/>중지 후에는 진행으로 복원하실 수 없습니다.", {
- btn: confirmBtnText,
- btnClick: function(index) {
- if(index == 1) {
- let data = { cpnStat : "G232_12" // 중지
- , cpnId : $('#CouponForm input[name=cpnId]').val()
- }
- var jsonData = JSON.stringify(data);
- gagajf.ajaxJsonSubmit('/marketing/coupon/changeStat', jsonData, fnCouponSaveCollback);
- }
- }
- });
- });
- // 삭제 버튼 클릭
- $("#btnCouponDelete").on("click", function() {
- mcxDialog.confirmC("쿠폰을 삭제하시겠습니까?<br/>삭제한 프로모션은 복원하실 수 없습니다.", {
- btn: confirmBtnText,
- btnClick: function(index) {
- if(index == 1) {
- let data = { cpnStat: "G232_14" // 삭제
- , cpnId : $('#CouponForm input[name=cpnId]').val()
- }
- var jsonData = JSON.stringify(data);
- gagajf.ajaxJsonSubmit('/marketing/coupon/changeStat', jsonData, fnCouponSaveCollback);
- }
- }
- });
- });
- /*]]>*/
- </script>
- </html>
|