<div id="maincon" class="analytics">
    <?php echo $menu; ?>

    <div id="rightcon">
        <div class="title"> <h2 class="edit">最近的访客列表</h2></div>
        <div class="span12 clear">
            <form method="GET" action="">
                <select name="site_code" class="span2 <?php if (!empty($cur_site_code)): ?>focused<?php endif; ?>">
                    <option value="">所有网站</option>
                    <?php
                    foreach ($sites as $site):
                        ?>
                        <option value="<?php echo $site; ?>" <?php if ($site === $cur_site_code): ?>selected="selected"<?php endif; ?> >
                            <?php echo $site; ?>
                        </option>
                    <?php endforeach; ?>
                </select>

                <input type="text" name="start" value="<?php echo $cur_start; ?>" placeholder="开始时间" class="input-small datepicker">
                <input type="text" name="end" value="<?php echo $cur_end; ?>" placeholder="结束时间" class="input-small datepicker">
                <select name="order_status" class="span2 <?php if (!empty($cur_order_status)): ?>focused<?php endif; ?>">
                    <option value="0">订单状态</option>
                    <option value="1" <?php if (1 == $cur_order_status): ?>selected="selected"<?php endif; ?> >
                        已下订单
                    </option>
                </select>
                <button class="btn btn-primary" type="submit">筛选访客</button>
            </form>
        </div>
        <div class="view_log_box clear">
           <table width="100%" border=0 cellpadding="0" cellspacing="0">
                <thead>
                    <tr>
                        <th>序号</th>
                        <th>网站</th>
                        <th>来源页面</th>
                        <th>查看访客记录</th>
                        <th>订单号</th>
                        <th>访问时间</th>
                    </tr>
                </thead>
                <tbody>
                    <?php foreach ($list as $key => $value): ?>
                        <tr>
                            <td><?php echo $cur_page + $key + 1; ?></td>
                            <td><?php echo $value->v_site_code; ?></td>
                            <td style="word-break:break-all"><a target="_blank" href="<?php echo $value->v_referer_url; ?>"><?php echo $value->v_referer_url; ?></a></td>
                            <td style="white-space:nowrap"><a target="_blank" href="<?php echo site_url('analytics/history/' . $value->v_id); ?>"><?php echo "访客" . $value->v_id; ?></a></td>
                            <td style="white-space:nowrap">
                                <?php if (!empty($value->v_order_num)): ?>
                                    <a target="_blank" href="<?php echo site_url('analytics/order_detail/'.$value->v_order_num); ?>"><?php echo $value->v_order_num; ?></a>
                                <?php else: ?>
                                    -- --
                                <?php endif; ?>
                            </td>
                            <td><?php echo date('Y-m-d H:i:s', $value->v_datetime); ?></td>
                        </tr>
                    <?php endforeach; ?>
                </tbody>
            </table>

            <p class="pages"><?php echo $pages; ?> <span class="badge badge-success"><?php echo $count; ?> 条记录</span></a></p>
        </div>
    </div>   

    <div class="clear"></div>
</div>