{{:ModuleInclude('public/header')}}

<style>
    .page-title {
        font-size: 18px;
        font-weight: 600;
        color: #1a1a2e;
        padding: 24px 0 16px 0;
        border-bottom: 2px solid #e8e8e8;
        margin-bottom: 20px;
    }
</style>

<div class="right-content">
    <div class="page-title">
        <i class="am-icon-ticket am-margin-right-sm"></i>电子票列表
    </div>

    <!-- 搜索栏 -->
    <div class="am-panel am-panel-default am-radius am-margin-bottom">
        <div class="am-panel-bd">
            <form class="am-form form-validation form-search" request-type="form"
                action="{{:PluginsAdminUrl('vr_ticket', 'admin', 'ticketlist')}}" method="POST">
                <div class="am-g">
                    <div class="am-u-sm-3 am-u-end">
                        <div class="am-input-group am-input-group-sm">
                            <span class="am-input-group-label">订单号</span>
                            <input type="text" name="order_no"
                                value="{{if !empty($params.order_no)}}{{$params.order_no}}{{/if}}" placeholder="请输入订单号"
                                class="am-radius" />
                        </div>
                    </div>
                    <div class="am-u-sm-3 am-u-end">
                        <div class="am-input-group am-input-group-sm">
                            <span class="am-input-group-label">票码</span>
                            <input type="text" name="ticket_code"
                                value="{{if !empty($params.ticket_code)}}{{$params.ticket_code}}{{/if}}"
                                placeholder="请输入票码" class="am-radius" />
                        </div>
                    </div>
                    <div class="am-u-sm-3 am-u-end">
                        <div class="am-input-group am-input-group-sm">
                            <span class="am-input-group-label">观演人</span>
                            <input type="text" name="real_name"
                                value="{{if !empty($params.real_name)}}{{$params.real_name}}{{/if}}"
                                placeholder="请输入观演人姓名" class="am-radius" />
                        </div>
                    </div>
                    <div class="am-u-sm-3 am-u-end">
                        <div class="am-input-group am-input-group-sm">
                            <span class="am-input-group-label">手机号</span>
                            <input type="text" name="phone" value="{{if !empty($params.phone)}}{{$params.phone}}{{/if}}"
                                placeholder="请输入手机号" class="am-radius" />
                        </div>
                    </div>
                </div>

                <div class="am-g am-margin-top">
                    <div class="am-u-sm-3 am-u-end">
                        <div class="am-input-group am-input-group-sm">
                            <span class="am-input-group-label">状态</span>
                            <select name="verify_status" class="am-radius">
                                <option value="">全部</option>
                                <option value="0" {{if isset($params.verify_status) && $params.verify_status==='0'
                                    }}selected{{/if}}>未核销</option>
                                <option value="1" {{if isset($params.verify_status) && $params.verify_status=='1'
                                    }}selected{{/if}}>已核销</option>
                                <option value="2" {{if isset($params.verify_status) && $params.verify_status=='2'
                                    }}selected{{/if}}>已退款</option>
                            </select>
                        </div>
                    </div>
                    <div class="am-u-sm-3 am-u-end">
                        <button type="submit" class="am-btn am-btn-primary am-btn-sm am-radius"
                            data-am-loading="{spinner:'circle-o-notch', loadingText:'搜索中...'}">
                            <i class="am-icon-search"></i> 搜索
                        </button>
                        <a href="{{:PluginsAdminUrl('vr_ticket', 'admin', 'ticketlist')}}"
                            class="am-btn am-btn-default am-btn-sm am-radius am-margin-left-xs">
                            <i class="am-icon-refresh"></i> 重置
                        </a>
                    </div>
                </div>
            </form>
        </div>
    </div>

    <!-- 票列表 -->
    <div class="am-panel am-panel-default">
        <div class="am-panel-hd">电子票列表 <span class="am-text-xs am-padding-left">共 {{$count|default=0}} 条</span></div>
        <div class="am-panel-bd">
            <table class="am-table am-table-striped am-table-hover am-text-middle">
                <thead>
                    <tr>
                        <th>票码</th>
                        <th>观演人</th>
                        <th>座位信息</th>
                        <th>商品名</th>
                        <th>状态</th>
                        <th>发放时间</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    {{if !empty($list)}}
                    {{volist name="list" id="ticket"}}
                    <tr>
                        <td>{{$ticket.ticket_code}}</td>
                        <td>{{$ticket.real_name|default='—'}}</td>
                        <td>{{if !empty($ticket.seat_info)}}{{$ticket.seat_info}}{{else}}无{{/if}}</td>
                        <td>{{$ticket.goods_title|default='已删除商品'}}</td>
                        <td>
                            {{if $ticket.verify_status == 0}}
                            <span class="am-badge am-badge-warning">未核销</span>
                            {{elseif $ticket.verify_status == 1}}
                            <span class="am-badge am-badge-success">已核销</span>
                            {{elseif $ticket.verify_status == 2}}
                            <span class="am-badge am-badge-danger">已退款</span>
                            {{/if}}
                        </td>
                        <td>{{if !empty($ticket.issued_at)}}{{:date('Y-m-d H:i', $ticket.issued_at)}}{{else}}—{{/if}}
                        </td>
                        <td>
                            <a href="{{:PluginsAdminUrl('vr_ticket', 'admin', 'ticketdetail')}}?id={{$ticket.id}}"
                                class="am-btn am-btn-default am-btn-xs am-radius">
                                <i class="am-icon-eye"></i> 查看详情
                            </a>
                        </td>
                    </tr>
                    {{/volist}}
                    {{else}}
                    <tr>
                        <td colspan="7" class="am-text-center">暂无数据</td>
                    </tr>
                    {{/if}}
                </tbody>
            </table>

            <!-- 分页 -->
            {{if !empty($page)}}
            <div class="am-margin-top">
                {{$page|raw}}
            </div>
            {{/if}}
        </div>
    </div>
</div>

{{:ModuleInclude('public/footer')}}