CouponPopupForm.html 101 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260
  1. <!DOCTYPE html>
  2. <html lang="ko"
  3. xmlns:th="http://www.thymeleaf.org">
  4. <!--
  5. *******************************************************************************
  6. * @source : CouponPopupForm.html
  7. * @desc : 쿠폰 등록 팝업 화면
  8. *============================================================================
  9. * ISTYLE24
  10. * Copyright(C) 2020 TSIT, All rights reserved.
  11. *============================================================================
  12. * VER DATE AUTHOR DESCRIPTION
  13. * === =========== ========== =============================================
  14. * 1.0 2020.12.23 xyzp1539 최초 작성
  15. *******************************************************************************
  16. -->
  17. <div class="modalPopup" data-width="1200">
  18. <div class="panelStyle" style="height: 750px;">
  19. <div class="panelTitle">
  20. <h2 th:text="${'쿠폰 ' + (mode == 'N' ? '등록' : '수정')}">쿠폰등록</h2>
  21. <button type="button" class="close" onclick="uifnPopupClose('CouponRegForm')"><i class="fa fa-times"></i></button>
  22. </div>
  23. <div class="panelContent">
  24. <form id="CouponForm" name="CouponForm" action="#" th:action="@{'/marketing/coupon/save'}" >
  25. <input type="hidden" name="supplyCompList" id="supplyCompList">
  26. <input type="hidden" name="brandList" id="brandList">
  27. <input type="hidden" name="applyGoodsList" id="applyGoodsList">
  28. <input type="hidden" name="exceptGoodsList" id="excepGoodsList">
  29. <input type="hidden" name="burdenList" id="burdenList">
  30. <input type="hidden" name="cateList" id="cateList">
  31. <input type="hidden" name="rdCpnNm" id="rdCpnNm">
  32. <input type="hidden" name="cpnId" id="cpnId" th:if="${cpnDetail}" th:value="${cpnDetail.cpnId}">
  33. <div class="tabs">
  34. <div class="tabsNav">
  35. <ul>
  36. <li class="on"><a href="#coupontab1">기본정보</a></li>
  37. <li><a href="#coupontab2">적용대상</a></li>
  38. <li><a href="#coupontab3">입점업체분담율</a></li>
  39. <li class="randomCpnTab" style="display:none;"><a href="#coupontab4">시리얼및난수</a></li>
  40. <li class="limitedTimeCpnTab" style="display:none;"><a href="#coupontab5">선착순쿠폰</a></li> <!--style="display:none;"-->
  41. </ul>
  42. </div>
  43. <ul class="tabsCont">
  44. <li class="tab on" id="coupontab1">
  45. <div class="panelStyle">
  46. <table class="frmStyle">
  47. <colgroup>
  48. <col style="width:10%">
  49. <col style="width:45%;">
  50. <col style="width:10%">
  51. <col style="width:35%;">
  52. </colgroup>
  53. <tbody>
  54. <tr th:if="${cpnDetail}">
  55. <th>쿠폰번호</th>
  56. <td colspan="5">
  57. <span th:if="${cpnDetail}" th:text="${cpnDetail.cpnId}"></span>
  58. </td>
  59. </tr>
  60. <tr>
  61. <th>쿠폰명<em class="required" title="필수"></em></th>
  62. <td colspan="5">
  63. <input type="text" name="cpnNm" id="cpnNm" style="width: 70%;" required="required" data-valid-name="쿠폰명">
  64. </td>
  65. </tr>
  66. <tr>
  67. <th>쿠폰유형<em class="required" title="필수"></em></th>
  68. <td>
  69. <input type="hidden" id="cpnType" name="cpnType" required="required" data-valid-name="쿠폰유형">
  70. <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>
  71. </td>
  72. <th class="limitedTimeCpnArea" style="display: none;">선착순쿠폰</th>
  73. <td class="limitedTimeCpnArea" style="display: none;">
  74. <label class="chkBox limitedTimeCpnBox" id="limitedTimeCpnBox"><input type="checkbox" name="limitedTimeCpnYn" id="limitedTimeCpnYn" value="N"/>선착순쿠폰</label>
  75. </td>
  76. </tr>
  77. <tr class="dcCdGb" style="display:none;">
  78. <th>할인쿠폰유형<em class="required" title="필수"></em></th>
  79. <td class="normalCol">
  80. <input type="hidden" id="dcCd" data-valid-name="할인쿠폰유형">
  81. <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>
  82. </td>
  83. <th class="randomCpnArea">난수생성수량<em class="required" title="필수"></em></th>
  84. <td class="randomCpnArea">
  85. <input type="text" name="randomCpnQty" class="w300" data-valid-name="난수생성수량" data-valid-type="numeric">
  86. </td>
  87. </tr>
  88. <tr class="serialCpnArea" style="display:none;">
  89. <th>시리얼쿠폰키워드<em class="required" title="필수"></em></th>
  90. <td>
  91. <input type="text" name="serialCpnNm" class="w300" maxlength="10" data-valid-name="시리얼쿠폰키워드">
  92. </td>
  93. <th>시리얼쿠폰발급수량<em class="required" title="필수"></em></th>
  94. <td>
  95. <input type="text" name="serialCpnQty" class="w300" data-valid-name="시리얼쿠폰발급수량" data-valid-type="numeric">
  96. </td>
  97. </tr>
  98. <tr>
  99. <th>사용가능고객구분<em class="required" title="필수"></em></th>
  100. <td>
  101. <label class="chkBox" th:if="${usableCustGbList}" th:each="oneData, status : ${usableCustGbList}">
  102. <input type="checkbox" name="usableCustGbArr" th:value="${oneData.cd}" th:text="${oneData.cdNm}"/>
  103. </label>
  104. </td>
  105. <th>사이트<em class="required" title="필수"></em></th>
  106. <td>
  107. <select name="siteCd" id="siteCd" required="required" data-valid-name="사이트">
  108. <option th:if="${siteCdList}" th:each="oneData , status : ${siteCdList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
  109. </select>
  110. </td>
  111. </tr>
  112. <tr>
  113. <th>사용고객등급구분<em class="required" title="필수"></em></th>
  114. <td>
  115. <label class="chkBox" th:if="${usableCustGradeList}" th:each="oneData, status : ${usableCustGradeList}">
  116. <input type="checkbox" name="usableCustGradeArr" th:value="${oneData.cd}" th:text="${oneData.cdNm}"/>
  117. </label>
  118. </td>
  119. <th>만료알림여부<em class="required" title="필수"></em></th>
  120. <td>
  121. <select name="endAlimYn" id="endAlimYn" required="required" data-valid-name="만료알림여부">
  122. <option value="Y">Y</option>
  123. <option value="N" selected="selected">N</option>
  124. </select>
  125. </td>
  126. </tr>
  127. <tr>
  128. <th>할인방식<em class="required" title="필수"></em></th>
  129. <td>
  130. <input type="hidden" name="dcWay" id="dcWay" required="required" data-valid-name="할인방식">
  131. <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>
  132. </td>
  133. <th>구매제한금액<em class="required" title="필수"></em></th>
  134. <td>
  135. <input type="text" id="buyLimitAmt" name="buyLimitAmt" class="w200" required="required" value="0" style="text-align: right;" data-valid-name="구매제한금액" data-valid-type="numeric">원
  136. </td>
  137. </tr>
  138. <tr>
  139. <th>할인값(PC)<em class="required" title="필수"></em></th>
  140. <td>
  141. <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>
  142. <button type="button" class="btn btn-default btn-lg" id="applySameValueBtn">동일적용</button>
  143. </td>
  144. <th>할인값(모바일웹)<em class="required" title="필수"></em></th>
  145. <td>
  146. <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>
  147. </td>
  148. </tr>
  149. <tr>
  150. <th>할인값(모바일앱)<em class="required" title="필수"></em></th>
  151. <td>
  152. <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>
  153. </td>
  154. <th class="maxDcAmtArea">최대할인금액<em class="required" title="필수"></em></th>
  155. <td class="maxDcAmtArea">
  156. <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>
  157. </td>
  158. </tr>
  159. <tr>
  160. <th>다운로드시작일시<em class="required" title="필수"></em></th>
  161. <td>
  162. <input type="hidden" name="downStdt" id="downStdt" required="required" data-valid-name="다운로드시작일시">
  163. <input type="text" class="schDate w100" name="downStDay" id="downStDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
  164. <select name="downStHH" id="downStHH">
  165. <option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
  166. </select>
  167. <select name="downStMM" id="downStMM">
  168. <option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
  169. </select>
  170. <th>다운로드종료일시<em class="required" title="필수"></em></th>
  171. <td>
  172. <input type="hidden" id="downEddt" name="downEddt" required="required" data-valid-name="다운로드종료일시">
  173. <input type="text" class="schDate w100" name="downEdDay" id="downEdDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
  174. <select name="downEdHH" id="downEdHH" onclick="fnChangeEdHH(this);">
  175. <option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
  176. <option th:text="24시" th:value="24"></option>
  177. </select>
  178. <select name="downEdMM" id="downEdMM">
  179. <option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
  180. </select>
  181. </td>
  182. </tr>
  183. <tr>
  184. <th>기간/일수구분<em class="required" title="필수"></em></th>
  185. <td>
  186. <select name="pdGb" id="pdGb" onchange="pdGbChange(this)" required="required" data-valid-name="기간/일수구분">
  187. <option value="P">기간</option>
  188. <option value="D">일수</option>
  189. </select>
  190. </td>
  191. <th>적용범위<em class="required" title="필수"></em></th>
  192. <td>
  193. <input type="hidden" name="applyScope" id="applyScope" required="required" data-valid-name="적용범위">
  194. <label class="rdoBtn"> <input type="radio" name="rdoApplyScope" value="A"/>전체</label>
  195. <label class="rdoBtn"> <input type="radio" name="rdoApplyScope" value="I"/>개별</label>
  196. </td>
  197. </tr>
  198. <tr class="availDayTr" style="display: none;">
  199. <th>유효기간일수<em class="required" title="필수"></em></th>
  200. <td>
  201. <input type="text" name="availDays" id="availDays" class="w200" data-valid-name="유효기간일수">
  202. </td>
  203. </tr>
  204. <tr>
  205. <th class="availDateTr">유효기간시작일시<em class="required" title="필수"></em></th>
  206. <td class="availDateTr">
  207. <input type="hidden" name="availStdt" id="availStdt" data-valid-name="유효기간시작일시">
  208. <input type="text" class="schDate w100" name="availStDay" id="availStDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
  209. <select name="availStHH" id="availStHH">
  210. <option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
  211. </select>
  212. <select name="availStMM" id="availStMM">
  213. <option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
  214. </select>
  215. <th class="availDateTr">유효기간종료일시<em class="required" title="필수"></em></th>
  216. <td class="availDateTr">
  217. <input type="hidden" id="availEddt" name="availEddt" data-valid-name="유효기간종료일시">
  218. <input type="text" class="schDate w100" name="availEdDay" id="availEdDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
  219. <select name="availEdHH" id="availEdHH" onclick="fnChangeEdHH(this);">
  220. <option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
  221. <option th:text="24시" th:value="24"></option>
  222. </select>
  223. <select name="availEdMM" id="availEdMM">
  224. <option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
  225. </select>
  226. </td>
  227. </tr>
  228. <tr class="firstBuyTr">
  229. <th>첫구매여부<em class="required" title="필수"></em></th>
  230. <td>
  231. <select name="firstOrdYn" id="firstOrdYn" onchange="firstOrdYnChange(this)" required="required" data-valid-name="첫구매여부">
  232. <option value="Y">Y</option>
  233. <option value="N" selected="selected">N</option>
  234. </select>
  235. </td>
  236. </tr>
  237. <tr>
  238. <th class="buyDateTr">첫구매기간시작일시<em class="required" title="필수"></em></th>
  239. <td class="buyDateTr">
  240. <input type="hidden" name="buyStdt" id="buyStdt" data-valid-name="첫구매기간시작일시">
  241. <input type="text" class="schDate w100" name="buyStDay" id="buyStDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
  242. <select name="buyStHH" id="buyStHH">
  243. <option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
  244. </select>
  245. <select name="buyStMM" id="buyStMM">
  246. <option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
  247. </select>
  248. <th class="buyDateTr">첫구매기간종료일시<em class="required" title="필수"></em></th>
  249. <td class="buyDateTr">
  250. <input type="hidden" id="buyEddt" name="buyEddt" data-valid-name="첫구매기간종료일시">
  251. <input type="text" class="schDate w100" name="buyEdDay" id="buyEdDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
  252. <select name="buyEdHH" id="buyEdHH" onclick="fnChangeEdHH(this);">
  253. <option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
  254. <option th:text="24시" th:value="24"></option>
  255. </select>
  256. <select name="buyEdMM" id="buyEdMM">
  257. <option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
  258. </select>
  259. </td>
  260. </tr>
  261. <tr class="custJoinTr">
  262. <th>신규회원여부<em class="required" title="필수"></em></th>
  263. <td>
  264. <select name="newCustYn" id="newCustYn" onchange="newCustYnChange(this)" required="required" data-valid-name="신규회원여부">
  265. <option value="Y">Y</option>
  266. <option value="N" selected="selected">N</option>
  267. </select>
  268. </td>
  269. </tr>
  270. <tr>
  271. <th class="custJoinDateTr">신규회원기간시작일시<em class="required" title="필수"></em></th>
  272. <td class="custJoinDateTr">
  273. <input type="hidden" name="custJoinStdt" id="custJoinStdt" data-valid-name="신규회원기간시작일시">
  274. <input type="text" class="schDate w100" name="custJoinStDay" id="custJoinStDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
  275. <select name="custJoinStHH" id="custJoinStHH">
  276. <option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
  277. </select>
  278. <select name="custJoinStMM" id="custJoinStMM">
  279. <option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
  280. </select>
  281. <th class="custJoinDateTr">신규회원기간종료일시<em class="required" title="필수"></em></th>
  282. <td class="custJoinDateTr">
  283. <input type="hidden" id="custJoinEddt" name="custJoinEddt" data-valid-name="신규회원기간종료일시">
  284. <input type="text" class="schDate w100" name="custJoinEdDay" id="custJoinEdDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
  285. <select name="custJoinEdHH" id="custJoinEdHH" onclick="fnChangeEdHH(this);">
  286. <option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
  287. <option th:text="24시" th:value="24"></option>
  288. </select>
  289. <select name="custJoinEdMM" id="custJoinEdMM">
  290. <option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
  291. </select>
  292. </td>
  293. </tr>
  294. <tr class="dcCdCheck1">
  295. <th>총발행제한수량<em class="required" title="필수"></em></th>
  296. <td>
  297. <input type="text" class="w200" name="totPubLimitQty" id="totPubLimitQty" value="0" required="required" data-valid-name="총발행제한수량" data-valid-type="numeric" style="text-align: right;">개
  298. <label class="chkBox" id="chkBoxTotPubQty"><input type="checkbox" id="chkNoLimitTotPubLimitQty"/>제한없음</label>
  299. </td>
  300. <th>1인당발행제한수량<em class="required" title="필수"></em></th>
  301. <td>
  302. <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;">개
  303. <label class="chkBox" id="chkBoxCustPubQty"><input type="checkbox" id="chkNoLimitCustPubLimitQty"/>제한없음</label>
  304. </td>
  305. </tr>
  306. <tr>
  307. <th class="dcCdCheck2">1회발행수량<em class="required" title="필수"></em></th>
  308. <td class="dcCdCheck2">
  309. <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;">개
  310. </td>
  311. <th>다운로드가능여부<em class="required" title="필수"></em></th>
  312. <td>
  313. <select name="downAblYn" id="downAblYn" required="required" data-valid-name="다운로드가능여부">
  314. <option value="Y">Y</option>
  315. <option value="Y" selected="selected">N</option>
  316. </select>
  317. </td>
  318. </tr>
  319. <!--<tr>
  320. <th>재발급여부<em class="required" title="필수"></em></th>
  321. <td>
  322. <select name="reissuance" id="reissuance" required="required" data-valid-name="재발급여부" >
  323. <option th:if="${reissuanceList}" th:each="oneData , status : ${reissuanceList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
  324. </select>
  325. </td>
  326. <th>다운로드구분<em class="required" title="필수"></em></th>
  327. <td>
  328. <select name="dnGb" id="dnGb" required="required" data-valid-name="다운로드구분">
  329. <option th:if="${dnGbList}" th:each="oneData , status:${dnGbList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
  330. </select>
  331. </td>
  332. </tr>-->
  333. <tr class="payTypeTr" style="display: none;">
  334. <th>결제수단<em class="required" title="필수"></em></th>
  335. <td colspan="5">
  336. <label class="chkBox" th:if="${payTypeList}" th:each="oneData, status : ${payTypeList}">
  337. <input type="checkbox" name="payTypeArr" th:value="${oneData.cd}" th:text="${oneData.cdNm}"/>
  338. </label>
  339. </td>
  340. </tr>
  341. <tr>
  342. <th>쿠폰상태<em class="required" title="필수"></em></th>
  343. <td>
  344. <label class="rdoBtn" th:if="${cpnStatList}" th:each="oneData, status : ${cpnStatList}" >
  345. <input type="radio" id="disCpnStat" name="disCpnStat" th:value="${oneData.cd}" th:text="${oneData.cdNm}" data-valid-name="상태" disabled="disabled"/>
  346. </label>
  347. <input type="hidden" id="cpnStat" name="cpnStat"/>
  348. </td>
  349. <th>제휴링크코드<em class="required" title="필수"></em></th>
  350. <td>
  351. <select name="afChannel" id="afChannel" onchange="fnChangeAfLinkCdList()" data-valid-name="제휴링크코드" required="required">
  352. <option th:if="${upperAfLinkCdList}" th:each="oneData , status : ${upperAfLinkCdList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
  353. </select>
  354. <select name="afLinkCd" id="afLinkCd">
  355. </select>
  356. </td>
  357. </tr>
  358. </tbody>
  359. </table>
  360. <!--<div class="mdPopBtnB aR">
  361. <button type="button" class="btn btn-info btn-lg" onclick="fnPubCustListPopUp();" th:if="${mode == 'U'}">발급받은회원</button>
  362. <button type="button" class="btn btn-info btn-lg" onclick="fnCustomerIssuePopUp();" th:if="${mode == 'U' && cpnDetail.dcCdGb == 'G233_00'}">쿠폰발행</button>
  363. <button type="button" class="btn btn-info btn-lg" onclick="fnCouponCreate();" th:if="${mode == 'N'}">등록</button>
  364. <button type="button" class="btn btn-info btn-lg" onclick="fnCouponUpdate();" th:if="${mode == 'U'}">수정</button>
  365. </div>-->
  366. </div>
  367. </li>
  368. <!-- 쿠폰적용대상-->
  369. <li class="tab" id="coupontab2" >
  370. <div class="panelStyle">
  371. <div class="inner-panelContent">
  372. <div class="panelContent">
  373. <div class="panelBar">
  374. <h4>적용 대상 상품 등록</h4>
  375. </div>
  376. <table class="frmStyle">
  377. <colgroup>
  378. <col style="width:15%;">
  379. <col style="width:85%;">
  380. </colgroup>
  381. <tbody>
  382. <tr>
  383. <th>공급처</th>
  384. <td>
  385. <div class="padding10 inner-tb-solid">
  386. <button type="button" class="btn btnRight btn-success btn-lg" id="btnSupplyAdd">공급처 추가</button>
  387. <button type="button" class="btn btnRight btn-success btn-lg" id="btnSupplyDel">선택삭제</button>
  388. <br/>
  389. <div id="supplyGridList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
  390. </div>
  391. </td>
  392. </tr>
  393. <tr>
  394. <th>브랜드</th>
  395. <td>
  396. <div class="padding10 inner-tb-solid">
  397. <button type="button" class="btn btnRight btn-success btn-lg" id="btnBrandAdd">브랜드 추가</button>
  398. <button type="button" class="btn btnRight btn-success btn-lg" id="btnBrandDel">선택삭제</button>
  399. <br/>
  400. <div id="brandGridList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
  401. </div>
  402. </td>
  403. </tr>
  404. <tr>
  405. <th>카테고리</th>
  406. <td>
  407. <div class="padding10 inner-tb-solid">
  408. <button type="button" class="btn btnRight btn-success btn-lg" id="btnCateAdd">카테고리 추가</button>
  409. <button type="button" class="btn btnRight btn-success btn-lg" id="btnCateDel">선택삭제</button>
  410. <br/>
  411. <div id="cateGridList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
  412. </div>
  413. </td>
  414. </tr>
  415. <tr>
  416. <th>적용상품</th>
  417. <td>
  418. <div class="padding10 inner-tb-solid">
  419. <button type="button" class="btn btnRight btn-success btn-lg" id="btnGoodsAdd">상품 추가</button>
  420. <button type="button" class="btn btnRight btn-success btn-lg" id="btnGoodsDel">선택삭제</button>
  421. <br/>
  422. <div id="goodsGridList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
  423. </div>
  424. </td>
  425. </tr>
  426. </tbody>
  427. </table>
  428. </div>
  429. </div>
  430. <div class="inner-panelContent">
  431. <div class="panelContent">
  432. <div class="panelBar">
  433. <h4>적용 대상 상품 등록</h4>
  434. </div>
  435. <table class="frmStyle">
  436. <colgroup>
  437. <col style="width:15%;">
  438. <col style="width:85%;">
  439. </colgroup>
  440. <tbody>
  441. <tr>
  442. <th>제외상품</th>
  443. <td>
  444. <div class="padding10 inner-tb-solid">
  445. <button type="button" class="btn btnRight btn-success btn-lg" id="btnExcepGoodsAdd">제외상품 추가</button>
  446. <button type="button" class="btn btnRight btn-success btn-lg" id="btnExcepGoodsDel">선택삭제</button>
  447. <br/>
  448. <div id="excepGoodsGridList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
  449. </div>
  450. </td>
  451. </tr>
  452. </tbody>
  453. </table>
  454. </div>
  455. </div>
  456. </div>
  457. </li>
  458. <!-- 쿠폰적용대상끝-->
  459. <!-- 입점업체분담율-->
  460. <li class="tab" id="coupontab3">
  461. <div class="panelStyle">
  462. <ul class="panelBar">
  463. <li class="left">
  464. <button type="button" class="btn btn-warning btn-lg" id="btnAddRow">행추가</button>
  465. <button type="button" class="btn btn-danger btn-lg" id="btnDelRow">행삭제</button>
  466. </li>
  467. </ul>
  468. <div id="inComGridList" style="width: 100%; height: 570px" class="ag-theme-balham"></div>
  469. </div>
  470. </li>
  471. <!-- 입점업체분담끝-->
  472. <!-- 난수 및 네임쿠폰 설정 -->
  473. <li class="tab" id="coupontab4">
  474. <div class="panelStyle">
  475. <span>
  476. <div id="randomCpnList" style="width: 100%; height: 500px" class="ag-theme-balham"></div>
  477. </span>
  478. </div>
  479. </li>
  480. <!-- 난수 및 네임쿠폰 설정-->
  481. <!-- 선착순 쿠폰 설정 START -->
  482. <li class="tab" id="coupontab5">
  483. <div class="panelStyle">
  484. <span class="limitedTimeCpnSpan">
  485. <button type="button" class="btn btnRight btn-success btn-lg" id="btnAddLimitedTimeCpnRow">행추가</button>
  486. <button type="button" class="btn btnRight btn-success btn-lg" id="btnDelLimitedTimeCpnRow">행삭제</button>
  487. </span>
  488. <br/>
  489. <div id="limitedTimeCpnList" style="width: 100%; height: 500px" class="ag-theme-balham"></div>
  490. </div>
  491. </li>
  492. <!-- 선착순 쿠폰 설정 END -->
  493. </ul>
  494. </div>
  495. <div class="mdPopBtnB aR">
  496. <button type="button" class="btn btn-info btn-lg" onclick="fnPubCustListPopUp();" th:if="${mode == 'U'}">발급받은회원</button>
  497. <button type="button" class="btn btn-info btn-lg" onclick="fnCustomerIssuePopUp();" th:if="${mode == 'U' && cpnDetail.dcCdGb == 'G233_00'}">쿠폰발행</button> <!-- 난수유형과 시리얼 유형에서는 쿠폰발행기능 X -->
  498. <button type="button" class="btn btnRight btn-success btn-lg couponButton" id="btnCouponSave" onclick="fnCouponCreate();">등록</button>
  499. <button type="button" class="btn btnRight btn-success btn-lg couponButton" id="btnChangeStatIng" style="display: none;">진행</button>
  500. <button type="button" class="btn btnRight btn-success btn-lg couponButton" id="btnCouponDelete" style="display: none;">삭제</button>
  501. <button type="button" class="btn btnRight btn-success btn-lg couponButton" id="btnCouponStop" style="display: none;">중지</button>
  502. </div>
  503. </form>
  504. </div>
  505. </div>
  506. </div>
  507. <script th:inline="javascript">
  508. /*<![CDATA[*/
  509. // 상세조회 리스트
  510. var mode = [[${mode}]];
  511. var cpnDetail = [[${cpnDetail}]];
  512. var cpnDtlRefvalSupplyCompList = [[${cpnDtlRefvalSupplyCompList}]];
  513. var cpnDtlRefvalApplyGoodsList = [[${cpnDtlRefvalApplyGoodsList}]];
  514. var cpnDtlRefvalCateList = [[${cpnDtlRefvalCateList}]];
  515. var cpnDtlRefvalBrandList = [[${cpnDtlRefvalBrandList}]];
  516. var cpnDtlRefvalExceptGoodsList = [[${cpnDtlRefvalExceptGoodsList}]];
  517. var cpnDtlBurdenList = [[${cpnDtlBurdenList}]];
  518. var randomCpnList = [[${randomCpnList}]];
  519. var issueCnt = [[${issueCnt}]];
  520. var cpnCustGbList = [[${cpnCustGbList}]];
  521. var cpnCustGradeList = [[${cpnCustGradeList}]];
  522. var cpnPayTypeList = [[${cpnPayTypeList}]];
  523. var limitedTimeCpnList = [[${limitedTimeCpnList}]];
  524. // 공통코드 리스트
  525. var ibSupplyComList = gagajf.convertToArray([[${ibSupplyCompList}]]);
  526. var formalGbList = gagajf.convertToArray([[${formalGbList}]]);
  527. var cateGbList = gagajf.convertToArray([[${cateGbList}]]);
  528. var delYnList = { "Y":"Yes", "N":"No" };
  529. var siteCdList = gagajf.convertToArray([[${siteCdList}]]);
  530. var selfBrandList = gagajf.convertToArray([[${selfBrandList}]]);
  531. // ag-grid 입점업체분담율 컬럼
  532. var columnDefs = [
  533. { headerName: "입점업체" , field:"supplyCompCd" , width:150, cellClass:"text-center" ,
  534. cellEditor: 'agRichSelectCellEditor',
  535. cellEditorParams: { values: gagaAgGrid.extractValues(ibSupplyComList) },
  536. valueFormatter: function (params) { return gagaAgGrid.lookupValue(ibSupplyComList, params.value); },
  537. valueParser: function (params) { return gagaAgGrid.lookupKey(ibSupplyComList, params.newValue);}
  538. } ,
  539. { headerName: "쿠폰분담율(%)", field:"burdenRate" , width:150, cellClass: "text-center" ,
  540. cellEditorParams: { maxlength: 10, required: true }
  541. } ,
  542. /*{ headerName: "삭제여부" , field: "delYn" , width:150, cellClass: "text-center" ,
  543. cellEditor: 'agRichSelectCellEditor',
  544. cellEditorParams: { values: gagaAgGrid.extractValues(delYnList) },
  545. valueFormatter: function (params) { return gagaAgGrid.lookupValue(delYnList, params.value); },
  546. valueParser: function (params) { return gagaAgGrid.lookupKey(delYnList, params.newValue); }
  547. } ,*/
  548. { headerName: "쿠폰번호" , field: "cpnId" , width: 120 , cellClass: 'text-center' , hide:true},
  549. { headerName: "삭제여부" , field: "delYn" , width: 120 , cellClass: 'text-center' , hide:true}
  550. ];
  551. // ag-grid 공급처 컬럼
  552. var supplyColumnDefs = [
  553. {width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
  554. { headerName : "공급업체코드" , field: "supplyCompCd" , width:150, cellClass: 'text-center'} ,
  555. { headerName: "공급업체명" , field: "supplyCompNm" , width:150, cellClass: 'text-center'},
  556. { headerName: "쿠폰대상일련번호" , field: "cpnRefvalSq" , width: 120 , cellClass: 'text-center' , hide:true},
  557. { headerName: "삭제여부" , field: "delYn" , width: 120 , cellClass: 'text-center' , hide:true}
  558. ];
  559. // ag-grid 브랜드 컬럼
  560. var brandSelColumnDefs = [
  561. {width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
  562. { headerName : "브랜드ID" , field: "brandCd" , width: 120, cellClass : 'text-center'} ,
  563. { headerName : "브랜드명" , field: "brandEnm" , width: 120, cellClass: 'text-center'} ,
  564. //{ headerName : "공급업체명", field: "supplyCompNm" , width: 150, cellClass: 'text-center' } ,
  565. { headerName: "쿠폰대상일련번호" , field: "cpnRefvalSq" , width: 120 , cellClass: 'text-center' , hide:true},
  566. { headerName: "삭제여부" , field: "delYn" , width: 120 , cellClass: 'text-center' , hide:true}
  567. ];
  568. // ag-grid 적용상품 컬럼
  569. var goodsSelColumnDefs = [
  570. {width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
  571. { headerName: "상품구분" , field: "goodsGb" , width: 100, cellClass: 'text-center'} ,
  572. { headerName: "Product ID" , field: "goodsCd" , width: 120, cellClass: 'text-center'},
  573. { headerName: "상품명" , field: "goodsNm" , width: 250 , cellClass: 'text-center'} ,
  574. { headerName: "쿠폰대상일련번호" , field: "cpnRefvalSq" , width: 120 , cellClass: 'text-center' , hide:true},
  575. { headerName: "삭제여부" , field: "delYn" , width: 120 , cellClass: 'text-center' , hide:true}
  576. ];
  577. // ag-grid 카테고리 컬럼
  578. var cateSelColumnDefs = [
  579. {width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
  580. { headerName: "사이트" , field: "siteCd" , width: 100 , cellClass: 'text-center' ,
  581. cellEditor: 'agRichSelectCellEditor',
  582. cellEditorParams: { values: gagaAgGrid.extractValues(siteCdList) },
  583. valueFormatter: function (params) { return gagaAgGrid.lookupValue(siteCdList, params.value); },
  584. valueParser: function (params) { return gagaAgGrid.lookupKey(siteCdList, params.newValue); }
  585. },
  586. { headerName: "카테고리구분" , field: "cateGb" , width: 100 , cellClass: 'text-center' ,
  587. cellEditor: 'agRichSelectCellEditor',
  588. cellEditorParams: { values: gagaAgGrid.extractValues(cateGbList) },
  589. valueFormatter: function (params) { return gagaAgGrid.lookupValue(cateGbList, params.value); },
  590. valueParser: function (params) { return gagaAgGrid.lookupKey(cateGbList, params.newValue); }
  591. },
  592. { headerName: "카테고리코드" , field: "cateNo" , width: 100 , cellClass: 'text-center'} ,
  593. { headerName: "카테고리명" , field: "cateNm" , width: 120 , cellClass: 'text-center'},
  594. { headerName: "이월/정상구분" , field: "formalGb" , width: 120 , cellClass: 'text-center',
  595. cellEditor: 'agRichSelectCellEditor',
  596. cellEditorParams: { values: gagaAgGrid.extractValues(formalGbList) },
  597. valueFormatter: function (params) { return gagaAgGrid.lookupValue(formalGbList, params.value); },
  598. valueParser: function (params) { return gagaAgGrid.lookupKey(formalGbList, params.newValue); }
  599. },
  600. { headerName: "브랜드명" , field:"brandCd" , width:150, cellClass: "text-center", required: true ,
  601. editable: true, cellEditor: 'agRichSelectCellEditor',
  602. cellEditorParams: { values: gagaAgGrid.extractValues(selfBrandList) },
  603. valueFormatter: function (params) { return gagaAgGrid.lookupValue(selfBrandList, params.value); },
  604. valueParser: function (params) { return gagaAgGrid.lookupKey(selfBrandList, params.newValue); }
  605. },
  606. { headerName: "쿠폰대상일련번호" , field: "cpnRefvalSq" , width: 120 , cellClass: 'text-center' , hide:true},
  607. { headerName: "삭제여부" , field: "delYn" , width: 120 , cellClass: 'text-center' , hide:true}
  608. ];
  609. // ag-grid 제외상품 컬럼
  610. var excepGoodsColumnDefs = [
  611. {width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
  612. { headerName: "상품구분" , field: "goodsGb" , width: 100, cellClass: 'text-center'} ,
  613. { headerName: "Product ID" , field: "goodsCd" , width: 120, cellClass: 'text-center'},
  614. { headerName: "상품명" , field: "goodsNm" , width: 250 , cellClass: 'text-center'} ,
  615. { headerName: "쿠폰대상일련번호" , field: "cpnRefvalSq" , width: 120 , cellClass: 'text-center' , hide:true},
  616. { headerName: "삭제여부" , field: "delYn" , width: 120 , cellClass: 'text-center' , hide:true}
  617. ];
  618. // ag-grid 시리얼 및 난수 리스트
  619. var randomCouponDefs = [
  620. { headerName : "생성쿠폰키워드" , field: "rdCpnNm" , width:150, cellClass: 'text-center'} ,
  621. { headerName: "지급고객번호" , field: "custNm" , width:150, cellClass: 'text-center'},
  622. { headerName: "고객아이디" , field: "custId" , width:150, cellClass: 'text-center'},
  623. { headerName: "고객명" , field: "custNm" , width:150, cellClass: 'text-center'},
  624. { headerName: "지급일" , field: "regDt" , width:150, cellClass: 'text-center'},
  625. { headerName: "쿠폰사용일" , field: "usedDt" , width:150, cellClass: 'text-center'}
  626. ];
  627. // 선착순 쿠폰 리스트
  628. var limitedTimeCpnDefs = [
  629. {width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
  630. { headerName: "쿠폰시퀀스", field: "cpnId", width: 150, cellClass: 'text-center'}, //, hide: true
  631. { headerName: "선착순쿠폰명" , field: "limitCpnNm" , width: 200, cellClass: 'text-center'
  632. ,cellEditorParams: { maxlength: 20}
  633. } ,
  634. { headerName: "시작일시" , field: "downStdt" , width: 200, cellClass: 'text-center'
  635. ,cellRenderer: function (params) { return gagaAgGrid.toDateTimeFormat(params.value); }
  636. },
  637. { headerName: "종료일시" , field: "downEddt" , width: 200 , cellClass: 'text-center'
  638. ,cellRenderer: function (params) { return gagaAgGrid.toDateTimeFormat(params.value); }
  639. } ,
  640. { headerName: "다운로드가능수량" , field: "downLimitQty" , width: 150 , cellClass: 'text-center'
  641. ,cellEditorParams: { maxlength: 4, validType: 'numeric'}
  642. },
  643. { headerName: "선착순시퀀스", field: "limitCpnId", width: 150, cellClass: 'text-center'} //, hide: true
  644. ];
  645. var inComGridOptions = gagaAgGrid.getGridOptions(columnDefs);
  646. var cateGridOptions = gagaAgGrid.getGridOptions(cateSelColumnDefs);
  647. var goodsGridOptions = gagaAgGrid.getGridOptions(goodsSelColumnDefs);
  648. var brandGridOptions = gagaAgGrid.getGridOptions(brandSelColumnDefs);
  649. var supplyGridOptions = gagaAgGrid.getGridOptions(supplyColumnDefs);
  650. var excepGoodsGridOptions = gagaAgGrid.getGridOptions(excepGoodsColumnDefs);
  651. var randomCouponGridOptions = gagaAgGrid.getGridOptions(randomCouponDefs);
  652. var limitedTimeCpnGridOptions = gagaAgGrid.getGridOptions(limitedTimeCpnDefs);
  653. inComGridOptions.defaultColDef.editable = true;
  654. inComGridOptions.rowSelection = "multiple";
  655. goodsGridOptions.rowSelection = "multiple";
  656. supplyGridOptions.rowSelection = "multiple";
  657. excepGoodsGridOptions.rowSelection = "multiple";
  658. cateGridOptions.rowSelection = "multiple";
  659. brandGridOptions.rowSelection = "multiple";
  660. inComGridOptions.stopEditingWhenGridLosesFocus = true;
  661. limitedTimeCpnGridOptions.defaultColDef.editable = true;
  662. limitedTimeCpnGridOptions.rowSelection = "multiple";
  663. // 삭제버튼 클릭시
  664. // 1.공급업체
  665. $('#btnSupplyDel').on('click', function() {
  666. supplyGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(supplyGridOptions)});
  667. });
  668. // 2.브랜드
  669. $('#btnBrandDel').on('click', function() {
  670. brandGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(brandGridOptions)});
  671. });
  672. // 3.카테고리
  673. $('#btnCateDel').on('click', function() {
  674. cateGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(cateGridOptions)});
  675. });
  676. // 4.적용상품
  677. $('#btnGoodsDel').on('click', function() {
  678. goodsGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(goodsGridOptions)});
  679. });
  680. // 5.제외상품
  681. $('#btnExcepGoodsDel').on('click', function() {
  682. excepGoodsGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(excepGoodsGridOptions)});
  683. });
  684. // 6.입점업체
  685. $('#btnDelRow').on('click', function() {
  686. inComGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(inComGridOptions)});
  687. });
  688. // 7.선착순
  689. $('#btnDelLimitedTimeCpnRow').on('click', function() {
  690. limitedTimeCpnGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(limitedTimeCpnGridOptions)});
  691. });
  692. // 선착순 쿠폰 행추가
  693. $('#btnAddLimitedTimeCpnRow').on('click', function() {
  694. var data = { cpnId: 1 ,limitCpnNm: null, downStdt: null, downEddt: null, downLimitQty: null, limitCpnId: null };
  695. gagaAgGrid.addRowData(limitedTimeCpnGridOptions, data, "limitCpnNm");
  696. });
  697. // 선착순 쿠폰 행삭제
  698. /*$('#btnDelLimitedTimeCpnRow').on('click', function() {
  699. var selectedData = limitedTimeCpnGridOptions.api.getSelectedRows();
  700. if (selectedData.length == 0) {
  701. mcxDialog.alert('선택된 행이 없습니다.');
  702. return;
  703. }
  704. var removedData = gagaAgGrid.removeRowData(limitedTimeCpnGridOptions, false);
  705. var arrLimitCpnId = [];
  706. $.each(selectedData, function(idx, item) {
  707. arrLimitCpnId.push(item.limitCpnId);
  708. });
  709. if (removedData.length > 0) {
  710. mcxDialog.confirm('삭제하시겠습니까?', {
  711. cancelBtnText: "취소",
  712. sureBtnText: "확인",
  713. sureBtnClick: function(){
  714. var data = { arrLimitCpnId : arrLimitCpnId
  715. ,cpnId : $('#CouponForm input[name=cpnId]').val()
  716. };
  717. var jsonData = JSON.stringify(data);
  718. gagajf.ajaxJsonSubmit('/marketing/coupon/limitedtime/coupon/update', jsonData);
  719. }
  720. });
  721. }
  722. });
  723. */
  724. // 선착순 쿠폰 체크박스 클릭시
  725. $("#CouponForm #limitedTimeCpnBox").bind('click', function (){
  726. var chkBox= document.getElementById('limitedTimeCpnYn').checked;
  727. if(chkBox){ //true 체크가 되어있었는데 해제됐어 -> 탭을 숨겨
  728. $("#CouponForm .limitedTimeCpnTab").hide();
  729. $("#limitedTimeCpnYn").val("N");
  730. $("#CouponForm #totPubLimitQty").val(0);
  731. $("#CouponForm input[id=chkBoxTotPubQty]").prop("disabled", false);
  732. $("#CouponForm input[id=totPubLimitQty]").prop("disabled", false);
  733. $("#CouponForm input[id=chkNoLimitTotPubLimitQty]").parent("label").removeClass("checked");
  734. $("#CouponForm input[id=chkNoLimitTotPubLimitQty]").attr('readonly', false);
  735. $("#CouponForm input[id=chkNoLimitTotPubLimitQty]").prop('disabled', false);
  736. $("#CouponForm input[id=chkNoLimitTotPubLimitQty]").parent().prop('disabled', false);
  737. }else{ //false 체크가 안되어있었는데 체크됐어 -> 탭을 보여줘
  738. $("#CouponForm .limitedTimeCpnTab").show();
  739. $("#limitedTimeCpnYn").val("Y");
  740. $("#CouponForm #totPubLimitQty").val(0);
  741. $("#CouponForm input[id=chkBoxTotPubQty]").prop("disabled", true);
  742. $("#CouponForm input[id=totPubLimitQty]").prop("disabled", true);
  743. $("#CouponForm input[id=chkNoLimitTotPubLimitQty]").parent("label").addClass("checked");
  744. $("#CouponForm input[id=chkNoLimitTotPubLimitQty]").attr('readonly', true);
  745. $("#CouponForm input[id=chkNoLimitTotPubLimitQty]").prop('disabled', true);
  746. $("#CouponForm input[id=chkNoLimitTotPubLimitQty]").parent().prop('disabled', true);
  747. }
  748. });
  749. // 종료시간 클릭시
  750. var fnChangeEdHH = function (obj){
  751. var selectId = obj.id;
  752. var changeId = "";
  753. if(selectId == "downEdHH"){
  754. changeId = "downEdMM";
  755. }else if(selectId == "availEdHH"){
  756. changeId = "availEdMM";
  757. }else if(selectId == "buyEdHH"){
  758. changeId = "buyEdMM";
  759. }else{
  760. changeId = "custJoinEdMM";
  761. }
  762. if(obj.value == 24) {
  763. $("#CouponForm #"+changeId+" option").hide();
  764. $('#CouponForm #'+changeId+' option:first').show().prop("selected", true);
  765. } else {
  766. $("#CouponForm #"+changeId+" option").show();
  767. }
  768. };
  769. // 총발행 제한수량 -> 제한없음 처리
  770. $("#CouponForm #chkBoxTotPubQty").bind('click', function (){
  771. var chkBox= document.getElementById('chkNoLimitTotPubLimitQty').checked;
  772. if(chkBox){ //true 체크가 되어있었는데 해제됐어 -> 값0 inputbox disabled 해제
  773. $("#CouponForm #totPubLimitQty").val(0);
  774. $("#CouponForm input[id=totPubLimitQty]").prop("disabled", false);
  775. }else{ //false 체크가 안되어있었는데 체크됐어 -> 값0 inputbox disabled
  776. $("#CouponForm #totPubLimitQty").val(0);
  777. $("#CouponForm input[id=totPubLimitQty]").prop("disabled", true);
  778. }
  779. });
  780. // 1인당발행 제한수량 -> 제한없음 처리
  781. $("#CouponForm #chkBoxCustPubQty").bind('click', function (){
  782. var chkBox= document.getElementById('chkNoLimitCustPubLimitQty').checked;
  783. if(chkBox){ //true 체크가 되어있었는데 해제됐어 -> 값0 inputbox disabled 해제
  784. $("#CouponForm #custPubLimitQty").val(0);
  785. $("#CouponForm input[id=custPubLimitQty]").prop("disabled", false);
  786. }else{ //false 체크가 안되어있었는데 체크됐어 -> 값0 inputbox disabled
  787. $("#CouponForm #custPubLimitQty").val(0);
  788. $("#CouponForm input[id=custPubLimitQty]").prop("disabled", true);
  789. }
  790. });
  791. // 할인방식 할인율 일때, 할인값 체크
  792. var fnDcValOnkeyUp = function (obj){
  793. var inputName = $(obj).attr("name");
  794. var rdoDcWay = $('#CouponForm input:radio[name="rdoDcWay"]:checked').val();
  795. var dcVal = $("#CouponForm input[name="+inputName+"]").val();
  796. if(rdoDcWay == "G240_11"){
  797. if(dcVal > 100){
  798. mcxDialog.alert('할인율은 100을 넘을수 없습니다.');
  799. $("#CouponForm input[name="+inputName+"]").val('');
  800. $("#CouponForm input[name="+inputName+"]").focus();
  801. return;
  802. }
  803. }
  804. }
  805. // 할인값 동일적용
  806. $("#applySameValueBtn").bind('click change', function () {
  807. var cdPval = $("#CouponForm input[name=dcPval]").val();
  808. $("#CouponForm input[name=dcMval]").val(cdPval);
  809. $("#CouponForm input[name=dcAval]").val(cdPval);
  810. });
  811. // 쿠폰 등록 버튼 클릭시
  812. function fnCouponCreate(){
  813. mcxDialog.confirm('저장하시겠습니까?' , {
  814. cancelBtnText:"취소",
  815. sureBtnText:"확인",
  816. sureBtnClick: function () {
  817. gagajf.removeCommaAtNumberFormattedInput('#CouponForm');
  818. // 필수값들 셋팅
  819. setReqValue();
  820. // 필수값 validation 체크
  821. if (!gagajf.validation('#CouponForm')) {
  822. return false;
  823. }
  824. // 데이터 validation 체크
  825. if(!checkValidation()) {
  826. return false;
  827. }
  828. var usableCustGbArr = [];
  829. var chkCustGb = $('#CouponForm input:checkbox[name=usableCustGbArr]:checked');
  830. for(let i=0; i< chkCustGb.length; i++){
  831. usableCustGbArr.push(chkCustGb.eq(i).val());
  832. }
  833. var usableCustGradeArr = [];
  834. var chkCustGrade = $('#CouponForm input:checkbox[name=usableCustGradeArr]:checked');
  835. for(let i=0; i< chkCustGrade.length; i++){
  836. usableCustGradeArr.push(chkCustGrade.eq(i).val());
  837. }
  838. var payTypeArr = [];
  839. var chkPayType = $('#CouponForm input:checkbox[name=payTypeArr]:checked');
  840. for(let i=0; i< chkPayType.length; i++){
  841. payTypeArr.push(chkPayType.eq(i).val());
  842. }
  843. var data = {
  844. cpnId : $('#CouponForm input[name=cpnId]').val()
  845. ,cpnNm : $('#CouponForm input[name=cpnNm]').val()
  846. ,siteCd : $('#CouponForm select[name=siteCd]').val()
  847. ,afLinkCd : $('#CouponForm select[name=afLinkCd]').val()
  848. ,cpnType : $('input:radio[name="rdoCpnType"]:checked').val()
  849. ,applyScope : $('input:radio[name="rdoApplyScope"]:checked').val()
  850. ,dcWay : $('input:radio[name="rdoDcWay"]:checked').val()
  851. ,dcPval : $('#CouponForm input[name=dcPval]').val()
  852. ,dcMval : $('#CouponForm input[name=dcMval]').val()
  853. ,dcAval : $('#CouponForm input[name=dcAval]').val()
  854. ,maxDcAmt : $('#CouponForm input[name=maxDcAmt]').val()
  855. ,pdGb : $('#CouponForm select[name=pdGb]').val()
  856. ,availStdt : $('#CouponForm input[name=availStdt]').val()
  857. ,availEddt : $('#CouponForm input[name=availEddt]').val()
  858. ,availDays : $('#CouponForm input[name=availDays]').val()
  859. ,custPubLimitQty : $('#CouponForm input[name=custPubLimitQty]').val()
  860. ,totPubLimitQty : $('#CouponForm input[name=totPubLimitQty]').val()
  861. ,onePubQtyy : $('#CouponForm input[name=onePubQtyy]').val()
  862. ,downStdt : $('#CouponForm input[name=downStdt]').val()
  863. ,downEddt : $('#CouponForm input[name=downEddt]').val()
  864. ,buyLimitAmt : $('#CouponForm input[name=buyLimitAmt]').val()
  865. ,cpnStat : $('input:radio[name="disCpnStat"]:checked').val()
  866. ,endAlimYn : $('#CouponForm select[name=endAlimYn]').val()
  867. ,firstOrdYn : $('#CouponForm select[name=firstOrdYn]').val()
  868. ,downAblYn : $('#CouponForm select[name=downAblYn]').val()
  869. ,custJoinStdt : $('#CouponForm input[name=custJoinStdt]').val()
  870. ,custJoinEddt : $('#CouponForm input[name=custJoinEddt]').val()
  871. ,buyStdt : $('#CouponForm input[name=buyStdt]').val()
  872. ,buyEddt : $('#CouponForm input[name=buyEddt]').val()
  873. ,newCustYn : $('#CouponForm select[name=newCustYn]').val()
  874. ,afChannel : $('#CouponForm select[name=afChannel]').val()
  875. ,dcCdGb : $('input:radio[name="dcCdGb"]:checked').val()
  876. ,rdCpnNm : $('input:radio[name="rdCpnNm"]:checked').val()
  877. ,supplyCompList : gagaAgGrid.getAllRowData(supplyGridOptions)
  878. ,brandList : gagaAgGrid.getAllRowData(brandGridOptions)
  879. ,applyGoodsList : gagaAgGrid.getAllRowData(goodsGridOptions)
  880. ,exceptGoodsList : gagaAgGrid.getAllRowData(excepGoodsGridOptions)
  881. ,cateList : gagaAgGrid.getAllRowData(cateGridOptions)
  882. ,burdenList : gagaAgGrid.getAllRowData(inComGridOptions)
  883. ,usableCustGbArr : usableCustGbArr
  884. ,usableCustGradeArr : usableCustGradeArr
  885. ,payTypeArr : payTypeArr
  886. ,limitedTimeCpnList : gagaAgGrid.getAllRowData(limitedTimeCpnGridOptions)
  887. };
  888. var jsonData = JSON.stringify(data);
  889. gagajf.ajaxJsonSubmit($('#CouponForm').prop('action'), jsonData, fnCouponSaveCollback);
  890. }
  891. });
  892. }
  893. var fnCouponSaveCollback = function (result){
  894. uifnPopupClose('CouponRegForm');
  895. $('#btnSearch').trigger('click');
  896. }
  897. // 쿠폰 수정 시
  898. function fnCouponUpdate(){
  899. mcxDialog.confirm('수정하시겠습니까?' , {
  900. cancelBtnText:"취소",
  901. sureBtnText:"확인",
  902. sureBtnClick: function () {
  903. gagajf.removeCommaAtNumberFormattedInput('#CouponForm');
  904. // disabled 해제
  905. $("#CouponForm * ").attr("readonly" , false);
  906. $("#CouponForm * ").prop("disabled" , false);
  907. // 필수값들 셋팅
  908. setReqValue();
  909. // 필수값 validation 체크
  910. if (!gagajf.validation('#CouponForm')) {
  911. return false;
  912. }
  913. if(!checkValidation()) {
  914. return false;
  915. }
  916. gagajf.ajaxFormSubmit($('#CouponForm').prop('action'), '#CouponForm', function() {
  917. uifnPopupClose('CouponRegForm');
  918. $('#btnSearch').trigger('click');
  919. });
  920. }
  921. });
  922. }
  923. // disabled 해제
  924. function setDisabledFalse(){ debugger;
  925. }
  926. function checkValidation(){
  927. // 사용가능고객구분 체크박스 체크
  928. var usableCustGbCnt = $('#CouponForm input:checkbox[name=usableCustGbArr]').length;
  929. if(usableCustGbCnt<1){
  930. mcxDialog.alert("사용가능고객구분을 체크해주세요.");
  931. $('#CouponForm input:checkbox[name=usableCustGbArr]').focus();
  932. return false;
  933. }
  934. // 사용가능고객등급 체크박스 체크
  935. var usableCustGradeCnt = $('#CouponForm input:checkbox[name=usableCustGradeArr]').length;
  936. if(usableCustGradeCnt<1){
  937. mcxDialog.alert("사용가능고객등급을 체크해주세요.");
  938. $('#CouponForm input:checkbox[name=usableCustGradeArr]').focus();
  939. return false;
  940. }
  941. // 결제수단 체크박스 체크
  942. var payTypeCnt = $('#CouponForm input:checkbox[name=payTypeArr]').length;
  943. if(payTypeCnt<1){
  944. mcxDialog.alert("사용가능고객등급을 체크해주세요.");
  945. $('#CouponForm input:checkbox[name=payTypeArr]').focus();
  946. return false;
  947. }
  948. //신규가입 지급한다면 validation 체크
  949. if( $('#newCustYn option:selected').val() == "Y" ){
  950. var fromDate = $('#CouponForm input[name=custJoinStdt]').val();
  951. var toDate = $('#CouponForm input[name=custJoinEddt]').val();
  952. if (gagajf.isNull(fromDate) || gagajf.isNull(toDate)) {
  953. mcxDialog.alertC("신규가입기간 시작일자와 종료일자를 입력하세요.", {
  954. sureBtnText: "확인",
  955. sureBtnClick: function() {
  956. $('#CouponForm input[name=custJoinStdt]').focus();
  957. }
  958. });
  959. return false;
  960. }
  961. if (fromDate > toDate) {
  962. mcxDialog.alertC("등록 시작일자는 종료일자 보다 클 수 없습니다.", {
  963. sureBtnText: "확인",
  964. sureBtnClick: function() {
  965. $('#CouponForm input[name=custJoinEddt]').focus();
  966. }
  967. });
  968. return false;
  969. }
  970. }
  971. // 첫구매 지급하면 validation 체크
  972. if( $('#firstOrdYn option:selected').val() == "Y" ){
  973. var fromDate = $('#CouponForm input[name=buyStdt]').val();
  974. var toDate = $('#CouponForm input[name=buyEddt]').val();
  975. if (gagajf.isNull(fromDate) || gagajf.isNull(toDate)) {
  976. mcxDialog.alertC("신규가입기간 시작일자와 종료일자를 입력하세요.", {
  977. sureBtnText: "확인",
  978. sureBtnClick: function() {
  979. $('#CouponForm input[name=buyStdt]').focus();
  980. }
  981. });
  982. return false;
  983. }
  984. if (fromDate > toDate) {
  985. mcxDialog.alertC("등록 시작일자는 종료일자 보다 클 수 없습니다.", {
  986. sureBtnText: "확인",
  987. sureBtnClick: function() {
  988. $('#CouponForm input[name=buyEddt]').focus();
  989. }
  990. });
  991. return false;
  992. }
  993. }
  994. // 할인율 validation 체크 (100을 넘길수없음)
  995. if($('#dcWay').val() == 'G240_11') {
  996. if($('#dcPval').val() > 100) {
  997. mcxDialog.alert('PC할인율은 100을 초과할수없습니다.');
  998. $('#dcPval').focus();
  999. return false;
  1000. } else if( $('#dcMval').val() > 100) {
  1001. mcxDialog.alert('모바일(웹)할인율은 100을 초과할수없습니다.');
  1002. $('#dcMval').focus();
  1003. return false;
  1004. } else if( $('#dcAval').val() > 100) {
  1005. mcxDialog.alert('모바일(앱)할인율은 100을 초과할수없습니다.');
  1006. $('#dcAval').focus();
  1007. return false;
  1008. }
  1009. }
  1010. // 할인쿠폰 유형에 따른 총 발행수량 수정 (주문서 쿠폰이고 난수쿠폰일 경우)
  1011. if($('#CouponForm #cpnType').val() == "G230_20" && $('#CouponForm input:radio[name="dcCdGb"]:checked').val() == "G233_20") {
  1012. if($("#CouponForm input[name=randomCpnQty]").val() == "" || $("#CouponForm input[name=randomCpnQty]").val() < 1) {
  1013. mcxDialog.alert('쿠폰의 발급 수량을 입력해주세요.');
  1014. $("#CouponForm input[name=randomCpnQty]").focus();
  1015. return false;
  1016. }
  1017. if($("#CouponForm input[name=randomCpnQty]").val() > 10000) {
  1018. mcxDialog.alert('쿠폰의 발급 수량은 10000장을 초과할 수 없습니다.');
  1019. $("#CouponForm input[name=randomCpnQty]").focus();
  1020. return false;
  1021. }
  1022. } else if ($('#CouponForm #cpnType').val() == "G230_20" && $('#CouponForm input:radio[name="dcCdGb"]:checked').val() == "G233_10") { // 주문서 쿠폰이고 시리얼 유형일 경우
  1023. if($("#CouponForm input[name=serialCpnNm]").val().length > 10) {
  1024. mcxDialog.alert('시리얼쿠폰키워드는 10글자를 넘을 수 없습니다.');
  1025. $("#CouponForm input[name=serialCpnNm]").focus();
  1026. return false;
  1027. }
  1028. if($("#CouponForm input[name=serialCpnQty]").val() == "" || $("#CouponForm input[name=serialCpnQty]").val() < 1) {
  1029. mcxDialog.alert('쿠폰의 발급 수량을 입력해주세요.');
  1030. $("#CouponForm input[name=serialCpnQty]").focus();
  1031. return false;
  1032. }
  1033. if($("#CouponForm input[name=randomCpnQty]").val() > 10000) {
  1034. mcxDialog.alert('쿠폰의 발급 수량은 10000장을 초과할 수 없습니다.');
  1035. $("#CouponForm input[name=serialCpnQty]").focus();
  1036. return false;
  1037. }
  1038. } else if ($('#CouponForm #cpnType').val() == "G230_11" && $("#limitedTimeCpnYn").val() == "Y") { // 상품쿠폰이고 선착순쿠폰 체크되어 있을때
  1039. let cpnData = gagaAgGrid.getAllRowData(limitedTimeCpnGridOptions);
  1040. if(cpnData.length < 1){
  1041. mcxDialog.alert("선착순 쿠폰을 설정해주세요.");
  1042. return false;
  1043. }else{
  1044. for(i=0; i<cpnData.length; i++){
  1045. if(gagajf.isNull(cpnData[i].limitCpnNm)){
  1046. mcxDialog.alert(i+1 + "번 행의 선착순 쿠폰명을 입력해주세요.");
  1047. return false;
  1048. }
  1049. if(gagajf.isNull(cpnData[i].downStdt)){
  1050. mcxDialog.alert(i+1 + "번 행의 선착순쿠폰 다운로드시작일을 입력해주세요.");
  1051. return false;
  1052. }
  1053. if(gagajf.isNull(cpnData[i].downEddt)){
  1054. mcxDialog.alert(i+1 + "번 행의 선착순쿠폰 다운로드종료일을 입력해주세요.");
  1055. return false;
  1056. }else{
  1057. var tempEddt = cpnData[i].downEddt.replace(/[^0-9]/g, '');
  1058. if(tempEddt.substr(8,14) == '000000'){
  1059. tempEddt = tempEddt.substr(0,8)+'235959';
  1060. cpnData[i].downEddt = tempEddt;
  1061. }
  1062. }
  1063. if(gagajf.isNull(cpnData[i].downLimitQty)){
  1064. mcxDialog.alert(i+1 + "번 행의 선착순쿠폰 다운로드가능수량을 입력해주세요.");
  1065. return false;
  1066. }else{
  1067. if(cpnData[i].downLimitQty<1){
  1068. mcxDialog.alert(i+1 + "번 행의 선착순쿠폰 다운로드가능수량을 1개이상 입력해주세요.");
  1069. return false;
  1070. }
  1071. }
  1072. }
  1073. limitedTimeCpnGridOptions.api.setRowData(cpnData);
  1074. }
  1075. }
  1076. return true;
  1077. }
  1078. // 할인방식 변경
  1079. $("#CouponForm input[name=rdoDcWay]").bind('click change', function () {
  1080. var radioValue = $(this).val();
  1081. //발급이력이있으면 수정안됨
  1082. if(issueCnt > 0 ) {
  1083. return false;
  1084. }
  1085. if(radioValue == 'G240_10') {
  1086. $('#dcPvalSpan').text("원");
  1087. $('#dcMvalSpan').text("원");
  1088. $('#dcAvalSpan').text("원");
  1089. $('#dcPval').val(0);
  1090. $('#dcMval').val(0);
  1091. $('#dcAval').val(0);
  1092. $('#maxDcAmt').val(0);
  1093. $("#CouponForm .maxDcAmtArea").hide();
  1094. } else {
  1095. $('#dcPvalSpan').text("%");
  1096. $('#dcMvalSpan').text("%");
  1097. $('#dcAvalSpan').text("%");
  1098. $('#dcPval').val(0);
  1099. $('#dcMval').val(0);
  1100. $('#dcAval').val(0);
  1101. $('#maxDcAmt').val(0);
  1102. $("#CouponForm .maxDcAmtArea").show();
  1103. }
  1104. });
  1105. // 쿠폰 상태 변경
  1106. $("#CouponForm input[name=rdoCpnType]").bind('click change', function () {
  1107. var radioValue = $(this).val();
  1108. if(mode == "U") {
  1109. radioValue = cpnDetail.cpnType;
  1110. }
  1111. // 즉시할인 쿠폰일때
  1112. if(radioValue == 'G230_10'){
  1113. $('#CouponForm .custJoinTr').hide();
  1114. $('#CouponForm .custJoinDateTr').hide();
  1115. $('#CouponForm .firstBuyTr').hide();
  1116. $('#CouponForm .buyDateTr').hide();
  1117. $('#CouponForm .dcCdCheck1').hide();
  1118. $('#CouponForm .limitedTimeCpnArea').hide();
  1119. }else{
  1120. if(radioValue == 'G230_11'){ // 상품쿠폰일때 선착순쿠폰 등록 가능
  1121. $('#CouponForm .limitedTimeCpnArea').show();
  1122. }else{
  1123. $('#CouponForm .limitedTimeCpnArea').hide();
  1124. }
  1125. $('#CouponForm .custJoinTr').show();
  1126. $('#CouponForm .firstBuyTr').show();
  1127. $('#CouponForm .dcCdCheck1').show();
  1128. }
  1129. // 상품쿠폰 선택시 적용범위 개별로 변경 나머진 전체
  1130. if(radioValue == 'G230_11') {
  1131. $("input:radio[name='rdoApplyScope']:radio[value='I']").prop('checked', true);
  1132. } else {
  1133. $("input:radio[name='rdoApplyScope']:radio[value='A']").prop('checked', true);
  1134. }
  1135. // 주문서 쿠폰 선택시 결제수단 노출
  1136. if(radioValue == 'G230_20') {
  1137. $('#CouponForm .payTypeTr').show();
  1138. $('#CouponForm #payType').attr('required' , true);
  1139. $("#CouponForm .dcCdGb").show(); // 할인쿠폰유형 노출
  1140. } else {
  1141. $('#CouponForm .payTypeTr').hide();
  1142. $('#CouponForm #payType').attr('required' , false );
  1143. $("#CouponForm .dcCdGb").hide(); // 할인쿠폰유형 숨김
  1144. $("#CouponForm input:radio[name='dcCdGb']:radio[value='G233_00']").prop('checked', true); // 주문서 쿠폰이 아닐 경우 일반 쿠폰으로 설정
  1145. }
  1146. $('#CouponForm #cpnType').val(radioValue);
  1147. });
  1148. // 할인 쿠폰 유형 변경
  1149. $("#CouponForm input[name=dcCdGb]").bind('click change', function () {
  1150. if(this.value == "G233_00") { // 일반 유형
  1151. $("#CouponForm .dcCdCheck1").show();
  1152. $("#CouponForm .dcCdCheck2").show();
  1153. $("#CouponForm .serialCpnArea").hide();
  1154. $("#CouponForm .randomCpnArea").hide();
  1155. $("#CouponForm #newCustYn").parent().attr("colspan", "");
  1156. $("#CouponForm .normalCol").attr("colspan", "5");
  1157. $('#CouponForm input[name="serialCpnNm"]').attr('required' , false);
  1158. $('#CouponForm input[name="serialCpnQty"]').attr('required' , false);
  1159. $('#CouponForm input[name="randomCpnQty"]').attr('required' , false);
  1160. } else {
  1161. if(this.value == "G233_10") { // 시리얼 유형
  1162. $("#CouponForm .serialCpnArea").show();
  1163. $("#CouponForm .randomCpnArea").hide();
  1164. $("#CouponForm .normalCol").attr("colspan", "5");
  1165. $('#CouponForm input[name="serialCpnNm"]').attr('required' , true);
  1166. $('#CouponForm input[name="serialCpnQty"]').attr('required' , true);
  1167. $('#CouponForm input[name="randomCpnQty"]').attr('required' , false);
  1168. } else { // 난수 유형
  1169. $("#CouponForm .serialCpnArea").hide();
  1170. $("#CouponForm .randomCpnArea").show();
  1171. $("#CouponForm .normalCol").attr("colspan", "");
  1172. $('#CouponForm input[name="serialCpnNm"]').attr('required' , false);
  1173. $('#CouponForm input[name="serialCpnQty"]').attr('required' , false);
  1174. $('#CouponForm input[name="randomCpnQty"]').attr('required' , true);
  1175. }
  1176. $("#CouponForm .dcCdCheck1").hide(); // 총발행제한수량, 1회발행수량, 1인당발행제한수량 숨김
  1177. $("#CouponForm .dcCdCheck2").hide(); // 총발행제한수량, 1회발행수량, 1인당발행제한수량 숨김
  1178. $("#CouponForm #newCustYn").parent().attr("colspan", "5"); // 총발행제한 수량을 없애면서 신규회원여부 colspan 수정
  1179. }
  1180. });
  1181. // 적용대상 - 브랜드 추가 버튼시
  1182. $('#btnBrandAdd').on('click' , function(){
  1183. cfnOpenBrandListPopup("fnSetPopupBrandInfo", "M");
  1184. });
  1185. // 브랜드 설정 / 브랜드 추가 콜백함수 (단수로 가져오므로 복수일 경우에 수정 확인 필요)
  1186. var fnSetPopupBrandInfo = function(result) {
  1187. for(let i = 0 ; i < result.length ; i++) {
  1188. let addChk = true, gridListValue = gagaAgGrid.getAllRowData(brandGridOptions); // 받아온 모든 데이터
  1189. // 받아온 data for
  1190. for(let j = 0 ; j < gridListValue.length ; j++) {
  1191. if(gridListValue[j].brandCd == result[i].brandCd) { addChk = false; } // 중복체크
  1192. }
  1193. // 중복되지 않은 데이터 리스트에 추가
  1194. if(addChk) {
  1195. gagaAgGrid.addRowData(brandGridOptions, {"brandCd" : result[i].brandCd, "brandEnm" : result[i].brandEnm, "supplyCompNm" : result[i].supplyCompNm});
  1196. }
  1197. }
  1198. };
  1199. // 적용대상 - 브랜드 삭제 버튼시
  1200. /*$('#btnBrandDel').on('click' , function(){
  1201. var selectVal = brandGridOptions.api.getSelectedRows();
  1202. if(selectVal.length == 0) {
  1203. mcxDialog.alert("선택된 행이 없습니다");
  1204. return;
  1205. }
  1206. if(cpnDetail != null ) {
  1207. mcxDialog.confirm('삭제하시겠습니까?', {
  1208. cancelBtnText: "취소",
  1209. sureBtnText: "확인",
  1210. sureBtnClick: function(){
  1211. gagaAgGrid.removeRowData(brandGridOptions , false);
  1212. var cpnRefvalSqArr = [];
  1213. $.each(selectVal , function(idx , item){
  1214. cpnRefvalSqArr.push(item.cpnRefvalSq);
  1215. });
  1216. var data = { cpnRefvalSqArr : cpnRefvalSqArr
  1217. ,cpnId : cpnDetail.cpnId
  1218. };
  1219. var jsonData = JSON.stringify(data);
  1220. gagajf.ajaxJsonSubmit('/marketing/coupon/refval/update', jsonData);
  1221. }
  1222. });
  1223. } else {
  1224. // 신규화면이면 그리드상 삭제
  1225. brandGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(brandGridOptions)});
  1226. }
  1227. });
  1228. */
  1229. // 적용대상 - 공급처 추가 버튼시
  1230. $('#btnSupplyAdd').on('click' , function (){
  1231. cfnOpenCompanyListPopup("fnSetPopupComapnyInfo" , "M");
  1232. });
  1233. // 공급업체 설정 / 업체 추가 콜백함수
  1234. var fnSetPopupComapnyInfo = function(result) {
  1235. // 기존 리스트 데이터 for
  1236. for(let i = 0 ; i < result.length ; i++) {
  1237. let addChk = true, gridListValue = gagaAgGrid.getAllRowData(supplyGridOptions); // 받아온 모든 데이터
  1238. // 받아온 data for
  1239. for(let j = 0 ; j < gridListValue.length ; j++) {
  1240. // 동일한 data는 추가하지 않음
  1241. if(gridListValue[j].supplyCompCd == result[i].supplyCompCd) { addChk = false; } // 중복체크
  1242. }
  1243. // 중복되지 않은 데이터 리스트에 추가
  1244. if(addChk) {
  1245. gagaAgGrid.addRowData(supplyGridOptions, {"supplyCompCd" : result[i].supplyCompCd, "supplyCompNm" : result[i].supplyCompNm});
  1246. }
  1247. }
  1248. };
  1249. // 적용대상 - 공급처 삭제시시
  1250. /*$('#btnSupplyDel').on('click' , function () {
  1251. var selectVal = supplyGridOptions.api.getSelectedRows();
  1252. if(selectVal.length == 0) {
  1253. mcxDialog.alert("선택된 행이 없습니다");
  1254. return;
  1255. }
  1256. if(cpnDetail != null ) {
  1257. mcxDialog.confirm('삭제하시겠습니까?', {
  1258. cancelBtnText: "취소",
  1259. sureBtnText: "확인",
  1260. sureBtnClick: function(){
  1261. gagaAgGrid.removeRowData(supplyGridOptions , false);
  1262. var cpnRefvalSqArr = [];
  1263. $.each(selectVal , function(idx , item){
  1264. cpnRefvalSqArr.push(item.cpnRefvalSq);
  1265. });
  1266. var data = { cpnRefvalSqArr : cpnRefvalSqArr
  1267. ,cpnId : $('#CouponForm #cpnId').val()
  1268. };
  1269. var jsonData = JSON.stringify(data);
  1270. gagajf.ajaxJsonSubmit('/marketing/coupon/refval/update', jsonData);
  1271. }
  1272. });
  1273. } else {
  1274. // 신규화면이면 그리드상 삭제
  1275. supplyGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(supplyGridOptions)});
  1276. }
  1277. });*/
  1278. // 적용대상 - 카테고리 추가시
  1279. $('#btnCateAdd').on('click' , function () {
  1280. cfnOpenCategoryPopup("fnSetPopupCategoryInfo");
  1281. });
  1282. // 카테고리 추가 콜백 함수
  1283. var fnSetPopupCategoryInfo = function (result) {
  1284. // 기존 리스트 데이터 for
  1285. for(let i = 0 ; i < result.length ; i++) {
  1286. let addChk = true, gridListValue = gagaAgGrid.getAllRowData(cateGridOptions); // 받아온 모든 데이터
  1287. // 받아온 data for
  1288. for(let j = 0 ; j < gridListValue.length ; j++) {
  1289. // 동일한 data는 추가하지 않음
  1290. if(gridListValue[j].cateNo == result[i].cateNo) { addChk = false; } // 중복체크
  1291. }
  1292. // 중복되지 않은 데이터 리스트에 추가
  1293. if(addChk) {
  1294. 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});
  1295. }
  1296. }
  1297. }
  1298. // 적용대상 - 카테고리 삭제시
  1299. /*$('#btnCateDel').on('click' , function () {
  1300. var selectVal = cateGridOptions.api.getSelectedRows();
  1301. if(selectVal.length == 0) {
  1302. mcxDialog.alert("선택된 행이 없습니다");
  1303. return;
  1304. }
  1305. if(cpnDetail != null) {
  1306. mcxDialog.confirm('삭제하시겠습니까?', {
  1307. cancelBtnText: "취소",
  1308. sureBtnText: "확인",
  1309. sureBtnClick: function(){
  1310. gagaAgGrid.removeRowData(cateGridOptions , false);
  1311. var cpnRefvalSqArr = [];
  1312. $.each(selectVal , function(idx , item){
  1313. cpnRefvalSqArr.push(item.cpnRefvalSq);
  1314. });
  1315. var data = { cpnRefvalSqArr : cpnRefvalSqArr
  1316. ,cpnId : $('#CouponForm #cpnId').val()
  1317. };
  1318. var jsonData = JSON.stringify(data);
  1319. gagajf.ajaxJsonSubmit('/marketing/coupon/refval/update', jsonData);
  1320. }
  1321. });
  1322. } else {
  1323. cateGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(cateGridOptions)});
  1324. }
  1325. });
  1326. */
  1327. // 적용대상 - 상품 추가시
  1328. $('#btnGoodsAdd').on('click' , function () {
  1329. cfnOpenGoodsPopup("fnSetPopupApplyGoodsInfo");
  1330. });
  1331. // 적용 상품 리스트 콜백함수
  1332. var fnSetPopupApplyGoodsInfo = function(result) {
  1333. gridAddGoodsList(goodsGridOptions, result , "apply");
  1334. };
  1335. // 적용대상 - 상품 삭제 시
  1336. /*$('#btnGoodsDel').on('click' , function () {
  1337. var selectVal = goodsGridOptions.api.getSelectedRows();
  1338. if(selectVal.length == 0) {
  1339. mcxDialog.alert("선택된 행이 없습니다");
  1340. return;
  1341. }
  1342. if(cpnDetail != null ) {
  1343. mcxDialog.confirm('삭제하시겠습니까?', {
  1344. cancelBtnText: "취소",
  1345. sureBtnText: "확인",
  1346. sureBtnClick: function(){
  1347. gagaAgGrid.removeRowData(goodsGridOptions , false);
  1348. var cpnRefvalSqArr = [];
  1349. $.each(selectVal , function(idx , item){
  1350. cpnRefvalSqArr.push(item.cpnRefvalSq);
  1351. });
  1352. var data = { cpnRefvalSqArr : cpnRefvalSqArr
  1353. ,cpnId : $('#CouponForm #cpnId').val()
  1354. };
  1355. var jsonData = JSON.stringify(data);
  1356. gagajf.ajaxJsonSubmit('/marketing/coupon/refval/update', jsonData);
  1357. }
  1358. });
  1359. } else {
  1360. goodsGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(goodsGridOptions)});
  1361. }
  1362. });
  1363. */
  1364. // 적용대상 - 제외상품 추가시
  1365. $('#btnExcepGoodsAdd').on('click' , function(){
  1366. cfnOpenGoodsPopup("fnSetPopupExceptGoodsInfo");
  1367. });
  1368. // 적용 상품 리스트 콜백함수
  1369. var fnSetPopupExceptGoodsInfo = function(result) {
  1370. gridAddGoodsList(excepGoodsGridOptions, result , "except");
  1371. };
  1372. // 적용대상 - 제외상품 삭제시
  1373. /*$('#btnExcepGoodsDel').on('click' , function () {
  1374. var selectVal = excepGoodsGridOptions.api.getSelectedRows();
  1375. if(selectVal.length == 0) {
  1376. mcxDialog.alert("선택된 행이 없습니다");
  1377. return;
  1378. }
  1379. if(cpnDetail != null ) {
  1380. mcxDialog.confirm('삭제하시겠습니까?', {
  1381. cancelBtnText: "취소",
  1382. sureBtnText: "확인",
  1383. sureBtnClick: function(){
  1384. gagaAgGrid.removeRowData(excepGoodsGridOptions , false);
  1385. var cpnRefvalSqArr = [];
  1386. $.each(selectVal , function(idx , item){
  1387. cpnRefvalSqArr.push(item.cpnRefvalSq);
  1388. });
  1389. var data = { cpnRefvalSqArr : cpnRefvalSqArr
  1390. ,cpnId : $('#CouponForm #cpnId').val()
  1391. };
  1392. var jsonData = JSON.stringify(data);
  1393. gagajf.ajaxJsonSubmit('/marketing/coupon/refval/update', jsonData);
  1394. }
  1395. });
  1396. } else {
  1397. excepGoodsGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(excepGoodsGridOptions)});
  1398. }
  1399. });
  1400. */
  1401. // ag-grid 상품관련 list 콜백함수
  1402. function gridAddGoodsList(OriginGridListOption, result, gubun) {
  1403. var goodsGbVal = "G800_10";
  1404. if(gubun == 'except'){
  1405. goodsGbVal = "G800_30";
  1406. }
  1407. for(let i = 0 ; i < result.length ; i++) {
  1408. let addChk = true, gridListValue = gagaAgGrid.getAllRowData(OriginGridListOption); // 받아온 모든 데이터
  1409. // 받아온 data for
  1410. for(let j = 0 ; j < gridListValue.length ; j++) {
  1411. if(gridListValue[j].goodsCd == result[i].goodsCd) { addChk = false; } // 중복체크
  1412. }
  1413. // 중복되지 않은 데이터 리스트에 추가
  1414. if(addChk) {
  1415. gagaAgGrid.addRowData(OriginGridListOption, {"goodsGb": goodsGbVal, "goodsCd" : result[i].goodsCd, "goodsNm" : result[i].goodsNm});
  1416. }
  1417. }
  1418. }
  1419. // 기간 일수 변경시
  1420. function pdGbChange(pThis){
  1421. var selectVal = $(pThis).val();
  1422. if(typeof selectVal == "undefined") {
  1423. if(mode == "U") {
  1424. selectVal = cpnDetail.pdGb;
  1425. } else {
  1426. selectVal = "P";
  1427. }
  1428. }
  1429. if(selectVal == "P") {
  1430. $('.availDateTr').css('display' , '');
  1431. $('.availDayTr').css('display' , 'none');
  1432. $('#CouponForm #availDays').attr('required' , false);
  1433. $('#CouponForm #availStDay').attr('required' , true);
  1434. $('#CouponForm #availEdDay').attr('required' , true);
  1435. $('#CouponForm #availStdt').attr('required' , true);
  1436. $('#CouponForm #availEddt').attr('required' , true);
  1437. } else {
  1438. $('.availDateTr').css('display' , 'none');
  1439. $('.availDayTr').css('display' , '');
  1440. $('#CouponForm #availDays').attr('required' , true);
  1441. $('#CouponForm #availStDay').attr('required' , false);
  1442. $('#CouponForm #availEdDay').attr('required' , false);
  1443. $('#CouponForm #availStdt').attr('required' , false);
  1444. $('#CouponForm #availEddt').attr('required' , false);
  1445. }
  1446. }
  1447. // 첫구매여부 변경시
  1448. function firstOrdYnChange(pThis){
  1449. var selectVal = $(pThis).val();
  1450. if(typeof selectVal == "undefined") {
  1451. if(mode == "U") {
  1452. selectVal = cpnDetail.firstOrdYn;
  1453. } else {
  1454. selectVal = "N";
  1455. }
  1456. }
  1457. if(selectVal == "Y" ) {
  1458. $('.buyDateTr').css('display' , '');
  1459. $('#buyStdt').attr('required' , true);
  1460. $('#buyEddt').attr('required' , true);
  1461. } else {
  1462. $('.buyDateTr').css('display' , 'none');
  1463. $('#buyStdt').attr('required' , false);
  1464. $('#buyEddt').attr('required' , false);
  1465. }
  1466. }
  1467. // 신규회원여부 변경시
  1468. function newCustYnChange(pThis){
  1469. var selectVal = $(pThis).val();
  1470. if(typeof selectVal == "undefined") {
  1471. if(mode == "U") {
  1472. selectVal = cpnDetail.newCustYn;
  1473. } else {
  1474. selectVal = "N";
  1475. }
  1476. }
  1477. if(selectVal == "Y" ) {
  1478. $('.custJoinDateTr').css('display' , '');
  1479. $('#custJoinStdt').attr('required' , true);
  1480. $('#custJoinEddt').attr('required' , true);
  1481. } else {
  1482. $('.custJoinDateTr').css('display' , 'none');
  1483. $('#custJoinStdt').attr('required' , false);
  1484. $('#custJoinEddt').attr('required' , false);
  1485. }
  1486. }
  1487. // 행추가시
  1488. $('#btnAddRow').on('click' , function(){
  1489. var data = { supplyCompCd: null , burdenRate : null , delYn : null};
  1490. gagaAgGrid.addRowData(inComGridOptions , data , "supplyCompCd" );
  1491. });
  1492. // 행삭제시
  1493. /*$('#btnDelRow').on('click' , function(){
  1494. inComGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(inComGridOptions)});
  1495. });*/
  1496. // 제휴링크채널 수정 (제휴링크가 꼭필요한지 확인필요)
  1497. function fnChangeAfLinkCdList(){
  1498. var actionUrl = "/business/aflink/list" + '?' + $('#afChannel').serialize();
  1499. var tag = "";
  1500. $("#CouponForm #afLinkCd").children('option').remove();
  1501. gagajf.ajaxJsonSubmit(actionUrl, '', function(data) {
  1502. for (let i = 0; i < data.length; i++) {
  1503. if (data[i].useYn == 'Y') {
  1504. tag += '<option value="' + data[i].afLinkCd + '">[' + data[i].afLinkCd + '] ' + data[i].afLinkNm + '</option>';
  1505. }
  1506. }
  1507. $("#CouponForm #afLinkCd").append(tag);
  1508. $("#CouponForm #afLinkCd option:first").attr("selected" , "selected");
  1509. });
  1510. }
  1511. // 발급받은회원 팝업
  1512. var fnPubCustListPopUp = function (){
  1513. let cpnId = $("#CouponForm #cpnId").val();
  1514. var actionUrl = "/marketing/coupon/pubCust/popup/form?cpnId=" + cpnId;
  1515. cfnOpenModalPopup(actionUrl, 'CpnPubCustListPopup');
  1516. };
  1517. // 쿠폰발행팝업
  1518. function fnCustomerIssuePopUp(){
  1519. cfnCpnPubForCustPopup();
  1520. };
  1521. // 전송시 값 세팅
  1522. function setReqValue(){
  1523. // 쿠폰유형값 세팅
  1524. $('#CouponForm #cpnType').val($('#CouponForm input:radio[name="rdoCpnType"]:checked').val());
  1525. // 할인방식값 세팅
  1526. $('#CouponForm #dcWay').val($('#CouponForm input:radio[name="rdoDcWay"]:checked').val());
  1527. // 적용범위값 세팅
  1528. $('#CouponForm #applyScope').val($('#CouponForm input:radio[name="rdoApplyScope"]:checked').val());
  1529. // 쿠폰상태
  1530. $('#CouponForm input[name=cpnStat]').val($('input:radio[name="disCpnStat"]:checked').val());
  1531. // 다운로드기간 세팅
  1532. let downStdt = "";
  1533. let downEddt = "";
  1534. downStdt = $('#CouponForm input[name=downStDay]').val()+$('#CouponForm select[name=downStHH]').val()+$('#CouponForm select[name=downStMM]').val()+'00';
  1535. if($('#CouponForm select[name=downEdHH]').val() == "24"){
  1536. downEddt = $('#CouponForm input[name=downEdDay]').val()+'235959';
  1537. }else{
  1538. downEddt = $('#CouponForm input[name=downEdDay]').val()+$('#CouponForm select[name=downEdHH]').val()+$('#CouponForm select[name=downEdMM]').val()+'00';
  1539. }
  1540. downStdt = downStdt.replace(/[^0-9]/g, '');
  1541. downEddt = downEddt.replace(/[^0-9]/g, '');
  1542. $('#CouponForm #downStdt').val(downStdt);
  1543. $('#CouponForm #downEddt').val(downEddt);
  1544. // 유효기간 세팅
  1545. let availStdt = "";
  1546. let availEddt = "";
  1547. if($("#CouponForm #pdGb").val() == 'P') {
  1548. availStdt = $('#CouponForm input[name=availStDay]').val()+$('#CouponForm select[name=availStHH]').val()+$('#CouponForm select[name=availStMM]').val()+'00';
  1549. if($('#CouponForm select[name=availEdHH]').val() == "24"){
  1550. availEddt = $('#CouponForm input[name=availEdDay]').val()+'235959';
  1551. }else{
  1552. availEddt = $('#CouponForm input[name=availEdDay]').val()+$('#CouponForm select[name=availEdHH]').val()+$('#CouponForm select[name=availEdMM]').val()+'00';
  1553. }
  1554. availStdt = availStdt.replace(/[^0-9]/g, '');
  1555. availEddt = availEddt.replace(/[^0-9]/g, '');
  1556. $('#CouponForm #availStdt').val(availStdt);
  1557. $('#CouponForm #availEddt').val(availEddt);
  1558. $('#CouponForm #availDays').val('');
  1559. } else {
  1560. $('#CouponForm #availStdt').val('');
  1561. $('#CouponForm #availEddt').val('');
  1562. }
  1563. // 첫구매기간세팅
  1564. let buyStdt = "";
  1565. let buyEddt = "";
  1566. buyStdt = $('#CouponForm input[name=buyStDay]').val()+$('#CouponForm select[name=buyStHH]').val()+$('#CouponForm select[name=buyStMM]').val()+'00';
  1567. if($('#CouponForm select[name=buyEdHH]').val() == "24"){
  1568. buyEddt = $('#CouponForm input[name=buyEdDay]').val()+'235959';
  1569. }else{
  1570. buyEddt = $('#CouponForm input[name=buyEdDay]').val()+$('#CouponForm select[name=buyEdHH]').val()+$('#CouponForm select[name=buyEdMM]').val()+'00';
  1571. }
  1572. buyStdt = buyStdt.replace(/[^0-9]/g, '');
  1573. buyEddt = buyEddt.replace(/[^0-9]/g, '');
  1574. $('#CouponForm #buyStdt').val(buyStdt);
  1575. $('#CouponForm #buyEddt').val(buyEddt);
  1576. // 신규회원기간 세팅
  1577. let custJoinStdt = "";
  1578. let custJoinEddt = "";
  1579. custJoinStdt = $('#CouponForm input[name=custJoinStDay]').val()+$('#CouponForm select[name=custJoinStHH]').val()+$('#CouponForm select[name=custJoinStMM]').val()+'00';
  1580. if($('#CouponForm select[name=custJoinEdHH]').val() == "24"){
  1581. custJoinEddt = $('#CouponForm input[name=custJoinEdDay]').val()+'235959';
  1582. }else{
  1583. custJoinEddt = $('#CouponForm input[name=custJoinEdDay]').val()+$('#CouponForm select[name=custJoinEdHH]').val()+$('#CouponForm select[name=custJoinEdMM]').val()+'00';
  1584. }
  1585. custJoinStdt = custJoinStdt.replace(/[^0-9]/g, '');
  1586. custJoinEddt = custJoinEddt.replace(/[^0-9]/g, '');
  1587. $('#CouponForm #custJoinStdt').val(custJoinStdt);
  1588. $('#CouponForm #custJoinEddt').val(custJoinEddt);
  1589. // 할인쿠폰 유형에 따른 총 발행수량 수정 (주문서 쿠폰이고 난수쿠폰일 경우)
  1590. if($('#CouponForm #cpnType').val() == "G230_20" && $('#CouponForm input:radio[name="dcCdGb"]:checked').val() == "G233_20") {
  1591. $('#CouponForm input[name="totPubLimitQty"]').val($('#CouponForm input[name="randomCpnQty"]').val()); // 총 발행수량 난수 생성수량으로 변경
  1592. $('#CouponForm input[name="custPubLimitQty"]').val(1); // 1인당 발행제한수량 1개 고정
  1593. $('#CouponForm input[name="onePubQty"]').val(1); // 1회발행수량 1개 고정
  1594. } else if ($('#CouponForm #cpnType').val() == "G230_20" && $('#CouponForm input:radio[name="dcCdGb"]:checked').val() == "G233_10") { // 주문서 쿠폰이고 시리얼 유형일 경우
  1595. $('#CouponForm input[name="rdCpnNm"]').val($('#CouponForm input[name="serialCpnNm"]').val()); // 시리얼유형쿠폰명 저장
  1596. $('#CouponForm input[name="totPubLimitQty"]').val($('#CouponForm input[name="serialCpnQty"]').val()); // 총 발행수량 랜덤쿠폰발급수량으로 변경
  1597. $('#CouponForm input[name="custPubLimitQty"]').val(1); // 1인당 발행제한수량 1개 고정
  1598. $('#CouponForm input[name="onePubQty"]').val(1); // 1회발행수량 1개 고정
  1599. }
  1600. // 적용대상 - 공급처 그리드 전체값 세팅
  1601. /*var supplyAllData = gagaAgGrid.getAllRowData(supplyGridOptions);
  1602. var jsonSupplyCompData = JSON.stringify(supplyAllData);
  1603. $('#CouponForm #supplyCompList').val(jsonSupplyCompData);*/
  1604. $('#CouponForm #supplyCompList').val(gagaAgGrid.getAllRowData(supplyGridOptions));
  1605. // 적용대상 - 브랜드 그리드 전체값 세팅
  1606. /*var brandAllData = gagaAgGrid.getAllRowData(brandGridOptions);
  1607. var jsonBrandData = JSON.stringify(brandAllData);
  1608. $('#CouponForm #brandList').val(jsonBrandData);*/
  1609. $('#CouponForm #brandList').val(gagaAgGrid.getAllRowData(brandGridOptions));
  1610. // // 적용대상 - 카테고리 그리드 전체값 세팅
  1611. /*var cateAllData = gagaAgGrid.getAllRowData(cateGridOptions);
  1612. var jsonCateData = JSON.stringify(cateAllData);
  1613. $('#CouponForm #cateList').val(jsonCateData);*/
  1614. $('#CouponForm #cateList').val(gagaAgGrid.getAllRowData(cateGridOptions));
  1615. // 적용대상 - 적용상품 그리드 전체값 세팅
  1616. /*var goodsAllData = gagaAgGrid.getAllRowData(goodsGridOptions);
  1617. var jsonGoodsData = JSON.stringify(goodsAllData);
  1618. $('#CouponForm #applyGoodsList').val(jsonGoodsData);*/
  1619. $('#CouponForm #applyGoodsList').val(gagaAgGrid.getAllRowData(goodsGridOptions));
  1620. // 적용대상 - 제외상품 그리드 전체값 세팅
  1621. /*var exceptGoodsAllData = gagaAgGrid.getAllRowData(excepGoodsGridOptions);
  1622. var jsonExceptGoodsData = JSON.stringify(exceptGoodsAllData);
  1623. $('#CouponForm #excepGoodsList').val(jsonExceptGoodsData);*/
  1624. $('#CouponForm #excepGoodsList').val(gagaAgGrid.getAllRowData(excepGoodsGridOptions));
  1625. // 입점업체분담율 그리드 전체값 세팅
  1626. /*var inCompBurdenAllData = gagaAgGrid.getAllRowData(inComGridOptions);
  1627. var jsonInCompBurdenData = JSON.stringify(inCompBurdenAllData);
  1628. $('#CouponForm #burdenList').val(jsonInCompBurdenData);*/
  1629. $('#CouponForm #burdenList').val(gagaAgGrid.getAllRowData(inComGridOptions));
  1630. }
  1631. $(document).ready(function() {
  1632. gagaAgGrid.createGrid('inComGridList', inComGridOptions);
  1633. gagaAgGrid.createGrid('brandGridList', brandGridOptions);
  1634. gagaAgGrid.createGrid('cateGridList', cateGridOptions);
  1635. gagaAgGrid.createGrid('supplyGridList', supplyGridOptions);
  1636. gagaAgGrid.createGrid('goodsGridList', goodsGridOptions);
  1637. gagaAgGrid.createGrid('excepGoodsGridList', excepGoodsGridOptions);
  1638. gagaAgGrid.createGrid('randomCpnList', randomCouponGridOptions);
  1639. gagaAgGrid.createGrid('limitedTimeCpnList', limitedTimeCpnGridOptions);
  1640. // 일단 버튼 숨김
  1641. $(".couponButton").hide();
  1642. // 초기화시 데이터 세팅
  1643. if (mode == "N") {
  1644. $('input[name=rdoCpnType]').eq(0).attr("checked", true);
  1645. $('input[name=dcCdGb]').eq(0).attr("checked", true);
  1646. $('input[name=rdoDcWay]').eq(0).attr("checked", true);
  1647. $('input[name=rdoApplyScope]').eq(0).attr("checked", true)
  1648. $('#CouponForm #availEdHH option:last').attr("selected", "selected");
  1649. $('#CouponForm #availEdMM option').hide();
  1650. $('#CouponForm #availEdMM option:first').show().prop("selected", true);
  1651. $('#downEdHH option:last').attr("selected", "selected");
  1652. $('#downEdMM option').hide();
  1653. $('#downEdMM option:first').show().prop("selected", true);
  1654. $('#custJoinEdHH option:last').attr("selected", "selected");
  1655. $('#custJoinEdMM option').hide();
  1656. $('#custJoinEdMM option:first').show().prop("selected", true);
  1657. $('#buyEdHH option:last').attr("selected", "selected");
  1658. $('#buyEdMM option').hide();
  1659. $('#buyEdMM option:first').show().prop("selected", true);
  1660. $("#CouponForm #afChannel option:first").attr("selected" , "selected");
  1661. $("#CouponForm .normalCol").attr("colspan", "5");
  1662. $("#CouponForm .randomCpnArea").hide();
  1663. $("#CouponForm .maxDcAmtArea").hide();
  1664. $("input:radio[name='disCpnStat']:radio[value='G232_10']").prop('checked', true); // 선택하기
  1665. if($('input:radio[name="rdoCpnType"]:checked').val() == 'G230_10'){
  1666. $('#CouponForm .custJoinTr').hide();
  1667. $('#CouponForm .custJoinDateTr').hide();
  1668. $('#CouponForm .firstBuyTr').hide();
  1669. $('#CouponForm .buyDateTr').hide();
  1670. $('#CouponForm .dcCdCheck1').hide();
  1671. }
  1672. $("#btnCouponSave").show(); // 저장버튼
  1673. $("#CouponForm .buttonSpan").show();
  1674. } else {
  1675. if(cpnDetail.cpnStat == "G232_10"){
  1676. $("#btnCouponSave").show(); // 저장버튼
  1677. $("#btnChangeStatIng").show(); // 진행버튼
  1678. $("#btnCouponDelete").show(); // 삭제버튼
  1679. $("#CouponForm .buttonSpan").show(); //행추가,삭제버튼
  1680. }else if(cpnDetail.cpnStat == "G232_10"){
  1681. $("#btnCouponSave").hide(); // 저장버튼
  1682. $("#btnCouponStop").show(); // 중지버튼
  1683. $("#btnCouponDelete").show(); // 삭제버튼
  1684. $("#CouponForm .buttonSpan").hide(); //행추가,삭제버튼
  1685. }else{
  1686. $("#CouponForm .buttonSpan").hide(); //행추가,삭제버튼
  1687. }
  1688. if(cpnCustGbList.length > 0){
  1689. var chkboxCnt = $('#CouponForm input:checkbox[name=usableCustGbArr]').length;
  1690. var dataCnt = cpnCustGbList.length;
  1691. for(let i=0; i<chkboxCnt; i++){
  1692. for(let j=0; j<dataCnt; j++){
  1693. var data = cpnCustGbList[j].usableCustGb;
  1694. if($('#CouponForm input:checkbox[name=usableCustGbArr]').eq(i).val() == data){
  1695. $('#CouponForm input:checkbox[name=usableCustGbArr]').eq(i).prop('checked', true);
  1696. $("#CouponForm input:checkbox[name=usableCustGbArr]").eq(i).parent().addClass('checked');
  1697. }
  1698. }
  1699. }
  1700. }
  1701. if(cpnCustGradeList.length > 0){
  1702. var chkboxCnt = $('#CouponForm input:checkbox[name=usableCustGradeArr]').length;
  1703. var dataCnt = cpnCustGradeList.length;
  1704. for(let i=0; i<chkboxCnt; i++){
  1705. for(let j=0; j<dataCnt; j++){
  1706. var data = cpnCustGradeList[j].usableCustGrade;
  1707. if($('#CouponForm input:checkbox[name=usableCustGradeArr]').eq(i).val() == data){
  1708. $('#CouponForm input:checkbox[name=usableCustGradeArr]').eq(i).prop('checked', true);
  1709. $("#CouponForm input:checkbox[name=usableCustGradeArr]").eq(i).parent().addClass('checked');
  1710. }
  1711. }
  1712. }
  1713. }
  1714. if(cpnPayTypeList.length > 0){
  1715. var chkboxCnt = $('#CouponForm input:checkbox[name=payTypeArr]').length;
  1716. var dataCnt = cpnPayTypeList.length;
  1717. for(let i=0; i<chkboxCnt; i++){
  1718. for(let j=0; j<dataCnt; j++){
  1719. var data = cpnPayTypeList[j].payType;
  1720. if($('#CouponForm input:checkbox[name=payTypeArr]').eq(i).val() == data){
  1721. $('#CouponForm input:checkbox[name=payTypeArr]').eq(i).prop('checked', true);
  1722. $("#CouponForm input:checkbox[name=payTypeArr]").eq(i).parent().addClass('checked');
  1723. }
  1724. }
  1725. }
  1726. }
  1727. // 수정모드시 그리드 세팅
  1728. inComGridOptions.api.setRowData(cpnDtlBurdenList);
  1729. supplyGridOptions.api.setRowData(cpnDtlRefvalSupplyCompList);
  1730. goodsGridOptions.api.setRowData(cpnDtlRefvalApplyGoodsList);
  1731. excepGoodsGridOptions.api.setRowData(cpnDtlRefvalExceptGoodsList);
  1732. brandGridOptions.api.setRowData(cpnDtlRefvalBrandList);
  1733. cateGridOptions.api.setRowData(cpnDtlRefvalCateList);
  1734. randomCouponGridOptions.api.setRowData(randomCpnList);
  1735. limitedTimeCpnGridOptions.api.setRowData(limitedTimeCpnList);
  1736. // 기본정보 세팅
  1737. $("#CouponForm input:radio[name='rdoDcWay']:radio[value=" + cpnDetail.dcWay + "]").prop('checked', true);
  1738. $("#CouponForm input:radio[name='rdoCpnType']:radio[value=" + cpnDetail.cpnType + "]").prop('checked', true);
  1739. $("#CouponForm input:radio[name='rdoApplyScope']:radio[value=" + cpnDetail.applyScope + "]").prop('checked', true);
  1740. $("#CouponForm #dcPval").val(cpnDetail.dcPval);
  1741. $("#CouponForm #dcMval").val(cpnDetail.dcMval);
  1742. $("#CouponForm #dcAval").val(cpnDetail.dcAval);
  1743. $("#CouponForm #maxDcAmt").val(cpnDetail.maxDcAmt);
  1744. $("#CouponForm #totPubLimitQty").val(cpnDetail.totPubLimitQty);
  1745. $("#CouponForm #custPubLimitQty").val(cpnDetail.custPubLimitQty);
  1746. $("#CouponForm #onePubQty").val(cpnDetail.onePubQty);
  1747. $("#CouponForm #usableCustGb").val(cpnDetail.usableCustGb).prop("selected", true);
  1748. $("#CouponForm #usableCustGrade").val(cpnDetail.usableCustGrade).prop("selected", true);
  1749. $("#CouponForm #endAlimYn").val(cpnDetail.endAlimYn).prop("selected", true);
  1750. $("#CouponForm #firstOrdYn").val(cpnDetail.firstOrdYn).prop("selected", true);
  1751. $("#CouponForm #reissuance").val(cpnDetail.reissuance).prop("selected", true);
  1752. $("#CouponForm #dnGb").val(cpnDetail.dnGb).prop("selected", true);
  1753. //$("#CouponForm #cpnStat").val(cpnDetail.cpnStat).prop("selected", true);
  1754. $("input:radio[name='disCpnStat']:radio[value="+cpnDetail.cpnStat+"]").prop('checked', true); // 선택하기
  1755. $("#CouponForm #newCustYn").val(cpnDetail.newCustYn).prop("selected", true);
  1756. $("#CouponForm #pdGb").val(cpnDetail.pdGb).prop("selected", true);
  1757. $("#CouponForm #siteCd").val(cpnDetail.siteCd).prop("selected", true);
  1758. $("#CouponForm #afChannel").val(cpnDetail.afChannel).prop("selected", true);
  1759. $("#CouponForm #cpnNm").val(cpnDetail.cpnNm);
  1760. $("#CouponForm #downAblYn").val(cpnDetail.downAblYn);
  1761. $("#CouponForm #buyLimitAmt").val(cpnDetail.buyLimitAmt);
  1762. $("#CouponForm #cpnId").val(cpnDetail.cpnId);
  1763. if(limitedTimeCpnList.length>0 && cpnDetail.cpnType == "G230_11"){ //상품쿠폰이고 선착순쿠폰일때
  1764. $("#CouponForm #limitedTimeCpnYn").val("Y");
  1765. $("#CouponForm .limitedTimeCpnTab").show();
  1766. $('#CouponForm .limitedTimeCpnArea').show();
  1767. $("#CouponForm input[id=limitedTimeCpnYn]").parent("label").addClass("checked");
  1768. $("#CouponForm input[id=limitedTimeCpnYn]").attr('readonly', true);
  1769. $("#CouponForm input[id=limitedTimeCpnYn]").prop('disabled', true);
  1770. $("#CouponForm input[id=limitedTimeCpnYn]").parent().prop('disabled', true);
  1771. $("#CouponForm input[id=totPubLimitQty]").prop("disabled", true);
  1772. $("#CouponForm input[id=chkNoLimitTotPubLimitQty]").parent("label").addClass("checked");
  1773. $("#CouponForm input[id=chkNoLimitTotPubLimitQty]").attr('readonly', true);
  1774. $("#CouponForm input[id=chkNoLimitTotPubLimitQty]").prop('disabled', true);
  1775. $("#CouponForm input[id=chkNoLimitTotPubLimitQty]").parent().prop('disabled', true);
  1776. }else{
  1777. $("#CouponForm #limitedTimeCpnYn").val("N");
  1778. $("#CouponForm .limitedTimeCpnTab").hide();
  1779. $('#CouponForm .limitedTimeCpnArea').hide();
  1780. }
  1781. // 한번 저장되면 쿠폰유형, 할인쿠폰유형, 난수 생성수량, 시리얼명, 시리얼쿠폰발급수량 수정 불가 처리
  1782. $("#CouponForm input:radio[name='rdoCpnType']").attr('readonly', true);
  1783. $("#CouponForm input:radio[name='rdoCpnType']").prop('disabled', true);
  1784. $("#CouponForm input:radio[name='rdoCpnType']").parent().prop('disabled', true);
  1785. $("#CouponForm input:radio[name='dcCdGb']").attr('readonly', true);
  1786. $("#CouponForm input:radio[name='dcCdGb']").prop('disabled', true);
  1787. $("#CouponForm input:radio[name='dcCdGb']").parent().prop('disabled', true);
  1788. $("#CouponForm input:radio[name='dcCdGb']:radio[value=" + cpnDetail.dcCdGb + "]").prop('checked', true);
  1789. $("#CouponForm input[name='serialCpnNm']").prop("disabled", true);
  1790. $("#CouponForm input[name='serialCpnQty']").prop("disabled", true);
  1791. $("#CouponForm input[name='randomCpnQty']").prop("disabled", true);
  1792. // 즉시할인 쿠폰이면
  1793. if(cpnDetail.cpnType == "G230_10") {
  1794. $('#CouponForm .custJoinTr').hide();
  1795. $('#CouponForm .custJoinDateTr').hide();
  1796. $('#CouponForm .firstBuyTr').hide();
  1797. $('#CouponForm .buyDateTr').hide();
  1798. $('#CouponForm .dcCdCheck1').hide();
  1799. }else{
  1800. $('#CouponForm .custJoinTr').show();
  1801. $('#CouponForm .custJoinDateTr').show();
  1802. $('#CouponForm .firstBuyTr').show();
  1803. $('#CouponForm .buyDateTr').show();
  1804. $('#CouponForm .dcCdCheck1').show();
  1805. }
  1806. // 할인방식이 할인율이면 최대할인금액 노출
  1807. if(cpnDetail.dcWay == "G240_11"){
  1808. $("#CouponForm .maxDcAmtArea").show();
  1809. }
  1810. // 주문서 쿠폰이면 할인쿠폰유형 노출
  1811. if(cpnDetail.cpnType == "G230_20") {
  1812. $("#CouponForm .dcCdGb").show();
  1813. }
  1814. // 할인코드유형이 일반유형이 아니면
  1815. if(cpnDetail.dcCdGb != "G233_00" ) {
  1816. $("#CouponForm .randomCpnTab").show(); // 시리얼 및 난수 TAB 노출
  1817. $("#CouponForm .dcCdCheck1").hide(); // 총발행제한수량, 1회발행수량, 1인당발행제한수량 숨김
  1818. $("#CouponForm .dcCdCheck2").hide(); // 총발행제한수량, 1회발행수량, 1인당발행제한수량 숨김
  1819. if(cpnDetail.dcCdGb == "G233_10") { // 시리얼 유형
  1820. $("#CouponForm input[name='serialCpnQty']").val(cpnDetail.totPubLimitQty);
  1821. $("#CouponForm input[name='serialCpnNm']").val(cpnDetail.rdCpnNm);
  1822. $("#CouponForm .normalCol").attr("colspan", "5");
  1823. $("#CouponForm .serialCpnArea").show();
  1824. $("#CouponForm .randomCpnArea").hide();
  1825. } else if (cpnDetail.dcCdGb == "G233_20") {
  1826. $("#CouponForm input[name='randomCpnQty']").val(cpnDetail.totPubLimitQty);
  1827. $("#CouponForm .normalCol").attr("colspan", "");
  1828. $("#CouponForm .randomCpnArea").show();
  1829. $("#CouponForm .serialCpnArea").hide();
  1830. }
  1831. }
  1832. // 쿠폰다운 날짜
  1833. let edDtArr;
  1834. if(!gagajf.isNull(cpnDetail.downEddt)){
  1835. edDtArr = cpnDetail.downEddt.split(" ");
  1836. if(edDtArr[1] == "23:59:59") {
  1837. edHour = "24";
  1838. edMinute = "00";
  1839. $("#CouponForm #downEdMM option").hide();
  1840. $('#CouponForm #downEdMM option:first').show().prop("selected", true);
  1841. }
  1842. }
  1843. // 유효 날짜
  1844. let availEdDtArr;
  1845. if(!gagajf.isNull(cpnDetail.availEddt)){
  1846. availEdDtArr = cpnDetail.availEddt.split(" ");
  1847. if(availEdDtArr[1] == "23:59:59") {
  1848. edHour = "24";
  1849. edMinute = "00";
  1850. $("#CouponForm #availEdMM option").hide();
  1851. $('#CouponForm #availEdMM option:first').show().prop("selected", true);
  1852. }
  1853. }
  1854. // 첫구매 날짜
  1855. let firstBuyEdDtArr;
  1856. if(!gagajf.isNull(cpnDetail.buyEddt)){
  1857. firstBuyEdDtArr = cpnDetail.buyEddt.split(" ");
  1858. if(firstBuyEdDtArr[1] == "23:59:59") {
  1859. edHour = "24";
  1860. edMinute = "00";
  1861. $("#CouponForm #buyEdMM option").hide();
  1862. $('#CouponForm #buyEdMM option:first').show().prop("selected", true);
  1863. }
  1864. }
  1865. // 신규가입 날짜
  1866. let custJoinEdDtArr;
  1867. if(!gagajf.isNull(cpnDetail.custJoinEddt)){
  1868. custJoinEdDtArr = cpnDetail.custJoinEddt.split(" ");
  1869. if(custJoinEdDtArr[1] == "23:59:59") {
  1870. edHour = "24";
  1871. edMinute = "00";
  1872. $("#CouponForm #custJoinEdMM option").hide();
  1873. $('#CouponForm #custJoinEdMM option:first').show().prop("selected", true);
  1874. }
  1875. }
  1876. /*
  1877. $("#CouponForm input:checkbox[name='cpnCreateType']").parent("label").addClass("formControl");
  1878. $("#CouponForm input:checkbox[name='cpnCreateType']").parent("label").prop('disabled', true);
  1879. $("#CouponForm input:checkbox[name='cpnCreateType']").addClass("formControl");
  1880. $("#CouponForm input:checkbox[name='cpnCreateType']").prop('disabled', true);
  1881. */
  1882. // 만약 쿠폰 발급한 내역이 있으면 쿠폰수정못하게 readonly , disabled 속성 추가
  1883. if (issueCnt > 0) {
  1884. $("#CouponForm #usableCustGb").attr('readonly', true);
  1885. $("#CouponForm #usableCustGb").attr('disabled', true);
  1886. $("#CouponForm #afChannel").attr('readonly', true);
  1887. $("#CouponForm #afChannel").attr('disabled', true);
  1888. $("#CouponForm #usableCustGrade").attr('readonly', true);
  1889. $("#CouponForm #usableCustGrade").attr('disabled', true);
  1890. $("#CouponForm #endAlimYn").attr('readonly', true);
  1891. $("#CouponForm #endAlimYn").attr('disabled', true);
  1892. $("#CouponForm #firstOrdYn").attr('readonly', true);
  1893. $("#CouponForm #firstOrdYn").attr('disabled', true);
  1894. $("#CouponForm #reissuance").attr('readonly', true);
  1895. $("#CouponForm #reissuance").attr('disabled', true);
  1896. $("#CouponForm #dnGb").attr('readonly', true);
  1897. $("#CouponForm #dnGb").attr('disabled', true);
  1898. $("#CouponForm #newCustYn").attr('readonly', true);
  1899. $("#CouponForm #newCustYn").attr('disabled', true);
  1900. $("#CouponForm #pdGb").attr('readonly', true);
  1901. $("#CouponForm #pdGb").attr('disabled', true);
  1902. $("#CouponForm #downAblYn").attr('readonly', true);
  1903. $("#CouponForm #downAblYn").attr('disabled', true);
  1904. $("#CouponForm #siteCd").attr('readonly', true);
  1905. $("#CouponForm #siteCd").attr('disabled', true);
  1906. $("#CouponForm #cpnNm").attr('readonly', true);
  1907. $("#CouponForm #cpnNm").attr('disabled', true);
  1908. $("#CouponForm #dcPval").attr('readonly', true);
  1909. $("#CouponForm #dcPval").attr('disabled', true);
  1910. $("#CouponForm #dcMval").attr('readonly', true);
  1911. $("#CouponForm #dcMval").attr('disabled', true);
  1912. $("#CouponForm #dcAval").attr('readonly', true);
  1913. $("#CouponForm #dcAval").attr('disabled', true);
  1914. $("#CouponForm #maxDcAmt").attr('readonly', true);
  1915. $("#CouponForm #maxDcAmt").attr('disabled', true);
  1916. $("#CouponForm #totPubLimitQty").attr('readonly', true);
  1917. $("#CouponForm #totPubLimitQty").attr('disabled', true);
  1918. $("#CouponForm #custPubLimitQty").attr('readonly', true);
  1919. $("#CouponForm #custPubLimitQty").attr('disabled', true);
  1920. $("#CouponForm #onePubQty").attr('readonly', true);
  1921. $("#CouponForm #onePubQty").attr('disabled', true);
  1922. $("#CouponForm #downStDay").attr('readonly', true);
  1923. $("#CouponForm #downStDay").attr('disabled', true);
  1924. $("#CouponForm #downStHH").attr('readonly', true);
  1925. $("#CouponForm #downStHH").attr('disabled', true);
  1926. $("#CouponForm #downStMM").attr('readonly', true);
  1927. $("#CouponForm #downStMM").attr('disabled', true);
  1928. $("#CouponForm #buyLimitAmt").attr('readonly', true);
  1929. $("#CouponForm input:radio[name='rdoDcWay']").attr('readonly', true);
  1930. $("#CouponForm input:radio[name='rdoApplyScope']").attr('readonly', true);
  1931. $("#CouponForm .rdoBtn").css('cursor', 'auto');
  1932. $("#CouponForm #cpnId").attr('readonly', true);
  1933. $("#CouponForm #cpnId").attr('disabled', true);
  1934. $("#CouponForm input:checkbox[name='cpnCreateType']").attr('readonly', true);
  1935. $("#CouponForm input:checkbox[name='cpnCreateType']").attr('disabled', true);
  1936. $("#CouponForm input:checkbox[name=cpnCreateType]").attr('checked', true);
  1937. $("#CouponForm input:checkbox[name=cpnCreateType]").parent().addClass('checked');
  1938. }
  1939. // 다운로드기간 세팅
  1940. splitDate("start", cpnDetail.downStdt, "down");
  1941. splitDate("end", cpnDetail.downEddt, "down");
  1942. // 유효기간이 날짜인경우 날짜 세팅
  1943. if (cpnDetail.pdGb == "P") {
  1944. splitDate("start", cpnDetail.availStdt, "avail");
  1945. splitDate("end", cpnDetail.availEddt, "avail");
  1946. if(issueCnt > 0) {
  1947. $("#CouponForm #availStDay").attr('readonly', true);
  1948. $("#CouponForm #availStDay").attr('disabled', true);
  1949. $("#CouponForm #availStHH").attr('readonly', true);
  1950. $("#CouponForm #availStHH").attr('disabled', true);
  1951. $("#CouponForm #availStMM").attr('readonly', true);
  1952. $("#CouponForm #availStMM").attr('disabled', true);
  1953. }
  1954. } else {
  1955. $("#CouponForm #availDays").val(cpnDetail.availDays);
  1956. $('#CouponForm #availEdHH option:last').attr("selected", "selected");
  1957. $('#CouponForm #availEdMM option:last').attr("selected", "selected");
  1958. }
  1959. // 첫구매여부 적용하는 경우 날짜 세팅
  1960. if (cpnDetail.firstOrdYn == "Y") {
  1961. splitDate("start", cpnDetail.buyStdt, "buy");
  1962. splitDate("end", cpnDetail.buyEddt, "buy");
  1963. if(issueCnt > 0) {
  1964. $("#CouponForm #buyStDay").attr('readonly', true);
  1965. $("#CouponForm #buyStDay").attr('disabled', true);
  1966. $("#CouponForm #buyStHH").attr('readonly', true);
  1967. $("#CouponForm #buyStHH").attr('disabled', true);
  1968. $("#CouponForm #buyStMM").attr('readonly', true);
  1969. $("#CouponForm #buyStMM").attr('disabled', true);
  1970. }
  1971. }
  1972. // 신규회원여부 적용하는 경우 날짜 세팅
  1973. if (cpnDetail.newCustYn == "Y") {
  1974. splitDate("start", cpnDetail.custJoinStdt, "custJoin");
  1975. splitDate("end", cpnDetail.custJoinEddt, "custJoin");
  1976. if(issueCnt > 0) {
  1977. $("#CouponForm #custJoinStDay").attr('readonly', true);
  1978. $("#CouponForm #custJoinStDay").attr('disabled', true);
  1979. $("#CouponForm #custJoinStHH").attr('readonly', true);
  1980. $("#CouponForm #custJoinStHH").attr('disabled', true);
  1981. $("#CouponForm #custJoinStMM").attr('readonly', true);
  1982. $("#CouponForm #custJoinStMM").attr('disabled', true);
  1983. }
  1984. }
  1985. }
  1986. // 기본세팅
  1987. pdGbChange();
  1988. firstOrdYnChange();
  1989. newCustYnChange();
  1990. fnChangeAfLinkCdList();
  1991. // 제휴채널2뎁스 기본세팅
  1992. if(cpnDetail != null ) {
  1993. $("#CouponForm #afLinkCd").val(cpnDetail.afLinkCd).prop("selected", true);
  1994. if(issueCnt > 0 ) {
  1995. $("#CouponForm #afLinkCd").attr('readonly', true);
  1996. $("#CouponForm #afLinkCd").attr('disabled', true);
  1997. }
  1998. }
  1999. });
  2000. // 날짜분리 ( 시작/종료날짜구분(start , end) , 날짜String , 적용타겟대상 )
  2001. function splitDate(stedGb , date , targetGb ){
  2002. var str = date;
  2003. var dateStr = str.split(' ');
  2004. var timeArr = dateStr[1].split(':');
  2005. if(stedGb == "start") {
  2006. $("#CouponForm #"+targetGb+"StDay").val(dateStr[0]);
  2007. $("#CouponForm #"+targetGb+"StHH").val(timeArr[0]);
  2008. $("#CouponForm #"+targetGb+"StMM").val(timeArr[1]);
  2009. } else {
  2010. $("#CouponForm #"+targetGb+"EdDay").val(dateStr[0]);
  2011. $("#CouponForm #"+targetGb+"EdHH").val(timeArr[0]);
  2012. $("#CouponForm #"+targetGb+"EdMM").val(timeArr[1]);
  2013. }
  2014. }
  2015. // 제한없음 문구 변경
  2016. $("input[name=totPubLimitQty],input[name=custPubLimitQty],input[name=buyLimitAmt],input[name=onePubQty]").change(function(){
  2017. if($(this).val() == "0"){
  2018. $("#"+$(this).attr("name")+"Span").html("*제한없음");
  2019. }else{
  2020. $("#"+$(this).attr("name")+"Span").html("");
  2021. }
  2022. $("#"+$(this).attr("name")+"Span").css("color", "red");
  2023. });
  2024. setTimeout(function(){
  2025. $("input[name=totPubLimitQty],input[name=custPubLimitQty],input[name=buyLimitAmt],input[name=onePubQty]").change();
  2026. }, 1);
  2027. // 콤마 찍어주기
  2028. $(function(){
  2029. setComma("CouponForm" , true);
  2030. });
  2031. function setComma(formId, pBoolean){
  2032. setTimeout(function(){
  2033. //숫자타입 콤마 찍어주기
  2034. $("#"+formId+" [data-valid-type=numeric]").each(function(){
  2035. $(this).change(function(){
  2036. if(pBoolean){
  2037. $(this).val($(this).val().addComma());
  2038. }else{
  2039. $(this).val($(this).val().removeComma());
  2040. }
  2041. });
  2042. if(pBoolean){
  2043. $(this).val($(this).val().addComma());
  2044. }else{
  2045. $(this).val($(this).val().removeComma());
  2046. }
  2047. });
  2048. }, 300);
  2049. }
  2050. // 진행 버튼 클릭
  2051. $("#btnChangeStatIng").on("click", function() {
  2052. mcxDialog.confirmC("쿠폰을 진행하시겠습니까?<br/>진행 후에는 수정이 제한될 수 있습니다.", {
  2053. btn: confirmBtnText,
  2054. btnClick: function(index) {
  2055. if(index == 1) {
  2056. let data = { cpnStat : "G232_11" // 진행
  2057. , cpnId : $('#CouponForm input[name=cpnId]').val()
  2058. }
  2059. var jsonData = JSON.stringify(data);
  2060. gagajf.ajaxJsonSubmit('/marketing/coupon/changeStat', jsonData, fnCouponSaveCollback);
  2061. }
  2062. }
  2063. });
  2064. });
  2065. // 중지 버튼 클릭
  2066. $("#btnCouponStop").on("click", function() {
  2067. mcxDialog.confirmC("쿠폰 진행을 중지하시겠습니까?<br/>중지 후에는 진행으로 복원하실 수 없습니다.", {
  2068. btn: confirmBtnText,
  2069. btnClick: function(index) {
  2070. if(index == 1) {
  2071. let data = { cpnStat : "G232_12" // 중지
  2072. , cpnId : $('#CouponForm input[name=cpnId]').val()
  2073. }
  2074. var jsonData = JSON.stringify(data);
  2075. gagajf.ajaxJsonSubmit('/marketing/coupon/changeStat', jsonData, fnCouponSaveCollback);
  2076. }
  2077. }
  2078. });
  2079. });
  2080. // 삭제 버튼 클릭
  2081. $("#btnCouponDelete").on("click", function() {
  2082. mcxDialog.confirmC("쿠폰을 삭제하시겠습니까?<br/>삭제한 프로모션은 복원하실 수 없습니다.", {
  2083. btn: confirmBtnText,
  2084. btnClick: function(index) {
  2085. if(index == 1) {
  2086. let data = { cpnStat: "G232_14" // 삭제
  2087. , cpnId : $('#CouponForm input[name=cpnId]').val()
  2088. }
  2089. var jsonData = JSON.stringify(data);
  2090. gagajf.ajaxJsonSubmit('/marketing/coupon/changeStat', jsonData, fnCouponSaveCollback);
  2091. }
  2092. }
  2093. });
  2094. });
  2095. /*]]>*/
  2096. </script>
  2097. </html>