<div nz-row [nzGutter]="24" class="pt-lg">
  <div nz-col nzXs="24" nzSm="12" nzMd="12" nzLg="6">
    <g2-card [title]="'app.analysis.total-sales' | i18n" total="¥ 126,560" contentHeight="44px" [action]="action1" [footer]="footer1">
      <ng-template #action1>
        <i nz-tooltip [nzTooltipTitle]="'app.analysis.introduce' | i18n" nz-icon nzType="info-circle"></i>
      </ng-template>
      <trend flag="up" style="display: block; margin-top: 2px">
        {{ 'app.analysis.week' | i18n }}
        <span class="pl-sm">12%</span>
      </trend>
      <trend flag="down">
        {{ 'app.analysis.day' | i18n }}
        <span class="pl-sm">11%</span>
      </trend>
      <ng-template #footer1>
        <p class="text-truncate mb0">
          {{ 'app.analysis.day-sales' | i18n }}
          <span class="ml-sm">￥12,423</span>
        </p>
      </ng-template>
    </g2-card>
  </div>
  <div nz-col nzXs="24" nzSm="12" nzMd="12" nzLg="6">
    <g2-card [title]="'app.analysis.visits' | i18n" total="8,848" contentHeight="46px" [action]="action2" [footer]="footer2">
      <ng-template #action2>
        <i nz-tooltip [nzTooltipTitle]="'app.analysis.introduce' | i18n" nz-icon nzType="info-circle"></i>
      </ng-template>
      <g2-mini-area *ngIf="data.visitData" color="#975FE4" height="46" [data]="data.visitData"></g2-mini-area>
      <ng-template #footer2>
        <p class="text-truncate mb0">
          {{ 'app.analysis.day-visits' | i18n }}
          <span class="ml-sm">1,234</span>
        </p>
      </ng-template>
    </g2-card>
  </div>
  <div nz-col nzXs="24" nzSm="12" nzMd="12" nzLg="6">
    <g2-card [title]="'app.analysis.payments' | i18n" total="6,560" contentHeight="46px" [action]="action3" [footer]="footer3">
      <ng-template #action3>
        <i nz-tooltip [nzTooltipTitle]="'app.analysis.introduce' | i18n" nz-icon nzType="info-circle"></i>
      </ng-template>
      <g2-mini-bar *ngIf="data.visitData" height="46" [data]="data.visitData"></g2-mini-bar>
      <ng-template #footer3>
        <p class="text-truncate mb0">
          {{ 'app.analysis.conversion-rate' | i18n }}
          <span class="ml-sm">60%</span>
        </p>
      </ng-template>
    </g2-card>
  </div>
  <div nz-col nzXs="24" nzSm="12" nzMd="12" nzLg="6">
    <g2-card [title]="'app.analysis.operational-effect' | i18n" total="78%" contentHeight="46px" [action]="action4" [footer]="footer4">
      <ng-template #action4>
        <i nz-tooltip [nzTooltipTitle]="'app.analysis.introduce' | i18n" nz-icon nzType="info-circle"></i>
      </ng-template>
      <g2-mini-progress height="46" percent="78" strokeWidth="8" target="80" color="#13C2C2"></g2-mini-progress>
      <ng-template #footer4>
        <div class="d-flex justify-content-between text-truncate">
          <trend flag="up">
            {{ 'app.analysis.week' | i18n }}
            <span class="pl-sm">12%</span>
          </trend>
          <trend flag="down">
            {{ 'app.analysis.day' | i18n }}
            <span class="pl-sm">11%</span>
          </trend>
        </div>
      </ng-template>
    </g2-card>
  </div>
</div>
<nz-card [nzLoading]="loading" [nzBordered]="false" class="ant-card__body-nopadding sales-card">
  <nz-tabset [nzTabBarExtraContent]="extraTemplate" *ngIf="data.salesData" (nzSelectedIndexChange)="salesChange($event)">
    <nz-tab *ngFor="let tab of saleTabs" [nzTitle]="'app.analysis.' + tab.key | i18n">
      <div nz-row>
        <div nz-col nzXs="24" nzSm="24" nzMd="12" nzLg="16">
          <div class="bar">
            <g2-bar
              *ngIf="tab.show"
              height="295"
              style="width: 100%"
              [title]="'app.analysis.' + tab.key + '-trend' | i18n"
              [data]="data.salesData"
            ></g2-bar>
          </div>
        </div>
        <div nz-col nzXs="24" nzSm="24" nzMd="12" nzLg="8">
          <div class="rank">
            <h4 class="ranking-title">{{ 'app.analysis.' + tab.key + '-ranking' | i18n }}</h4>
            <ul class="rank-list">
              <li *ngFor="let i of rankingListData; let idx = index">
                <span class="number" [ngClass]="{ active: idx < 3 }">{{ idx + 1 }}</span>
                <span class="title">{{ i.title }}</span>
                <span class="value">{{ i.total | number: '3.0' }}</span>
              </li>
            </ul>
          </div>
        </div>
      </div>
    </nz-tab>
    <ng-template #extraTemplate>
      <div class="sales-extra-wrap">
        <div class="sales-extra">
          <span *ngFor="let t of dateRangeTypes" (click)="setDate(t)" [class.currentDate]="dateRangeType === t">
            {{ 'app.analysis.all-' + t | i18n }}
          </span>
        </div>
        <nz-range-picker [(ngModel)]="dateRange"></nz-range-picker>
      </div>
    </ng-template>
  </nz-tabset>
