#@layout()

#define script()
<script>

    function doDel(id) {
        if (confirm("确定要删除该优惠码吗？删除后不可恢复")) {
            ajaxGet("#(CPATH)/admin/finance/coupon/doCodeDel/" + id);
        }
    }

    $("#batchDel").click(function () {
        var ids = getSelectedIds();
        if (ids == "") {
            alert('您未选择任何内容');
            return
        }
        if (confirm("确定要删除选中的优惠码吗？删除后不可恢复")) {
            ajaxGet("#(CPATH)/admin/finance/coupon/doCodeDelByIds?ids=" + ids);
        }
    })


</script>
#end

#define content()
<div class="content-wrapper">

    <section class="content-header">
        <h1>
            优惠券领取列表
            <small>Coupon User List</small>
        </h1>
    </section>

    <section class="content">

        <div class="row">
            <div class="col-xs-12">
                <div class="box box-primary">
                    <div class="box-header with-border">

                        <div class="row actionPanel">
                            <div class="col-xs-12">
                                <a href="#(CPATH)/admin/finance/coupon/takeEdit?cid=#(coupon.id)" class="btn btn-primary ">
                                    <i class="fa fa-fw fa-plus"></i> 新分配
                                </a>
                                <button type="submit" id="batchDel" class="btn btn-default checkAction"> 批量删除</button>
                            </div>
                        </div>

                    </div>
                    <!-- /.box-header -->
                    <div class="box-body ">

                        <table class="table table-striped">
                            <tbody>
                            <tr>
                                <th style="width: 10px">
                                    <input name="dataItem" onchange="checkAll(this)" type="checkbox"/>

                                <th style="">优惠码</th>
                                <th style="width: 25%">优惠券名称</th>
                                <th style="width: 15%">领取用户</th>
                                <th style="width: 15%">领取时间</th>
                                <th style="width: 10%">状态</th>
                            </tr>
                            #for(code : page.list ??)
                            <tr class="jp-actiontr">
                                <td><input class="dataItem" type="checkbox" value="#(code.id ??)" />
                                </td>
                                <td>
                                    <strong>
                                        #(code.code ??)
                                    </strong>
                                    <div class="jp-actionblock">
                                        <div class="jp-actionitem">
                                            <a href="#(CPATH)/admin/finance/coupon/takeEdit/#(code.id)?cid=#(code.coupon_id)">编辑</a> |
                                            <a href="#(CPATH)/admin/finance/coupon/useds/?codeid=#(code.id)">使用记录</a> |
                                            <a href="javascript:;" class="red-action" onclick="doDel('#(code.id)')">删除</a>
                                        </div>
                                    </div>
                                </td>
                                <td>#(code.title ??)</td>
                                <td>
                                    <a href="#(CPATH)/admin/user/detail/#(code.user.id ??)">#(code.user.nickname ??)</a>
                                </td>
                                <td>
                                    #date(code.valid_time ??)
                                </td>
                                <td>#(code.statusStr ??)</td>
                            </tr>
                            #end
                            </tbody>
                        </table>
                    </div>
                    <!-- /.box-body -->
                    <div class="box-footer">
                        <div class="row">
                            <div class="col-sm-12">
                                #@_paginate()
                            </div>
                        </div>
                    </div>
                </div>
                <!-- /.box -->
            </div>
        </div>

    </section>
</div>
#end
