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

<!--条件搜索-->
<div class="inner-content">
    <form nz-form [formGroup]="searchForm" (ngSubmit)="getRequest(true , searchForm.value)">
        <div nz-row>

            <div nz-col nzSpan="6">
                <nz-form-item>
                    <nz-form-label [nzSpan]="6">油品</nz-form-label>
                    <nz-form-control [nzSpan]="16">
                        <input nz-input formControlName="oilNo"/>
                    </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>
    <div class="operating-button">
        <button nz-button nzType="primary" class="right-btn" (click)="showTripartitePlatformModal()" >渠道支付配置</button>
        <button nz-button nzType="primary" class="right-btn" (click)="getAdd()" >添加油品优惠</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 , searchForm.value)"
            (nzPageSizeChange)="getRequest(false , searchForm.value)">
        <thead nzSingleSort>
        <tr>
            <th nzWidth="50px">编号</th>
            <th nzWidth="80px">油品</th>
            <th nzWidth="80px">优惠比例</th>
            <th nzWidth="100px">创建时间</th>
            <th nzWidth="100px">更新时间</th>
            <th nzWidth="80px" nzRight="0px">操作</th>
        </tr>
        </thead>
        <tbody>
        <tr *ngFor="let data of ajaxTable.data; let i = index">
            <td>{{i+1}}</td>
            <td>{{data.oilNo}}</td>
            <td>{{data.priceRate}} %</td>
            <td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td>
            <td>{{data.updateTime | date: 'yyyy-MM-dd HH:mm'}}</td>
            <td nzRight="0px" class="table-td-operation">
                <a (click)="getEdit(data.id)">编辑</a>
                <nz-divider nzType="vertical"></nz-divider>
                <a (click)='getForbiddenUser(data.id)'>删除</a>
            </td>
        </tr>
        </tbody>
    </nz-table>
</div>


<nz-modal [(nzVisible)]="isVisible" nzTitle="编辑"  (nzOnCancel)="handleCancel()" (nzOnOk)="handleOk()">
    <form nz-form [formGroup]="getForm">
        <div nz-row>
            <div nz-col [nzSpan]="22">
                <nz-form-item>
                    <nz-form-label [nzFor]="'oilNoName'" nzRequired>油品名称</nz-form-label>
                    <nz-form-control nzErrorTip="请输入油品名称!">
                        <nz-select formControlName="roleType" [formControlName]="'oilNo'" nzAllowClear nzPlaceHolder="选择类型">
                            <nz-option *ngFor="let item  of roleTypeArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option>
                        </nz-select>
                    </nz-form-control>
                </nz-form-item>
            </div>
            <div nz-col [nzSpan]="22">
                <nz-form-item>
                    <nz-form-label [nzFor]="'oilNoName'" nzRequired>折扣比例</nz-form-label>
                    <nz-form-control nzErrorTip="请输入折扣比例!">
                        <nz-input-group nzSuffix="%" >
                            <input type="number"  nz-input formControlName="priceRate" />
                        </nz-input-group>
                    </nz-form-control>
                </nz-form-item>
            </div>
        </div>
    </form>
</nz-modal>

<nz-modal [(nzVisible)]="tripartitePlatformModal" nzTitle="渠道支付配置" (nzOnCancel)="closeTripartitePlatformModal()" nzWidth="500px" [nzFooter]="null">

    <nz-form-item>
        <nz-form-label [nzSpan]="6" nzRequired >渠道</nz-form-label>
        <nz-form-control [nzSpan]="14">
            <nz-select [(ngModel)]="channelId" (ngModelChange)="selectChannel($event)">
                <nz-option *ngFor="let item of gasChannelConfigChannelArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option>
            </nz-select>
        </nz-form-control>
    </nz-form-item>

    <form nz-form [formGroup]="tripartitePlatformForm">
        <nz-form-item>
            <nz-form-label [nzSpan]="6" nzRequired >第三方平台</nz-form-label>
            <nz-form-control [nzSpan]="14">
                <nz-select formControlName="payPlatformType">
                    <nz-option nzValue="1" nzLabel="微信"></nz-option>
                </nz-select>
            </nz-form-control>
        </nz-form-item>

        <nz-form-item>
            <nz-form-label [nzSpan]="6" nzRequired >商户全称</nz-form-label>
            <nz-form-control [nzSpan]="14">
                <input nz-input placeholder="请输入第三方平台商户全称" formControlName="payPlatformMerName" />
            </nz-form-control>
        </nz-form-item>

        <nz-form-item>
            <nz-form-label [nzSpan]="6" nzRequired >商户号</nz-form-label>
            <nz-form-control [nzSpan]="14">
                <input nz-input placeholder="请输入第三方平台商户号" formControlName="payPlatformMerNo" />
            </nz-form-control>
        </nz-form-item>

        <nz-form-item>
            <nz-form-label [nzSpan]="6" nzRequired >是否分账</nz-form-label>
            <nz-form-control [nzSpan]="14">
                <nz-radio-group formControlName="profitSharingStatus">
                    <label nz-radio nzValue="true">是</label>
                    <label nz-radio nzValue="false">否</label>
                </nz-radio-group>
            </nz-form-control>
        </nz-form-item>

        <nz-form-item *ngIf="tripartitePlatformForm.value.profitSharingStatus == 'true'">
            <nz-form-label [nzSpan]="6" nzRequired >分账比例(%)</nz-form-label>
            <nz-form-control [nzSpan]="14">
                <nz-input-number formControlName="profitSharingRatio" [nzPrecision]="2" [nzMin]="0" [nzMax]="30" [nzPlaceHolder]="'分账比例(%)'"></nz-input-number>
            </nz-form-control>
        </nz-form-item>

        <nz-form-item *ngIf="tripartitePlatformForm.value.profitSharingStatus == 'true'">
            <nz-form-label [nzSpan]="6" nzRequired >接收方全称</nz-form-label>
            <nz-form-control [nzSpan]="14">
                <input nz-input placeholder="分账接收方全称" formControlName="profitSharingReceiversName" />
            </nz-form-control>
        </nz-form-item>

        <nz-form-item *ngIf="tripartitePlatformForm.value.profitSharingStatus == 'true'">
            <nz-form-label [nzSpan]="6" nzRequired >接收方商户号</nz-form-label>
            <nz-form-control [nzSpan]="14">
                <input nz-input placeholder="分账接收方商户号" formControlName="profitSharingReceiversNo" />
            </nz-form-control>
        </nz-form-item>

        <div style="text-align: center;">
            <button nz-button nzType="primary" style="width: 150px;" (click)="submitTripartitePlatform()">确定</button>
        </div>
    </form>
</nz-modal>

<!--
<nz-modal [(nzVisible)]="configOilMerNumModal" nzTitle="配置商户号"  (nzOnCancel)="closeConfigOilMerNum()" (nzOnOk)="submitConfigOilMerNum()">
    <form nz-form [formGroup]="configOilMerNumForm">
        <div nz-row>
            <div nz-col [nzSpan]="22">
                <nz-form-item>
                    <nz-form-label nzRequired>商户号</nz-form-label>
                    <nz-form-control>
                        <nz-input-group>
                            <input nz-input formControlName="codeValue" [placeholder]="'加油站订单入账商户号'" />
                        </nz-input-group>
                    </nz-form-control>
                </nz-form-item>
            </div>
        </div>
    </form>
</nz-modal>-->
