GoodsSupplyPriceForm.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. <!DOCTYPE html>
  2. <html lang="ko"
  3. xmlns:th="http://www.thymeleaf.org">
  4. <!--
  5. *******************************************************************************
  6. * @source : GoodsSupplyPriceForm.html
  7. * @desc : 입점 상품 가격 승인 관리
  8. *============================================================================
  9. * STYLE24
  10. * Copyright(C) 2020 TSIT, All rights reserved.
  11. *============================================================================
  12. * VER DATE AUTHOR DESCRIPTION
  13. * === =========== ========== =============================================
  14. * 1.0 2020.11.18 eskim 최초 작성
  15. *******************************************************************************
  16. -->
  17. <div id="main">
  18. <!-- 메인타이틀 영역 -->
  19. <div class="main-title">
  20. </div>
  21. <!-- //메인타이틀 영역 -->
  22. <!-- 메뉴 설명 -->
  23. <div class="infoBox menu-desc">
  24. </div>
  25. <form id="goodsPriceHstForm" name="goodsPriceHstForm" action="#" th:action="@{'/goods/supply/price/list'}">
  26. <input type="hidden" id="confirmY" name="confirmY">
  27. <!-- 패널 영역1 -->
  28. <div class="panelStyle" >
  29. <div class="panelTitle">
  30. <h3><i class="fa fa-info-circle"></i>아래 검색조건 중 <font color="red">업체, 브랜드, 상품코드, 발생일</font> 중 하나를 꼭 입력해 주세요.</h3>
  31. </div>
  32. <div class="panelContent">
  33. <table class="frmStyle">
  34. <colgroup>
  35. <col width="7%"/>
  36. <col/>
  37. <col width="7%"/>
  38. <col width="18%"/>
  39. <col width="7%"/>
  40. <col width="10%"/>
  41. <col width="7%"/>
  42. <col width="10%"/>
  43. </colgroup>
  44. <tr>
  45. <th>업체/브랜드<em class="required" title="필수"></em></th>
  46. <td>
  47. <select name="supplyCompCd" id="supplyCompCd">
  48. <option value="" >[전체]</option>
  49. <option th:if="${supplyCompList}" th:each="oneData, status : ${supplyCompList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
  50. </select>
  51. <select name="brandCd" id="brandCd">
  52. <option value="">[전체]</option>
  53. </select>
  54. </td>
  55. <th>브랜드<em class="required" title="필수"></em></th>
  56. <td>
  57. <input type="text" class="w100" name="searchTxt" id="searchTxt" maxlength="20" />
  58. <button type="button" class="btn icn" id="btnSearchBrand"><i class="fa fa-search"></i></button>
  59. <input type="text" class="w100" name="searchBrandCd" readonly="readonly"/>
  60. </td>
  61. <th>상품코드<em class="required" title="필수"></em></th>
  62. <td>
  63. <input type="text" class="w150" name="goodsCd" id="goodsCd" maxlength="50"/>
  64. </td>
  65. <th>승인여부</th>
  66. <td>
  67. <select name="cfrmYn" id="cfrmYn">
  68. <option value="">[전체]</option>
  69. <option th:if="${useYnList}" th:each="oneData, status : ${useYnList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
  70. </select>
  71. </td>
  72. </tr>
  73. <tr>
  74. <th>발생일<em class="required" title="필수"></em></th>
  75. <td colspan="7" id="sellTerms"></td>
  76. </tr>
  77. </table>
  78. <ul class="panelBar">
  79. <li class="center">
  80. <button type="button" class="btn btn-gray btn-lg" id="btnInit" >초기화</button>
  81. <button type="button" class="btn btn-info btn-lg" id="btnSearch" >조회</button>&nbsp;&nbsp;&nbsp;&nbsp;
  82. <!-- <button type="button" class="btn btn-base btn-lg" id="btnConfirmSearch" th:if="${sessionInfo.roleCd == 'G001_0000' OR sessionInfo.roleCd == 'G001_A000' OR sessionInfo.roleCd == 'G001_A101' OR sessionInfo.roleCd == 'G001_A100' OR sessionInfo.roleCd == 'G001_A001'}">미승인목록 조회</button> -->
  83. </li>
  84. </ul>
  85. </div>
  86. <!-- //검색조건 영역 -->
  87. </div>
  88. <!-- 패널 영역1 -->
  89. <div class="panelStyle">
  90. <!-- 상단버튼 영역 -->
  91. <ul class="panelBar">
  92. <li class="right">
  93. <button type="button" class="btn btn-success btn-lg" id="btnSaveGoodsPriceConfirm" th:if="${sessionInfo.roleCd == 'G001_0000' OR sessionInfo.roleCd == 'G001_A000' OR sessionInfo.roleCd == 'G001_A101' OR sessionInfo.roleCd == 'G001_A100' OR sessionInfo.roleCd == 'G001_A001'}">승인</button>
  94. </li>
  95. </ul>
  96. <!-- //상단버튼 영역 -->
  97. <!-- 검색결과 영역 -->
  98. <div id="gridList" style="width: 100%; height: 550px;" class="ag-theme-balham"></div>
  99. <!-- 검색결과 영역 -->
  100. </div>
  101. </form>
  102. <!-- //패널 영역2 -->
  103. <script type="text/javascript" src="/ux/plugins/gaga/gaga.paging.js?v=2019072202"></script>
  104. <script th:inline="javascript">
  105. /*<![CDATA[*/
  106. var sessRoleCd = [[${sessionInfo.roleCd}]];
  107. var goodsStatList = gagajf.convertToArray([[${goodsStatList}]]);
  108. var formalGbList = gagajf.convertToArray([[${formalGbList}]]);
  109. var columnDefs = [];
  110. columnDefs = [
  111. {width: 40, minWidth: 40, cellClass: 'text-right', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
  112. {headerName: 'No', width: 60, cellClass: 'text-center', valueGetter: function(params) { return params.node.rowIndex + 1 }},
  113. {headerName: "업체", field: "supplyCompNm" , width: 100, cellClass: 'text-center'},
  114. {headerName: "브랜드", field: "brandEnm" , width: 100, cellClass: 'text-center'},
  115. {headerName: "상품코드", field: "goodsCd", width: 130, cellClass: 'text-center'
  116. ,cellRenderer: function(params) {
  117. return '<a href="javascript:void(0);">' + params.value + '</a>';
  118. }
  119. },
  120. {headerName: "상품상태", field: "goodsStat" , width: 100, cellClass: 'text-center',
  121. cellEditorParams: { values: gagaAgGrid.extractValues(goodsStatList) },
  122. valueFormatter: function (params) { return gagaAgGrid.lookupValue(goodsStatList, params.value); },
  123. valueParser: function (params) { return gagaAgGrid.lookupKey(goodsStatList, params.newValue); }
  124. },
  125. {headerName: "온라인 현재판매가", field: "currPrice", width: 120, cellClass: 'text-right'
  126. ,valueFormatter: function(params) {return params.value.addComma();}
  127. },
  128. {headerName: "판매가조정대상금액", field: "resGoodsPrice", width: 140, cellClass: 'text-right'
  129. ,cellRenderer: function(params) {
  130. if (params.data.resGoodsPrice <= 0){
  131. return "-";
  132. }else{
  133. var gapPrice = Number(params.data.currPrice) - Number(params.data.resGoodsPrice);
  134. if (gapPrice >= 0){
  135. return '<font color="red"> '+ params.value.addComma() +'</font>';
  136. }else{
  137. return '<font color="blue"> '+ params.value.addComma() +'</font>';
  138. }
  139. }
  140. }
  141. },
  142. {headerName: "온라인 판매수수료", field: "goodsSellFeeRate", width: 140, cellClass: 'text-right'
  143. ,valueFormatter: function(params) {return params.value.addComma();}
  144. },
  145. {headerName: "판매수수료 조정대상수수료", field: "sellFeeRate", width: 180, cellClass: 'text-right'
  146. ,cellRenderer: function(params) {
  147. if (gagajf.isNull(params.data.sellFeeRate)){
  148. return "-";
  149. }else{
  150. var gapRate = Number(params.data.goodsSellFeeRate) - Number(params.data.sellFeeRate);
  151. if (gapRate >= 0){
  152. return '<font color="red"> '+ params.data.sellFeeRate +'</font>';
  153. }else{
  154. return '<font color="blue"> '+ params.data.sellFeeRate +'</font>';
  155. }
  156. }
  157. }
  158. },
  159. {headerName: "승인자", field: "cfrmNm", width: 130, cellClass: 'text-center'},
  160. {headerName: "승인일자", field: "cfrmDt" , width: 150, cellClass: 'text-center',
  161. cellRenderer: function(params) {
  162. return !gagajf.isNull(params.value) ? params.value.toDate("YYYYMMDDHHmmss").format("YYYY-MM-DD HH:mm:ss") : '';
  163. }
  164. },
  165. {headerName: "등록일시", field: "regDt", width: 180, cellClass: 'text-center',
  166. cellRenderer: function(params) {
  167. return !gagajf.isNull(params.value) ? params.value.toDate("YYYYMMDDHHmmss").format("YYYY-MM-DD HH:mm:ss") : '';
  168. }
  169. },
  170. {headerName: "등록자", field: "regNm" , width: 100, cellClass: 'text-center'}
  171. ];
  172. // Get GridOptions
  173. var gridOptions = gagaAgGrid.getGridOptions(columnDefs);
  174. // 중복 선택 가능
  175. gridOptions.rowSelection = 'multiple';
  176. gridOptions.suppressRowClickSelection = true;
  177. //gridOptions.rowHeight = 60; //이미지가 있을경우 높이 지정해야함.
  178. // Row Click
  179. gridOptions.onCellClicked = function(event) {
  180. var goodsCd = event.data.goodsCd;
  181. if (event.colDef.field == "goodsCd"){
  182. cfnOpenGoodsDetailPopup('U',goodsCd);
  183. }
  184. }
  185. gridOptions.excelStyles = [
  186. {
  187. id: 'text-center',
  188. dataType: 'string',
  189. font: {size : 10, bold: false}
  190. },
  191. {
  192. id: 'text-left',
  193. dataType: 'string',
  194. font: {size : 10, bold: false}
  195. },
  196. {
  197. id: 'text-right',
  198. font: {size : 10, bold: false}
  199. }
  200. ]
  201. // 초기화 클릭시
  202. $('#btnInit').on('click', function() {
  203. fnInit();
  204. });
  205. var fnInit = function(){
  206. $('#goodsPriceHstForm')[0].reset();
  207. //$("#goodsPriceHstForm input[type=radio]").removeClass("checked");
  208. $("#goodsPriceHstForm input[type=checkbox]").removeClass("checked");
  209. //$("#goodsPriceHstForm input[type=radio]").parent("label").removeClass("checked");
  210. $("#goodsPriceHstForm input[type=checkbox]").parent("label").removeClass("checked");
  211. $("#goodsPriceHstForm input[type=radio][checked]").parent("label").addClass("checked");
  212. }
  213. // 조회클릭시
  214. $('#btnSearch').on('click', function() {
  215. fnGoodsPriceHstListSearch('N');
  216. });
  217. // 미승인목록 조회클릭시
  218. $('#btnConfirmSearch').on('click', function() {
  219. fnGoodsPriceHstListSearch('Y');
  220. });
  221. // 조회
  222. var fnGoodsPriceHstListSearch = function(confirmY) {
  223. $("#goodsPriceHstForm input[name=confirmY]").val(confirmY);
  224. if(!fnConditionCheck()) return;
  225. var formId = "#goodsPriceHstForm";
  226. gagaAgGrid.fetch($(formId).prop('action'), gridOptions, formId);
  227. }
  228. //검색 조건 확인
  229. var fnConditionCheck = function(){
  230. var formId = '#goodsPriceHstForm';
  231. var form = document.goodsPriceHstForm;
  232. if ($("#goodsPriceHstForm input[name=confirmY]").val() == "Y") return true;
  233. var searchFlag = false;
  234. var cnt = 0;
  235. if( !gagajf.isNull($("#goodsPriceHstForm select[name=supplyCompCd]").val())
  236. || !gagajf.isNull($("#goodsPriceHstForm input[name=goodsCd]").val())
  237. || (!gagajf.isNull($("#goodsPriceHstForm input[name=stDate]").val()) && !gagajf.isNull($("#goodsPriceHstForm input[name=edDate]").val()))
  238. || !gagajf.isNull($("#goodsPriceHstForm input[name=searchBrandCd]").val())
  239. ){
  240. searchFlag = true;
  241. }else{
  242. /*
  243. for (i = 0; i < form.elements.length; i++ ) {
  244. var el = form.elements[i];
  245. if ($(el).prop("type") == "text" || ($(el).prop("type") == "select-one" && el.name != "search" && el.name != "dateGbn" && el.name != "cfrmYn")) {
  246. if (!(el.value == null || el.value == "")) {
  247. cnt++;
  248. }
  249. }
  250. }
  251. if(cnt > 0) searchFlag = true;
  252. */
  253. }
  254. if(searchFlag == false){
  255. mcxDialog.alert("검색조건을 입력하세요.");
  256. return false;
  257. }
  258. return true;
  259. }
  260. //업체변경시
  261. $('#goodsPriceHstForm select[name=supplyCompCd]').on('change', function() {
  262. var actionUrl = '/renderer/supplyCompany/brand/list/' + $(this).val();
  263. if(sessRoleCd == "G001_A1001"){
  264. actionUrl = '/renderer/brand/AuthBrandlist';
  265. }
  266. $("#goodsPriceHstForm select[name=brandCd] option:gt(0)").remove();
  267. cfnCreateCombo(actionUrl, $('#goodsPriceHstForm select[name=brandCd]'), "[전체]", "");
  268. });
  269. //브랜드 변경시
  270. $('#goodsPriceHstForm select[name=brandCd]').on('change', function() {
  271. var supplyCompCd = $('#goodsPriceHstForm select[name=supplyCompCd]').val();
  272. var brandCd = $('#goodsPriceHstForm select[name=brandCd]').val();
  273. $("#goodsPriceHstForm select[name=sellStoreCd] option:gt(0)").remove();
  274. if (!gagajf.isNull(brandCd)){
  275. var url = "/renderer/extmall/sellstore/list/"+supplyCompCd+"/"+brandCd+"/";
  276. cfnCreateCombo(url, $('#goodsPriceHstForm select[name=sellStoreCd]'), "[전체]", "");
  277. }
  278. });
  279. // 승인 클릭 시
  280. $('#btnSaveGoodsPriceConfirm').on('click', function() {
  281. /* if ($("#goodsPriceHstForm input[name=confirmY]").val() != "Y"){
  282. mcxDialog.alert("미승인목록 조회후 승인하세요.");
  283. return false;
  284. } */
  285. var selectedData = gagaAgGrid.selectedRowData(gridOptions);
  286. if (selectedData.length == 0) {
  287. mcxDialog.alert('선택된 행이 없습니다.');
  288. return;
  289. }
  290. var checkFlag = false;
  291. $.each(selectedData, function(idx, item) {
  292. if (!gagajf.isNull(item.cfrmDt)){
  293. checkFlag = true;
  294. mcxDialog.alertC(item.goodsCd +" 상품은 승인된 상품입니다. ",{
  295. sureBtnText: "확인",
  296. sureBtnClick: function() {
  297. gridOptions.api.setFocusedCell(idx, "goodsCd", null);
  298. }
  299. });
  300. return false;
  301. }
  302. });
  303. if (checkFlag){
  304. return false;
  305. }
  306. mcxDialog.confirm('승인 하시겠습니까?',{
  307. cancelBtnText: "취소",
  308. sureBtnText: "확인",
  309. sureBtnClick: function(){
  310. var jsonData = JSON.stringify(selectedData);
  311. gagajf.ajaxJsonSubmit('/goods/supply/price/save', jsonData, fnSaveGoodsPriceConfirmCollBack);
  312. }
  313. });
  314. });
  315. var fnSaveGoodsPriceConfirmCollBack = function(){
  316. fnGoodsPriceHstListSearch('N');
  317. }
  318. // 브랜드 조회 팝업에서 호출
  319. var fnSetBrandInfo = function(result) {
  320. $("#goodsPriceHstForm input[name=searchBrandCd]").val(result[0].brandCd);
  321. }
  322. // 브랜드 조회 선택시
  323. $('#btnSearchBrand').on('click', function() {
  324. if (gagajf.isNull($("#goodsPriceHstForm input[name=searchTxt]").val())){
  325. mcxDialog.alert('브랜드 검색어를 입력하세요.');
  326. return false;
  327. }
  328. cfnOpenBrandListPopup('fnSetBrandInfo', $("#goodsPriceHstForm input[name=searchTxt]").val());
  329. });
  330. $(document).ready(function() {
  331. cfnCreateCalendar('#sellTerms', 'stDate', 'edDate', true, '등록일', 'X');
  332. var selectCode = '<select name="dateGbn" id="dateGbn">';
  333. selectCode += '<option value="R" seledted>가격변경일</option>';
  334. selectCode += '<option value="P">승인일자</option>';
  335. selectCode += '</select>';
  336. $("#goodsPriceHstForm").find('#sellTerms').prepend(selectCode);
  337. if(sessRoleCd == "G001_A101") {
  338. $("#goodsPriceHstForm select[name=supplyCompCd]").val([[${sessionInfo.supplyCompCd}]]);
  339. $("#goodsPriceHstForm select[name=supplyCompCd]").attr("disabled", true);
  340. $("select[disabled]").addClass("formControl");
  341. var actionUrl = '/renderer/brand/AuthBrandlist';
  342. cfnCreateCombo(actionUrl, $('#goodsPriceHstForm select[name=brandCd]'), "[전체]");
  343. }
  344. // Create a agGrid
  345. gagaAgGrid.createGrid('gridList', gridOptions);
  346. });
  347. /*]]>*/
  348. </script>
  349. </div>
  350. </html>