<template>

  <el-form class="dm-wrap" :model="form"  ref="form" :rules="rules" label-width="120px">
    <div class="border-radius2" style="padding:15px;margin-bottom:20px;">
        <cardTemp pbSize="pb15" :activeId.sync="form.proReferId" @emitActiveObj="getCardActiveObjFun"  :showPagination="false" :cardLimitType="3"></cardTemp>
    </div>
    <el-form-item prop="integralCost" label="积分费用">
      <el-input-number controls-position="right" :disabled="isInfo" v-model="form.integralCost" class="w300" :precison="0" :min="0"></el-input-number>
    </el-form-item>
    <el-form-item prop="cashCost" label="现金费用">
      <el-input-number controls-position="right" :disabled="isInfo" v-model="form.cashCost" class="w300" :precison="2" :min="0"></el-input-number>
    </el-form-item>
    <el-form-item prop="limitTimes" label="次数显示">
      <el-checkbox :disabled="isInfo" v-model="isLimitTimes"> 每个会员限制兑换
      </el-checkbox>
      <el-input-number controls-position="right" :disabled="isInfo || !isLimitTimes" v-model="form.limitTimes" class="w100" :precison="0" :min="0"></el-input-number> 次
    </el-form-item>
    <el-form-item prop="memberGradeArr" label="适用会员">
      <el-select v-model="form.memberGradeArr" multiple placeholder="请选择" class="w300">
        <el-option v-for="item in memberGradeOptions" :key="item.gradeId" :label="item.gradeName" :value="item.gradeId"></el-option>
      </el-select>
    </el-form-item>
    <el-form-item label="展现门店" class="is-required">
      <vue-gic-store-linkage :disabled="isInfo" :msg="sendChildData" ref="selectTree" @sendSelectGroupData="getSelectGroupData"></vue-gic-store-linkage>
    </el-form-item>
    <el-form-item prop="exchangeDateType" label="兑换日期" class="is-required">
      <el-radio-group v-model="form.exchangeDateType" style="line-height:inherit;">
        <div class="mb10"><el-radio :label="1">全部日期</el-radio></div>
        <div class="mb10"><el-radio :label="2">固定日期
          <el-date-picker v-model="form.exchangeFixDate" :disabled="form.exchangeDateType !== 2"  type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
        </el-radio></div>
        <div class="mb10"><el-radio  :label="3">每月
          <el-select v-model="form.exchangeDateDayArr" :disabled="form.exchangeDateType !== 3"  multiple filterable default-first-option placeholder="请选择">
            <el-option v-for="item in monthOptions" :key="item" :label="item" :value="item"></el-option>
          </el-select>
        </el-radio></div>
        <div class="mb10"><el-radio  :label="4">每周
           <el-select v-model="form.exchangeDateWeekArr" :disabled="form.exchangeDateType !== 4" multiple placeholder="请选择">
            <el-option v-for="item in exchangeDateWeekOptions" :key="item" :label="item" :value="item"></el-option>
          </el-select>
        </el-radio></div>
      </el-radio-group>
    </el-form-item>

    <el-form-item prop="exchangeTimeType" label="兑换时段" class="is-required">
      <el-radio-group v-model="form.exchangeTimeType">
        <div class="mb10"><el-radio :label="1">全部时段</el-radio></div>
        <div class="mb10">
          <el-radio :label="2" class="vertical-middle">部分时段</el-radio>
          <span class="gray fz13 vertical-top ml20">请使用24小时制输入时间，格式如11:00至14:30</span>
        </div>
        <p v-for="(v,i) in timeRangeList" :key="i" class="pb10">
          <el-time-picker :disabled="form.exchangeTimeType === 1" class="vertical-middle w250" is-range v-model="v.timeRange" value-format="HH:mm" format="HH:mm" range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" placeholder="选择时间范围"></el-time-picker>
          <el-button class="vertical-middle" type="text" @click="delTimeRange(i)">删除</el-button>
        </p>
        <p><el-button type="text" @click="addTimeRange">添加时间段</el-button></p>
      </el-radio-group>
    </el-form-item>

    <el-form-item prop="proShowStatus" label="显示状态">
      <el-radio-group v-model="form.proShowStatus">
        <el-radio :label="1">上架状态就显示</el-radio>
        <el-radio :label="2">兑换状态下显示</el-radio>
      </el-radio-group>
    </el-form-item>
    <el-form-item prop="releaseType" label="发布时间">
      <el-radio-group v-model="form.releaseType">
        <el-radio :label="1">立即发布</el-radio>
        <el-radio :label="2">定时发布
          <el-date-picker v-model="form.limitTimeBegin" type="datetime" placeholder="选择日期时间"></el-date-picker>
        </el-radio>
      </el-radio-group>
    </el-form-item>
    <div class="btn-wrap_fixed" :class="{'on':asideShow}">
      <el-button type="primary" @click="submit('form')" v-if="!isInfo">{{isAdd?'确认新增':'确认编辑'}}</el-button>
      <el-button @click="$router.go(-1)">返 回</el-button>
    </div>
  </el-form>
</template>

<script>
import infojs from './info.js';
export default infojs;
</script>
