    <!-- 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="objectName"/>
                    </nz-form-control>
                </nz-form-item>
            </div>
            <div nz-col nzSpan="6">
                <nz-form-item>
                    <nz-form-label [nzSpan]="6">审核类型</nz-form-label>
                    <nz-form-control [nzSpan]="16">
                        <nz-select formControlName="objectType">
                            <nz-option nzValue="1" nzLabel="Jack"></nz-option>
                            <nz-option nzValue="2" nzLabel="Lucy"></nz-option>
                            <nz-option nzValue="disabled" nzLabel="Disabled" nzDisabled></nz-option>
                        </nz-select>
                    </nz-form-control>
                </nz-form-item>
            </div>
            <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="approveSerialNo"/>
                    </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>
    <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="120px">审核流水号</th>
            <th nzWidth="80px">审核对象名称</th>
            <th nzWidth="80px">审核类型</th>
            <th nzWidth="100px">提交人员</th>
            <th nzWidth="100px">创建时间</th>
            <th nzWidth="80px">状态</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.approveSerialNo}}</td>
            <td>{{data.objectName}}</td>
            <td>{{data.objectType | auditType}}</td>
            <td>{{data.submitOperatorName}}</td>
            <td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td>
            <td>{{data.status | auditStatus}}</td>
            <td nzRight="0px" class="table-td-operation">
                <a (click)="getDetail(data.id , data.objectType)"><i nz-icon [nzIconfont]="'icon-xiangqing'" nz-tooltip="审核详情"></i></a>
                <nz-divider *ngIf="data['status'] === 1" nzType="vertical"></nz-divider>
                <a (click)="approveProcessed(3 , data.id)"  *ngIf="data['status'] === 1"><i nz-icon nzType="check-circle" nzTheme="outline" nz-tooltip="通过"></i></a>
                <nz-divider *ngIf="data['status'] === 1" nzType="vertical"></nz-divider>
                <a (click)="approveProcessed(2 , data.id)"  *ngIf="data['status'] === 1"><i nz-icon nzType="stop"  nz-tooltip="驳回" nzTheme="outline"></i></a>
            </td>
        </tbody>
    </nz-table>
</div>

