GoodsSupplyPriceForm.html 14 KB

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