<!--
 * @Descripttion: 当前组件信息
 * @version: 1.0.0
 * @Author: 无尘
 * @Date: 2019-11-18 10:37:02
 * @LastEditors: 无尘
 * @LastEditTime: 2019-11-29 16:40:52
 -->
<!--
<reward-config @submitBack="submitBack" @submitNext="submitNext"></reward-config>

import rewardConfig from '@/components/active-config/reward-config.vue';
-->
<template>
  <div class="reward-config-content">
    <div class="config-title font-14 color-303133">奖励配置</div>
    <el-form label-width="154px" :model="activeInfoData" ref="rewardForm" :rules="rules">
      <el-form-item label="奖励模式：" prop="awardMode">
        <ul class="flex">
          <template v-for="(item, index) in awardData">
            <li :class="['li-cell flex-1 ', activeInfoData.awardMode == item.goalId ? 'li-cell-active' : '']" :key="index + 'first'" @click="selectMode(item)">
              <div class="li-cell-inner flex ">
                <div class="li-cell-left flex flex-align-center flex-pack-center">
                  <img :src="activeInfoData.awardMode == item.goalId ? item.selectedIconUrl : item.iconUrl" alt="" />
                </div>
                <div class="li-cell-right border-box flex flex-column ">
                  <div class="li-cell-active_name flex flex-align-center  font-18 color-303133">{{ item.goalName }}</div>
                  <div class="li-cell-active_describe flex flex-align-center  font-14 color-606266">{{ item.describe }}</div>
                </div>
              </div>
              <div class="common-cell-check">
                <div class="common-cell-triangle">
                  <div class="common-cell-outer">
                    <i class="el-icon-upload-success el-icon-check"></i>
                  </div>
                </div>
              </div>
            </li>
          </template>
        </ul>
      </el-form-item>
      <el-form-item v-if="activeInfoData.awardMode == 1" label="奖励方案（多选）：" prop="">
        <ul class="flex  m-t-48">
          <template v-for="(item, index) in awardTypeData">
            <li :class="['li-cell li-second-cell flex-1 ', activeInfoData[item.key] ? 'li-second-active' : '']" :key="index + 'second'" @click="selectModeType(item, activeInfoData)">
              <div class="li-cell-inner">
                <div class="li-cell-bottom border-box">
                  <div class="li-cell-scene">
                    <div class="li-cell-scene_title font-14 color-303133">{{ item.goalName }}</div>
                    <div class="li-cell-scene_text font-14 color-606266">{{ item.describe }}</div>
                  </div>
                </div>
              </div>
              <div class="common-cell-check">
                <div class="common-cell-triangle">
                  <div class="common-cell-outer">
                    <i class="el-icon-upload-success el-icon-check"></i>
                  </div>
                </div>
              </div>
            </li>
          </template>
        </ul>
      </el-form-item>
      <el-form-item v-if="activeInfoData.awardMode == 1" class="m-t-50">
        <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
          <el-tab-pane v-if="basePath.map(ele => ele.transName).includes('消费')" label="消费行为控制" name="first">
            <!-- 消费行为控制 -->
            <consume-config ref="singleConsume" v-model="activeInfoData.consumeAction"></consume-config>
          </el-tab-pane>
          <el-tab-pane v-if="activeInfoData.instantAwardFlag" label="即时奖励配置" name="second">
            <!-- 即时奖励配置 -->
            <spot-award ref="singleSpot" v-model="activeInfoData.instanceAward"></spot-award>
          </el-tab-pane>
          <el-tab-pane v-if="activeInfoData.passAwardFlag" label="闯关奖励配置" name="third">
            <!-- 闯关奖励配置 -->
            <entry-award ref="singleEntry" v-model="activeInfoData.passAward"></entry-award>
          </el-tab-pane>
          <el-tab-pane v-if="activeInfoData.competitionAwardFlag" label="竞赛奖励配置" name="four">
            <competition-award ref="singleCompetition" v-model="activeInfoData.compitionAward"></competition-award>
            <!-- 竞赛奖励配置 -->
          </el-tab-pane>
          <el-tab-pane label="受邀人奖励" name="five">
            <!-- 受邀人奖励 -->
            <invitee-reward ref="singleInvitee" v-model="activeInfoData.invitedAward"></invitee-reward>
          </el-tab-pane>
          <el-tab-pane v-if="basePath.map(ele => ele.transName).includes('消费')" label="防欺诈风险控制" name="six">
            <!-- 防欺诈风险控制 -->
            <fraud-control ref="singleFreeze" v-model="activeInfoData.pointFreeze"></fraud-control>
          </el-tab-pane>
        </el-tabs>
      </el-form-item>
      <el-form-item v-if="activeInfoData.awardMode == 2" class="m-t-50">
        <ul class="active-big-class">
          <template v-for="(parentItem, ind) in ProgressiveData">
            <li :key="ind + 'set'" :class="['parent-li-cell border-box', parentItem.serviceAttentionFlag ? 'show-active-li' : '']">
              <div class="progress-active-title flex  flex-space-between border-box">
                <div class="active-title-left">
                  <div class="active-title-title font-16 color-303133">{{ parentItem.title }}</div>
                  <div class="active-title-subtitle font-14 color-606266 m-t-7">{{ parentItem.subTitle }}</div>
                </div>
                <div class="active-title-right flex flex-align-center">
                  <el-switch v-model="parentItem.serviceAttentionFlag" active-text="" inactive-text=""> </el-switch>
                </div>
              </div>
              <div v-if="parentItem.serviceAttentionFlag" class="set-body">
                <div data-v-6033a8b1="" class="el-form-item m-t-44">
                  <label for="" class="el-form-item__label" style="width: 115px;">奖励模式：</label>
                  <div class="el-form-item__content" style="margin-left: 115px;">
                    <ul class="flex  m-t-48">
                      <template v-for="(item, index) in awardTypeData">
                        <li :class="['li-cell li-second-cell flex-1 ', parentItem[item.key] ? 'li-second-active' : '']" :key="index + 'second'" @click="selectModeType(item, parentItem)">
                          <div class="li-cell-inner">
                            <div class="li-cell-bottom border-box">
                              <div class="li-cell-scene">
                                <div class="li-cell-scene_title font-14 color-303133">{{ item.goalName }}</div>
                                <div class="li-cell-scene_text font-14 color-606266">{{ item.describe }}</div>
                              </div>
                            </div>
                          </div>
                          <div class="common-cell-check">
                            <div class="common-cell-triangle">
                              <div class="common-cell-outer">
                                <i class="el-icon-upload-success el-icon-check"></i>
                              </div>
                            </div>
                          </div>
                        </li>
                      </template>
                    </ul>
                  </div>
                </div>
                <el-tabs class="m-t-30" v-model="parentItem.activeName" type="card" @tab-click="handleClick">
                  <el-tab-pane v-if="basePath.map(ele => ele.transName).includes('消费')" label="消费行为控制" name="first">
                    <!-- 消费行为控制 -->
                    <consume-config ref="singleConsume" v-model="parentItem.consumeAction"></consume-config>
                  </el-tab-pane>
                  <el-tab-pane v-if="parentItem.instantAwardFlag" label="即时奖励配置" name="second">
                    <!-- 即时奖励配置 -->
                    <spot-award></spot-award>
                  </el-tab-pane>
                  <el-tab-pane v-if="parentItem.passAwardFlag" label="闯关奖励配置" name="third">
                    <!-- 闯关奖励配置 -->
                    <entry-award></entry-award>
                  </el-tab-pane>
                  <el-tab-pane v-if="parentItem.competitionAwardFlag" label="竞赛奖励配置" name="four">
                    <competition-award></competition-award>
                    <!-- 竞赛奖励配置 -->
                  </el-tab-pane>
                  <el-tab-pane label="受邀人奖励" name="five">
                    <!-- 受邀人奖励 -->
                    <invitee-reward></invitee-reward>
                  </el-tab-pane>
                  <el-tab-pane v-if="basePath.map(ele => ele.transName).includes('消费')" label="防欺诈风险控制" name="six">
                    <!-- 防欺诈风险控制 -->
                    <fraud-control></fraud-control>
                  </el-tab-pane>
                </el-tabs>
              </div>
            </li>
            <li v-if="basePath.map(ele => ele.transName).includes('消费')" :key="ind + 'set'" :class="['parent-li-cell border-box', parentItem.serviceAttentionFlag ? 'show-active-li' : '']">
              <div class="progress-active-title flex  flex-space-between border-box">
                <div class="active-title-left">
                  <div class="active-title-title font-16 color-303133">{{ parentItem.title }}</div>
                  <div class="active-title-subtitle font-14 color-606266 m-t-7">{{ parentItem.subTitle }}</div>
                </div>
                <div class="active-title-right flex flex-align-center">
                  <el-switch v-model="parentItem.serviceAttentionFlag" active-text="" inactive-text=""> </el-switch>
                </div>
              </div>
              <div v-if="parentItem.serviceAttentionFlag" class="set-body">
                <div data-v-6033a8b1="" class="el-form-item m-t-44">
                  <label for="" class="el-form-item__label" style="width: 115px;">奖励模式：</label>
                  <div class="el-form-item__content" style="margin-left: 115px;">
                    <ul class="flex  m-t-48">
                      <template v-for="(item, index) in awardTypeData">
                        <li :class="['li-cell li-second-cell flex-1 ', parentItem[item.key] ? 'li-second-active' : '']" :key="index + 'second'" @click="selectModeType(item, parentItem)">
                          <div class="li-cell-inner">
                            <div class="li-cell-bottom border-box">
                              <div class="li-cell-scene">
                                <div class="li-cell-scene_title font-14 color-303133">{{ item.goalName }}</div>
                                <div class="li-cell-scene_text font-14 color-606266">{{ item.describe }}</div>
                              </div>
                            </div>
                          </div>
                          <div class="common-cell-check">
                            <div class="common-cell-triangle">
                              <div class="common-cell-outer">
                                <i class="el-icon-upload-success el-icon-check"></i>
                              </div>
                            </div>
                          </div>
                        </li>
                      </template>
                    </ul>
                  </div>
                </div>
                <el-tabs class="m-t-30" v-model="parentItem.activeName" type="card" @tab-click="handleClick">
                  <el-tab-pane v-if="basePath.map(ele => ele.transName).includes('消费')" label="消费行为控制" name="first">
                    <!-- 消费行为控制 -->
                    <consume-config ref="singleConsume" v-model="parentItem.consumeAction"></consume-config>
                  </el-tab-pane>
                  <el-tab-pane v-if="parentItem.instantAwardFlag" label="即时奖励配置" name="second">
                    <!-- 即时奖励配置 -->
                    <spot-award></spot-award>
                  </el-tab-pane>
                  <el-tab-pane v-if="parentItem.passAwardFlag" label="闯关奖励配置" name="third">
                    <!-- 闯关奖励配置 -->
                    <entry-award></entry-award>
                  </el-tab-pane>
                  <el-tab-pane v-if="parentItem.competitionAwardFlag" label="竞赛奖励配置" name="four">
                    <competition-award></competition-award>
                    <!-- 竞赛奖励配置 -->
                  </el-tab-pane>
                  <el-tab-pane label="受邀人奖励" name="five">
                    <!-- 受邀人奖励 -->
                    <invitee-reward></invitee-reward>
                  </el-tab-pane>
                  <el-tab-pane v-if="basePath.map(ele => ele.transName).includes('消费')" label="防欺诈风险控制" name="six">
                    <!-- 防欺诈风险控制 -->
                    <fraud-control></fraud-control>
                  </el-tab-pane>
                </el-tabs>
              </div>
            </li>
          </template>
        </ul>
      </el-form-item>
      <el-form-item class="m-t-50">
        <el-button type="primary" @click="submitBack">上一步</el-button>
        <el-button type="primary" @click="submitForm('rewardForm')">确认新建</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
