| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220 |
- <!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();" th:if="${mode == 'N'}">등록</button>
- <button type="button" class="btn btn-info btn-lg" onclick="fnCouponUpdate();" th:if="${mode == 'U'}">수정</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}
- ];
- // 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}
- ];
- // 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}
- ];
- // 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}
- ];
- // 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}
- ];
- // 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}
- ];
- // 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";
- // 선착순 쿠폰 행추가
- $('#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>
|