|
|
@@ -0,0 +1,342 @@
|
|
|
+<!DOCTYPE html>
|
|
|
+<html lang="ko"
|
|
|
+ xmlns:th="http://www.thymeleaf.org">
|
|
|
+<!--
|
|
|
+ *******************************************************************************
|
|
|
+ * @source : CouponTradingForm.html
|
|
|
+ * @desc : 쿠폰 사용 통계 Page
|
|
|
+ *============================================================================
|
|
|
+ * STYLE24
|
|
|
+ * Copyright(C) 2020 TSIT, All rights reserved.
|
|
|
+ *============================================================================
|
|
|
+ * VER DATE AUTHOR DESCRIPTION
|
|
|
+ * === =========== ========== =============================================
|
|
|
+ * 1.0 2021-09-28 화 lmc 최초 작성
|
|
|
+ *******************************************************************************
|
|
|
+ -->
|
|
|
+ <div id="main">
|
|
|
+ <!-- 메인타이틀 영역 -->
|
|
|
+ <div class="main-title"></div>
|
|
|
+ <!-- //메인타이틀 영역 -->
|
|
|
+
|
|
|
+ <!-- 메뉴 설명 -->
|
|
|
+ <div class="infoBox menu-desc"></div>
|
|
|
+ <!-- //메뉴 설명 -->
|
|
|
+
|
|
|
+ <!-- 검색조건 영역 -->
|
|
|
+ <div class="panelStyle">
|
|
|
+ <form id="searchForm" name="searchForm" action="#" th:action="@{'/statistics/coupon/order/list'}" onsubmit="$('#btnSearch').trigger('click'); return false;">
|
|
|
+ <table class="frmStyle" aria-describedby="검색조건">
|
|
|
+ <colgroup>
|
|
|
+ <col style="width:10%;"/>
|
|
|
+ <col style="width:10%;"/>
|
|
|
+ <col style="width:60%;"/>
|
|
|
+ <col style="width:20%;"/>
|
|
|
+ </colgroup>
|
|
|
+ <tr>
|
|
|
+ <th>기간<i class="required" title="필수" aria-hidden="true"></i></th>
|
|
|
+ <td colspan="2" id="terms"></td>
|
|
|
+ <td rowspan="2">
|
|
|
+ <textarea class="textareaR3 w70p" name="cpnId" placeholder="쿠폰번호/쿠폰코드를 입력하세요."></textarea>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <th>쿠폰유형</th>
|
|
|
+ <td colspan="2">
|
|
|
+ <label class="chkBox checked" th:if="${cpnTypeList}" th:each="oneData, status : ${cpnTypeList}"><input type="checkbox" name="cpnTypeArr" th:value="${oneData.cd}" th:text="${oneData.cdNm}" checked="checked"/></label>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </table>
|
|
|
+ <ul class="panelBar">
|
|
|
+ <li class="center">
|
|
|
+ <button type="button" class="btn btn-base btn-lg" id="btnSearch">조회</button>
|
|
|
+ <button type="button" class="btn btn-gray btn-lg" id="btnInit">초기화</button>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </form>
|
|
|
+ <form id="detailSearchForm" action="/statistics/coupon/order/detail/list" style="display:none;">
|
|
|
+ <input name="startDt">
|
|
|
+ <input name="endDt">
|
|
|
+ <input name="cpnId">
|
|
|
+ </form>
|
|
|
+ </div>
|
|
|
+ <!-- 검색조건 영역 -->
|
|
|
+
|
|
|
+ <!-- 리스트 영역 -->
|
|
|
+ <div class="panelStyle">
|
|
|
+ <ul class="panelBar">
|
|
|
+ <li>
|
|
|
+ <button type="button" class="btn btn-default btn-lg" onclick="fnExcelDownLoad();">엑셀다운로드</button>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ <div id="gridList" style="width: 100%; height: 470px" class="ag-theme-balham"></div>
|
|
|
+ </div>
|
|
|
+ <div class="panelStyle">
|
|
|
+ <ul class="panelBar">
|
|
|
+ <li>
|
|
|
+ <button type="button" class="btn btn-default btn-lg" onclick="fnDetailExcelDownLoad();">엑셀다운로드</button>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ <div id="detailGridList" style="width: 100%; height: 470px" class="ag-theme-balham"></div>
|
|
|
+ </div>
|
|
|
+ <!-- //리스트 영역 -->
|
|
|
+ </div>
|
|
|
+
|
|
|
+<style>
|
|
|
+.ag-header-group-text{
|
|
|
+ margin-left: calc(50% - 25px);
|
|
|
+}
|
|
|
+</style>
|
|
|
+<script th:inline="javascript">
|
|
|
+/*<![CDATA[*/
|
|
|
+ let columnDefs = [
|
|
|
+ { headerName: "쿠폰유형", field: "cpnId", width: 100, cellClass: 'text-center', hide:true },
|
|
|
+ { headerName: "쿠폰유형", field: "cpnTypeNm", width: 100, cellClass: 'text-center' },
|
|
|
+ { headerName: "쿠폰번호", field: "cpnId", width: 100, cellClass: 'text-center' },
|
|
|
+ { headerName: "쿠폰명", field: "cpnNm", width: 200, cellClass: 'text-left' },
|
|
|
+ { headerName: "자사분담율", field: "burden", width: 150, cellClass: 'text-right',
|
|
|
+ cellRenderer: function(params) {
|
|
|
+ return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ { headerName: "다운수", field: "downCnt", width: 150, cellClass: 'text-right',
|
|
|
+ cellRenderer: function(params) {
|
|
|
+ return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ { headerName: "사용수", field: "useCnt", width: 150, cellClass: 'text-right',
|
|
|
+ cellRenderer: function(params) {
|
|
|
+ return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ { headerName: "주문결제액", field: "ordAmt", width: 150, cellClass: 'text-right',
|
|
|
+ cellRenderer: function(params) {
|
|
|
+ return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ { headerName: "쿠폰비용", field: "cpnAmt", width: 150, cellClass: 'text-right',
|
|
|
+ cellRenderer: function(params) {
|
|
|
+ return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ { headerName: "상세보기", field: "detail", width: 100, cellClass: 'text-center',
|
|
|
+ cellRenderer: function (params) {
|
|
|
+ return '<a href="javascript:void(0);">판매현황보기</a>';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ ];
|
|
|
+
|
|
|
+ let detailColumnDefs = [
|
|
|
+ { headerName: "브랜드", field: "brandEnm", width: 150, cellClass: 'text-center' },
|
|
|
+ { headerName: "상품번호", field: "goodsCd", width: 150, cellClass: 'text-center',
|
|
|
+ cellRenderer: function (params) {
|
|
|
+ return '<a href="javascript:void(0);">'+params.value+'</a>';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ { headerName: "상품명", field: "goodsNm", width: 300, cellClass: 'text-left',
|
|
|
+ cellRenderer: function (params) {
|
|
|
+ return '<a href="javascript:void(0);">'+params.value+'</a>';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ { headerName: "원판매가액", field: "ordAmt", width: 150, cellClass: 'text-right',
|
|
|
+ cellRenderer: function(params) {
|
|
|
+ return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ { headerName: "판매수량", field: "ordQty", width: 150, cellClass: 'text-right',
|
|
|
+ cellRenderer: function(params) {
|
|
|
+ return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ { headerName: "구매자수", field: "custCpnCnt", width: 150, cellClass: 'text-right',
|
|
|
+ cellRenderer: function(params) {
|
|
|
+ return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ { headerName: "구매율", field: "ordRate", width: 150, cellClass: 'text-right',
|
|
|
+ cellRenderer: function(params) {
|
|
|
+ return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ ];
|
|
|
+
|
|
|
+ let gridOptions = gagaAgGrid.getGridOptions(columnDefs);
|
|
|
+ let detailGridOptions = gagaAgGrid.getGridOptions(detailColumnDefs);
|
|
|
+
|
|
|
+ // Row Click
|
|
|
+ gridOptions.onCellClicked = function(event) {
|
|
|
+ var params = event.data;
|
|
|
+ if (event.colDef.field == "goodsCd"){
|
|
|
+ cfnOpenGoodsDetailPopup('U', params.goodsCd);
|
|
|
+ }
|
|
|
+ else if (event.colDef.field == "goodsNm"){
|
|
|
+ cfnOpenGoodsDetailPopup('U', params.goodsCd);
|
|
|
+ }
|
|
|
+ else if (event.colDef.field == "detail"){
|
|
|
+ $("#detailSearchForm input[name=startDt]").val($("#searchForm input[name=startDt]").val());
|
|
|
+ $("#detailSearchForm input[name=endDt]").val($("#searchForm input[name=endDt]").val());
|
|
|
+ $("#detailSearchForm input[name=cpnId]").val(params.cpnId);
|
|
|
+ gagaAgGrid.fetch($('#detailSearchForm').prop('action'), detailGridOptions, '#detailSearchForm', fnDetailCreateTotal);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // Row Click
|
|
|
+ detailGridOptions.onCellClicked = function(event) {
|
|
|
+ var params = event.data;
|
|
|
+ if (event.colDef.field == "goodsCd"){
|
|
|
+ cfnOpenGoodsDetailPopup('U',goodsCd);
|
|
|
+ }
|
|
|
+ else if (event.colDef.field == "goodsNm"){
|
|
|
+ cfnOpenGoodsDetailPopup('U',goodsCd);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ gridOptions.excelStyles = [
|
|
|
+ {
|
|
|
+ id: 'text-center',
|
|
|
+ dataType: 'string',
|
|
|
+ font: {size : 10, bold: false}
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 'text-left',
|
|
|
+ dataType: 'string',
|
|
|
+ font: {size : 10, bold: false}
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 'text-right',
|
|
|
+ dataType: 'number',
|
|
|
+ font: {size : 10, bold: false}
|
|
|
+ }
|
|
|
+ ];
|
|
|
+
|
|
|
+ detailGridOptions.excelStyles = gridOptions.excelStyles;
|
|
|
+
|
|
|
+ var fnExcelDownLoad = function(){
|
|
|
+
|
|
|
+ var totalRows = gridOptions.api.getDisplayedRowCount();
|
|
|
+ if(totalRows==0){
|
|
|
+ mcxDialog.alert('조회된 내역이 없습니다.');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ var date = new Date().format("YYYYMMDDHHmmss");
|
|
|
+ var params = {
|
|
|
+ fileName : "쿠폰주문목록_"+ date,
|
|
|
+ sheetName: "DATA"
|
|
|
+ };
|
|
|
+ gridOptions.api.exportDataAsExcel(params);
|
|
|
+ }
|
|
|
+ var fnDetailExcelDownLoad = function(){
|
|
|
+
|
|
|
+ var totalRows = detailGridOptions.api.getDisplayedRowCount();
|
|
|
+ if(totalRows==0){
|
|
|
+ mcxDialog.alert('조회된 내역이 없습니다.');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ var date = new Date().format("YYYYMMDDHHmmss");
|
|
|
+ var params = {
|
|
|
+ fileName : "쿠폰주문상세목록_"+ date,
|
|
|
+ sheetName: "DATA"
|
|
|
+ };
|
|
|
+ detailGridOptions.api.exportDataAsExcel(params);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // 검색
|
|
|
+ $('#btnSearch').on('click', function() {
|
|
|
+ // 입력 값 체크
|
|
|
+ if (!gagajf.validation($('#searchForm')))
|
|
|
+ return false;
|
|
|
+
|
|
|
+ gagaAgGrid.fetch($('#searchForm').prop('action'), gridOptions, '#searchForm', fnCreateTotal);
|
|
|
+ });
|
|
|
+
|
|
|
+ // 합계 생성
|
|
|
+ let fnCreateTotal = function() {
|
|
|
+
|
|
|
+ let totInfo = {};
|
|
|
+ totInfo.cpnTypeNm = "TOTAL";
|
|
|
+ totInfo.burden = 0;
|
|
|
+ totInfo.downCnt = 0;
|
|
|
+ totInfo.useRate = 0;
|
|
|
+ totInfo.useCnt = 0;
|
|
|
+ totInfo.ordAmt = 0;
|
|
|
+ totInfo.cpnAmt = 0;
|
|
|
+
|
|
|
+ gridOptions.api.forEachNode(function(rowNode, index) {
|
|
|
+ if (!rowNode.group) {
|
|
|
+ if( typeof rowNode.data.burden == 'number') { totInfo.burden += rowNode.data.burden ; }
|
|
|
+ if( typeof rowNode.data.downCnt == 'number') { totInfo.downCnt += rowNode.data.downCnt ; }
|
|
|
+ if( typeof rowNode.data.useRate == 'number') { totInfo.useRate += rowNode.data.useRate ; }
|
|
|
+ if( typeof rowNode.data.useCnt == 'number') { totInfo.useCnt += rowNode.data.useCnt ; }
|
|
|
+ if( typeof rowNode.data.ordAmt == 'number') { totInfo.ordAmt += rowNode.data.ordAmt ; }
|
|
|
+ if( typeof rowNode.data.cpnAmt == 'number') { totInfo.cpnAmt += rowNode.data.cpnAmt ; }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ gagaAgGrid.setPinnedRowData(gridOptions, totInfo, 'top');
|
|
|
+ }
|
|
|
+
|
|
|
+ // 합계 생성
|
|
|
+ let fnDetailCreateTotal = function() {
|
|
|
+
|
|
|
+ let totInfo = {};
|
|
|
+ totInfo.brandEnm = 'TOTAL';
|
|
|
+ totInfo.goodsCd = '';
|
|
|
+ totInfo.goodsNm = '';
|
|
|
+ totInfo.ordAmt = 0;
|
|
|
+ totInfo.ordQty = 0;
|
|
|
+ totInfo.custCnt = 0;
|
|
|
+ totInfo.custCpnCnt = 0;
|
|
|
+ totInfo.ordRate = 0;
|
|
|
+
|
|
|
+ detailGridOptions.api.forEachNode(function(rowNode, index) {
|
|
|
+ if (!rowNode.group) {
|
|
|
+ if( typeof rowNode.data.ordAmt == 'number') { totInfo.ordAmt += rowNode.data.ordAmt ; }
|
|
|
+ if( typeof rowNode.data.ordQty == 'number') { totInfo.ordQty += rowNode.data.ordQty ; }
|
|
|
+ if( typeof rowNode.data.custCnt == 'number') { totInfo.custCnt += rowNode.data.custCnt ; }
|
|
|
+ if( typeof rowNode.data.custCpnCnt == 'number') { totInfo.custCpnCnt += rowNode.data.custCpnCnt ; }
|
|
|
+ if( typeof rowNode.data.ordRate == 'number') { totInfo.ordRate += rowNode.data.ordRate ; }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ if(totInfo.custCpnCnt > 0 && totInfo.custCnt > 0){
|
|
|
+ totInfo.ordRate = Math.floor((totInfo.custCpnCnt / totInfo.custCnt * 100) / 10) * 10;
|
|
|
+ }else{
|
|
|
+ totInfo.ordRate = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ gagaAgGrid.setPinnedRowData(detailGridOptions, totInfo, 'top');
|
|
|
+ }
|
|
|
+
|
|
|
+ // 초기화 클릭시
|
|
|
+ $('#btnInit').on('click', function() {
|
|
|
+ $('#searchForm')[0].reset();
|
|
|
+
|
|
|
+ $('#extmallIdTxt').html('');
|
|
|
+ $('#searchForm input[name=extmallIdList]').val('');
|
|
|
+ $('#supplyCompCdTxt').html('');
|
|
|
+ $('#searchForm input[name=supplyCompCdList]').val('');
|
|
|
+ $('#afLinkCdTxt').html('');
|
|
|
+ $('#searchForm input[name=afLinkCdList]').val('');
|
|
|
+ $('#brandCdTxt').html('');
|
|
|
+ $('#searchForm input[name=brandCdList]').val('');
|
|
|
+ $('#itemkindCdTxt').html('');
|
|
|
+ $('#searchForm input[name=itemkindCdList]').val('');
|
|
|
+ });
|
|
|
+
|
|
|
+ $(document).ready(function() {
|
|
|
+ cfnCreateCalendar('#terms', 'startDt', 'endDt', true, '주문', undefined, ['btnToday']);
|
|
|
+ $('.btnYesterday').trigger('click');
|
|
|
+
|
|
|
+ // Create a agGrid
|
|
|
+ gagaAgGrid.createGrid('gridList', gridOptions);
|
|
|
+ // Create a agGrid
|
|
|
+ gagaAgGrid.createGrid('detailGridList', detailGridOptions);
|
|
|
+
|
|
|
+ });
|
|
|
+/*]]>*/
|
|
|
+</script>
|
|
|
+
|
|
|
+</html>
|