<!-- start 面包屑 -->
<app-breadcrumb></app-breadcrumb>
<!-- end 面包屑 -->

<!--条件搜索-->
<div class="inner-content">
    <form nz-form [formGroup]="searchForm" (ngSubmit)="getRequest(true , searchForm.value)">
        <div nz-row>
            <div nz-col nzSpan="6">
                <nz-form-item>
                    <nz-form-label [nzSpan]="6">用户名称</nz-form-label>
                    <nz-form-control [nzSpan]="16">
                        <input nz-input formControlName="name"/>
                    </nz-form-control>
                </nz-form-item>
            </div>
            <div nz-col nzSpan="6">
                <nz-form-item>
                    <nz-form-label [nzSpan]="6">电话</nz-form-label>
                    <nz-form-control [nzSpan]="16">
                        <input nz-input formControlName="phone"/>
                    </nz-form-control>
                </nz-form-item>
            </div>
            <div nz-col nzSpan="6">
                <nz-form-item>
                    <nz-form-label [nzSpan]="6">用户状态</nz-form-label>
                    <nz-form-control [nzSpan]="16">
                        <nz-select nzShowSearch nzAllowClear formControlName="status" nzPlaceHolder="请选择用户状态">
                            <nz-option  nzLabel="禁用" nzValue="0"></nz-option>
                            <nz-option nzLabel="正常" nzValue="1"></nz-option>
                        </nz-select>
                    </nz-form-control>
                </nz-form-item>
            </div>
            <div nz-col nzSpan="6">
                <nz-form-item>
                    <nz-form-label [nzSpan]="6">注册时间</nz-form-label>
                    <nz-form-control [nzSpan]="16">
                        <nz-range-picker [nzShowTime]="{ nzFormat: 'HH:mm' }" formControlName="regTime"></nz-range-picker>
                    </nz-form-control>
                </nz-form-item>
            </div>
        </div>

        <div nz-row>
            <div nz-col nzSpan="24" class="search-button">
                <button nz-button nzType="primary"><i nz-icon nzType="search" nzTheme="outline"></i>搜索</button>
                <button nz-button nzType="default" (click)="resetForm()"><i nz-icon nzType="reload" nzTheme="outline"></i>重置</button>
            </div>
        </div>
    </form>
</div>


<div class="inner-content">
    <span>共计 {{total}} 条数据</span>
    <nz-table
           class="table"
            #ajaxTable
            nzShowSizeChanger
            [nzFrontPagination]="false"
            [nzData]="requestData"
            [nzLoading]="loading"
            [nzTotal]="total"
            [(nzPageIndex)]="pageNum"
            [(nzPageSize)]="pageSize"
            [nzScroll]="{ x: '1200px' }"
            (nzPageIndexChange)="getRequest(false , searchForm.value)"
            (nzPageSizeChange)="getRequest(false , searchForm.value)">
        <thead nzSingleSort>
        <tr>
            <th nzWidth="50px">编号</th>
            <th nzWidth="80px">用户名称</th>
            <th nzWidth="70px">用户头像</th>
            <th nzWidth="100px">用户电话</th>
            <th nzWidth="50px">金币数量</th>
            <th nzWidth="100px">注册时间</th>
            <th nzWidth="50px">状态</th>
            <th nzWidth="80px" nzRight="0px">操作</th>
        </tr>
        </thead>
        <tbody>
        <tr *ngFor="let data of ajaxTable.data; let i = index">
            <td>{{i+1}}</td>
            <td>{{data.name}}</td>
            <td>
                <img class="head_img" src="{{data.headerImg}}" onerror="this.src='../../../../assets/admin/navigation/icon.png'" alt="">
            </td>
            <td>{{data.phone}}</td>
            <td>{{data.gold}}</td>
            <td>{{data.regTime | date: 'yyyy-MM-dd HH:mm'}}</td>
            <td>{{data.status ===1 ? '正常' : '禁用'}}</td>
            <td nzRight="0px" class="table-td-operation">
                <a (click)='getForbiddenUser(data.id , data.status)'>{{data.status === 1 ? '禁用': '启用'}}</a>
                <nz-divider nzType="vertical"></nz-divider>
                <a (click)='setUpAgent(data.id , data.isAgent)'>{{data.isAgent === true ? '禁用推广员': '启用推广员'}}</a>
            </td>
        </tbody>
    </nz-table>
</div>