<nz-modal [(nzVisible)]="isVisible" nzWidth="900" nzTitle="审核详情" (nzOnCancel)="handleCancel()">
    <ng-container *ngIf="objectType === 3">
        <nz-descriptions  nzTitle="审核基础内容" nzBordered>
            <nz-descriptions-item nzTitle="审核类型" >{{data['approve']['objectType'] | auditType}}</nz-descriptions-item>
            <nz-descriptions-item nzTitle="审核状态">{{data['approve']['status'] | auditStatus}}</nz-descriptions-item>
            <nz-descriptions-item nzTitle="申请人员">{{data['approve']['submitOperatorName']}}</nz-descriptions-item>
            <nz-descriptions-item nzTitle="审核名称">{{data['approve']['objectName']}}</nz-descriptions-item>
        </nz-descriptions>
        <nz-descriptions style="margin-top: 20px;" nzTitle="审核对象详情" nzBordered>
            <nz-descriptions-item nzTitle="分发代理商">{{approveObject['agentName']}}</nz-descriptions-item>
            <nz-descriptions-item nzTitle="分发卡券">{{approveObject['couponName']}}</nz-descriptions-item>
            <nz-descriptions-item nzTitle="分发数量">{{approveObject['stockCount']}}</nz-descriptions-item>
            <nz-descriptions-item nzTitle="类型类型">{{approveObject['type'] == 1 ? '销售码' : '兑换码'}}</nz-descriptions-item>

        </nz-descriptions>
    </ng-container>
    <ng-container *ngIf="objectType !== 3">
        <nz-descriptions  nzTitle="审核基础内容" nzBordered>
            <nz-descriptions-item nzTitle="审核类型" >{{data['approve']['objectType'] | auditType}}</nz-descriptions-item>
            <nz-descriptions-item nzTitle="审核状态">{{data['approve']['status'] | auditStatus}}</nz-descriptions-item>
            <nz-descriptions-item nzTitle="申请人员">{{data['approve']['submitOperatorName']}}</nz-descriptions-item>
            <nz-descriptions-item nzTitle="审核名称">{{data['approve']['objectName']}}</nz-descriptions-item>
        </nz-descriptions>
        <nz-descriptions style="margin-top: 20px;" nzTitle="审核对象详情" nzBordered>
            <nz-descriptions-item nzTitle="卡券类型">{{data['object']['couponType'] === 1 ? '内部卷' : '外部卷'}}</nz-descriptions-item>
            <nz-descriptions-item nzTitle="支付类型">{{data['object']['couponType'] === 1 ? '微信支付' : '金币支付'}}</nz-descriptions-item>
            <nz-descriptions-item nzTitle="展示区域">{{data['object']['displayArea'] === 1 ? '赠券专区' : '金币专区'}}</nz-descriptions-item>
            <nz-descriptions-item nzTitle="销售价格">¥{{data['object']['salesPrice']}}</nz-descriptions-item>
            <nz-descriptions-item nzTitle="折扣价格">¥{{data['object']['discountPrice']}}</nz-descriptions-item>
            <nz-descriptions-item nzTitle="销售数量">{{data['object']['salesCount']}}</nz-descriptions-item>
            <nz-descriptions-item nzTitle="限购数量">{{data['object']['limitNumber']}}</nz-descriptions-item>
            <nz-descriptions-item nzTitle="归库天数">{{data['object']['recycleDay']}}</nz-descriptions-item>

            <nz-descriptions-item nzTitle="销售截至时间">{{data['object']['salesEndTime'] | date : 'yyyy-MM-dd'}}</nz-descriptions-item>
            <nz-descriptions-item nzTitle="是否赠送卡券">{{data['object']['isPresent'] === true ? '赠送' : '不赠送'}}</nz-descriptions-item>
            <nz-descriptions-item nzTitle="创建时间">{{data['object']['createTime'] | date : 'yyyy-MM-dd'}}</nz-descriptions-item>
        </nz-descriptions>

        <h3 style="margin-top: 20px;" *ngIf="data['object']['isPresent'] === true">赠券列表</h3>
        <nz-table *ngIf="data['object']['isPresent'] === true" #basicTable [nzData]="data['object']['handselCouponList']" [nzScroll]="{ x: '1200px' }">
            <thead>
            <tr>
                <th nzWidth="160px">卡券名称</th>
                <th nzWidth="100px">销售价格</th>
                <th nzWidth="100px">折扣价格</th>
                <th nzWidth="100px">展示区域</th>
                <th nzWidth="100px">卡券类型</th>
            </tr>
            </thead>
            <tbody>
            <tr *ngFor="let data of basicTable.data">
                <td>{{data['highCouponModel'].couponName}}</td>
                <td>¥{{data['highCouponModel'].salesPrice}}</td>
                <td>¥{{data['highCouponModel'].discountPrice}}</td>
                <td>{{data['highCouponModel'].displayArea === 1 ? '赠券专区' : '金币专区'}}</td>
                <td>{{data['highCouponModel'].couponType === 1 ? '内部卷' : '外部卷'}}</td>
            </tr>
            </tbody>
        </nz-table>
    </ng-container>
    <div *nzModalFooter>
        <button  *ngIf="data['approve']['status'] !== 1" nz-button nzType="default" (click)="handleCancel()">关闭</button>
        <button *ngIf="data['approve']['status'] === 1" nz-button nzType="default" (click)="approveProcessed(2 , this.id)">审核驳回</button>
        <button *ngIf="data['approve']['status'] === 1" nz-button nzType="primary" (click)="approveProcessed(3 , this.id)">审核通过</button>
    </div>
</nz-modal>

