<!--
 * @Description  : 
 * @Version      : 1.0
 * @Author       : Shiming
 * @Date         : 2021-12-24 15:54:08
 * @LastEditors  : Shiming
 * @LastEditTime : 2022-03-24 11:10:44
 * @FilePath     : \\tms-obc-web\\src\\app\\routes\\sys-setting\\components\\network-freight\\network-freight.component.html
 * Copyright (C) 2022 huzhenhong. All rights reserved.
-->

<page-header-wrapper title="网络货运人"> </page-header-wrapper>

<nz-card>
  <div nz-row nzGutter="8">
    <!-- 查询字段小于或等于3个时，不显示伸缩按钮 -->
    <div nz-col nzSpan="24" *ngIf="queryFieldCount <= 4">
      <sf
        #sf
        [schema]="schema"
        [ui]="ui"
        [mode]="'search'"
        [disabled]="!sf?.valid"
        [loading]="false"
        (formSubmit)="st?.load(1)"
        (formReset)="resetSF()"
      ></sf>
    </div>

    <!-- 查询字段大于3个时，根据展开状态调整布局 -->
    <ng-container *ngIf="queryFieldCount > 4">
      <div nz-col [nzSpan]="_$expand ? 24 : 18">
        <sf #sf [schema]="schema" [ui]="ui" [compact]="true" [button]="'none'"></sf>
      </div>
      <div nz-col [nzSpan]="_$expand ? 24 : 6" [class.text-right]="_$expand">
        <button nz-button nzType="primary" [disabled]="!sf.valid" [nzLoading]="isLoading && st.loading" (click)="st?.load(1)">查询</button>
        <button nz-button nzType="primary">导出</button>
        <button nz-button (click)="resetSF()">重置</button>
        <button nz-button nzType="link" (click)="expandToggle()">
          {{ !_$expand ? '展开' : '收起' }}
          <i nz-icon [nzType]="!_$expand ? 'down' : 'up'"></i>
        </button>
      </div>
    </ng-container>
  </div>
</nz-card>

<nz-card class="content-box">
  <!-- 工具栏 -->
  <div class="toolbar" style="float: right; padding-bottom: 15px">
    <button nz-button nzType="primary" (click)="creat()">新增</button>
  </div>
  <st
    #st
    [scroll]="{ x: '2000px' }"
    [data]="service.$api_networkTransporter_page"
    [columns]="columns"
    [req]="{ params: reqParams }" [page]="{}"
    [loading]="false"
    (change)="stChange($event)"
  >
    <ng-template st-row="costRate" let-item let-index="index">
      <div>{{ item?.costRate ? item?.costRate + '%' : '' }}</div>
    </ng-template>
    <ng-template st-row="goodsSurchargeRatio" let-item let-index="index">
      <div>货源单：{{ item?.goodsSurchargeRatio ? item?.goodsSurchargeRatio + '%' : '' }}</div>
      <div>合同单：{{ item?.contractSurchargeRatio ? item?.contractSurchargeRatio + '%' : '' }}</div>
    </ng-template>
    <ng-template st-row="ticketEnable" let-item let-index="index">
      <div>{{ item?.ticketEnable ? '已开启' : '未开启' }}</div>
    </ng-template>
    <ng-template st-row="insuranceEnable" let-item let-index="index">
      <div>{{ item?.insuranceEnable ? '已开启' : '未开启' }}</div>
    </ng-template>
    <ng-template st-row="pinganEnable" let-item let-index="index">
      <div>{{ item?.pinganEnable ? '已开启' : '未开启' }}</div>
    </ng-template>
    <ng-template st-row="pufaEnable" let-item let-index="index">
      <div >{{ item?.pufaEnable ? '已开启' : '未开启' }}</div>
    </ng-template>
    <ng-template st-row="pinganAccountEnable" let-item let-index="index">
      <a (click)="createAccount(item,'1','pinganAccount')">{{ item?.pinganAccount || '开通子账户' }}</a>
    </ng-template>
    <ng-template st-row="pufaAccountEnable" let-item let-index="index">
      <a (click)="createAccount(item,'2','pufaAccount')">{{ item?.pufaAccount || '开通子账户' }}</a>
    </ng-template>
    <ng-template st-row="invoiceEnable" let-item let-index="index">
      <div>{{ item?.invoiceEnable ? '已开启' : '未开启' }}</div>
    </ng-template>
    <ng-template st-row="bankName" let-item let-index="index">
      <a href="javascript:;" (click)="setMakeInvoice()">开通子账户</a>
    </ng-template>
    <ng-template st-row="virtualAccount" let-item let-index="index">
      <a href="javascript:;" (click)="setMakeInvoice()">开通子账户</a>
    </ng-template>
  </st>
</nz-card>

<!-- <nz-modal [(nzVisible)]="isVisible" [nzFooter]="nzModalFooter" nzTitle="财务设置" (nzOnOk)="handleOK()" (nzOnCancel)="handleCancel()">
  <ng-container *nzModalContent>
    <sf #sfFre [schema]="addSchema" [ui]="ui2" [formData]="formData" [compact]="false" [button]="'none'"> </sf>
  </ng-container>
  <ng-template #nzModalFooter>
    <button nz-button nzType="primary" (click)="handleCancel()" [disabled]="">取消</button>
    <button nz-button nzType="default" (click)="handleOK()">确 定</button>
  </ng-template>
</nz-modal> -->

<nz-modal [(nzVisible)]="isVisibleTicket" [nzFooter]="nzModalFooterTiket" nzTitle="财务设置" (nzOnCancel)="handleCancelTicket()">
  <ng-container *nzModalContent>
    <div nz-row [nzGutter]="10" style="height: 600px; overflow-y: auto">
      <div nz-col [nzSpan]="6" style="position: relative;">
        <ul nz-menu nzMode="inline" class="card-height">
          <li nz-menu-item [nzSelected]="idx === 0" (click)="changeType(item)" *ngFor="let item of tabs; let idx = index">
            {{ item.name }}
          </li>
        </ul>
      </div>
      <div nz-col [nzSpan]="18" style="overflow: scroll">
        <sf #sfTicket [schema]="ticketSchema" [ui]="ui3" *ngIf="TicketStatus" [formData]="formDataTicket" [compact]="false" [button]="'none'">
        </sf>
        <sf #sfTax [schema]="TaxSchema" [ui]="ui4" *ngIf="taxStatus" [formData]="formDataTax" [compact]="false" [button]="'none'"> </sf>
        
        <sf #sfNC [schema]="NCSchema" [ui]="ui5" *ngIf="NCStatus" [formData]="formDataNC" [compact]="false" [button]="'none'"> </sf>
      </div>
    </div>
  </ng-container>
  <ng-template #nzModalFooterTiket>
    <button nz-button nzType="primary" (click)="handleCancelTicket()" [disabled]="">取消</button>
    <button nz-button nzType="default" (click)="handleOKTicket()">确 定</button>
  </ng-template>
</nz-modal>
