#252 주문취소 요청 기능 추가중

This commit is contained in:
chicpro
2013-07-11 14:29:15 +09:00
parent a16e62a5da
commit 75ac8f7a66
5 changed files with 203 additions and 2 deletions

View File

@ -358,4 +358,29 @@ if(!$result) {
ADD `od_escrow` TINYINT(4) NOT NULL DEFAULT '0' AFTER `od_tno` ", true);
}
*/
// shop_request 테이블이 없을 경우 생성
if(!sql_query(" select rq_id from {$g4['shop_request_table']} limit 1 ", false)) {
sql_query(" CREATE TABLE IF NOT EXISTS `{$g4['shop_request_table']}` (
`rq_id` INT(11) NOT NULL AUTO_INCREMENT,
`rq_type` TINYINT(4) NOT NULL DEFAULT '0',
`od_id` BIGINT(20) unsigned NOT NULL,
`ct_id` VARCHAR(255) NOT NULL DEFAULT '',
`mb_id` VARCHAR(20) NOT NULL DEFAULT '',
`rq_content` TEXT NOT NULL,
`rq_reg_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
`rq_ip` VARCHAR(255) NOT NULL DEFAULT '',
`rq_status` TINYINT(4) NOT NULL DEFAULT '0',
`rq_item` TEXT NOT NULL,
`rq_recv` TINYINT(4) NOT NULL DEFAULT '0',
`dl_company` INT(11) NOT NULL DEFAULT '0',
`rq_invoice` VARCHAR(255) NOT NULL DEFAULT '0',
`rq_amount1` INT(11) NOT NULL DEFAULT '0',
`rq_amount2` INT(11) NOT NULL DEFAULT '0',
`rq_account` VARCHAR(255) NOT NULL DEFAULT '0',
`rq_process` TEXT NOT NULL,
`rq_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`rq_id`)
) ", false);
}
?>

View File

@ -496,6 +496,7 @@ if($shop_install) {
fwrite($f, "\$g4['shop_mileage_table'] = SHOP_TABLE_PREFIX.'mileage'; // 마일리지 테이블\n");
fwrite($f, "\$g4['shop_coupon_table'] = SHOP_TABLE_PREFIX.'coupon'; // 쿠폰정보 테이블\n");
fwrite($f, "\$g4['shop_sendcost_table'] = SHOP_TABLE_PREFIX.'sendcost'; // 추가배송비 테이블\n");
fwrite($f, "\$g4['shop_request_table'] = SHOP_TABLE_PREFIX.'request'; // 주문 취소, 교환, 반품 요청테이블\n");
fwrite($f, "?>");
}

View File

