<?php if (!defined('THINK_PATH')) exit(); $JSARR[]=THEME_PATH."/common/js/invoicing_order/goods_detail.js"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="author" content="HANCHAO"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<?php $csscommon="/Public/bootstrap/css/bootstrap.min.css" ?>
<?php $csscommon.="|/Public/HanChaoUI/css/hanchaoui.css" ?>
<?php $CSSARR[]=THEME_PATH."/common/css/main.css" ?>
<?php $CSSARR[]="/Public/HanChaoUI/css/weebox.css" ?>
<link rel="stylesheet" href="<?php echo min_css($CSSARR,$csscommon);?>" media="all"/>
<?php $jscommon="/Public/script/jquery.min.js" ?>
<?php $jscommon.="|/Public/bootstrap/js/bootstrap.min.js" ?>
<?php $JSARR['min2']=THEME_PATH."/common/js/common.js" ?>
<?php $JSARR['min3']="/Public/HanChaoUI/js/weebox.js" ?>
<script language="javascript">var URL = '/admin.php?s=/tui_huan/';var THEME_COLOR = '';var ROOT_PATH = '/';var APP   =   '/admin.php?s=/';var CONTROLLER_NAME   =   '<?php echo (CONTROLLER_NAME); ?>';var THEME_PATH   =   '<?php echo (TPL_PATH); ?>/';</script>
<script type="text/javascript" src="<?php echo min_js($JSARR,$jscommon);?>"></script><!--[if IE]>
<link href="/Public/bootstrap/css/bootstrap.ie.css" rel="stylesheet" type="text/css"/>
 <script src="/Public/bootstrap/js/html5shiv.js"></script>
<![endif]-->
<script language="javascript">
$(function($){
    $(window.parent.document).find('#loading').hide();
    var topid='<?php echo ($_GET['topid']); ?>';
    var leftid='<?php echo ($_GET['leftid']); ?>';
    changemenu(topid,leftid);
});
function changemenu(topid,leftid){
    if(!topid && !leftid)return false;
    if(topid)parent._OPENleft(topid);
    if(leftid){
        $(window.parent.document).find('#_OPENright'+leftid).parent().prev().click();
        $(window.parent.document).find('#_OPENright'+leftid+' a').click();
    }
}
</script>
<title><?php echo (L("website_manage")); ?>Powered by hanchao</title>
</head>
<body><?php if(!empty($big_menu)): ?><div class="pad-lr-10 col-sm-12">
    <div class="btn-handle mt15">
   <?php if(is_array($big_menu)): foreach($big_menu as $k=>$vo): ?><a class="btn <?php if(!empty($menu_hover)): if(in_array(($k), is_array($menu_hover)?$menu_hover:explode(',',$menu_hover))): ?>btn-primary<?php else: ?>btn-default<?php endif; ?>                
   <?php else: ?>btn-primary<?php endif; ?>" href="<?php echo (isset($vo)?$vo:''); ?>"><?php echo (isset($k)?$k:''); ?></a>&nbsp;&nbsp;<?php endforeach; endif; ?>
    </div>
</div><?php endif; ?>

