<!-- 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
            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 nzWidth="50px">编号</th>
            <th nzWidth="80px">油品类型</th>
            <th nzWidth="80px">油品</th>
            <th nzWidth="80px">国标价</th>
            <th nzWidth="100px">油站价</th>
            <th nzWidth="100px">优惠价</th>
            <th nzWidth="100px">优惠幅度</th>
            <th nzWidth="160px" nzRight="0px">操作</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.priceGun == null ? '暂无' : '¥' + data.priceGun}}</td>
            <td>{{data.priceVip == null ? '暂无' : '¥' + data.priceVip}}</td>
            <td>{{data.preferentialMargin == null ? '暂无' : '¥' + data.preferentialMargin}}</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" (nzOnOk)="editGasOilPrice()"
          nzWidth="700px">
    <div nz-row>
        <div nz-col nzSpan="18">
            <nz-form-item>
                <nz-form-label [nzSpan]="6">油品</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>
    </div>
    <form nz-form [formGroup]="validateForm" class="login-form">
        <div nz-row>
            <div nz-col nzSpan="18">
                <nz-form-item>
                    <nz-form-label [nzSpan]="6">油枪价</nz-form-label>
                    <nz-form-control [nzSpan]="16">
                        <input nz-input formControlName="priceGun" placeholder="请输入油枪价..."/>
                    </nz-form-control>
                </nz-form-item>
            </div>
            <div nz-col nzSpan="18">
                <nz-form-item>
                    <nz-form-label [nzSpan]="6">优惠幅度</nz-form-label>
                    <nz-form-control [nzSpan]="16">
                        <nz-input-number
                                style="width: 300px"
                                formControlName="preferentialMargin"
                                [nzMin]="0"
                                [nzMax]="100"
                                [nzPrecision]="2"
                                nzPrecisionMode="cut"
                                nzPlaceHolder="请输入优惠幅度!"
                                [nzFormatter]="formatterPercent"
                                [nzParser]="parserPercent"
                        ></nz-input-number>
                    </nz-form-control>
                </nz-form-item>
            </div>
        </div>
    </form>

</nz-modal>

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

<nz-modal [(nzVisible)]="oilVisible" nzTitle="配置油枪" (nzOnCancel)="oilVisible = false"  (nzOnOk)="addGasOilPrice()">
    <div nz-row>
        <div nz-col nzSpan="18">
            <nz-form-item>
                <nz-form-label [nzSpan]="6">油枪号</nz-form-label>
                <nz-form-control [nzSpan]="16">
                    <nz-input-number
                            style="width: 300px"
                            [(ngModel)]="gunNo"
                            [nzMin]="1"
                            [nzMax]="10000"
                            nzPlaceHolder="请输入油枪号!"
                    ></nz-input-number>
                </nz-form-control>
            </nz-form-item>
        </div>
    </div>
</nz-modal>

