<page-header-wrapper [title]="'销票处理'">
</page-header-wrapper>


<nz-card class="search-box" nzBordered>
    <div nz-row nzGutter="8">
        <div nz-col [nzXl]="_$expand ? 24 : 18" [nzLg]="24" [nzSm]="24" [nzXs]="24">
            <sf #sf [schema]="searchSchema"
                [ui]="{ '*': { spanLabelFixed: 110,grid: { lg: 8, md: 12, sm: 12, xs: 24,gutter:10 } }}"
                [compact]="true" [button]="'none'"></sf>
        </div>
        <div nz-col [nzXl]="_$expand ? 24 : 6" [nzLg]="24" [nzSm]="24" [nzXs]="24" class="text-right">
            <button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="st?.load(1)">查询</button>
            <button nz-button (click)="resetSF()">重置</button>
            <!-- <button nz-button> 导出</button> -->
            <button nz-button nzType="link" (click)="expandToggle()">
                {{ !_$expand ? '展开' : '收起' }}
                <i nz-icon [nzType]="!_$expand ? 'down' : 'up'"></i>
            </button>
        </div>
    </div>
</nz-card>

<nz-card class="content-box" nzBordered>
    <nz-tabset [nzTabBarExtraContent]="extraTemplate" (nzSelectedIndexChange)="selectChange($event)">
        <nz-tab nzTitle="全部"></nz-tab>
        <nz-tab nzTitle="待处理"></nz-tab>
        <nz-tab nzTitle="待确认"></nz-tab>
        <!-- <nz-tab nzTitle="已确认"></nz-tab> -->
    </nz-tabset>
    <ng-template #extraTemplate>
        <div class="d-flex align-items-center">
            <div class="mr-md">
                已选择
                <strong class="text-red">{{ selectedRows.length }}</strong> 张发票&nbsp;&nbsp; 发票金额总计
                <strong class="text-red">{{totalCallNo }}</strong>
                <a *ngIf="totalCallNo > 0" (click)="st.clearCheck();totalCallNo=0" class="ml-lg">清空</a>
            </div>
            <button nz-button *ngIf="resourceStatus===1 || !resourceStatus" (click)="this.batchPush()">推送开票</button>
            <!-- <button nz-button *ngIf="resourceStatus===1 || !resourceStatus"
                (click)="this.batchRemove(selectedRows)">移除</button>
            <button nz-button *ngIf="resourceStatus===2 || !resourceStatus"
                (click)="this.batchWithdraw(selectedRows)">撤回</button> -->
        </div>
    </ng-template>


    <st #st [scroll]="{ x: '2000px' }" [data]="service.$api_ficoVatinvHList" [columns]="columns" [page]="{}"
        [req]="{process: beforeReq }" [res]="{process:afterRes }" [loading]="false" (change)="stChange($event)">
        <ng-template st-row="vatinvcode" let-item let-index="index" let-column="column">
            {{ item.vatinvcode }} <br>
            <label class="text-primary">{{item.stsLabel}}</label>
        </ng-template>
    </st>
</nz-card>

<ng-template #requestedModal>
    <div nz-row nzGutter="8">
        <div nz-col nzSpan="24" se-container [labelWidth]="100" [col]="1">
            <se label="购买方" class="mb-sm">
                {{openInfo?.artoname}}
            </se>
            <se label="纳税号" class="mb-sm">
                {{openInfo?.artotaxno}}
            </se>
            <se label="注册地址" class="mb-sm">
                {{openInfo?.artoadd}}
            </se>
            <se label="注册电话" class="mb-sm">
                {{openInfo?.artotel}}
            </se>
            <se label="开户行" class="mb-sm">
                {{openInfo?.artobank}}
            </se>
            <se label="银行账户" class="mb-sm">
                {{openInfo?.artoacc}}
            </se>
            <se label="服务名称" class="mb-sm">
                {{openInfo?.vatnameLabel}}
            </se>
            <se label="发票备注栏" class="mb-sm">
                {{openInfo?.vatremarks}}
            </se>
            <se label="其它要求" class="mb-sm">
                {{openInfo?.otherremarks}}
            </se>
            <se label="销货清单" class="mb-sm">
                {{openInfo?.isdetail?'需要':'不需要'}}
            </se>
            <se label="开票金额" class="mb-sm">
                {{openInfo?.vatmoney | currency}}
            </se>
            <se label="开票日期" required>
                <nz-date-picker [(ngModel)]="openInfo.invoicedate" nzShowTime nzPlaceHolder="请选择" style=" width: 100%;">
                </nz-date-picker>
            </se>
            <se label="发票号码" required>
                <input nz-input [(ngModel)]="openInfo.invoiceno" placeholder="请输入" />
            </se>
            <se label="发票代码" required>
                <input nz-input [(ngModel)]="openInfo.invoiceno2" placeholder="请输入" />
            </se>
        </div>
    </div>
</ng-template>