<script type="text/javascript" src="/Public/script/MyDate/WdatePicker.js"></script>
<div class="pad-lr-10 col-sm-12">
    <div>
        <form name="searchform" action="/admin.php?s=/tui_huan/index" method="POST" >
            <div class="toolbars-hanchao mt15 clearfix">
                <div>订单号：<input name="order_sn" value="<?php echo (isset($order_sn)?$order_sn:''); ?>" type="text" class="form-control w130" /></div>
                <div><select id="shop_id" class="form-control" name="shop_id" ><option value="" >全部仓库</option><?php if(!empty($shops_list)){ $selectdvalue=0;foreach($shops_list as $key=>$val) { if(empty($shop_id) && !is_numeric($shop_id))$shop_id=array();$shop_idarr=remove_empty_array($shop_id);if(in_array($key,$shop_idarr)) { ?><option selected="selected" value="<?php echo $key ?>"><?php echo $val;$selectdvalue=1; ?></option><?php }else { ?><option value="<?php echo $key ?>"><?php echo $val ?></option><?php } } } ?></select></div>
                <div><select id="source" class="form-control" name="source" ><?php if(!empty($tui_source)){ $selectdvalue=0;foreach($tui_source as $key=>$val) { if(empty($source) && !is_numeric($source))$source=array();$sourcearr=remove_empty_array($source);if(in_array($key,$sourcearr)) { ?><option selected="selected" value="<?php echo $key ?>"><?php echo $val;$selectdvalue=1; ?></option><?php }else { ?><option value="<?php echo $key ?>"><?php echo $val ?></option><?php } } } ?></select></div>
                <div><input name="is_first" id="is_first" type="hidden" value="1" />申请时间 ：
                    <input class="Wdate form-control w160" name="data_from" type="text" id="data_from" size="20" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',maxDate:'#F{ $dp.$D(\'data_to\')}'})" value="<?php echo (isset($data_from)?$data_from:''); ?>" />
                    -
                    <input class="Wdate form-control w160" name="data_to" type="text" id="data_to" size="20" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{ $dp.$D(\'data_from\')}'})" value="<?php echo (isset($data_to)?$data_to:''); ?>" />
                </div>
                <div><button type="submit" class="btn btn-primary">搜索</button></div>
            </div>
        </form>

        <table class="table table-hover table-striped table-hanchao mt15 table-bordered">
            <thead>
            <tr>
                <th width="60" align="center"><?php echo orderurl('LAN_ID','id');;?></th><!--升序-->
                <th width="160"><?php echo orderurl('订单号','order_id');;?></th>
                <th width="180"><?php echo orderurl('申请时间','add_time');;?></th>
                <th width="150"><?php echo orderurl('仓库','shop_id');;?></th>
                <th width="150"><?php echo orderurl('会员','uid');;?></th>
                <th width="100"><?php echo orderurl('收银员','cashier_name');;?></th>
                <th width="220"><?php echo orderurl('商品名称','goods_info');;?></th>
                <th width="160"><?php echo orderurl('退货原因','reason');;?></th>
                <th width="160"><?php echo orderurl('拒绝理由','not_content');;?></th>
                <th width="100"><?php echo orderurl('退货数量','goods_info');;?></th>
                <th width="100"><?php echo orderurl('退货金额','money');;?></th>
                <th width="80">退货来源</th>
                <th width="120">退货方式</th>
                <th width="100"><a href="#">操作</a></th>
            </tr>
            </thead>
            <tbody>
            <?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><tr>
                    <td><?php echo (isset($vo["id"])?$vo["id"]:''); ?></td>
                    <td><?php echo (idtoname($vo["order_id"],'OrderInfo','order_sn')); ?></td>
                    <td><?php echo (time_format($vo["add_time"])); ?></td>
                    <td><?php echo (idtoname($vo["shop_id"],'Shops','name')); ?></td>
                    <td><?php echo (showuser($vo["uid"])); ?></td>
                    <td><?php echo (isset($vo["cashier_name"])?$vo["cashier_name"]:''); ?></td>
                    <td title="<?php echo (isset($vo["str"])?$vo["str"]:''); ?>"><?php echo (h($vo["str"])); ?></td>
                    <td title="<?php echo (isset($vo["reason"])?$vo["reason"]:''); ?>"><?php echo (isset($vo["reason"])?$vo["reason"]:''); ?></td>
                    <td title="<?php echo (isset($vo["not_content"])?$vo["not_content"]:''); ?>"><?php echo (isset($vo["not_content"])?$vo["not_content"]:''); ?></td>
                    <td><?php echo (isset($vo["goods_info"]["number"])?$vo["goods_info"]["number"]:''); ?></td>
                    <td><?php echo (format_price($vo["money"])); ?></td>
                    <td><?php echo (isset($vo["tui_type"])?$vo["tui_type"]:''); ?></td>
                    <td><?php echo (isset($vo["tui_source"])?$vo["tui_source"]:''); ?></td>
                    <td id="confirm_<?php echo (isset($vo["id"])?$vo["id"]:''); ?>">
                        <?php if($vo["status"] == 0): ?><a onclick="agree(<?php echo (isset($vo["id"])?$vo["id"]:''); ?>)">同意</a>&nbsp;&nbsp;&nbsp;&nbsp;<a onclick="$.openUrl('<?php echo U('TuiHuan/content',array('id'=>$vo['id']));?>','拒绝','','','hc');">拒绝</a>
                        <?php elseif($vo["status"] == 1): ?>已同意
                            <?php else: ?>已拒绝<?php endif; ?>
                    </td>
                </tr><?php endforeach; endif; else: echo "" ;endif; ?>
            </tbody>
            </tbody>
        </table>
        <nav class="pages_hanchao" id="pages"><?php echo (isset($_page)?$_page:''); ?></nav>
    </div>
</div>
<script type="text/javascript">
    //同意退货
    function agree(id){
        var query=new Object();
        query.id=id;
        $.ajax({
            type:'post',
            data:query,
            url:APP+"TuiHuan/agree.html",
            success:function(data){
                if(data.status==1){
                    var str="已同意";
                    $("#confirm_"+id).html(str);
                    $.showSuccess(data.info,0,'hc');
                }else{
                    $.showErr(data.info,0,'hc');
                }
            }
        });
    }
    //拒绝退货
    function notagree(id){
        var query=new Object();
        query.id=id;
        $.ajax({
            type:'post',
            data:query,
            url:APP+"TuiHuan/notagree.html",
            success:function(data){
                if(data.status==1){
                    var str="已拒绝";
                    $("#confirm_"+id).html(str);
                    $.showSuccess(data.info,0,'hc');
                }else{
                    $.showErr(data.info,0,'hc');
                }
            }
        });
    }
</script>
</body>
</html>