<?php (!defined('IN_ADMIN') || !defined('IN_MUDDER')) && exit('Access Denied'); ?>
<div id="body">
<form method="get" action="admincp.php">
    <input type="hidden" name="action" value="<?=$action?>" />
    <input type="hidden" name="file" value="<?=$file?>" />
    <div class="space">
        <table class="maintable" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td width="10%" class="altbg1">
                    板块: <select name="pcd">
                        <option value="0">==全部==</option>
                        <? foreach($_panels as $key=>$val) { ?>
                            <option value="<?=$key?>"<?if($pcd==$key)echo' selected';?>><?=$val?></option>
                            <?=$val?>
                        <? } ?>
                    </select>
                    状态: <select name="flag">
                        <option value="1"<?if($flag==1)echo' selected';?>>正常</option>
                        <option value="4"<?if($flag==4)echo' selected';?>>过期</option>
                        <option value="3"<?if($flag==3)echo' selected';?>>无效</option>
                        <option value="2"<?if($flag==2)echo' selected';?>>未审核</option>
                        </select>
                    <input type="submit" value="搜索" class="btn2" />
                </td>
            </tr>
        </table>
    </div>
</form>
<form method="post" action="admincp.php?action=<?=$action?>&file=<?=$file?>&">
    <input type="hidden" name="flag" value="<?=$flag?>" />
    <input type="hidden" name="pcd" value="<?=$pcd?>" />
    <div class="space">
        <div class="subtitle">优惠券管理</div>
        <table class="maintable" border="0" cellspacing="0" cellpadding="0">
            <tr class="altbg1">
                <td width="5%">选</td>
                <td width="*">名称</td>
                <td width="20%">优惠说明</td>
                <td width="20%">所属商铺</td>
                <td width="12%">发布时间</td>
                <td width="8%">状态</td>
                <td width="10%">操作</td>
            </tr>
            <?if($coupons) {?>
            <?foreach($coupons as $val) {?>
            <tr>
                <td><input type="checkbox" name="couponids[]" value="<?=$val['couponid']?>" /></td>
                <td><?=$val['subject']?></td>
                <td><?=$val['des']?></td>
                <td><?=$val['shopname']?></td>
                <td><?=date('Y-m-d',$val['dateline'])?></td>
                <td><?=$flag==1?'正常':($flag==2?'未审核':($flag==3?'无效':'过期'))?></td>
                <td><a href="admincp.php?action=<?=$action?>&file=edit&couponid=<?=$val['couponid']?>">编辑</a></td>
            </tr>
            <? } ?>
            <tr class="altbg1">
                <td colspan="7">
                    <button type="button" class="btn2" onclick="checkbox_checked('couponids[]');">全选</button>&nbsp;
                    <?if($flag==2) {?>
                    <input type="radio" name="operation" value="delete" /> 删除&nbsp;
                    <input type="radio" name="operation" value="check" /> 审核&nbsp;
                    <? } ?>
                    <?=$multipage?>
                </td>
            </tr>
            <? } ?>
        </table>
        <center><input type="submit" name="dosubmit" value=" 提交操作 " class="btn" /></center>
    </div>
</form>
<script type="text/javascript">
var g;
function reload() {
    var obj = document.getElementById('reload');
    var btn = document.getElementById('switch');
    if(obj.innerHTML.match(/^<.+href=.+>/)) {
        g = obj.innerHTML;
        obj.innerHTML = '<input type="file" name="picture" size="50" class="upfile">';
        btn.innerHTML = '取消上传';
    } else {
        obj.innerHTML = g;
        btn.innerHTML = '重新上传';
    }
}
</script>
</div>