<!-- start 面包屑 -->
<nz-breadcrumb>
  <nz-breadcrumb-item>
    优惠活动
  </nz-breadcrumb-item>
  <nz-breadcrumb-item>
    配置活动
  </nz-breadcrumb-item>
</nz-breadcrumb>
<!-- end 面包屑 -->

<nz-content class="inner-content">
  <form nz-form [formGroup]="dataForm" >

    <nz-form-item>
      <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>商户</nz-form-label>
      <nz-form-control [nzSm]="6" [nzXs]="24">
        <nz-select [formControlName]="'merId'" [nzPlaceHolder]="'请选择商户'" (ngModelChange)="getStore($event)">
          <nz-option *ngFor="let item of merArray" nzValue="{{item.id}}" nzLabel="{{item.merName}}"></nz-option>
        </nz-select>
      </nz-form-control>
    </nz-form-item>

    <nz-form-item>
      <nz-form-label [nzSm]="6" [nzXs]="24">门店</nz-form-label>
      <nz-form-control [nzSm]="6" [nzXs]="24">
        <nz-select [formControlName]="'storeId'" nzAllowClear [nzPlaceHolder]="'请选择门店'">
          <nz-option *ngFor="let item of storeArray" nzValue="{{item.id}}" nzLabel="{{item.name}}"></nz-option>
        </nz-select>
      </nz-form-control>
    </nz-form-item>

    <nz-form-item>
      <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>优惠活动名称</nz-form-label>
      <nz-form-control [nzSm]="6" [nzXs]="24">
        <input nz-input placeholder="请输入优惠券名称..."  [formControlName]="'name'" />
      </nz-form-control>
    </nz-form-item>

    <nz-form-item>
      <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>参与方式</nz-form-label>
      <nz-form-control [nzSm]="6" [nzXs]="24">
        <nz-select [formControlName]="'partakeWay'" [nzPlaceHolder]="'请选择参与'">
          <nz-option *ngFor="let item of discountActivityPartakeWayArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option>
        </nz-select>
      </nz-form-control>
    </nz-form-item>

    <nz-form-item *ngIf="this.dataForm.controls['partakeWay'].value === '3'">
      <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>限制类型</nz-form-label>
      <nz-form-control [nzSm]="6" [nzXs]="24">
        <nz-select [formControlName]="'restrictType'">
          <nz-option nzValue="1" nzLabel="每日"></nz-option>
        </nz-select>
      </nz-form-control>
    </nz-form-item>

    <nz-form-item *ngIf="this.dataForm.controls['partakeWay'].value === '3'">
      <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>限制参与次数</nz-form-label>
      <nz-form-control [nzSm]="6" [nzXs]="24" >
        <nz-input-number nz-input placeholder="请输入限制参与次数" [nzMin]="1" [nzMax]="100" [nzStep]="1" [formControlName]="'restrictPartakeNum'"></nz-input-number>
      </nz-form-control>
    </nz-form-item>

    <nz-form-item>
      <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>优惠券类型</nz-form-label>
      <nz-form-control [nzSm]="6" [nzXs]="24">
        <nz-select [formControlName]="'discountType'" [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>

    <nz-form-item *ngIf="this.dataForm.controls['partakeWay'].value === '1'">
      <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>满减条件金额</nz-form-label>
      <nz-form-control [nzSm]="6" [nzXs]="24">
        <input nz-input [type]="'number'" placeholder="请输入满减条件金额"  [formControlName]="'discountCondition'" />
      </nz-form-control>
    </nz-form-item>

    <nz-form-item>
      <nz-form-label [nzSm]="6" [nzXs]="24" [nzFor]="'discountPrice'" nzRequired>{{this.dataForm.controls['partakeWay'].value === '3' ? '优惠折扣（%）' : '优惠金额'}}</nz-form-label>
      <nz-form-control [nzSm]="6" [nzXs]="24" nzErrorTip="{{this.dataForm.controls['partakeWay'].value === '3' ? '请输入优惠折扣' : '请输入优惠金额'}}">
        <input nz-input [type]="'number'" placeholder="{{this.dataForm.controls['partakeWay'].value === '3' ? '请输入优惠折扣' : '请输入优惠金额'}}"  [formControlName]="'discountPrice'"/>
      </nz-form-control>
    </nz-form-item>

    <nz-form-item>
      <nz-form-label [nzSm]="6" [nzXs]="24" [nzFor]="'finalCostPrice'" nzRequired>{{this.dataForm.controls['partakeWay'].value === '3' ? '成本折扣（%）' : '成本优惠'}}</nz-form-label>
      <nz-form-control [nzSm]="6" [nzXs]="24" nzErrorTip="{{this.dataForm.controls['partakeWay'].value === '3' ? '请输入成本折扣' : '请输入成本优惠'}}">
        <input nz-input [type]="'number'" placeholder="{{this.dataForm.controls['partakeWay'].value === '3' ? '请输入成本折扣' : '请输入成本优惠'}}"  [formControlName]="'finalCostPrice'"/>
      </nz-form-control>
    </nz-form-item>

    <nz-form-item>
      <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>活动结束时间</nz-form-label>
      <nz-form-control [nzSm]="6" [nzXs]="24">
        <nz-date-picker nzFormat="yyyy-MM-dd " [nzPlaceHolder]="'请选择活动结束时间'" [formControlName]="'endTime'"></nz-date-picker>
      </nz-form-control>
    </nz-form-item>

    <nz-form-item nz-row class="register-area">
      <nz-form-control [nzSpan]="14" [nzOffset]="6">
        <button nz-button nzType="primary" style="width: 170px;" (click)="submitFrom()">提交</button>
      </nz-form-control>
    </nz-form-item>
  </form>

</nz-content>