@ -657,6 +657,35 @@ CREATE TABLE IF NOT EXISTS `shop_mileage` (
-- --------------------------------------------------------
--
-- Table structure for table `shop_request`
--
DROP TABLE IF EXISTS `shop_request`;
CREATE TABLE IF NOT EXISTS `shop_request` (
`rq_id` INT(11) NOT NULL AUTO_INCREMENT,
`rq_type` TINYINT(4) NOT NULL DEFAULT '0',
`od_id` BIGINT(20) unsigned NOT NULL,
`ct_id` VARCHAR(255) NOT NULL DEFAULT '',
`mb_id` VARCHAR(20) NOT NULL DEFAULT '',
`rq_content` TEXT NOT NULL,
`rq_reg_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
`rq_ip` VARCHAR(255) NOT NULL DEFAULT '',
`rq_status` TINYINT(4) NOT NULL DEFAULT '0',
`rq_item` TEXT NOT NULL,
`rq_recv` TINYINT(4) NOT NULL DEFAULT '0',
`dl_company` INT(11) NOT NULL DEFAULT '0',
`rq_invoice` VARCHAR(255) NOT NULL DEFAULT '0',
`rq_amount1` INT(11) NOT NULL DEFAULT '0',
`rq_amount2` INT(11) NOT NULL DEFAULT '0',
`rq_account` VARCHAR(255) NOT NULL DEFAULT '0',
`rq_process` TEXT NOT NULL,
`rq_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`rq_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `shop_sendcost`
--

View File

@ -22,6 +22,13 @@ if (!$od['od_id']) {
alert("조회하실 주문서가 없습니다.", G4_SHOP_URL);
}
// 처리 중인 요청이 있는지..
$dsp_request = true;
$sql = " select count(*) as cnt from {$g4['shop_request_table']} where od_id = '$od_id' and rq_status = '0' ";
$rq = sql_fetch($sql);
if($rq['cnt'])
$dsp_request = false;
// 결제방법
$settle_case = $od['od_settle_case'];
@ -44,6 +51,10 @@ if(openwin != null) {
<p>주문번호 <strong><?php echo $od_id; ?></strong></p>
<section id="sod_fin_list">
<form name="forderrequest" method="post" action="./orderrequestupdate.php" onsubmit="return frequest_check(this);">
<input type="hidden" name="od_id" value="<?php echo $od['od_id']; ?>">
<input type="hidden" name="uq_id" value="<?php echo $od['uq_id']; ?>">
<input type="hidden" name="rq_type" value="">
<h2>주문하신 상품</h2>
<span class="sound_only">상품 상태 설명</span>
<dl id="sod_fin_legend">
@ -58,6 +69,7 @@ if(openwin != null) {
</dl>
<?php
$od_count1 = $od_count2 = 0;
$idx = 0;
$sql = " select it_id, it_name, cp_amount
from {$g4['shop_cart_table']}
@ -79,7 +91,7 @@ if(openwin != null) {
<table class="basic_tbl">
<thead>
<tr>
<th scope="col">옵션항목</th>
<th scope="col" colspan="2">옵션항목</th>
<th scope="col">수량</th>
<th scope="col">판매가</th>
<th scope="col">소계</th>
@ -89,7 +101,7 @@ if(openwin != null) {
</thead>
<tbody>
<?php
$sql = " select ct_option, ct_qty, ct_price, ct_point, ct_status, io_type, io_price
$sql = " select ct_id, ct_option, ct_qty, ct_price, ct_point, ct_status, io_type, io_price
from {$g4['shop_cart_table']}
where uq_id = '$uq_id'
and it_id = '{$row['it_id']}'
@ -106,6 +118,11 @@ if(openwin != null) {
$point = $opt['ct_point'] * $opt['ct_qty'];
?>
<tr>
<td>
<input type="hidden" name="ct_id[<?php echo $idx; ?>]" value="<?php echo $opt['ct_id']; ?>">
<label for="chk_ct_id_<?php echo $idx; ?>"><?php echo $opt['ct_option']; ?> 선택</label>
<input type="checkbox" name="chk_ct_id[<?php echo $idx; ?>]" id="chk_ct_id_<?php echo $idx; ?>" value="1">
</td>
<td><?php echo $opt['ct_option']; ?></td>
<td class="td_smallmng"><?php echo number_format($opt['ct_qty']); ?></td>
<td class="td_bignum"><?php echo number_format($opt_price); ?></td>
@ -126,6 +143,8 @@ if(openwin != null) {
$od_count1++;
if($opt['ct_status'] == '주문')
$od_count2++;
$idx++;
}
?>
</tbody>
@ -184,6 +203,24 @@ if(openwin != null) {
<dd class="sod_bsk_point"><strong><?php echo number_format($tot_point); ?> 점</strong></dd>
</dl>
<div id="request_form">
<div>
<label for="rq_content">요청내용</label>
<input type="text" name="rq_content" id="rq_content" value="">
</div>
<div>
<input type="submit" value="확인" required class="required">
<button type="button" id="request_cancel">취소</button>
</div>
</div>
<div>
<button type="button" class="req_button">취소요청</button>
<button type="button" class="req_button">교환요청</button>
<button type="button" class="req_button">반품요청</button>
</div>
</form>
</section>
<div id="sod_fin_view">
@ -594,6 +631,61 @@ if(openwin != null) {
<!-- } 주문상세내역 끝 -->
<script>
var req_act = "";
$(function() {
$(".req_button").click(function() {
var $chk_item = $("input[name^=chk_ct_id]:checked");
req_act = $(this).text();
<?php if(!$dsp_request) { ?>
alert("관리자가 처리 중인 요청내용이 있어 추가로 요청하실 수 없습니다.");
return false;
<?php } ?>
if($chk_item.size() < 1) {
alert(req_act+"할 상품을 하나 이상 선택해 주십시오");
return false;
}
$("input[name=rq_content]").val("");
$("#request_form").show();
});
$("#request_cancel").click(function() {
$("#request_form").hide();
});
});
function frequest_check(f)
{
var rq_type;
var $chk_item = $("input[name^=chk_ct_id]:checked");
if($chk_item.size() < 1) {
alert(req_act+"할 상품을 하나 이상 선택해 주십시오");
return false;
}
if(!confirm("선택하신 상품을 "+req_act+"하시겠습니까?"))
return false;
switch(req_act) {
case "교환요청":
rq_type = 1;
break;
case "반품요청":
rq_type = 2;
break;
default:
rq_type = 0;
break;
}
f.rq_type.value = rq_type;
return true;
}
function fcancel_check(f)
{
if(!confirm("주문을 정말 취소하시겠습니까?"))

View File

@ -0,0 +1,54 @@
<?php
include_once('./_common.php');
$od_id = $_POST['od_id'];
$uq_id = $_POST['uq_id'];
$rq_type = $_POST['rq_type'];
$rq_content = $_POST['rq_content'];
switch($rq_type) {
case 1:
$req_act = '교환요청';
break;
case 2:
$req_act = '반품요청';
break;
default:
$req_act = '취소요청';
break;
}
if(!count($_POST['chk_ct_id']))
alert($req_act.'하실 상품을 하나이상 선택해 주십시오.');
$od = sql_fetch(" select od_id from {$g4['shop_order_table']} where od_id = '$od_id' and uq_id = '$uq_id' and mb_id = '{$member['mb_id']}' ");
if (!$od['od_id']) {
alert("존재하는 주문이 아닙니다.");
}
$sql = " select count(*) as cnt from {$g4['shop_request_table']} where rq_type = '$rq_type' and od_id = '$od_id' and rq_status = '0' ";
$rq = sql_fetch($sql);
if($rq['cnt'])
alert('관리자가 확인 중인 '.$req_act.'이 있습니다');
$count = count($_POST['ct_id']);
$ct_id = '';
$rsp = '';
for($i=0; $i<$count; $i++) {
if($_POST['chk_ct_id'][$i]) {
$ct_id .= $rsp.$_POST['ct_id'][$i];
$rsp = ',';
}
}
$sql = " insert into {$g4['shop_request_table']}
( rq_type, od_id, ct_id, mb_id, rq_content, rq_reg_time, rq_ip )
values
( '$rq_type', '$od_id', '$ct_id', '{$member['mb_id']}', '$rq_content', '".G4_TIME_YMDHIS."', '$REMOTE_ADDR' ) ";
sql_query($sql);
goto_url(G4_SHOP_URL.'/orderinquiryview.php?od_id='.$od_id.'&amp;uq_id='.$uq_id);
?>