#@layout()

#define script()
<script>

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

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


</script>
#end

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

    <section class="content-header">
        <h1>
            优惠券管理
            <small>Coupon Management</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="coupon/edit" 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>
                                <th style="width: 35%">名称</th>
                                <th style="width: 15%">类型</th>
                                <th style="width: 10%">金额</th>
                                <th style="width: 10%">发券量</th>
                                <th style="width: 10%">领取量</th>
                                <th style="width: 10%">使用量</th>
                                <th style="width: 10%">状态</th>
                            </tr>
                            #for(coupon : page.list ??)
                            <tr class="jp-actiontr">
                                <td><input class="dataItem" type="checkbox" value="#(coupon.id)" />
                                </td>
                                <td>
                                    <strong>
                                        <a href="#(CPATH)/admin/finance/coupon/edit/#(coupon.id)"> #(coupon.title ??) </a>
                                    </strong>
                                    <div class="jp-actionblock">
                                        <div class="jp-actionitem">
                                            <a href="#(CPATH)/admin/finance/coupon/edit/#(coupon.id)">编辑</a> |
                                            <a href="#(CPATH)/admin/finance/coupon/takeEdit?cid=#(coupon.id)">分配</a> |
                                            <a href="javascript:;" class="red-action"
                                               onclick="doDel('#(coupon.id)')">删除</a>
                                        </div>
                                    </div>
                                </td>
                                <td>#(coupon.typeStr ??)</td>
                                <td>#(coupon.amount ??)</td>
                                <td>#(coupon.quota ??)</td>
                                <td><a href="#(CPATH)/admin/finance/coupon/takes/#(coupon.id)">#(coupon.take_count ??)</a></td>
                                <td><a href="#(CPATH)/admin/finance/coupon/useds?coid=#(coupon.id)">#(coupon.used_count ??)</a></td>
                                <td>#(coupon.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
