<!-- 页头 -->
<page-header-wrapper [logo]="logo" [content]="content">
  <ng-template #logo>
    <button nz-button nz-tooltip nzTooltipTitle="返回上一页" (click)="goBack()">
      <i nz-icon nzType="left" nzTheme="outline"></i>
    </button>
  </ng-template>
  <ng-template #content>
    <nz-skeleton [nzLoading]="service.http.loading">
      <div class="user-info" nz-row>
        <div nz-col [nzXl]="18" [nzLg]="24" [nzSm]="24" [nzXs]="24" class="d-flex">
          <img [src]="detailData?.enterpriseLogo" />
          <div style="flex: 1;">
            <div nz-row>
              <div nz-col [nzLg]="12" [nzSm]="24" [nzXs]="24">
                <p style="margin-bottom: 0;">{{ detailData?.enterpriseName }}</p>
              </div>
              <div nz-col [nzLg]="12" [nzSm]="24" [nzXs]="24">
                <nz-badge nzStatus="success" nzText="正常" *ngIf="detailData?.stateLocked === 0"></nz-badge>
                <nz-badge nzStatus="error" nzText="冻结" *ngIf="detailData?.stateLocked === 1"></nz-badge>
              </div>
            </div>
            <div nz-row>
              <div nz-col [nzLg]="12" [nzSm]="24" [nzXs]="24">
                <p>{{ detailData?.unifiedSocialCreditCode }}</p>
              </div>
              <div nz-col [nzLg]="12" [nzSm]="24" [nzXs]="24">
                认证时间：{{detailData?.createTime}}
              </div>
            </div>
            <div>
              服务评级：<nz-rate [ngModel]="detailData?.serviceLevel" nzDisabled></nz-rate>
            </div>
          </div>
        </div>
        <div nz-col [nzXl]="6" [nzLg]="24" [nzSm]="24" [nzXs]="24" class="text-right mt-sm">
          <button [nzLoading]="service.http.loading" nz-button nzDanger nz-popconfirm [nzPopconfirmTitle]="enable"
            (nzOnConfirm)="freezeOrResume(1)" nzPopconfirmPlacement="bottomRight" *ngIf="detailData?.stateLocked === 1">
            启用
          </button>
          <button [nzLoading]="service.http.loading" nz-button nzDanger nz-popconfirm [nzPopconfirmTitle]="frozen"
            (nzOnConfirm)="freezeOrResume(0)" nzPopconfirmPlacement="bottomRight" *ngIf="detailData?.stateLocked === 0">
            冻结
          </button>
          <button [nzLoading]="service.http.loading" nz-button nzDanger nz-popconfirm [nzPopconfirmTitle]="Payfrozen"
            (nzOnConfirm)="PayOrResume(0)" nzPopconfirmPlacement="bottomRight" *ngIf="detailData?.createPay === 1">
            开通支付权限
          </button>
          <button [nzLoading]="service.http.loading" nz-button nzDanger nz-popconfirm [nzPopconfirmTitle]="Payenable"
            (nzOnConfirm)="PayOrResume(1)" nzPopconfirmPlacement="bottomRight" *ngIf="detailData?.createPay === 0">
            关闭支付权限
          </button>
        </div>
      </div>
    </nz-skeleton>
  </ng-template>

  <ng-template #frozen>
    <ng-container
      *ngTemplateOutlet="PopconfirmTempalte;context:{title:'确定冻结该企业吗？',content:'停用后，该企业将被限制使用，不限于访问受限、无法发布货源等，请谨慎操作'}">
    </ng-container>
  </ng-template>
  <ng-template #enable>
    <ng-container *ngTemplateOutlet="PopconfirmTempalte;context:{title:'确定启用该企业吗？',content:'启用后，该企业将恢复正常使用功能，请再次确认'}">
    </ng-container>
  </ng-template>
  <ng-template #Payenable>
    <ng-container
      *ngTemplateOutlet="PopconfirmTempalte;context:{title:'确定关闭该企业支付权限吗？',content:'停用后，该企业将被限制使用支付功能，请谨慎操作'}">
    </ng-container>
  </ng-template>
  <ng-template #Payfrozen>
    <ng-container
      *ngTemplateOutlet="PopconfirmTempalte;context:{title:'确定开通该企业支付权限吗？',content:'启用后，该企业将恢复正常支付功能，请再次确认'}">
    </ng-container>
  </ng-template>
</page-header-wrapper>

