<!-- start 面包屑 -->
<app-breadcrumb></app-breadcrumb>
<!-- end 面包屑 -->
<!--条件搜索-->

<div class="inner-content">
    <form nz-form [formGroup]="searchForm" (ngSubmit)="search(searchForm.value)">
        <div nz-row>
            <div nz-col nzSpan="8" *ngIf="adminFlag == 1 && roleType == 5">
                <nz-form-item>
                    <nz-form-label [nzSpan]="8">代理公司</nz-form-label>
                    <nz-form-control [nzSpan]="14">
                        <nz-select formControlName="orgId" nzAllowClear (ngModelChange)="requestAgent($event)">
                            <nz-option *ngFor="let item of orgIdArray" nzValue="{{item['id']}}" nzLabel="{{item['name']}}"></nz-option>
                        </nz-select>
                    </nz-form-control>
                </nz-form-item>
            </div>
            <div nz-col nzSpan="8" *ngIf="roleType == 5">
                <nz-form-item>
                    <nz-form-label [nzSpan]="8">代理商</nz-form-label>
                    <nz-form-control [nzSpan]="14">
                        <nz-select formControlName="agentId"nzAllowClear (ngModelChange)="requestSalesman($event)">
                            <nz-option *ngFor="let item of tyAgentArray" nzValue="{{item['id']}}" nzLabel="{{item['agentName']}}"></nz-option>
                        </nz-select>
                    </nz-form-control>
                </nz-form-item>
            </div>
            <div nz-col nzSpan="8" *ngIf="roleType == 8 || (roleType == 5 && adminFlag  == 1)">
                <nz-form-item>
                    <nz-form-label [nzSpan]="8">业务员</nz-form-label>
                    <nz-form-control [nzSpan]="14">
                        <nz-select formControlName="salesmanId" nzAllowClear>
                            <nz-option *ngFor="let item of tySalesmanArray" nzValue="{{item['id']}}" nzLabel="{{item['salesmanName']}}"></nz-option>
                        </nz-select>
                    </nz-form-control>
                </nz-form-item>
            </div>
            <div nz-col nzSpan="8">
                <nz-form-item>
                    <nz-form-label [nzSpan]="8">订单号</nz-form-label>
                    <nz-form-control [nzSpan]="14">
                        <input nz-input formControlName="orderNo" />
                    </nz-form-control>
                </nz-form-item>
            </div>
            <div nz-col nzSpan="8">
                <nz-form-item>
                    <nz-form-label [nzSpan]="8">加油站</nz-form-label>
                    <nz-form-control [nzSpan]="14">
                        <input nz-input formControlName="goodsName" />
                    </nz-form-control>
                </nz-form-item>
            </div>
            <div nz-col nzSpan="8" *ngIf="adminFlag == 1 && roleType == 5">
                <nz-form-item>
                    <nz-form-label [nzSpan]="8">用户手机号</nz-form-label>
                    <nz-form-control [nzSpan]="14">
                        <input nz-input formControlName="memPhone" />
                    </nz-form-control>
                </nz-form-item>
            </div>
            <div nz-col nzSpan="8">
                <nz-form-item>
                    <nz-form-label [nzSpan]="8">支付时间</nz-form-label>
                    <nz-form-control [nzSpan]="14">
                        <nz-range-picker
                                [nzShowTime]="{ nzHideDisabledOptions: true }"
                                formControlName="payTimeArray"
                                nzFormat="yyyy-MM-dd HH:mm:ss"
                        ></nz-range-picker>
                    </nz-form-control>
                </nz-form-item>
            </div>
            <div nz-col nzSpan="8">
                <nz-form-item>
                    <nz-form-label [nzSpan]="8">订单状态</nz-form-label>
                    <nz-form-control [nzSpan]="14">
                        <nz-select formControlName="orderStatus" nzAllowClear>
                            <nz-option nzValue="3" nzLabel="已完成"></nz-option>
                            <nz-option nzValue="4" nzLabel="已退款"></nz-option>
                            <nz-option nzValue="6" nzLabel="退款中"></nz-option>
                            <nz-option nzValue="7" nzLabel="退款驳回"></nz-option>
                        </nz-select>
                    </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>共计 {{dataObject.total?dataObject.total:0}} 条数据</span>
    <div class="operating-button">
        <button nz-button nzType="primary" class="right-btn" (click)="excelOrder()"><i nz-icon nzType="plus" nzTheme="outline"></i>导出订单</button>
    </div>

    <!--数组表格 -->
    <nz-table #basicTable
              [nzData]="dataObject.list"
              [nzTotal]="dataObject.total"
              [nzFrontPagination]="false"
              [nzLoading]="tableLoading"
              [nzPageIndex]="whereObject.pageNum"
              (nzPageIndexChange)="requestData($event)"
              [nzScroll]="{ x: '1150px'}">
        <thead>
        <tr>
            <th nzWidth="120px" *ngIf="adminFlag == 1 && roleType == 5">代理公司</th>
            <th nzWidth="120px" *ngIf="roleType == 5">代理商</th>
            <th nzWidth="120px" *ngIf="roleType == 8 || (roleType == 5 && adminFlag == 1)">业务员</th>
            <th nzWidth="160px">加油站</th>
            <th nzWidth="160px" *ngIf="adminFlag == 1 && roleType == 5">用户手机号</th>
            <th nzWidth="200px">订单号</th>
            <th nzWidth="100px">支付类型</th>
            <th nzWidth="100px">加油金额</th>
            <th nzWidth="100px">加油升数</th>
            <th nzWidth="100px">优惠金额</th>
            <th nzWidth="100px">实付金额</th>
            <th nzWidth="80px">油号</th>
            <th nzWidth="80px">枪号</th>
            <th nzWidth="100px">平台枪价</th>
            <th nzWidth="100px">团油枪价</th>
            <th nzWidth="170px">创建时间</th>
            <th nzWidth="170px">支付时间</th>
            <th nzWidth="100px">订单状态</th>
            <th nzWidth="170px">退款时间</th>
            <th nzWidth="110px" nzRight="0px">操作</th>
        </tr>
        </thead>
        <tbody>
        <tr *ngFor="let data of basicTable.data;let i = index">
            <td *ngIf="adminFlag == 1 && roleType == 5">{{data.orgName?data.orgName:'无'}}</td>
            <td *ngIf="roleType == 5">{{data.agentName?data.agentName:'无'}}</td>
            <td *ngIf="roleType == 8 ||(roleType == 5 && adminFlag == 1)">{{data.salesmanName?data.salesmanName:'无'}}</td>
            <td>{{data.goodsName}}</td>
            <td *ngIf="adminFlag == 1 && roleType == 5">{{data.memPhone}}</td>
            <td>{{data.orderNo}}</td>
            <td>{{data.payType}}</td>
            <td>{{data.totalPrice}}元</td>
            <td>{{data.oilLiters}}升</td>
            <td>{{data.deductionPrice}}元</td>
            <td>{{data.payRealPrice}}元</td>
            <td>{{data.gasOilNo}}</td>
            <td>{{data.gasGunNo}}号</td>
            <td>{{data.platformPrice}}元</td>
            <td>{{data.gasPriceGun}}元</td>
            <td>{{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td>
            <td>{{data.payTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td>
            <td>
                <span *ngIf="data.orderStatus == 3">已完成</span>
                <span *ngIf="data.orderStatus == 4">已退款</span>
                <span *ngIf="data.orderStatus == 6">退款中</span>
                <span *ngIf="data.orderStatus == 7">退款驳回</span>
            </td>
            <td>{{data.refundTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td>
            <td nzRight="0px" class="table-td-operation">
                <a nz-dropdown [nzDropdownMenu]="menu"> 操作列表 <i nz-icon nzType="down"></i> </a>
                <nz-dropdown-menu #menu="nzDropdownMenu">
                    <ul nz-menu nzSelectable>
                        <li nz-menu-item nzDisabled>暂无操作</li>
                    </ul>
                </nz-dropdown-menu>
            </td>
        </tr>
        </tbody>
    </nz-table>
</div>