/* eslint-disable */
import consumeConfig from '@/components/active-config/configs/consume-config.vue';
import spotAward from '@/components/active-config/configs/spot-award.vue';
import entryAward from '@/components/active-config/configs/entry-award.vue';
import competitionAward from '@/components/active-config/configs/competition-award.vue';
import inviteeReward from '@/components/active-config/configs/invitee-reward.vue';
import fraudControl from '@/components/active-config/configs/fraud-control.vue';
import { _debounce } from '@/common/js/public';
import showMsg from '@/common/js/showmsg';
import errMsg from '@/common/js/error';

import { getRequest, postJson } from '@/api/api';
export default {
  name: 'reward-config',
  props: {},
  components: {
    consumeConfig,
    spotAward,
    entryAward,
    competitionAward,
    inviteeReward,
    fraudControl
  },
  data() {
    return {
      basePath: [],
      switchObj: {
        serviceAttentionFlag: '服务号关注',
        entryActivityFlag: '访问活动营销页',
        authorizeOpenCardFlag: '会员认证',
        enjoyGameFlag: '游戏参与',
        receiveCardFlag: '卡券领取',
        consumeAwardFlag: '消费'
      },
      activeInfoData: {
        activityId: '',
        awardMode: '1',
        instantAwardFlag: 1, // 即时
        passAwardFlag: 0, // 闯关
        competitionAwardFlag: 0, // 竞赛
        serviceAttentionFlag: 0, // 服务号关注开关
        entryActivityFlag: 0, // 活动着陆页开关
        authorizeOpenCardFlag: 0, // 认证开卡奖励开关
        enjoyGameFlag: 0, // 参与游戏开关
        receiveCardFlag: 0, // 领取卡券开关
        consumeAwardFlag: 0, // 消费奖开关
        // 消费行为控制
        consumeAction: {
          consumeStoreControlFlag: 0, //消费门店控制开关 1控制，0不控制
          consumeStoreName: '', //消费门店文案
          dealAmountControlFlag: 0, //成交额控制开关 0不控制，1控制区间
          dealAmountControlMin: 1, //成交额控制最小值
          dealAmountControlMax: 1, //成交额控制最大值
          singleDealNumberControlFlag: 0, //单笔成交件数控制开关 0不控制，1控制区间
          singleDealNumberControlMin: 1, //单笔成交件数最小值
          singleDealNumberControlMax: 1, //单笔成交件数最大值
          uuid: '',
          storeList: []
        },
        // 即时奖励
        instanceAward: {
          instanceMade: 1, //即时奖励模式 1、定额奖励，2阶梯奖励，3成交额等比奖励
          instancePoint: 1, //奖励积分（定额中的积分，等比中的积分）
          instanceNumber: 1, //等比奖励种的每多少元
          instanceContent: [
            {
              start: 1,
              end: 5,
              point: 1,
              infinity: false
            },
            {
              start: 10,
              end: 20,
              point: 1,
              infinity: false
            }
          ], //即时奖励内容（阶梯内容） 奖励内容json字符串
          awardLimitType: 1, //奖励限制类型 1、不限制奖励（推荐），2、限制奖励次数，3、限制奖励额度
          awardLimitNumber: 1, //限制奖励次数
          awardLimitPoint: 1, //限制奖励额度
          stepType: 1 //步骤类型 类型：1服务号关注，2活动营销页访问奖励，3会员认证奖励，4游戏参与奖励，5卡券领取奖励6，消费奖励
        },
        // 闯关奖励
        passAward: {
          dealNumberFlag: 1, //成交人数开关 1开启
          dealAmountFlag: 0, //成交额开关 1开启
          dealNumberSettingParam: [], //成交人数奖项 成交人数奖项json
          dealAmountSettingParam: [], //成交额奖项 成交额奖项json
          stepType: 1 //步骤类型 类型：1服务号关注，2活动营销页访问奖励，3会员认证奖励，4游戏参与奖励，5卡券领取奖励6，消费奖励
        },
        // 竞赛奖励
        compitionAward: {
          dealNumberFlag: 1, //成交人数开关 1开启
          dealAmountFlag: 0, //成交额开关 1开启
          dealNumberSettingParam: [], //成交人数奖项 成交人数奖项json
          dealAmountSettingParam: [], //成交额奖项 成交额奖项json
          stepType: 1 //步骤类型 类型：1服务号关注，2活动营销页访问奖励，3会员认证奖励，4游戏参与奖励，5卡券领取奖励6，消费奖励
        },
        // 受邀人奖励
        invitedAward: {
          pointSettingFlag: true, //积分奖励开关 1开启
          cardSettingFlag: false, //卡券开关 1开启
          pointAwardMode: 1, //1、定额，2、阶梯，3、等比
          pointAwardPoint: 1, //定额奖励积分
          pointAwardStepParam: [
            {
              amount: 1,
              point: 1
            }
          ],
          pointAwardPerAmount: 1, //等比奖励中的每成交多少元
          pointAwardPerPoint: 1, //等比奖励中积分
          cardAwardMode: 0,
          cardId: '',
          cardName: '',
          cardAwardStepParam: [
            {
              amount: 1,
              cardId: '',
              cardName: ''
            }
          ]
        },
        // 防欺诈
        pointFreeze: {
          numberLimitType: 1,
          numberLimitNum: 1,
          awardLimitType: 1, //奖励限制类型 1、不限制奖励（推荐），2、限制奖励次数，3、限制奖励额度
          awardLimitNumber: 1, //额度
          operateDay: 1, //限制延时
          stepType: 1 //步骤类型 类型：1服务号关注，2活动营销页访问奖励，3会员认证奖励，4游戏参与奖励，5卡券领取奖励6，消费奖励
        }
      },
      rules: {
        awardMode: [{ required: true, message: '请选择奖励模式', trigger: 'blur' }]
      },
      awardData: [
        {
          goalId: 1,
          selectedIconUrl: require('../../assets/images/jl-pre.png'),
          iconUrl: require('../../assets/images/jl.png'),
          goalName: '单次奖励（推荐）',
          describe: '无论活动的转化路径分多少步，只有当受邀人完成了最后一步的行为，邀请人才能得到奖励。',
          check: false
        },
        {
          goalId: 2,
          selectedIconUrl: require('../../assets/images/lc-pre.png'),
          iconUrl: require('../../assets/images/lc.png'),
          goalName: '渐进式奖励',
          describe: '可以对转化路径当中的每一步单独配置奖励信息，即可以将转化路径理解为漏斗模型，邀请人可以分层获得奖励。'
        }
      ],
      awardTypeData: [
        {
          goalId: 1,
          key: 'instantAwardFlag',
          goalName: '即时奖励（推荐）',
          describe: '当受邀人满足完成了相关的行为，即时发放邀请人或受邀人的奖励。',
          check: false
        },
        {
          goalId: 2,
          key: 'passAwardFlag',
          goalName: '闯关奖励',
          describe: '满足相关行为的受邀人数量满足条件后，邀请人即可领取相关奖励，可设置难度逐级递增的多个阶段目标。',
          check: false
        },
        {
          goalId: 3,
          key: 'competitionAwardFlag',
          goalName: '竞赛奖励',
          describe: '活动结束后进行统一排名结算和奖励发放的模式，奖项信息可自定义设置。',
          check: false
        }
      ],
      // el-tabs
      activeName: 'first',
      // 渐进式奖励
      ProgressiveData: [
        {
          activeName: 'first', // tab,
          serviceAttentionFlag: false, // 服务号关注开关
          entryActivityFlag: false, // 活动着陆页开关
          authorizeOpenCardFlag: false, // 认证开卡奖励开关
          enjoyGameFlag: false, // 参与游戏开关
          receiveCardFlag: false, // 领取卡券开关
          consumeAwardFlag: false, // 消费奖开关
          title: '服务号关注奖励',
          subTitle: '当受邀人成功关注了服务号之后触发的奖励，开启后可配置相关奖励内容，若该行为无奖励则保持关闭状态即可。',
          instantAwardFlag: 1, // 即时
          passAwardFlag: 0, // 闯关
          competitionAwardFlag: 0, // 竞赛
          // 消费行为控制
          consumeAction: {
            consumeStoreControlFlag: 0, //消费门店控制开关 1控制，0不控制
            consumeStoreName: '', //消费门店文案
            dealAmountControlFlag: 0, //成交额控制开关 0不控制，1控制区间
            dealAmountControlMin: 1, //成交额控制最小值
            dealAmountControlMax: 1, //成交额控制最大值
            singleDealNumberControlFlag: 0, //单笔成交件数控制开关 0不控制，1控制区间
            singleDealNumberControlMin: 1, //单笔成交件数最小值
            singleDealNumberControlMax: 1, //单笔成交件数最大值
            uuid: '',
            storeList: []
          },
          // 即时奖励
          instanceAward: {
            instanceMade: 1, //即时奖励模式 1、定额奖励，2阶梯奖励，3成交额等比奖励
            instancePoint: 1, //奖励积分（定额中的积分，等比中的积分）
            instanceNumber: 1, //等比奖励种的每多少元
            instanceContent: [
              {
                start: 1,
                end: 5,
                point: 1,
                infinity: false
              },
              {
                start: 10,
                end: 20,
                point: 1,
                infinity: false
              }
            ], //即时奖励内容（阶梯内容） 奖励内容json字符串
            awardLimitType: 1, //奖励限制类型 1、不限制奖励（推荐），2、限制奖励次数，3、限制奖励额度
            awardLimitNumber: 1, //限制奖励次数
            awardLimitPoint: 1, //限制奖励额度
            stepType: 1 //步骤类型 类型：1服务号关注，2活动营销页访问奖励，3会员认证奖励，4游戏参与奖励，5卡券领取奖励6，消费奖励
          },
          // 闯关奖励
          passAward: {
            dealNumberFlag: 1, //成交人数开关 1开启
            dealAmountFlag: 0, //成交额开关 1开启
            dealNumberSettingParam: [], //成交人数奖项 成交人数奖项json
            dealAmountSettingParam: [], //成交额奖项 成交额奖项json
            stepType: 1 //步骤类型 类型：1服务号关注，2活动营销页访问奖励，3会员认证奖励，4游戏参与奖励，5卡券领取奖励6，消费奖励
          },
          // 竞赛奖励
          compitionAward: {
            dealNumberFlag: 1, //成交人数开关 1开启
            dealAmountFlag: 0, //成交额开关 1开启
            dealNumberSettingParam: [], //成交人数奖项 成交人数奖项json
            dealAmountSettingParam: [], //成交额奖项 成交额奖项json
            stepType: 1 //步骤类型 类型：1服务号关注，2活动营销页访问奖励，3会员认证奖励，4游戏参与奖励，5卡券领取奖励6，消费奖励
          },
          // 受邀人奖励
          invitedAward: {
            pointSettingFlag: true, //积分奖励开关 1开启
            cardSettingFlag: false, //卡券开关 1开启
            pointAwardMode: 1, //1、定额，2、阶梯，3、等比
            pointAwardPoint: 1, //定额奖励积分
            pointAwardStepParam: [
              {
                amount: 1,
                point: 1
              }
            ],
            pointAwardPerAmount: 1, //等比奖励中的每成交多少元
            pointAwardPerPoint: 1, //等比奖励中积分
            cardAwardMode: 0,
            cardId: '',
            cardName: '',
            cardAwardStepParam: [
              {
                amount: 1,
                cardId: '',
                cardName: ''
              }
            ]
          },
          // 防欺诈
          pointFreeze: {
            numberLimitType: 1,
            numberLimitNum: 1,
            awardLimitType: 1, //奖励限制类型 1、不限制奖励（推荐），2、限制奖励次数，3、限制奖励额度
            awardLimitNumber: 1, //额度
            operateDay: 1, //限制延时
            stepType: 1 //步骤类型 类型：1服务号关注，2活动营销页访问奖励，3会员认证奖励，4游戏参与奖励，5卡券领取奖励6，消费奖励
          }
        },
        {
          activeName: 'first',
          serviceAttentionFlag: false, // 服务号关注开关
          entryActivityFlag: false, // 活动着陆页开关
          authorizeOpenCardFlag: false, // 认证开卡奖励开关
          enjoyGameFlag: false, // 参与游戏开关
          receiveCardFlag: false, // 领取卡券开关
          consumeAwardFlag: false, // 消费奖开关
          title: '活动营销页访问奖励',
          subTitle: '当受邀人成功访问了指定活动营销页之后触发的奖励，开启后可配置相关奖励内容，若该行为无奖励则保持关闭状态即可。',
          instantAwardFlag: 1, // 即时
          passAwardFlag: 0, // 闯关
          competitionAwardFlag: 0, // 竞赛
          // 消费行为控制
          consumeAction: {
            consumeStoreControlFlag: 0, //消费门店控制开关 1控制，0不控制
            consumeStoreName: '', //消费门店文案
            dealAmountControlFlag: 0, //成交额控制开关 0不控制，1控制区间
            dealAmountControlMin: 1, //成交额控制最小值
            dealAmountControlMax: 1, //成交额控制最大值
            singleDealNumberControlFlag: 0, //单笔成交件数控制开关 0不控制，1控制区间
            singleDealNumberControlMin: 1, //单笔成交件数最小值
            singleDealNumberControlMax: 1, //单笔成交件数最大值
            uuid: '',
            storeList: []
          },
          // 即时奖励
          instanceAward: {
            instanceMade: 1, //即时奖励模式 1、定额奖励，2阶梯奖励，3成交额等比奖励
            instancePoint: 1, //奖励积分（定额中的积分，等比中的积分）
            instanceNumber: 1, //等比奖励种的每多少元
            instanceContent: [
              {
                start: 1,
                end: 5,
                point: 1,
                infinity: false
              },
              {
                start: 10,
                end: 20,
                point: 1,
                infinity: false
              }
            ], //即时奖励内容（阶梯内容） 奖励内容json字符串
            awardLimitType: 1, //奖励限制类型 1、不限制奖励（推荐），2、限制奖励次数，3、限制奖励额度
            awardLimitNumber: 1, //限制奖励次数
            awardLimitPoint: 1, //限制奖励额度
            stepType: 1 //步骤类型 类型：1服务号关注，2活动营销页访问奖励，3会员认证奖励，4游戏参与奖励，5卡券领取奖励6，消费奖励
          },
          // 闯关奖励
          passAward: {
            dealNumberFlag: 1, //成交人数开关 1开启
            dealAmountFlag: 0, //成交额开关 1开启
            dealNumberSettingParam: [], //成交人数奖项 成交人数奖项json
            dealAmountSettingParam: [], //成交额奖项 成交额奖项json
            stepType: 1 //步骤类型 类型：1服务号关注，2活动营销页访问奖励，3会员认证奖励，4游戏参与奖励，5卡券领取奖励6，消费奖励
          },
          // 竞赛奖励
          compitionAward: {
            dealNumberFlag: 1, //成交人数开关 1开启
            dealAmountFlag: 0, //成交额开关 1开启
            dealNumberSettingParam: [], //成交人数奖项 成交人数奖项json
            dealAmountSettingParam: [], //成交额奖项 成交额奖项json
            stepType: 1 //步骤类型 类型：1服务号关注，2活动营销页访问奖励，3会员认证奖励，4游戏参与奖励，5卡券领取奖励6，消费奖励
          },
          // 受邀人奖励
          invitedAward: {
            pointSettingFlag: true, //积分奖励开关 1开启
            cardSettingFlag: false, //卡券开关 1开启
            pointAwardMode: 1, //1、定额，2、阶梯，3、等比
            pointAwardPoint: 1, //定额奖励积分
            pointAwardStepParam: [
              {
                amount: 1,
                point: 1
              }
            ],
            pointAwardPerAmount: 1, //等比奖励中的每成交多少元
            pointAwardPerPoint: 1, //等比奖励中积分
            cardAwardMode: 0,
            cardId: '',
            cardName: '',
            cardAwardStepParam: [
              {
                amount: 1,
                cardId: '',
                cardName: ''
              }
            ]
          },
          // 防欺诈
          pointFreeze: {
            numberLimitType: 1,
            numberLimitNum: 1,
            awardLimitType: 1, //奖励限制类型 1、不限制奖励（推荐），2、限制奖励次数，3、限制奖励额度
            awardLimitNumber: 1, //额度
            operateDay: 1, //限制延时
            stepType: 1 //步骤类型 类型：1服务号关注，2活动营销页访问奖励，3会员认证奖励，4游戏参与奖励，5卡券领取奖励6，消费奖励
          }
        },
        {
          activeName: 'first',
          serviceAttentionFlag: false, // 服务号关注开关
          entryActivityFlag: false, // 活动着陆页开关
          authorizeOpenCardFlag: false, // 认证开卡奖励开关
          enjoyGameFlag: false, // 参与游戏开关
          receiveCardFlag: false, // 领取卡券开关
          consumeAwardFlag: false, // 消费奖开关
          title: '会员认证奖励',
          subTitle: '当受邀人完成了会员认证之后触发的奖励，开启后可配置相关奖励内容，若该行为无奖励则保持关闭状态即可。',
          instantAwardFlag: 1, // 即时
          passAwardFlag: 0, // 闯关
          competitionAwardFlag: 0, // 竞赛
          // 消费行为控制
          consumeAction: {
            consumeStoreControlFlag: 0, //消费门店控制开关 1控制，0不控制
            consumeStoreName: '', //消费门店文案
            dealAmountControlFlag: 0, //成交额控制开关 0不控制，1控制区间
            dealAmountControlMin: 1, //成交额控制最小值
            dealAmountControlMax: 1, //成交额控制最大值
            singleDealNumberControlFlag: 0, //单笔成交件数控制开关 0不控制，1控制区间
            singleDealNumberControlMin: 1, //单笔成交件数最小值
            singleDealNumberControlMax: 1, //单笔成交件数最大值
            uuid: '',
            storeList: []
          },
          // 即时奖励
          instanceAward: {
            instanceMade: 1, //即时奖励模式 1、定额奖励，2阶梯奖励，3成交额等比奖励
            instancePoint: 1, //奖励积分（定额中的积分，等比中的积分）
            instanceNumber: 1, //等比奖励种的每多少元
            instanceContent: [
              {
                start: 1,
                end: 5,
                point: 1,
                infinity: false
              },
              {
                start: 10,
                end: 20,
                point: 1,
                infinity: false
              }
            ], //即时奖励内容（阶梯内容） 奖励内容json字符串
            awardLimitType: 1, //奖励限制类型 1、不限制奖励（推荐），2、限制奖励次数，3、限制奖励额度
            awardLimitNumber: 1, //限制奖励次数
            awardLimitPoint: 1, //限制奖励额度
            stepType: 1 //步骤类型 类型：1服务号关注，2活动营销页访问奖励，3会员认证奖励，4游戏参与奖励，5卡券领取奖励6，消费奖励
          },
          // 闯关奖励
          passAward: {
            dealNumberFlag: 1, //成交人数开关 1开启
            dealAmountFlag: 0, //成交额开关 1开启
            dealNumberSettingParam: [
              {
                achieve: 5,
                point: 1,
                pointCheck: false,
                cardId: '',
                cardName: '',
                cardCheck: false
              }
            ], //成交人数奖项 成交人数奖项json
            dealAmountSettingParam: [
              {
                achieve: 5,
                point: 1,
                pointCheck: false,
                cardId: '',
                cardName: '',
                cardCheck: false
              }
            ], //成交额奖项 成交额奖项json
            stepType: 1 //步骤类型 类型：1服务号关注，2活动营销页访问奖励，3会员认证奖励，4游戏参与奖励，5卡券领取奖励6，消费奖励
          },
          // 竞赛奖励
          compitionAward: {
            dealNumberFlag: 1, //成交人数开关 1开启
            dealAmountFlag: 0, //成交额开关 1开启
            dealNumberSettingParam: [], //成交人数奖项 成交人数奖项json
            dealAmountSettingParam: [], //成交额奖项 成交额奖项json
            stepType: 1 //步骤类型 类型：1服务号关注，2活动营销页访问奖励，3会员认证奖励，4游戏参与奖励，5卡券领取奖励6，消费奖励
          },
          // 受邀人奖励
          invitedAward: {
            pointSettingFlag: true, //积分奖励开关 1开启
            cardSettingFlag: false, //卡券开关 1开启
            pointAwardMode: 1, //1、定额，2、阶梯，3、等比
            pointAwardPoint: 1, //定额奖励积分
            pointAwardStepParam: [
              {
                amount: 1,
                point: 1
              }
            ],
            pointAwardPerAmount: 1, //等比奖励中的每成交多少元
            pointAwardPerPoint: 1, //等比奖励中积分
            cardAwardMode: 0,
            cardId: '',
            cardName: '',
            cardAwardStepParam: [
              {
                amount: 1,
                cardId: '',
                cardName: ''
              }
            ]
          },
          // 防欺诈
          pointFreeze: {
            numberLimitType: 1,
            numberLimitNum: 1,
            awardLimitType: 1, //奖励限制类型 1、不限制奖励（推荐），2、限制奖励次数，3、限制奖励额度
            awardLimitNumber: 1, //额度
            operateDay: 1, //限制延时
            stepType: 1 //步骤类型 类型：1服务号关注，2活动营销页访问奖励，3会员认证奖励，4游戏参与奖励，5卡券领取奖励6，消费奖励
          }
        },
        {
          activeName: 'first',
          serviceAttentionFlag: false, // 服务号关注开关
          entryActivityFlag: false, // 活动着陆页开关
          authorizeOpenCardFlag: false, // 认证开卡奖励开关
          enjoyGameFlag: false, // 参与游戏开关
          receiveCardFlag: false, // 领取卡券开关
          consumeAwardFlag: false, // 消费奖开关
          title: '游戏参与奖励',
          subTitle: '当受邀人成功参与了指定游戏之后触发的奖励，开启后可配置相关奖励内容，若该行为无奖励则保持关闭状态即可。',
          instantAwardFlag: 1, // 即时
          passAwardFlag: 0, // 闯关
          competitionAwardFlag: 0, // 竞赛
          // 消费行为控制
          consumeAction: {
            consumeStoreControlFlag: 0, //消费门店控制开关 1控制，0不控制
            consumeStoreName: '', //消费门店文案
            dealAmountControlFlag: 0, //成交额控制开关 0不控制，1控制区间
            dealAmountControlMin: 1, //成交额控制最小值
            dealAmountControlMax: 1, //成交额控制最大值
            singleDealNumberControlFlag: 0, //单笔成交件数控制开关 0不控制，1控制区间
            singleDealNumberControlMin: 1, //单笔成交件数最小值
            singleDealNumberControlMax: 1, //单笔成交件数最大值
            uuid: '',
            storeList: []
          },
          // 即时奖励
          instanceAward: {
            instanceMade: 1, //即时奖励模式 1、定额奖励，2阶梯奖励，3成交额等比奖励
            instancePoint: 1, //奖励积分（定额中的积分，等比中的积分）
            instanceNumber: 1, //等比奖励种的每多少元
            instanceContent: [
              {
                start: 1,
                end: 5,
                point: 1,
                infinity: false
              },
              {
                start: 10,
                end: 20,
                point: 1,
                infinity: false
              }
            ], //即时奖励内容（阶梯内容） 奖励内容json字符串
            awardLimitType: 1, //奖励限制类型 1、不限制奖励（推荐），2、限制奖励次数，3、限制奖励额度
            awardLimitNumber: 1, //限制奖励次数
            awardLimitPoint: 1, //限制奖励额度
            stepType: 1 //步骤类型 类型：1服务号关注，2活动营销页访问奖励，3会员认证奖励，4游戏参与奖励，5卡券领取奖励6，消费奖励
          },
          // 闯关奖励
          passAward: {
            dealNumberFlag: 1, //成交人数开关 1开启
            dealAmountFlag: 0, //成交额开关 1开启
            dealNumberSettingParam: [], //成交人数奖项 成交人数奖项json
            dealAmountSettingParam: [], //成交额奖项 成交额奖项json
            stepType: 1 //步骤类型 类型：1服务号关注，2活动营销页访问奖励，3会员认证奖励，4游戏参与奖励，5卡券领取奖励6，消费奖励
          },
          // 竞赛奖励
          compitionAward: {
            dealNumberFlag: 1, //成交人数开关 1开启
            dealAmountFlag: 0, //成交额开关 1开启
            dealNumberSettingParam: [], //成交人数奖项 成交人数奖项json
            dealAmountSettingParam: [], //成交额奖项 成交额奖项json
            stepType: 1 //步骤类型 类型：1服务号关注，2活动营销页访问奖励，3会员认证奖励，4游戏参与奖励，5卡券领取奖励6，消费奖励
          },
          // 受邀人奖励
          invitedAward: {
            pointSettingFlag: true, //积分奖励开关 1开启
            cardSettingFlag: false, //卡券开关 1开启
            pointAwardMode: 1, //1、定额，2、阶梯，3、等比
            pointAwardPoint: 1, //定额奖励积分
            pointAwardStepParam: [
              {
                amount: 1,
                point: 1
              }
            ],
            pointAwardPerAmount: 1, //等比奖励中的每成交多少元
            pointAwardPerPoint: 1, //等比奖励中积分
            cardAwardMode: 0,
            cardId: '',
            cardName: '',
            cardAwardStepParam: [
              {
                amount: 1,
                cardId: '',
                cardName: ''
              }
            ]
          },
          // 防欺诈
          pointFreeze: {
            numberLimitType: 1,
            numberLimitNum: 1,
            awardLimitType: 1, //奖励限制类型 1、不限制奖励（推荐），2、限制奖励次数，3、限制奖励额度
            awardLimitNumber: 1, //额度
            operateDay: 1, //限制延时
            stepType: 1 //步骤类型 类型：1服务号关注，2活动营销页访问奖励，3会员认证奖励，4游戏参与奖励，5卡券领取奖励6，消费奖励
          }
        },
        {
          activeName: 'first',
          serviceAttentionFlag: false, // 服务号关注开关
          entryActivityFlag: false, // 活动着陆页开关
          authorizeOpenCardFlag: false, // 认证开卡奖励开关
          enjoyGameFlag: false, // 参与游戏开关
          receiveCardFlag: false, // 领取卡券开关
          consumeAwardFlag: false, // 消费奖开关
          title: '卡券领取奖励',
          subTitle: '当受邀人成功领取了指定卡券之后触发的奖励，开启后可配置相关奖励内容，若该行为无奖励则保持关闭状态即可。',
          instantAwardFlag: 1, // 即时
          passAwardFlag: 0, // 闯关
          competitionAwardFlag: 0, // 竞赛
          // 消费行为控制
          consumeAction: {
            consumeStoreControlFlag: 0, //消费门店控制开关 1控制，0不控制
            consumeStoreName: '', //消费门店文案
            dealAmountControlFlag: 0, //成交额控制开关 0不控制，1控制区间
            dealAmountControlMin: 1, //成交额控制最小值
            dealAmountControlMax: 1, //成交额控制最大值
            singleDealNumberControlFlag: 0, //单笔成交件数控制开关 0不控制，1控制区间
            singleDealNumberControlMin: 1, //单笔成交件数最小值
            singleDealNumberControlMax: 1, //单笔成交件数最大值
            uuid: '',
            storeList: []
          },
          // 即时奖励
          instanceAward: {
            instanceMade: 1, //即时奖励模式 1、定额奖励，2阶梯奖励，3成交额等比奖励
            instancePoint: 1, //奖励积分（定额中的积分，等比中的积分）
            instanceNumber: 1, //等比奖励种的每多少元
            instanceContent: [
              {
                start: 1,
                end: 5,
                point: 1,
                infinity: false
              },
              {
                start: 10,
                end: 20,
                point: 1,
                infinity: false
              }
            ], //即时奖励内容（阶梯内容） 奖励内容json字符串
            awardLimitType: 1, //奖励限制类型 1、不限制奖励（推荐），2、限制奖励次数，3、限制奖励额度
            awardLimitNumber: 1, //限制奖励次数
            awardLimitPoint: 1, //限制奖励额度
            stepType: 1 //步骤类型 类型：1服务号关注，2活动营销页访问奖励，3会员认证奖励，4游戏参与奖励，5卡券领取奖励6，消费奖励
          },
          // 闯关奖励
          passAward: {
            dealNumberFlag: 1, //成交人数开关 1开启
            dealAmountFlag: 0, //成交额开关 1开启
            dealNumberSettingParam: [], //成交人数奖项 成交人数奖项json
            dealAmountSettingParam: [], //成交额奖项 成交额奖项json
            stepType: 1 //步骤类型 类型：1服务号关注，2活动营销页访问奖励，3会员认证奖励，4游戏参与奖励，5卡券领取奖励6，消费奖励
          },
          // 竞赛奖励
          compitionAward: {
            dealNumberFlag: 1, //成交人数开关 1开启
            dealAmountFlag: 0, //成交额开关 1开启
            dealNumberSettingParam: [], //成交人数奖项 成交人数奖项json
            dealAmountSettingParam: [], //成交额奖项 成交额奖项json
            stepType: 1 //步骤类型 类型：1服务号关注，2活动营销页访问奖励，3会员认证奖励，4游戏参与奖励，5卡券领取奖励6，消费奖励
          },
          // 受邀人奖励
          invitedAward: {
            pointSettingFlag: true, //积分奖励开关 1开启
            cardSettingFlag: false, //卡券开关 1开启
            pointAwardMode: 1, //1、定额，2、阶梯，3、等比
            pointAwardPoint: 1, //定额奖励积分
            pointAwardStepParam: [
              {
                amount: 1,
                point: 1
              }
            ],
            pointAwardPerAmount: 1, //等比奖励中的每成交多少元
            pointAwardPerPoint: 1, //等比奖励中积分
            cardAwardMode: 0,
            cardId: '',
            cardName: '',
            cardAwardStepParam: [
              {
                amount: 1,
                cardId: '',
                cardName: ''
              }
            ]
          },
          // 防欺诈
          pointFreeze: {
            numberLimitType: 1,
            numberLimitNum: 1,
            awardLimitType: 1, //奖励限制类型 1、不限制奖励（推荐），2、限制奖励次数，3、限制奖励额度
            awardLimitNumber: 1, //额度
            operateDay: 1, //限制延时
            stepType: 1 //步骤类型 类型：1服务号关注，2活动营销页访问奖励，3会员认证奖励，4游戏参与奖励，5卡券领取奖励6，消费奖励
          }
        },
        {
          activeName: 'first',
          serviceAttentionFlag: false, // 服务号关注开关
          entryActivityFlag: false, // 活动着陆页开关
          authorizeOpenCardFlag: false, // 认证开卡奖励开关
          enjoyGameFlag: false, // 参与游戏开关
          receiveCardFlag: false, // 领取卡券开关
          consumeAwardFlag: false, // 消费奖开关
          title: '消费奖励',
          subTitle: '当受邀人进行了消费之后触发的奖励，开启后可配置相关奖励内容，若该行为无奖励则保持关闭状态即可。',
          instantAwardFlag: 1, // 即时
          passAwardFlag: 0, // 闯关
          competitionAwardFlag: 0, // 竞赛
          // 消费行为控制
          consumeAction: {
            consumeStoreControlFlag: 0, //消费门店控制开关 1控制，0不控制
            consumeStoreName: '', //消费门店文案
            dealAmountControlFlag: 0, //成交额控制开关 0不控制，1控制区间
            dealAmountControlMin: 1, //成交额控制最小值
            dealAmountControlMax: 1, //成交额控制最大值
            singleDealNumberControlFlag: 0, //单笔成交件数控制开关 0不控制，1控制区间
            singleDealNumberControlMin: 1, //单笔成交件数最小值
            singleDealNumberControlMax: 1, //单笔成交件数最大值
            uuid: '',
            storeList: []
          },
          // 即时奖励
          instanceAward: {
            instanceMade: 1, //即时奖励模式 1、定额奖励，2阶梯奖励，3成交额等比奖励
            instancePoint: 1, //奖励积分（定额中的积分，等比中的积分）
            instanceNumber: 1, //等比奖励种的每多少元
            instanceContent: [
              {
                start: 1,
                end: 5,
                point: 1,
                infinity: false
              },
              {
                start: 10,
                end: 20,
                point: 1,
                infinity: false
              }
            ], //即时奖励内容（阶梯内容） 奖励内容json字符串
            awardLimitType: 1, //奖励限制类型 1、不限制奖励（推荐），2、限制奖励次数，3、限制奖励额度
            awardLimitNumber: 1, //限制奖励次数
            awardLimitPoint: 1, //限制奖励额度
            stepType: 1 //步骤类型 类型：1服务号关注，2活动营销页访问奖励，3会员认证奖励，4游戏参与奖励，5卡券领取奖励6，消费奖励
          },
          // 闯关奖励
          passAward: {
            dealNumberFlag: 1, //成交人数开关 1开启
            dealAmountFlag: 0, //成交额开关 1开启
            dealNumberSettingParam: [], //成交人数奖项 成交人数奖项json
            dealAmountSettingParam: [], //成交额奖项 成交额奖项json
            stepType: 1 //步骤类型 类型：1服务号关注，2活动营销页访问奖励，3会员认证奖励，4游戏参与奖励，5卡券领取奖励6，消费奖励
          },
          // 竞赛奖励
          compitionAward: {
            dealNumberFlag: 1, //成交人数开关 1开启
            dealAmountFlag: 0, //成交额开关 1开启
            dealNumberSettingParam: [], //成交人数奖项 成交人数奖项json
            dealAmountSettingParam: [], //成交额奖项 成交额奖项json
            stepType: 1 //步骤类型 类型：1服务号关注，2活动营销页访问奖励，3会员认证奖励，4游戏参与奖励，5卡券领取奖励6，消费奖励
          },
          // 受邀人奖励
          invitedAward: {
            pointSettingFlag: true, //积分奖励开关 1开启
            cardSettingFlag: false, //卡券开关 1开启
            pointAwardMode: 1, //1、定额，2、阶梯，3、等比
            pointAwardPoint: 1, //定额奖励积分
            pointAwardStepParam: [
              {
                amount: 1,
                point: 1
              }
            ],
            pointAwardPerAmount: 1, //等比奖励中的每成交多少元
            pointAwardPerPoint: 1, //等比奖励中积分
            cardAwardMode: 0,
            cardId: '',
            cardName: '',
            cardAwardStepParam: [
              {
                amount: 1,
                cardId: '',
                cardName: ''
              }
            ]
          },
          // 防欺诈
          pointFreeze: {
            numberLimitType: 1,
            numberLimitNum: 1,
            awardLimitType: 1, //奖励限制类型 1、不限制奖励（推荐），2、限制奖励次数，3、限制奖励额度
            awardLimitNumber: 1, //额度
            operateDay: 1, //限制延时
            stepType: 1 //步骤类型 类型：1服务号关注，2活动营销页访问奖励，3会员认证奖励，4游戏参与奖励，5卡券领取奖励6，消费奖励
          }
        }
      ]
    };
  },
  methods: {
    /**
     * 选择模式
     */
    selectMode(item) {
      const that = this;
      that.activeInfoData.awardMode = item.goalId;
    },
    selectModeType(item, pItem) {
      const that = this;
      pItem[item.key] = pItem[item.key] ? 0 : 1;
    },
    /**
     * 选择tab
     */
    handleClick(tab, event) {
      console.log(tab, event);
    },
    /**
     * 上一步
     */
    submitBack() {
      const that = this;
      that.$store.dispatch('saveRewardInfo', that.activeInfoData);
      that.$emit('submitBack');
    },
    /**
     * 下一步
     */
    submitForm: _debounce(function(formName) {
      const that = this;
      that.$refs[formName].validate(valid => {
        if (valid) {
          if (that.activeInfoData.awardMode == 1) {
            that.singleCheck(); // 判断单次
          } else {
            that.moreCheck(); // 判断渐进式
          }
        } else {
          return false;
        }
      });
    }, 500),
    async singleCheck() {
      const that = this;
      const flag = that.basePath.map(ele => ele.transName).includes('消费') ? await that.$refs.singleConsume.submitForm() : true;
      if (!flag) {
        showMsg.showmsg('请完善消费行为控制', 'warning');
        return false;
      }
      const spot = that.activeInfoData.instantAwardFlag == 1 ? await that.$refs.singleSpot.submitForm() : true;
      console.log(spot);
      if (!spot) {
        showMsg.showmsg('请完善即时奖励配置', 'warning');
        return false;
      }
      const entry = that.activeInfoData.passAwardFlag == 1 ? await that.$refs.singleEntry.submitForm() : true;
      console.log(entry);
      if (!entry) {
        showMsg.showmsg('请完善闯关奖励配置', 'warning');
        return false;
      }
      const competition = that.activeInfoData.competitionAwardFlag == 1 ? await that.$refs.singleCompetition.submitForm() : true;
      console.log(competition);
      if (!competition) {
        showMsg.showmsg('请完善竞赛奖励配置', 'warning');
        return false;
      }
      const invitee = await that.$refs.singleInvitee.submitForm();
      console.log(invitee);
      if (!invitee) {
        showMsg.showmsg('请完善受邀人奖励配置', 'warning');
        return false;
      }
      const freeze = that.basePath.map(ele => ele.transName).includes('消费') ? await that.$refs.singleFreeze.submitForm() : true;
      console.log(freeze);
      console.log('单次数据', that.activeInfoData);
      const postData = {
        activityId: that.activeInfoData.activityId,
        awardMode: that.activeInfoData.awardMode,
        awardItems: [that.activeInfoData]
      };
      that.postSave(postData);
    },
    async moreCheck() {
      const that = this;
      that.postSave();
    },
    postSave(data) {
      const that = this;
      let para = JSON.parse(JSON.stringify(data));
      // 最后需要中心组装数据， [{}] json数组形式传递
      postJson('/sharing-core-web/edit-activity-award', para)
        .then(res => {
          let resData = res.data;
          if (resData.errorCode == 1) {
            showMsg.showmsg('活动创建成功', 'success');
            that.$store.dispatch('clearActiveData');
            return;
          }
          errMsg.errorMsg(resData);
        })
        .catch(function(error) {
          that.$message.error({
            duration: 1000,
            message: error.message
          });
        });
    },
    /**
     * 获取活动中心数据
     */
    getData() {
      const that = this;
      let para = {
        activityId: that.$route.query.activityId
      };
      getRequest('/sharing-core-web/get-activity-award', para)
        .then(res => {
          let resData = res.data;
          if (resData.errorCode == 1) {
            if (!resData.result) {
              return false;
            }
            that.activeInfoData = resData.result;
            return false;
          }
          errMsg.errorMsg(resData);
        })
        .catch(function(error) {
          that.$message.error({
            duration: 1000,
            message: error.message
          });
        });
    }
  },
  mounted() {
    const that = this;
    if (that.$route.query.hasOwnProperty('activityId')) {
      that.getData();
    }
    if (Object.keys(that.$store.state.baseInfo).length) {
      that.basePath = JSON.parse(JSON.stringify(that.$store.state.baseInfo)).router;
      const names = that.basePath.map(ele => ele.transName);
      if (names.includes('消费')) {
        that.activeName = 'first';
      } else {
        that.activeName = 'second';
      }
      for (const i in that.switchObj) {
        that.activeInfoData[i] = names[names.length - 1].includes(that.switchObj[i]) ? 1 : 0;
      }
      if (names[names.length - 1].includes('领取卡券')) {
        that.activeInfoData.consumeAwardFlag = 1;
      }
      that.activeInfoData.activityId = JSON.parse(JSON.stringify(that.$store.state.baseInfo)).activityId;
    }
    if (Object.keys(that.$store.state.rewardInfo).length) {
      that.$nextTick(() => {
        that.activeInfoData = JSON.parse(JSON.stringify(that.$store.state.rewardInfo));
      });
    }
  }
};
</script>
<style lang="less" scoped>
.reward-config-content {
  padding: 48px 0 0 0;
  .config-title {
    font-weight: 600;
    margin-bottom: 30px;
  }
  .m-t-30 {
    margin-top: 30px;
  }
  .m-t-50 {
    margin-top: 50px;
  }
  .el-form-item {
    /deep/ .el-form-item__label {
      color: #606266;
    }
  }
  ul {
    .li-cell {
      position: relative;
      width: 362px;
      height: 124px;
      background: rgba(255, 255, 255, 1);
      border-radius: 4px;
      border: 1px solid rgba(220, 223, 230, 1);
      margin-left: 10px;
      cursor: pointer;
      max-width: 30%;
      &:first-child {
        margin-left: 0;
      }
      .li-cell-inner {
        border-radius: 4px;
        width: 100%;
        height: 100%;
        .li-cell-left {
          height: 100%;
          padding-left: 30px;
          img {
            max-width: 66px;
            max-height: 66px;
          }
        }
        .li-cell-right {
          height: 100%;
          padding: 16px 36px;
          .li-cell-active_name {
            font-weight: 600;
            line-height: 25px;
          }
          .li-cell-active_describe {
            height: 60px;
            margin-top: 10px;
            font-weight: 500;
            line-height: 20px;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-line-clamp: 3; //规定几行显示省略号
            -webkit-box-orient: vertical;
            overflow: hidden;
          }
        }
      }
      .common-cell-check {
        display: none;
        position: absolute;
        right: 0;
        bottom: 0;
        width: 22px;
        height: 22px;
        z-index: 1;
        .common-cell-triangle {
          position: relative;
          width: 100%;
          height: 100%;
          overflow: hidden;
          .common-cell-outer {
            position: absolute;
            right: -16px;
            bottom: -6px;
            width: 32px;
            height: 20px;
            background: #fff;
            text-align: center;
            -webkit-transform: rotate(-45deg);
            -moz-transform: rotate(-45deg);
            transform: rotate(-45deg);

            i {
              position: absolute;
              top: 0px;
              left: 7px;
              font-size: 12px;
              color: #1890ff;
              -webkit-transform: rotate(45deg);
              -moz-transform: rotate(45deg);
              transform: rotate(45deg);
            }
          }
        }
      }
      &.li-cell-active {
        background: linear-gradient(63deg, #357bdf 0%, #72b4fb 100%);
        box-shadow: 0px 2px 10px 0px rgba(58, 127, 178, 0.5);
        border-radius: 4px;
        border: none;
        .li-cell-inner {
          .li-cell-right {
            .li-cell-active_name {
              color: #fff;
            }
            .li-cell-active_describe {
              color: #fff;
            }
          }
        }
        .common-cell-check {
          display: block;
          .common-cell-triangle {
            border-bottom-right-radius: 4px;
          }
        }
      }
      /* 二级 */
      &.li-second-cell {
        max-width: 234px;
        height: 141px;
        padding: 20px;
        .li-cell-inner {
          .li-cell-bottom {
            height: 60px;
            background: #fff;
            border-radius: 0 0 4px 4px;
            .li-cell-scene {
              .li-cell-scene_title {
                font-weight: 600;
                line-height: 20px;
              }
              .li-cell-scene_text {
                margin-top: 10px;
                font-weight: 500;
                line-height: 20px;
                text-overflow: ellipsis;
                display: -webkit-box;
                -webkit-line-clamp: 4; //规定几行显示省略号
                -webkit-box-orient: vertical;
                overflow: hidden;
              }
            }
          }
        }
        .common-cell-check {
          .common-cell-triangle {
            .common-cell-outer {
              background: #1890ff;
              i {
                color: #fff;
              }
            }
          }
        }
      }
      &.li-second-active {
        border-radius: 4px;
        border: 2px solid rgba(24, 144, 255, 1);
        box-shadow: 0px 6px 8px 0px rgba(166, 181, 199, 0.34);
        .common-cell-check {
          display: block;
          .common-cell-triangle {
            border-bottom-right-radius: 1px;
          }
        }
      }
    }
  }

  .active-big-class {
    width: 1200px;
    .progress-active-title {
      width: 100%;
      padding: 0 20px;
      height: 70px;

      .active-title-left {
        padding-top: 12px;
      }
      .active-title-title {
        font-weight: 600;
        line-height: 22px;
      }
      .active-title-subtitle {
        font-weight: 500;
        line-height: 20px;
      }
    }
    .parent-li-cell {
      border-bottom: 1px solid rgba(220, 223, 230, 1);
      &:first-child {
        border-top: 1px solid rgba(220, 223, 230, 1);
      }
      .set-body {
        padding: 15px 20px 0 20px;
      }

      &.show-active-li {
        box-shadow: 0px 1px 8px 0px rgba(170, 170, 170, 0.32);
        border: 1px solid rgba(220, 223, 230, 1);
        background: #fff;
        &:not(:first-child) {
          border-top: none;
        }
        .progress-active-title {
          background: rgba(243, 246, 249, 1);
        }
      }
    }
  }
}
</style>
