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

<div class="inner-content">
    <div nz-row [nzGutter]="8" class="statistics">
        <div nz-col [nzSpan]="12">
            <nz-card nzTitle="收入">
                <span>¥ {{income}}</span>
            </nz-card>
        </div>
        <div nz-col [nzSpan]="12">
            <nz-card nzTitle="支出">
                <span style="color: red">¥ {{expend}}</span>
            </nz-card>
        </div>
    </div>
</div>

<!--条件搜索-->
<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="goldType" nzPlaceHolder="请选择金币类型">
                            <nz-option  nzLabel="收入" nzValue="1"></nz-option>
                            <nz-option nzLabel="支出" nzValue="2"></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="goldType" nzPlaceHolder="请选择来源类型">
                            <nz-option  nzLabel="充值" nzValue="1"></nz-option>
                            <nz-option nzLabel="订单" nzValue="2"></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-range-picker
                                [nzFormat]="'yyyy/MM/dd'"
                                formControlName="createTime"
                        ></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="100px">用户电话</th>
            <th nzWidth="100px">来源类型</th>
            <th nzWidth="100px">产生时间</th>
            <th nzRight nzWidth="100px">金币类型</th>
            <th nzRight nzWidth="100px">金币数</th>
        </tr>
        </thead>
        <tbody>
        <tr *ngFor="let data of ajaxTable.data; let i = index">
            <td>{{i+1}}</td>
            <td>{{data['highUser']?.name}}</td>
            <td>{{data['highUser']?.phone}}</td>
            <td>{{data.resType === 1 ? '充值' : '订单'}}</td>
            <td>{{data.createTime | date: 'yyyy-MM-dd HH:mm:ss'}}</td>
            <td nzRight>{{data.goldType === 1 ? '收入' : '支出'}}</td>
            <td nzRight>{{data.gold}}</td>
        </tbody>
    </nz-table>
</div>