</nz-card>
<div nz-row [nzGutter]="24">
  <div nz-col nzXs="24" nzSm="24" nzMd="24" nzLg="12">
    <nz-card
      [nzLoading]="loading"
      [nzBordered]="false"
      [nzTitle]="'app.analysis.online-top-search' | i18n"
      [nzExtra]="extraOp"
      class="mb-0"
    >
      <ng-template #extraOp>
        <i nz-dropdown [nzDropdownMenu]="extraOpMenu" nz-icon nzType="ellipsis" class="icon-group"></i>
        <nz-dropdown-menu #extraOpMenu="nzDropdownMenu">
          <ul nz-menu>
            <li nz-menu-item>操作一</li>
            <li nz-menu-item>操作二</li>
          </ul>
        </nz-dropdown-menu>
      </ng-template>
      <div nz-row [nzGutter]="64">
        <div nz-col nzXs="24" nzSm="12" class="mb-md">
          <number-info total="12,321" subTotal="17.1" status="up" [subTitle]="subTitle">
            <ng-template #subTitle>
              {{ 'app.analysis.search-users' | i18n }}
              <i nz-tooltip [nzTooltipTitle]="'app.analysis.introduce' | i18n" nz-icon nzType="info-circle" class="ml-sm"></i>
            </ng-template>
          </number-info>
          <g2-mini-area *ngIf="data.visitData2" [line]="true" height="45" [data]="data.visitData2"></g2-mini-area>
        </div>
        <div nz-col nzXs="24" nzSm="12" class="mb-md">
          <number-info [subTitle]="'app.analysis.per-capita-search' | i18n" total="2.7" subTotal="26.2" status="down"></number-info>
          <g2-mini-area *ngIf="data.visitData2" [line]="true" height="45" [data]="data.visitData2"></g2-mini-area>
        </div>
      </div>
      <st [data]="data.searchData" [columns]="searchColumn" size="small" ps="5" [page]="{ toTop: false }">
        <ng-template st-row="range" let-i>
          <trend [flag]="i.status === 1 ? 'down' : 'up'">
            <span>{{ i.range }}%</span>
          </trend>
        </ng-template>
      </st>
    </nz-card>
  </div>
  <div nz-col nzXs="24" nzSm="24" nzMd="24" nzLg="12">
    <nz-card
      [nzLoading]="loading"
      [nzBordered]="false"
      [nzTitle]="'app.analysis.the-proportion-of-sales' | i18n"
      [nzBodyStyle]="{ 'padding.px': 24 }"
      [nzExtra]="extra"
      class="sales-card mb-0"
      style="min-height: 506.5px"
    >
      <ng-template #extra>
        <nz-radio-group [(ngModel)]="salesType" (ngModelChange)="changeSaleType()">
          <label nz-radio-button [nzValue]="'all'">
            {{ 'app.analysis.channel.all' | i18n }}
          </label>
          <label nz-radio-button [nzValue]="'online'">
            {{ 'app.analysis.channel.online' | i18n }}
          </label>
          <label nz-radio-button [nzValue]="'offline'">
            {{ 'app.analysis.channel.stores' | i18n }}
          </label>
        </nz-radio-group>
        <i nz-dropdown [nzDropdownMenu]="salesExtraMenu" nzPlacement="bottomLeft" nz-icon nzType="ellipsis" class="ml-md"></i>
        <nz-dropdown-menu #salesExtraMenu="nzDropdownMenu">
          <ul nz-menu>
            <li nz-menu-item>操作一</li>
            <li nz-menu-item>操作二</li>
          </ul>
        </nz-dropdown-menu>
      </ng-template>
      <h4 class="my-xl">{{ 'app.analysis.sales' | i18n }}</h4>
      <g2-pie
        *ngIf="salesPieData"
        [data]="salesPieData"
        [hasLegend]="true"
        [subTitle]="'app.analysis.sales' | i18n"
        [height]="248"
        [lineWidth]="4"
        [total]="salesTotal"
        [valueFormat]="handlePieValueFormat"
      >
      </g2-pie>
    </nz-card>
  </div>
</div>
<nz-card [nzLoading]="loading" [nzBordered]="false" [nzBodyStyle]="{ padding: '0 0 32px' }" class="offline-card mt-lg">
  <nz-tabset *ngIf="data.offlineData" [(nzSelectedIndex)]="offlineIdx" (nzSelectedIndexChange)="offlineChange($event)">
    <nz-tab *ngFor="let tab of data.offlineData; let i = index" [nzTitle]="nzTabHeading">
      <ng-template #nzTabHeading>
        <div class="flex-center-between px-md">
          <number-info
            [title]="tab.name"
            [subTitle]="'app.analysis.conversion-rate' | i18n"
            gap="2"
            [total]="tab.cvr * 100 + '%'"
            [theme]="i !== offlineIdx ? 'light' : 'default'"
            class="mr-md"
          ></number-info>
          <g2-pie
            style="padding-top: 36px; width: 48px"
            [animate]="false"
            [color]="i !== offlineIdx ? '#BDE4FF' : 'rgba(24, 144, 255, 0.85)'"
            [inner]="0.55"
            [tooltip]="false"
            [padding]="[0, 0, 0, 0]"
            [percent]="tab.cvr * 100"
            [height]="48"
          >
          </g2-pie>
        </div>
      </ng-template>
      <div class="px-lg">
        <g2-timeline *ngIf="tab.show" [data]="tab.chart" [titleMap]="titleMap"></g2-timeline>
      </div>
    </nz-tab>
  </nz-tabset>
</nz-card>
