File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
<%--
Class Name : RefundDetail.jsp
Description : Refund 상세 페이지
Modification Information
수정일 수정자 수정내용
------- -------- ---------------------------
2021.06.10 이준호 최초 생성
author : 이준호
since : 2021.06.10
--%>
<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="ec" uri="/WEB-INF/tld/ecnet_tld.tld"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<title>환불요청 상세</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<script type="text/javascript" src="<c:url value='/js/web_common.js' />"></script>
<script type="text/javaScript" language="javascript">
$(document).ready(function(){
$('.changeMo').hide();
var checkId = $('#mberId').val();
fn_refundIdChk(checkId);
/*
* mj_pg테이블 pg_status 상태
* - 0 입금대기
* - 1 결제완료
* - 4 결제오류
* - 8 취소오류
* - 9 취소완료
*/
$(document).on('click', '.payBtn', function() {
var pgStatus = $(this).data('info');
var msg;
if(!($('#refundStatus').val() == '2' || $('#refundStatus').val() == '1'))
{
alert("처리가 완료된 대상자 입니다.");
return false;
}
if(pgStatus === 1)
msg = '[취소] 결제를 취소하시겠습니까?';
if(pgStatus === 9)
msg = '[복구] 취소된 내역을 복구하시겠습니까?';
if(confirm(msg))
{
/* 기본 변수 값 select Start */
/* 기본 변수 값 select Start */
var $this = $(this);
$('.changeMo').show();
// 테이블 tr 까지의 선택자
var $tr = $this.parent().parent();
// click한 해당 로우의 moid 값
var moid = $tr.children().eq(0).val();
// click한 해당 로우의 cash 값
var cash = fn_minusComma($tr.children('td').eq(1).text().trim());
// click한 해당 로우의 point 값
var point = fn_minusComma($tr.children('td').eq(2).text().trim());
/*//기본 변수 값 select End */
/*//기본 변수 값 select End */
var targetCash = fn_targetCash();
var targetPoint = fn_targetPoint();
// int로 변환
targetCash = parseInt(targetCash);
cash = Math.floor( parseInt(cash)/ 11 * 10 );
targetPoint = parseInt(targetPoint);
point = parseInt(point);
if(pgStatus === 1)
{
if( cash > targetCash)
{
alert("취소 가능한 금액이 아닙니다. 확인해 주세요");
return false;
}
}
fn_updCashAndPointStatus(moid, pgStatus, cash, point);
var resultCash = fn_changeResult(pgStatus, targetCash, cash);
var resultPoint = fn_changeResult(pgStatus, targetPoint, point);
// 2자리마다 ' ,' 붙이는 fn
$('#resultCash').text(fn_unitChanges(resultCash));
$('#resultPoint').text(fn_unitChanges(resultPoint));
// 비교하여 색 변환
fn_colorChange(fn_oriData('#mberCashTxt'), resultCash, '#resultCash');
fn_colorChange(fn_oriData('#mberPointTxt'), resultPoint, '#resultPoint');
fn_payAndPointCancel(pgStatus, cash, '#cancelCash');
fn_payAndPointCancel(pgStatus, point, '#cancelPoint');
fn_changeText($this, $tr, pgStatus);
}
})
});
//처리취소 요청 fn
function fn_updCashAndPointStatus(moid, payCancleDiv, cash, point){
$('#cashAndPointForm > #moid').val(moid);
$('#cashAndPointForm > #payCancleDiv').val(payCancleDiv);
$('#cashAndPointForm > #refundCash').val(cash);
$('#cashAndPointForm > #refundPoint').val(point);
var data = new FormData(document.cashAndPointForm);
$.ajax({
type: "POST"
, url:"<c:url value='/uss/ion/pay/updateCashAndPointAjax.do' />"
, data: data
, dataType:'json'
, async: false
, processData: false
, contentType: false
, cache: false
, success: function (data) {
// console.log('data : ', data);
// console.log('data : ', data.message);
if(data.message != '')
{
alert(data.message);
return false;
}
}
,error: function (e) {
alert("요청에 실패하였습니다.");
console.log("ERROR : ", e);
}
});
}
function fn_changeText($this, $tr, pgStatus){
if(pgStatus === 1)
{
$tr.children('td').eq(5).text('취소완료');
$this.text('복구');
$this.data('info', 9);
}
if(pgStatus === 9)
{
$tr.children('td').eq(5).text('결제완료');
$this.text('취소');
$this.data('info', 1);
}
}
/*
* 만약 결제완료 상태(1)이면
* 결제완료 -> 취소 이므로
* 취소 영역에 +
* 아니면 결제취소 상태(9)이므로
* 취소 영역에 -
*/
function fn_payAndPointCancel(pgStatus, obj, cancelData){
var targetData = fn_minusComma($(cancelData).text());
targetData = parseInt(targetData);
if(isNaN(targetData)){ targetData = 0; }
if(pgStatus === 1)
targetData = targetData + obj
if(pgStatus === 9)
targetData = targetData - obj
$(cancelData).text(targetData);
}
/*
* 만약 결제완료 상태(1)이면
* 결제완료 -> 취소 이므로
* 마이너스 처리
* 아니면 결제취소 상태(9)이므로
* 플러스 처리
*/
function fn_changeResult(pgStatus, target, obj){
// 10% 수수료
if(pgStatus === 1)
return target - obj;
if(pgStatus === 9)
return target + obj;
}
// 바꿀 금액을 찾는 function
function fn_targetCash(){
if($('#resultCash').text() === '')
return fn_minusComma($('#mberCashTxt').text());
else
return fn_minusComma($('#resultCash').text());
}
// 바꿀 Point을 찾는 function
function fn_targetPoint(){
if($('#resultPoint').text() === '')
return fn_minusComma($('#mberPointTxt').text());
else
return fn_minusComma($('#resultPoint').text());
}
//금액 비교하여 색 체인지
function fn_colorChange(ori, resultNum, targetId){
var color;
if(ori > resultNum)
color = 'red'
else if(ori < resultNum)
color = 'blue'
else
color = 'black'
$(targetId).css("color", color);
}
function fn_oriData(targetData){
var oriData = fn_minusComma($(targetData).text());
return parseFloat(oriData);
}
// TEXT , 제거
function fn_minusComma(data){
return data.replace(/,/g, '');
}
function fn_refundIdChk(checkId){
$.ajax({
type:"POST",
url:"<c:url value='/uss/ion/pay/cancelRegistIdChkAjax.do' />",
data:{
"checkId": checkId
},
dataType:'json',
timeout:(1000*30),
success:function(data){
if(data.message != null)
{
alert(data.message);
return false;
}
else
{
var refundVO = data.refundVO;
// 회원 아이디
$('#mberIdTxt').text(refundVO.mberId);
// 회원 이름
$('#mberNmTxt').text(refundVO.mberNm);
// 회원 전화번호
$('#mberPhoneNoTxt').text(refundVO.mberPhoneNo);
// 회원 보유 금액
$('#mberCashTxt').text(fn_unitChanges(refundVO.mberMoney));
// 회원 보유 포인트
$('#mberPointTxt').text(fn_unitChanges(refundVO.mberPoint));
// 결제 목록 테이블 호출
listLoad('1');
}
},
error:function(request , status, error){
console.log(' error ?');
console.log('request : ', request);
console.log('status : ', status);
}
});
}
// 2자리마다 , 붙이기
function fn_unitChanges(data){
return data.toString()
.replace(/\B(?<!\.\d*)(?=(\d{3})+(?!\d))/g, ",");
}
function linkPage(pageNo){
listLoad(pageNo)
}
function listLoad(pageNo){
document.ajaxForm.pageIndex.value = pageNo;
document.ajaxForm.mberId.value = $('#mberId').val();
var sendData = $(document.ajaxForm).serializeArray();
var listAjaxUrl = "/uss/ion/pay/refundDetailPayListAjax.do";
$("#PayListLoad").load(listAjaxUrl, sendData ,function(response, status, xhr){
});
}
// 처리취소 요청 fn
function fn_updProcStatus(dataVal){
var msg;
if(dataVal == 3){
msg = "결제취소 요청을 완료처리 하시겠습니까?"
}else{
msg = "결제취소 요청을 취소처리 하시겠습니까?"
}
if(confirm(msg))
{
$('#refundCash').val($('#cancelCash').text().trim());
$('#refundPoint').val($('#cancelPoint').text().trim());
$('#refundStatus').val(dataVal);
var data = new FormData(document.writeForm);
$.ajax({
type: "POST"
, url:"<c:url value='/uss/ion/pay/updateProcStatusAjax.do' />"
, data: data
, dataType:'json'
, async: false
, processData: false
, contentType: false
, cache: false
, success: function (data) {
console.log('data : ', data);
alert(data.message);
fn_goList();
}
,error: function (e) {
alert("요청에 실패하였습니다.");
console.log("ERROR : ", e);
}
});
}
}
function fn_memoSave(){
var url = "<c:url value='/uss/ion/pay/updateRefundMemoAjax.do'/>";
var data = new FormData(document.writeForm);
$.ajax({
type: "POST",
url: url,
data: data,
dataType:'json',
async: false,
processData: false,
contentType: false,
cache: false,
success: function (returnData, status) {
if(status == 'success'){
alert("저장 되었습니다.");
} else if(status== 'fail'){
alert("저장에 실패하였습니다.");
}
},
error: function (e) { alert("저장에 실패하였습니다."); console.log("ERROR : ", e); }
});
}
function fn_goList(){
var form = document.writeForm ;
form.mberId.value='';
form.action = "<c:url value='/uss/ion/pay/RefundList.do' />";
form.submit();
}
function fnSelectMber(mberId) {
document.modiForm.mberId.value = mberId;
window.open("about:blank", 'popupSelectMber', 'width=900, height=1800, top=100, left=100, fullscreen=no, menubar=no, status=no, toolbar=no, titlebar=yes, location=no, scrollbar=no');
document.modiForm.action = "<c:url value='/uss/umt/user/EgovGnrlselectedUserView.do'/>";
document.modiForm.target = "popupSelectMber";
document.modiForm.submit();
}
</script>
</head>
<body>
<form name="writeForm" method="post">
<input type="hidden" name="mberId" id="mberId" value="<c:out value='${refundVO.mberId }'/>">
<input type="hidden" name="refundId" id="refundId" value="<c:out value='${refundVO.refundId }'/>">
<input type="hidden" name="refundStatus" id="refundStatus" value="<c:out value='${refundVO.refundStatus }'/>">
<input type="hidden" name="searchCondition" value="<c:out value='${refundVO.searchCondition }'/>"/>
<input type="hidden" name="searchCondition2" value="<c:out value='${refundVO.searchCondition2 }'/>"/>
<input type="hidden" name="pageIndex" value="<c:out value='${refundVO.pageIndex}'/>"/>
<input type="hidden" name="searchSortCnd" value="<c:out value="${refundVO.searchSortCnd}" />" />
<input type="hidden" name="searchSortOrd" value="<c:out value="${refundVO.searchSortOrd}" />" />
<input type="hidden" name="searchKeyword" value="<c:out value="${refundVO.searchKeyword}" />" />
<input type="hidden" name="refundCash" id="refundCash" value="" />
<input type="hidden" name="refundPoint" id="refundPoint" value="" />
<div class="contWrap">
<div class="pageTitle">
<div class="pageIcon"><img src="/pb/img/pageTitIcon4.png" alt=""></div>
<h2 class="titType1 c_222222 fwBold">결제취소 상세</h2>
<p class="tType6 c_999999">결제취소 등록 페이지 입니다.</p>
</div>
<div class="pageCont">
<table class="tbType2">
<colgroup>
<col style="width: 25%">
<col style="width: *%">
</colgroup>
<tbody>
<tr>
<th><span>회원 아이디</span></th>
<td id="mberIdTxt" onclick="javascript:fnSelectMber('<c:out value="${refundVO.mberId}"/>'); return false;" style="cursor:pointer;">
</td>
</tr>
<tr>
<th><span >회원 이름</span></th>
<td id="mberNmTxt">
</td>
</tr>
<tr>
<th><span >회원 전화번호</span></th>
<td id="mberPhoneNoTxt">
</td>
</tr>
<tr>
<th><span >결제취소요청 일시</span></th>
<td>
<c:out value="${refundVO.payCanReqDate}" />
</td>
</tr>
<tr>
<th><span >결제취소 사유</span></th>
<td>
<c:out value="${refundVO.refundReasonEtc}" />
</td>
</tr>
<tr>
<th><span >결제취소 상태</span></th>
<td>
<ec:code code="${refundVO.refundStatus }" codeId="ITN052"/>
</td>
</tr>
<tr>
<th><span >회원 보유 금액</span></th>
<td>
<span id="mberCashTxt"></span>
<span class="changeMo"> || </span>
<span class="changeMo" id="resultCash"></span>
</td>
</tr>
<tr>
<th><span >회원 보유 포인트</span></th>
<td>
<span id="mberPointTxt"></span>
<span class="changeMo"> || </span>
<span class="changeMo" id="resultPoint"></span>
</td>
</tr>
<tr>
<th><span >결제취소금액(충전금액 기준)</span></th>
<td id="cancelCash">
<c:choose>
<c:when test="${refundVO.refundStatus eq '3' || refundVO.refundStatus eq '4' }">
<c:out value="${refundVO.refundCash }"/>
</c:when>
<c:otherwise>
0
</c:otherwise>
</c:choose>
</td>
</tr>
<tr>
<th><span >결제취소포인트</span></th>
<td id="cancelPoint">
<c:choose>
<c:when test="${refundVO.refundStatus eq '3' || refundVO.refundStatus eq '4' }">
<c:out value="${refundVO.refundPoint }"/>
</c:when>
<c:otherwise>
0
</c:otherwise>
</c:choose>
</td>
</tr>
<tr>
<th><span >결제취소 처리자</span></th>
<td>
<c:out value="${refundVO.lastUpdusrId }" />
</td>
</tr>
<tr>
<th><span >결제취소 처리일시</span></th>
<td>
<c:out value="${refundVO.lastUpdtPnttm }" />
</td>
</tr>
</tbody>
</table>
<table class="tbType2 tbType2_refund">
<colgroup>
<col style="width: 20%">
<col style="width: 80%">
</colgroup>
<tbody>
<tr>
<th><span>메모</span></th>
<td>
<textarea name="refundMemo" id="refundMemo" class="refund_memo">${refundVO.refundMemo}</textarea>
<input type="button" class="btnType1 bg_88888" value="메모저장" onclick="fn_memoSave(); return false;">
</td>
</tr>
</tbody>
</table>
<div class="btnWrap">
<input type="button" class="btnType1 bg_888888" value="목록" onclick="fn_goList(); return false;">
<c:if test="${refundVO.refundStatus eq '1' || refundVO.refundStatus eq '2' }">
<input type="button" class="btnType1 bg_888888" value="처리취소" onclick="fn_updProcStatus(4); return false;">
<input type="button" class="btnType1 bg_888888" value="처리완료" onclick="fn_updProcStatus(3); return false;"/>
</c:if>
</div>
<span id="PayListLoad"/>
</div>
</div>
</form>
<form name="ajaxForm" id="ajaxForm" method="post">
<input type="hideen" name="mberId" id="mberId" value=""/>
<input type="hideen" name="returnUrl" value="RefundDetailPayDetailAjax"/>
<input type="hidden" name="pageIndex" value=""/>
</form>
<form name="cashAndPointForm" id="cashAndPointForm" method="post">
<input type="hidden" name="mberId" id="mberId" value="<c:out value='${refundVO.mberId }'/>">
<input type="hidden" name="moid" id="moid" value="">
<input type="hidden" name="payCancleDiv" id="payCancleDiv" value="">
<input type="hidden" name="refundCash" id="refundCash" value="">
<input type="hidden" name="refundPoint" id="refundPoint" value="">
</form>
<form name="modiForm" id="modiForm" method="post">
<input name="mberId" type="hidden" />
</form>
</body>
</html>