#@layout()
#define script()
<script>

    function deliver(id) {
        openlayer('发货','#(CPATH)/admin/order/deliver/'+id);
    }

    function openlayer(title,url) {
        layer.open({
            type: 2,
            title: title,
            anim: 2,
            shadeClose: true,
            shade: 0.5,
            area: ['70%', '90%'],
            content: url,
            end: function () {

            }
        });
    }

</script>
#end

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

    <section class="content-header">
        <h1>
            订单列表
            <small>Order List</small>
        </h1>
    </section>

    <section class="content-header text-tap">
        <div class="row">

            <div class="col-lg-3 col-xs-6">
                <!-- small box -->
                <div class="small-box bg-red">
                    <div class="inner">
                        <h3>#(todayOrderCount ?? 0)</h3>

                        <p>今日订单</p>
                    </div>
                    <div class="icon">
                        <i class="ion ion-pie-graph"></i>
                    </div>
                </div>
            </div>
            <!-- ./col -->

            <div class="col-lg-3 col-xs-6">
                <!-- small box -->
                <div class="small-box bg-aqua">
                    <div class="inner">
                        <h3>#(monthOrderCount ?? 0)</h3>

                        <p>本月订单</p>
                    </div>
                    <div class="icon">
                        <i class="ion ion-bag"></i>
                    </div>
                </div>
            </div>
            <!-- ./col -->
            <div class="col-lg-3 col-xs-6">
                <!-- small box -->
                <div class="small-box bg-green">
                    <div class="inner">
                        <h3>#(mouthPaymentAmount ?? 0)</h3>

                        <p>本月销售</p>
                    </div>
                    <div class="icon">
                        <i class="ion ion-stats-bars"></i>
                    </div>
                </div>
            </div>
            <!-- ./col -->
            <div class="col-lg-3 col-xs-6">
                <!-- small box -->
                <div class="small-box bg-yellow">
                    <div class="inner">
                        <h3>#(mountOrderUserCount ?? 0)</h3>

                        <p>本月购买用户</p>
                    </div>
                    <div class="icon">
                        <i class="ion ion-person"></i>
                    </div>
                </div>
            </div>
            <!-- ./col -->

        </div>

    </section>

    <section class="content">

        <div class="row">
            <div class="col-xs-12">
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <form class="form-horizontal actionPanel">
                            <div class="row">
                                <div class="form-group col-xs-4">
                                    <label class="col-sm-3 control-label">商品</label>
                                    <div class="col-sm-9">
                                        <input type="text" class="form-control">
                                    </div>
                                </div>
                                <div class="form-group col-xs-4">
                                    <label class="col-sm-3 control-label">订单号</label>
                                    <div class="col-sm-9">
                                        <input class="form-control">
                                    </div>
                                </div>
                                <div class="form-group col-xs-4">
                                    <button type="submit" class="btn btn-primary ">查询</button>
                                    <button type="reset" class="btn btn-default">重置</button>
                                    <a class="btn"> 更多<i class="fa fa-fw fa-angle-down"></i> </a>
                                </div>
                            </div>
                            <!-- /.box-body -->
                        </form>

                        <div class="row actionPanel">
                            <div class="col-xs-12">
                                <button type="submit" class="btn btn-primary "><i class="fa fa-fw fa-plus"></i> 新建
                                </button>
                                <button type="submit" class="btn btn-default"><i class="fa fa-fw fa-refresh"></i> 同步
                                </button>
                                <button type="submit" class="btn btn-default checkAction"> 批量删除</button>
                                <div class="btn-group checkAction">
                                    <button type="button" class="btn btn-default">更多</button>
                                    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"
                                            aria-expanded="false">
                                        <span class="caret"></span>
                                        <span class="sr-only">Toggle Dropdown</span>
                                    </button>
                                    <ul class="dropdown-menu" role="menu">
                                        <li><a href="#">Action</a></li>
                                        <li><a href="#">Another action</a></li>
                                        <li><a href="#">Something else here</a></li>
                                        <li class="divider"></li>
                                        <li><a href="#">Separated link</a></li>
                                    </ul>
                                </div>
                            </div>
                        </div>

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

                        <table class="table table-striped">
                            <tbody>
                            <tr>
                                <th style="text-align: center">商品</th>
                                <th style="text-align: center">数量</th>
                                <th style="text-align: center">单价</th>
                                <th style="text-align: center">总价</th>
                                <th style="text-align: center">操作</th>
                            </tr>


                            #for(order : page.list ??)
                            <tr>
                                <td colspan="5" bgcolor="#fff">
                                    <div class="box box-dashboard" style="margin-bottom: 0px">
                                        <div class="box-header with-border row">
                                            <div class="col-lg-10">
                                                订单号：#(order.ns ??)（<span style="color:red">#(order.tradeStatusStr ??)</span>）
                                                总金额：<span style="color:red;padding-right: 20px">#(order.orderRealAmount ??)</span>
                                                支付状态：<span style="color:red;padding-right: 20px">#(order.payStatusStr ??)</span>
                                                物流状态：<span style="color:red;padding-right: 20px">#(order.deliveryStatusStr ??)</span>
                                                发票状态：<span style="color:red;padding-right: 20px">#(order.invoiceStatusStr ??)</span>
                                            </div>
                                            <div class="col-lg-2" style="text-align: right">
                                                <h3 class="box-title">
                                                    #if(!order.isDeliveried())
                                                    <a href="javascript:;" onclick="deliver('#(order.id)')">发货</a>
                                                    #end
                                                    <a href="#(CPATH)/admin/order/detail/#(order.id)">详情</a>
                                                </h3>
                                            </div>
                                        </div>
                                        <!-- /.box-header -->
                                        <div class="box-body no-padding">
                                            <table class="table table-striped">
                                                <tbody>
                                                #for(item : order.items)
                                                <tr>
                                                    <td style="width: 20%;text-align: center">
                                                        #(item.product_title ??)
                                                    </td>
                                                    <td style="width: 20%;text-align: center">
                                                        #(item.product_count ??)
                                                    </td>
                                                    <td style="width: 20%;text-align: center">
                                                        #(item.product_price ??)
                                                    </td>
                                                    <td style="width: 20%;text-align: center">
                                                        #(item.product_price * item.product_count ??)
                                                    </td>
                                                    <td style="width: 20%;text-align: center">
                                                        <a href="#">编辑</a>
                                                    </td>
                                                </tr>
                                                #end
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </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
