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

<!--条件搜索-->
<div class="inner-content">
    <span>共计 {{total}} 条数据</span>
    <div class="operating-button">
        <button nz-button nzType="primary" class="right-btn" (click)="isVisible = true">添加油号</button>
    </div>

    <nz-table
            class="table"
            #ajaxTable
            nzBordered
            nzShowSizeChanger
            [nzFrontPagination]="false"
            [nzData]="requestData"
            [nzLoading]="loading"
            [nzTotal]="total"
            [(nzPageIndex)]="pageNum"
            [(nzPageSize)]="pageSize"
            [nzScroll]="{ x: '1200px' }"
            (nzPageIndexChange)="getRequest(false , {})"
            (nzPageSizeChange)="getRequest(false , {})">
        <thead nzSingleSort>
        <tr>
            <th rowspan="2" nzWidth="80px">编号</th>
            <th rowspan="2" nzWidth="110px">油号类型</th>
            <th rowspan="2" nzWidth="100px">油号</th>
            <th rowspan="2" nzWidth="110px">国标价</th>
            <th rowspan="2" nzWidth="110px">油站直降</th>
            <th rowspan="2" nzWidth="110px">油站价</th>
            <th colspan="2" nzWidth="110px">平台补贴</th>
            <th rowspan="2" nzWidth="100px">终端价</th>
            <th rowspan="2" nzWidth="150px" nzRight="0px">操作</th>
        </tr>
        <tr>
            <th nzWidth="60px">金额</th>
            <th nzWidth="60px">折扣</th>
        </tr>
        </thead>
        <tbody>
        <tr *ngFor="let data of ajaxTable.data; let i = index">
            <td>{{i + 1}}</td>
            <td>{{data.oilTypeName}}</td>
            <td>{{data.oilNoName}}</td>
            <td>{{data.priceOfficial == null ? '暂无' : '¥ ' + data.priceOfficial}}</td>
            <td>{{data.gasStationDrop == null ? '暂无' : '¥ ' + data.gasStationDrop}}</td>
            <td>{{data.priceGun == null ? '暂无' : '¥ ' + data.priceGun}}</td>
            <td>{{'￥' + data.preferentialMargin}}</td>
            <td>{{(data.ext1 == 100?' 无': (data.ext1 + ' 折'))}}</td>
            <td>{{data.priceVip == null ? '暂无' : '¥ ' + data.priceVip}}</td>
            <td nzRight="0px" class="table-td-operation">
                <a (click)="getGunNoListByOilPrice(data.id)">油枪列表</a>
                <nz-divider nzType="vertical"></nz-divider>
                <a (click)="getGasOilPrice(data.id)">添加油枪</a>
                <nz-divider nzType="vertical"></nz-divider>
                <a (click)="getDelete(data.oilNo)">删除</a>
            </td>
        </tbody>
    </nz-table>
</div>

<nz-modal [(nzVisible)]="isVisible" nzTitle="添加油号" (nzOnCancel)="isVisible = false" [nzFooter]="null" nzWidth="350px">
    <nz-form-item>
        <nz-form-label [nzSpan]="6" nzRequired>油号</nz-form-label>
        <nz-form-control [nzSpan]="16">
            <nz-select [(ngModel)]="oilNo" nzAllowClear (ngModelChange)="getOilPriceDetail($event)" nzPlaceHolder="请选择油号">
                <nz-option *ngFor="let item of gasOilType" [nzValue]="item.codeValue" nzLabel="{{item.codeName}}"></nz-option>
            </nz-select>
        </nz-form-control>
    </nz-form-item>
    <div style="width: 100%;text-align: center;">
        <button nz-button nzType="primary" style="width: 150px;" (click)="editGasOilPrice()">确定</button>
    </div>
</nz-modal>

<nz-modal [(nzVisible)]="oilGunVisible" nzTitle="油枪列表" (nzOnCancel)="oilGunVisible = false" [nzFooter]="null" nzWidth="500px" (nzOnOk)="oilGunVisible= false">
    <nz-table #errorStudentTable [nzData]="oilGunList">
        <thead>
        <tr>
            <th nzWidth="60px">序号</th>
            <th nzWidth="100px">油号类型</th>
            <th nzWidth="80px">油号</th>
            <th nzWidth="80px">油枪号</th>
            <th nzWidth="80px">操作</th>
        </tr>
        </thead>
        <tbody>
        <tr *ngFor="let data of errorStudentTable.data;let i = index">
            <td>{{ i + 1}}</td>
            <td>{{data.oilTypeName}}</td>
            <td>{{data.oilNo+'#'}}</td>
            <td>{{data.gunNo}}</td>
            <td>
                <a (click)="delGunNo(data.id)">删除</a>
            </td>
        </tr>
        </tbody>
    </nz-table>
</nz-modal>

<nz-modal [(nzVisible)]="oilVisible" nzTitle="添加油枪" (nzOnCancel)="oilVisible = false"  [nzFooter]="null" nzWidth="350px">
    <nz-form-item>
        <nz-form-label [nzSpan]="6" nzRequired>油枪号</nz-form-label>
        <nz-form-control [nzSpan]="16">
            <nz-input-number
                    style="width: 100%"
                    [(ngModel)]="gunNo"
                    [nzMin]="1"
                    [nzMax]="10000"
                    nzPlaceHolder="请输入油枪号"
            ></nz-input-number>
        </nz-form-control>
    </nz-form-item>
    <div style="width: 100%;text-align: center;">
        <button nz-button nzType="primary" style="width: 150px;" (click)="addGasOilPrice()">确定</button>
    </div>
</nz-modal>

