<!-- start 面包屑 -->
<app-breadcrumb></app-breadcrumb>
<!-- end 面包屑 -->
<!--条件搜索-->

<div class="inner-content">
  <form nz-form [formGroup]="searchForm" (ngSubmit)="search(searchForm.value)">
    <div nz-row>
      <div nz-col nzSpan="8">
        <nz-form-item>
          <nz-form-label [nzSpan]="8">活动名称</nz-form-label>
          <nz-form-control [nzSpan]="14">
            <input nz-input formControlName="name" />
          </nz-form-control>
        </nz-form-item>
      </div>
      <div nz-col nzSpan="8">
        <nz-form-item>
          <nz-form-label [nzSpan]="8">参与门店</nz-form-label>
          <nz-form-control [nzSpan]="14">
            <input nz-input formControlName="storeName" />
          </nz-form-control>
        </nz-form-item>
      </div>
      <div nz-col nzSpan="8">
        <nz-form-item>
          <nz-form-label [nzSpan]="8">状态</nz-form-label>
          <nz-form-control [nzSpan]="14">
            <nz-select [formControlName]="'status'" [nzPlaceHolder]="''">
              <nz-option nzValue="1" nzLabel="编辑中"></nz-option>
              <nz-option nzValue="2" nzLabel="进行中"></nz-option>
              <nz-option nzValue="3" nzLabel="已结束"></nz-option>
            </nz-select>
          </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>共计 {{dataObject.total?dataObject.total:0}} 条数据</span>
  <div class="operating-button">
    <button *ngIf="BTN_STORE_DISCOUNT_ACTIVITY_ADD" nz-button nzType="primary" class="right-btn" [routerLink]="['/admin/store-discount-activity/edit']"><i nz-icon nzType="plus" nzTheme="outline"></i>添加</button>
  </div>

  <!--数组表格 -->
  <nz-table #basicTable
            [nzData]="dataObject.list"
            [nzTotal]="dataObject.total"
            [nzFrontPagination]="false"
            [nzLoading]="tableLoading"
            [nzPageIndex]="whereObject.pageNum"
            (nzPageIndexChange)="requestData($event)"
            [nzScroll]="{ x: '1150px'}">
    <thead>
    <tr>
      <th nzWidth="70px">序号</th>
      <th nzWidth="150px">参与门店</th>
      <th nzWidth="150px">优惠名称</th>
      <th nzWidth="100px">优惠类型</th>
      <th nzWidth="130px">参与优惠条件</th>
      <th nzWidth="100px">优惠金额</th>
      <th nzWidth="150px">结束时间</th>
      <th nzWidth="100px">优惠状态</th>
      <th nzWidth="160px">创建时间</th>
      <th nzWidth="150px" nzRight="0px">操作</th>
    </tr>
    </thead>
    <tbody>
    <tr *ngFor="let data of basicTable.data;let i = index">
      <td>{{i + 1}}</td>
      <td>{{data.storeName}}</td>
      <td>{{data.name}}</td>
      <td>
        <span *ngIf="data.discountType == 1">满减</span>
        <span *ngIf="data.discountType == 2">立减</span>
        <span *ngIf="data.discountType == 3">折扣</span>
      </td>
      <td>{{data.discountType==3?data.discountCondition+'%':'￥'+data.discountCondition}}</td>
      <td>{{data.discountType==3?data.discountPrice+'%':'￥'+data.discountPrice}}</td>
      <td>{{data.endTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td>
      <td>
        <span *ngIf="data.status == 1">编辑中</span>
        <span *ngIf="data.status == 2">进行中</span>
        <span *ngIf="data.status == 3">已结束</span>
      </td>
      <td>{{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td>
      <td nzRight="0px" class="table-td-operation">
        <a nz-dropdown [nzDropdownMenu]="menu">操作列表 <i nz-icon nzType="down"></i></a>
        <nz-dropdown-menu #menu="nzDropdownMenu">
          <ul nz-menu nzSelectable>
            <li nz-menu-item *ngIf="data.status != 3 && BTN_STORE_DISCOUNT_ACTIVITY_UPDATE">
              <a [routerLink]="['/admin/store-discount-activity/edit']" [queryParams]="{id: data.id}">修改</a>
            </li>
            <li nz-menu-item *ngIf="data.status == 1 && BTN_STORE_DISCOUNT_ACTIVITY_UPDATE"><a (click)="showUpOnlineConfirm(data.id)">上线</a></li>
            <li nz-menu-item *ngIf="data.status == 2 && BTN_STORE_DISCOUNT_ACTIVITY_UPDATE"><a (click)="showLowerOnlineConfirm(data.id)">下线</a></li>
            <li nz-menu-item *ngIf="data.status == 1 && BTN_STORE_DISCOUNT_ACTIVITY_DEL"><a (click)="showDelConfirm(data.id)">删除</a></li>
            <li nz-menu-item nzDisabled>暂无其他操作</li>
          </ul>
        </nz-dropdown-menu>
      </td>
    </tr>
    </tbody>
  </nz-table>
</div>

