<!-- 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="8">
                <nz-form-item>
                    <nz-form-label [nzSpan]="6">代理商</nz-form-label>
                    <nz-form-control [nzSpan]="16">
                        <nz-select nzShowSearch nzAllowClear formControlName="agentId" nzPlaceHolder="请选择代理商" (ngModelChange)="getDistributionFirst($event)">
                            <nz-option *ngFor="let item of agentData" nzLabel="{{item.agentName}}" [nzValue]="item.agentId"></nz-option>
                        </nz-select>
                    </nz-form-control>
                </nz-form-item>
            </div>
            <div nz-col nzSpan="8">
                <nz-form-item>
                    <nz-form-label [nzSpan]="6">一级分销</nz-form-label>
                    <nz-form-control [nzSpan]="16">
                        <nz-select nzShowSearch nzAllowClear formControlName="popularizeUserId" nzPlaceHolder="请选择一级分销" (ngModelChange)="getDistributionSecond($event)">
                            <nz-option *ngFor="let item of distributionFirst" nzLabel="{{item.userName}}" [nzValue]="item.userId"></nz-option>
                        </nz-select>
                    </nz-form-control>
                </nz-form-item>
            </div>
            <div nz-col nzSpan="8">
                <nz-form-item>
                    <nz-form-label [nzSpan]="6">二级分销</nz-form-label>
                    <nz-form-control [nzSpan]="16">
                        <nz-select nzShowSearch nzAllowClear formControlName="popularizeUserId" nzPlaceHolder="请选择二级分销">
                            <nz-option *ngFor="let item of distributionSecond" nzLabel="{{item.userName}}" [nzValue]="item.userId"></nz-option>
                        </nz-select>
                    </nz-form-control>
                </nz-form-item>
            </div>
            <div nz-col nzSpan="8">
                <nz-form-item>
                    <nz-form-label [nzSpan]="6">订单号</nz-form-label>
                    <nz-form-control [nzSpan]="16">
                        <input nz-input formControlName="orderNo"  [placeholder]="'请输入订单号'" />
                    </nz-form-control>
                </nz-form-item>
            </div>
            <div nz-col nzSpan="8">
                <nz-form-item>
                    <nz-form-label [nzSpan]="6">标题</nz-form-label>
                    <nz-form-control [nzSpan]="16">
                        <input nz-input formControlName="title"  [placeholder]="'请输入标题'" />
                    </nz-form-control>
                </nz-form-item>
            </div>
            <div nz-col nzSpan="8">
                <nz-form-item>
                    <nz-form-label [nzSpan]="6">用户名称</nz-form-label>
                    <nz-form-control [nzSpan]="16">
                        <input nz-input formControlName="userName"  [placeholder]="'请输入用户名称'" />
                    </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="100px">商品logo</th>
            <th nzWidth="80px">分销类型</th>
            <th nzWidth="70px">订单号</th>
            <th nzWidth="70px">用户名称</th>
            <th nzWidth="70px">积分数量</th>
            <th nzWidth="100px">创建时间</th>
        </tr>
        </thead>
        <tbody>
        <tr *ngFor="let data of ajaxTable.data; let i = index">
            <td>{{i+1}}</td>
            <td>{{data.title}}</td>
            <td>
                <img class="head_img" src="{{WEB_SERVE_URL + data.ext1}}" onerror="this.src='../../../../assets/admin/navigation/icon.png'" alt="">
            </td>
            <td>{{data.type == 1 ? '二级分销' : '一级分销'}}</td>
            <td>{{data.orderNo}}</td>
            <td>{{data.userName}}</td>
            <td>{{data.integralNum}}</td>
            <td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td>
        </tbody>
    </nz-table>
</div>