<nz-card [nzLoading]="service.http.loading">
  <sv-container col="3">
    <sv-title>企业管理员信息</sv-title>
    <sv label="姓名">
      {{ detailData?.adminUserInfo?.name }}
    </sv>
    <sv label="手机号">
      {{ detailData?.adminUserInfo?.mobile }}
    </sv>
    <sv label="身份证号">
      {{ detailData?.contactadminUserInfo?.certificateNumber }}
    </sv>
  </sv-container>
  <sv-container col="2">
    <sv label="身份证照">
      <app-imagelist
        [imgList]="[detailData?.adminUserInfo?.certificatePhotoFrontWatermark,detailData?.adminUserInfo?.certificatePhotoBackWatermark]">
      </app-imagelist>
    </sv>
    <sv label="企业授权函">
      <app-imagelist [imgList]="[detailData?.adminUserInfo?.certificatePhotoBackWatermark]"></app-imagelist>
    </sv>
  </sv-container>
  <nz-divider></nz-divider>
  <sv-container col="3" class="mt16">
    <sv-title>
      <label class="mr-md">企业基本信息</label>
      <label *ngIf="detailData?.approvalStatus===10" style="color: #1890ff;"><i nz-icon nzType="info-circle"
          nzTheme="fill" class="mr-xs"></i>待审核
      </label>
      <label *ngIf="detailData?.approvalStatus===20" style="color: #52c41a;"><i nz-icon nzType="check-circle"
          nzTheme="fill" class="mr-xs"></i>审核通过
      </label>
      <label *ngIf="detailData?.approvalStatus===30" style="color: #ff4d4f;"><i nz-icon nzType="close-circle"
          nzTheme="fill" class="mr-xs"></i>驳回
      </label>
    </sv-title>
    <sv label="公司名称">
      {{ detailData?.enterpriseName }}
    </sv>
    <sv label="统一社会信用代码">
      {{ detailData?.unifiedSocialCreditCode }}
    </sv>
    <sv label="公司类型">
      {{ detailData?.enterpriseType }}
    </sv>
    <sv label="注册资本">
      {{ detailData?.registrationCapital }}
      <span *ngIf="detailData?.registrationCapital">万元</span>
    </sv>
    <sv label="成立日期">
      {{ detailData?.enterpriseRegistrationTime }}
    </sv>
    <sv label="营业期限">
      <div *ngIf="!!detailData?.operatingStartTime && !!detailData?.operatingEndTime">
        {{ detailData?.operatingStartTime }} 至 {{ detailData?.operatingEndTime }}
      </div>
      <div *ngIf="!detailData?.operatingStartTime && !detailData?.operatingEndTime">长期</div>
      <div *ngIf="!!detailData?.operatingStartTime && !detailData?.operatingEndTime">{{ detailData?.operatingStartTime
        }} 至 长期</div>
    </sv>
  </sv-container>
  <sv-container col="2" class="mt16">
    <sv label="公司所在地" col="3">
      {{ detailData?.fullRegionVO?.provinceName }}{{ detailData?.fullRegionVO?.cityName }}{{
      detailData?.fullRegionVO?.areaName }}
    </sv>
    <sv label="公司详细地址">
      {{ detailData?.enterpriseAddress }}
    </sv>
  </sv-container>
  <sv-container col="1" class="mt16">
    <sv label="经营范围">
      {{ detailData?.businessScope }}
    </sv>
  </sv-container>
  <sv-container col="2" class="mt16">
    <sv label="税务机关">
      {{ detailData?.taxAuthority }}
    </sv>
    <sv label="营业执照">
      <app-imagelist [imgList]="[detailData?.licensePhotoWatermark]"></app-imagelist>
    </sv>
  </sv-container>
  <nz-divider></nz-divider>
  <sv-container col="3" class="mt16">
    <sv-title>法人信息</sv-title>
    <sv label="法定代表人">
      {{ detailData?.legalPersonIdentityVO?.name }}
    </sv>
    <sv label="身份证号码">
      {{ detailData?.legalPersonIdentityVO?.certificateNumber }}
    </sv>
    <sv label="身份证有效期">
      {{ detailData?.legalPersonIdentityVO?.validStartTime }} -
      {{ detailData?.legalPersonIdentityVO?.validEndTime || '长期' }}
    </sv>
    <sv label="身份证照" col="1">
      <app-imagelist
        [imgList]="[detailData?.legalPersonIdentityVO?.certificatePhotoFrontWatermark,detailData?.legalPersonIdentityVO?.certificatePhotoBackWatermark]">
      </app-imagelist>
    </sv>
  </sv-container>
  <nz-divider></nz-divider>
  <sv-container col="3" class="mt16">
    <sv-title>企业开票信息</sv-title>
    <sv label="开户银行">
      {{ detailData?.createBank }}
    </sv>
    <sv label="银行账户">
      {{ detailData?.bankAccount }}
    </sv>
    <sv label="注册电话">
      {{ detailData?.registerPhone }}
    </sv>
    <sv label="注册地址">
      {{ detailData?.registerAddress }}
    </sv>
  </sv-container>
</nz-card>

<ng-template #PopconfirmTempalte let-title="title" let-content="content">
  <div class="ant-popover-message">
    <i nz-icon nzType="info-circle" nzTheme="fill"></i>
    <div class="ant-popover-message-title ng-star-inserted self-ant-popover-title" style="font-size: 16px">{{title}}
    </div>
    <div class="ant-popover-message-title ng-star-inserted">
      {{content}}
    </div>
  </div>
</ng-template>