<!doctype html>
<html class="no-js">
<head>

<include file="Common/head" />

</head>
<body>

<include file="Common/header" />

<div class="am-cf admin-main">

    <!-- sidebar start -->
    <include file="Common/sidebar" nav="store"/>
    <!-- sidebar end -->

    <!-- content start -->
    <div class="admin-content">
        <div class="admin-content-body">
            <div class="am-cf am-padding am-padding-bottom-0">
                <div class="am-fl am-cf">
                    <strong class="am-text-primary am-text-lg">商家管理</strong> / <small>商家订单</small>
                </div>
            </div>
            <hr style="margin-top:0px;">
            <div class="am-g">
                <div class="am-u-sm-12 am-u-md-12">
                    <form action="" method="get">
                    <div class="am-form-group">
                        
                        <span class="onm">
                            <input type="text" name="text" value="{$text}" placeholder="订单编号/收货人/收货人电话" style="width: 230px">
                        </span>
                        
                        <span class="time">
                            <input type="date" name="start_time" value="{$start_time}" placeholder="开始日期">
                            —
                            <input type="date" name="end_time" value="{$end_time}" placeholder="结束日期">
                        </span> 
                        <span class="store">
                            <select name="store" id="">
                                <option value="0" <?php if($store==0){echo "selected";}?>>所有商家</option>
                                <?php foreach($stores as $ks => $vs){?>
                                <option value="<?php echo $vs['id']?>" <?php if($store==$vs['id']){echo "selected";}?>><?php echo $vs['name']?></option>
                                <?php }?>
                            </select> 
                        </span>
                        <span class="status">
                            <select name="status" id="">
                                <option value="0" <?php if($status==0){echo "selected";}?>>所有状态</option>
                                <option value="1" <?php if($status==1){echo "selected";}?>>待确认</option>
                                <option value="2" <?php if($status==2){echo "selected";}?>>待送货</option>
                                <option value="3" <?php if($status==3){echo "selected";}?>>已完成</option>
                                <option value="-1" <?php if($status==-1){echo "selected";}?>>已取消</option>
                                <option value="-2" <?php if($status==-2){echo "selected";}?>>已拒绝</option>
                            </select> 
                        </span>
                        <button class="am-btn am-btn-default" type="submit" onclick="javascript:this.form.action='{:U('storeOrderList')}';">搜索</button>
                        <a href="{:U('storeOrderList')}" class="am-btn am-btn-default">重置</a>
                        <input class="am-btn am-btn-default" type="submit" onclick="javascript:this.form.action='{:U('storeExportToexcel')}';" value="导出excel">
                    </div>
                    </form>
                    
                </div>
            </div>
            <div class="am-g">
                <div class="am-u-sm-12">
                    <table class="am-table am-table-hover table-main am-text-nowrap">
                        <thead>
                            <tr>
                                <!-- <th>ID</th> -->
                                <th>ID</th>
                                <th>所属小区</th>
                                <th>所属商家</th>
                                <th>订单编号</th>
                                <th>商品</th>
                                <th>订单金额</th>
                                <th>收货人</th>
                                <th>收货人电话</th>
                                <th>状态</th>
                                <th>预计送达时间</th>
                                <th>下单时间</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            <volist name="list" id="vo">
                                <tr>
                                    <!-- <td>{$vo.id}</td> -->
                                    <td>{$vo.id}</td>
                                    <td>{$vo.store_village}</td>
                                    <td>{$vo.store_name}</td>
                                    <td>{$vo.order_sn}</td>
                                    <td>{$vo.goods}</td>
                                    <td>{$vo.total_fee}</td>
                                    <td>{$vo.name}</td>
                                    <td>{$vo.mobile}</td>
                                    <td>
                                        <switch name="vo.status">
                                            <case value="1">待确认</case>
                                            <case value="2">待送货</case>
                                            <case value="3">已完成</case>
                                            <case value="-1">已取消</case>
                                            <case value="-2">已拒绝</case>
                                        </switch>
                                    </td>
                                    <td>
                                        <if condition="$vo[expect_time] gt 0">
                                            {$vo.expect_time|date='Y-m-d H:i:s',###}
                                        </if>
                                    </td>
                                    <td>
                                        <if condition="$vo[create_time] gt 0">
                                            {$vo.create_time|date='Y-m-d H:i:s',###}
                                        </if>
                                    </td>
                                    <td>
                                        <a href="{:U('storeOrderDetail', array('id' => $vo[id],'p'=>I('p')))}">
                                            <button class="am-btn am-btn-default am-btn-xs">
                                                详情
                                            </button>
                                        </a>
                                    </td>
                                </tr>
                            </volist>
                        </tbody>
                    </table>
                    {$page}
                </div>
            </div>
        </div>
    </div>
    <!-- content end -->
</div>

<include file="Common/footer" />

<script type="text/javascript">
    $(function(){
        // 删除
        $(".del_link").on("click",function(){
            var the_link=$(this).attr("data-url");
            var bool = confirm("确认删除吗？");
            if (bool) {
                location.href = the_link;
            };
        });
        // 完成
        $(".sendGoods").on('click', function() {
            var bool = confirm("确认完成吗？");
            if (bool) {
                location.href = $(this).attr("data-url");
                return true;
            } else {
                return false;
            };
        });
    });
</script>
</body>
</html>