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

<div class="inner-content">
    <div class="main">
        <form nz-form [formGroup]="dataFrom">
            <div nz-row>
                <div nz-col class="gutter-row" [nzSpan]="24">
                    <nz-form-item>
                        <nz-form-label [nzSpan]="8" nzRequired>价格类型</nz-form-label>
                        <nz-form-control [nzSpan]="8">
                            <nz-select formControlName="priceType" [nzPlaceHolder]="'请选择价格类型'" (ngModelChange)="selectPriceType($event)">
                                <nz-option *ngFor="let item of priceTypeArray" nzLabel="{{item.codeName}}" nzValue="{{item.codeValue}}"></nz-option>
                            </nz-select>
                        </nz-form-control>
                    </nz-form-item>
                </div>

                <div nz-col class="gutter-row" [nzSpan]="24">
                    <nz-form-item>
                        <nz-form-label [nzSpan]="8" nzRequired>油号</nz-form-label>
                        <nz-form-control [nzSpan]="8">
                            <nz-select formControlName="oilNo" [nzPlaceHolder]="'请选择油号'" (ngModelChange)="selectOilNo($event)">
                                <nz-option *ngFor="let item of oilNoArray" nzLabel="{{item.codeName}}" nzValue="{{item.codeValue}}"></nz-option>
                            </nz-select>
                        </nz-form-control>
                    </nz-form-item>
                </div>

                <div nz-col class="gutter-row" [nzSpan]="24" *ngIf="dataFrom.value.priceType == 1">
                    <nz-form-item>
                        <nz-form-label [nzSpan]="8" nzRequired>执行地区</nz-form-label>
                        <nz-form-control [nzSpan]="8">
                            <nz-select formControlName="regionId" nzShowSearch [nzPlaceHolder]="'设置执行地区'">
                                <nz-option *ngFor="let item of regionArray" nzLabel="{{item.regionName}}" nzValue="{{item.regionId}}"></nz-option>
                            </nz-select>
                        </nz-form-control>
                    </nz-form-item>
                </div>

                <div nz-col class="gutter-row" [nzSpan]="24" *ngIf="(secUserObjectType == 0 || secUserObjectType == 1 || secUserObjectType == 2) && (dataFrom.value.priceType == 2 || dataFrom.value.priceType == 3)">
                    <nz-form-item>
                        <nz-form-label [nzSpan]="8" nzRequired>加油站</nz-form-label>
                        <nz-form-control [nzSpan]="8">
                            <nz-select formControlName="merStoreIdArray" nzMode="multiple" [nzPlaceHolder]="'请选择加油站'">
                                <nz-option *ngFor="let item of gasArray" nzLabel="{{'【' + item.storeKey + '】' + item.storeName}}" nzValue="{{item.id}}"></nz-option>
                            </nz-select>
                        </nz-form-control>
                    </nz-form-item>
                </div>

                <div nz-col class="gutter-row" [nzSpan]="24" *ngIf="dataFrom.value.priceType == 2 || dataFrom.value.priceType == 4">
                    <nz-form-item>
                        <nz-form-label [nzSpan]="8">国标价</nz-form-label>
                        <nz-form-control [nzSpan]="8">
                            <nz-input-number formControlName="priceOfficial" [nzMin]="0" [nzMax]="999" [nzStep]="1" [nzPrecision]="2"></nz-input-number>
                        </nz-form-control>
                    </nz-form-item>
                </div>

                <div nz-col class="gutter-row" [nzSpan]="24">
                    <nz-form-item>
                        <nz-form-label [nzSpan]="8" nzRequired>执行价格</nz-form-label>
                        <nz-form-control [nzSpan]="8">
                            <nz-input-group nzAddOnAfter="元">
                                <nz-input-number formControlName="price" [nzMin]="0" [nzMax]="999" [nzStep]="1" [nzPrecision]="2" (ngModelChange)="priceChange($event)"></nz-input-number>
                            </nz-input-group>
                        </nz-form-control>
                    </nz-form-item>
                </div>

                <div nz-col class="gutter-row" [nzSpan]="24" *ngIf="dataFrom.value.priceType == 4">
                    <nz-form-item>
                        <nz-form-label [nzSpan]="8">直降后油站价</nz-form-label>
                        <nz-form-control [nzSpan]="8">
                            <nz-input-number formControlName="gasPrice" [nzMin]="0" [nzMax]="999" [nzStep]="1" [nzPrecision]="2"></nz-input-number>
                        </nz-form-control>
                    </nz-form-item>
                </div>

                <div nz-col class="gutter-row" [nzSpan]="24">
                    <nz-form-item>
                        <nz-form-label [nzSpan]="8" nzRequired>执行方式</nz-form-label>
                        <nz-form-control [nzSpan]="8">
                            <nz-radio-group formControlName="executionType">
                                <label nz-radio nzValue="1">立刻执行</label>
                                <label nz-radio nzValue="2">定时执行</label>
                            </nz-radio-group>
                        </nz-form-control>
                    </nz-form-item>
                </div>

                <div nz-col class="gutter-row" [nzSpan]="24" *ngIf="dataFrom.value.executionType == 2">
                    <nz-form-item>
                        <nz-form-label [nzSpan]="8" nzRequired>执行时间</nz-form-label>
                        <nz-form-control [nzSpan]="8">
                            <nz-date-picker formControlName="startTime" nzFormat="yyyy-MM-dd HH:mm:ss" nzShowTime [nzPlaceHolder]="'设置执行时间'"></nz-date-picker>
                        </nz-form-control>
                    </nz-form-item>
                </div>

            </div>

            <div class="btn-div">
                <button class="btn-post" nz-button nzType="primary" (click)="submitFrom()" [nzLoading]="btnLoading" nzBlock>保存</button>
            </div>
        </form>
    </div>
</div>
