<!--
 * @Descripttion: 当前组件信息-闯关奖励设置
 * @version: 1.0.0
 * @Author: 无尘
 * @Date: 2019-11-21 16:37:02
 * @LastEditors: 无尘
 * @LastEditTime: 2020-12-21 17:15:41
 -->
<!--
<competition-award></competition-award>

import competitionAward from '@/components/active-config/configs/competition-award.vue';
-->

<template>
  <div class="competition-award border-box">
    <el-form
      label-width="154px"
      :model="compitionAward"
      ref="rewardForm"
      :rules="rules"
    >
      <el-form-item
        label="竞赛指标（多选）："
        prop=""
      >
        <ul class="flex ">
          <template v-for="(item, index) in modeData">
            <li
              v-if="index == 0"
              :class="['li-cell li-second-cell flex-1 ', compitionAward.dealNumberFlag == 1 ? 'li-second-active' : '']"
              :key="index + 'first'"
              @click="selectStore(item)"
            >
              <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>
            <li
              v-if="index == 1  && basePath.map(ele => ele.transName).includes('消费') && compitionAward.stepType == 6"
              :class="['li-cell li-second-cell flex-1 ', compitionAward.dealAmountFlag == 1 ? 'li-second-active' : '']"
              :key="index + 'first'"
              @click="selectStore(item)"
            >
              <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-show="compitionAward.dealNumberFlag == 1"
        class="m-t-20"
        label="完成人数竞赛奖项："
        prop=""
      >
        <div class="w-912">
          <el-table
            :data="compitionAward.dealNumberSettingParam"
            style="width: 100%"
          >
            <el-table-column
              label="奖项名称"
              width="307"
            >
              <template slot-scope="scope">
                <div class="cell">
                  <limitInput
                    :inputWidth="275"
                    :disflag="$route.query.editFlag ? true : false"
                    :inputValue.sync="scope.row.awardName"
                    :holder="'请输入奖项名称'"
                    :getByType="'char'"
                    :maxLength="20"
                  > </limitInput>
                </div>
              </template>
            </el-table-column>
            <el-table-column
              label="排名"
              width="305"
            >
              <template slot-scope="scope">
                <div class="cell">
                  <div v-if="scope.$index == 0">
                    <span class="font-14 color-606266 p-r-10">前</span>
                    <el-input-number
                      class="w-140"
                      :disabled="$route.query.editFlag"
                      v-model="scope.row.end"
                      controls-position="right"
                      :step="1"
                      :step-strictly="true"
                      :min="1"
                      :max="9999999999"
                      @change="changeEndNum($event,scope.$index,scope.row, 1)"
                    > </el-input-number>
                    <span class="font-14 color-606266 p-l-10">名</span>
                  </div>
                  <div
                    v-if="scope.$index != 0 && scope.$index != compitionAward.dealNumberSettingParam.length - 1"
                    class="l-h-40"
                  >
                    <div>
                      <span class="font-14 color-606266 p-r-10">第</span>
                      <el-input-number
                        class="w-140"
                        :disabled="true"
                        v-model="scope.row.start"
                        controls-position="right"
                        :step="1"
                        :step-strictly="true"
                        :min="1"
                        :max="9999999999"
                      > </el-input-number>
                      <span class="font-14 color-606266 p-l-10 p-r-10">名 至</span>
                    </div>
                    <div>
                      <span class="font-14 color-606266 p-r-10">第</span>
                      <el-input-number
                        class="w-140"
                        :disabled="$route.query.editFlag"
                        v-model="scope.row.end"
                        controls-position="right"
                        :step="1"
                        :step-strictly="true"
                        :min="1"
                        :max="9999999999"
                        @change="changeEndNum($event,scope.$index,scope.row, 1)"
                      > </el-input-number>
                      <span class="font-14 color-606266 p-l-10">名</span>
                    </div>
                  </div>
                  <div
                    v-if="scope.$index != 0 && scope.$index == compitionAward.dealNumberSettingParam.length - 1"
                    class="l-h-40"
                  >
                    <div>
                      <span class="font-14 color-606266 p-r-10">第</span>
                      <el-input-number
                        class="w-140"
                        :disabled="true"
                        v-model="scope.row.start"
                        controls-position="right"
                        :step="1"
                        :step-strictly="true"
                        :min="1"
                        :max="9999999999"
                      > </el-input-number>
                      <span class="font-14 color-606266 p-l-10 p-r-10">名 至</span>
                      <!-- <el-checkbox
                        v-if="scope.row.infinity"
                        class="m-l-10"
                        :disabled="$route.query.editFlag"
                        v-model="scope.row.infinity"
                        @change="changeEnd($event, scope.row)"
                      >无穷大</el-checkbox> -->
                    </div>
                    <div>
                      <span class="font-14 color-606266 p-r-10">第</span>
                      <el-input-number
                        class="w-140"
                        :disabled="$route.query.editFlag"
                        v-model="scope.row.end"
                        controls-position="right"
                        :step="1"
                        :step-strictly="true"
                        :min="1"
                        :max="9999999999"
                      > </el-input-number>
                      <!-- <el-checkbox
                        v-if="scope.$index == compitionAward.dealNumberSettingParam.length - 1"
                        class="m-l-10"
                        :disabled="$route.query.editFlag"
                        v-model="scope.row.infinity"
                        @change="changeEnd($event, scope.row)"
                      >无穷大</el-checkbox> -->
                    </div>
                  </div>
                </div>
              </template>
            </el-table-column>
            <el-table-column
              label="奖品"
              width="300"
            >
              <template slot-scope="scope">
                <div class="cell flex flex-align-center">
                  <div>
                    <div>
                      <el-checkbox v-model="scope.row.pointCheck">积分</el-checkbox>
                      <el-input-number
                        class="w-146"
                        :disabled="$route.query.editFlag"
                        v-model="scope.row.point"
                        controls-position="right"
                        :step="1"
                        :step-strictly="true"
                        :min="1"
                        :max="999999"
                      > </el-input-number>
                    </div>
                    <div class="m-t-10">
                      <el-checkbox v-model="scope.row.cardCheck">卡券</el-checkbox>
                      <disable-card-show v-if="$route.query.editFlag " :cardName.sync="scope.row.cardName"></disable-card-show>
                      <select-card v-else v-model="scope.row.cardId" :cardName.sync="scope.row.cardName"></select-card>
                    </div>
                  </div>
                  <el-button
                    v-if="scope.$index != 0"
                    class="m-l-16"
                    :disabled="$route.query.editFlag"
                    @click.stop="deleteRow(scope.$index, compitionAward.dealNumberSettingParam)"
                    type="text"
                    size="small"
                  >
                    删除
                  </el-button>
                </div>
              </template>
            </el-table-column>
          </el-table>
          <div
            class="add-line text-center cursor-pointer"
            @click="addPeopleItem"
          ><i class="el-icon-plus color-2F54EB"></i><span class="color-2F54EB font-14 p-l-10">添加奖项</span></div>
        </div>
      </el-form-item>
      <el-form-item
        v-show="compitionAward.dealAmountFlag == 1"
        class="m-t-20"
        label="成交额竞赛奖项: "
        prop=""
      >
        <div class="w-912">
          <el-table
            :data="compitionAward.dealAmountSettingParam"
            style="width: 100%"
          >
            <el-table-column
              label="奖项名称"
              width="307"
            >
              <template slot-scope="scope">
                <div class="cell">
                  <limitInput
                    :inputWidth="275"
                    :disflag="$route.query.editFlag ? true : false"
                    :inputValue.sync="scope.row.awardName"
                    :holder="'请输入奖项名称'"
                    :getByType="'char'"
                    :maxLength="20"
                  > </limitInput>
                </div>
              </template>
            </el-table-column>
            <el-table-column
              label="排名"
              width="305"
            >
              <template slot-scope="scope">
                <div class="cell">
                  <div v-if="scope.$index == 0">
                    <span class="font-14 color-606266 p-r-10">前</span>
                    <el-input-number
                      class="w-140"
                      :disabled="$route.query.editFlag"
                      v-model="scope.row.end"
                      controls-position="right"
                      :step="1"
                      :step-strictly="true"
                      :min="1"
                      :max="9999999999"
                      @change="changeEndNum($event,scope.$index,scope.row, 2)"
                    > </el-input-number>
                    <span class="font-14 color-606266 p-l-10">名</span>
                  </div>
                  <div
                    v-if="scope.$index != 0 && scope.$index != compitionAward.dealAmountSettingParam.length - 1"
                    class="l-h-40"
                  >
                    <div>
                      <span class="font-14 color-606266 p-r-10">第</span>
                      <el-input-number
                        class="w-140"
                        :disabled="true"
                        v-model="scope.row.start"
                        controls-position="right"
                        :step="1"
                        :step-strictly="true"
                        :min="1"
                        :max="9999999999"
                      > </el-input-number>
                      <span class="font-14 color-606266 p-l-10 p-r-10">名 至</span>
                    </div>
                    <div>
                      <span class="font-14 color-606266 p-r-10">第</span>
                      <el-input-number
                        class="w-140"
                        :disabled="$route.query.editFlag"
                        v-model="scope.row.end"
                        controls-position="right"
                        :step="1"
                        :step-strictly="true"
                        :min="1"
                        :max="9999999999"
                        @change="changeEndNum($event,scope.$index,scope.row, 2)"
                      > </el-input-number>
                      <span class="font-14 color-606266 p-l-10">名</span>
                    </div>

                  </div>
                  <div
                    v-if="scope.$index != 0 && scope.$index == compitionAward.dealAmountSettingParam.length - 1"
                    class="l-h-40"
                  >
                    <div>
                      <span class="font-14 color-606266 p-r-10">第</span>
                      <el-input-number
                        class="w-140"
                        :disabled="true"
                        v-model="scope.row.start"
                        controls-position="right"
                        :step="1"
                        :step-strictly="true"
                        :min="1"
                        :max="9999999999"
                      > </el-input-number>
                      <span class="font-14 color-606266 p-l-10 p-r-10">名 至</span>
                      <!-- <el-checkbox
                        :disabled="$route.query.editFlag"
                        v-if="scope.row.infinity"
                        class="m-l-10"
                        v-model="scope.row.infinity"
                        @change="changeEnd($event, scope.row)"
                      >无穷大</el-checkbox> -->
                    </div>
                    <div>
                      <span class="font-14 color-606266 p-r-10">第</span>
                      <el-input-number
                        :disabled="$route.query.editFlag"
                        v-model="scope.row.end"
                        class="w-140"
                        controls-position="right"
                        :step="1"
                        :step-strictly="true"
                        :min="1"
                        :max="9999999999"
                      > </el-input-number>
                      <!--  <el-checkbox
                        :disabled="$route.query.editFlag"
                        v-if="scope.$index == compitionAward.dealAmountSettingParam.length - 1"
                        class="m-l-10"
                        v-model="scope.row.infinity"
                        @change="changeEnd($event, scope.row)"
                      >无穷大</el-checkbox> -->
                    </div>
                  </div>
                </div>
              </template>
            </el-table-column>
            <el-table-column
              label="奖品"
              width="300"
            >
              <template slot-scope="scope">
                <div class="cell flex flex-align-center">
                  <div>
                    <div>
                      <el-checkbox v-model="scope.row.pointCheck">积分</el-checkbox>
                      <el-input-number
                        class="w-146"
                        :disabled="$route.query.editFlag"
                        v-model="scope.row.point"
                        controls-position="right"
                        :step="1"
                        :step-strictly="true"
                        :min="1"
                        :max="999999"
                      > </el-input-number>
                    </div>
                    <div class="m-t-10">
                      <el-checkbox v-model="scope.row.cardCheck">卡券</el-checkbox>
                      <disable-card-show v-if="$route.query.editFlag " :cardName.sync="scope.row.cardName"></disable-card-show>
                      <select-card v-else v-model="scope.row.cardId" :cardName.sync="scope.row.cardName"></select-card>
                    </div>
                  </div>
                  <el-button
                    v-if="scope.$index != 0"
                    class="m-l-16"
                    :disabled="$route.query.editFlag"
                    @click.stop="deleteRow(scope.$index, compitionAward.dealAmountSettingParam)"
                    type="text"
                    size="small"
                  >
                    删除
                  </el-button>
                </div>
              </template>
            </el-table-column>
          </el-table>
          <div
            class="add-line text-center cursor-pointer"
            @click="addMoneyItem"
          ><i class="el-icon-plus color-2F54EB"></i><span class="color-2F54EB font-14 p-l-10">添加奖项</span></div>
        </div>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import limitInput from '@/components/limit-input.vue';
import selectCard from '@/components/active-config/configs/select-card.vue';
import disableCardShow from '@/components/active-config/configs/disable-card-show.vue';

/* import errMsg from '@/common/js/error';
import { getRequest } from '@/api/api'; */
import mixins from '@/mixins/emitter';
export default {
  name: 'competition-award',
  mixins: [mixins],
  props: {
    value: {
      type: [Object, Array],
      default() {
        return {
          dealNumberFlag: 1, //成交人数开关 1开启
          dealAmountFlag: 0, //成交额开关 1开启
          dealNumberSettingParam: [
            {
              awardName: '',
              start: 0,
              end: 5,
              infinity: false,
              point: 1,
              pointCheck: false,
              cardId: '',
              cardName: '',
              cardCheck: false
            }
          ], //成交人数奖项 成交人数奖项json
          dealAmountSettingParam: [
            {
              awardName: '',
              start: 0,
              end: 5,
              infinity: false,
              point: 1,
              pointCheck: false,
              cardId: '',
              cardName: '',
              cardCheck: false
            }
          ], //成交额奖项 成交额奖项json
          "stepType": 1 //步骤类型 类型：1服务号关注，2活动营销页访问奖励，3会员认证奖励，4游戏参与奖励，5卡券领取奖励6，消费奖励
        };
      }
    }
  },
  components: {
    limitInput,
    selectCard,
    disableCardShow
  },
  data() {
    return {
      basePath: [],
      compitionAward: {
        dealNumberFlag: 1, //成交人数开关 1开启
        dealAmountFlag: 0, //成交额开关 1开启
        dealNumberSettingParam: [], //成交人数奖项 成交人数奖项json
        dealAmountSettingParam: [], //成交额奖项 成交额奖项json
        stepType: 1 //步骤类型 类型：1服务号关注，2活动营销页访问奖励，3会员认证奖励，4游戏参与奖励，5卡券领取奖励6，消费奖励
      },
      modeData: [
        {
          goalId: 1,
          goalName: '完成人数（推荐）',
          describe: '以完成活动所设置路径的受邀人数量作为计数指标',
          check: false
        },
        {
          goalId: 2,
          goalName: '成交额',
          describe: '以受邀人的总消费金额作为计数指标（单个受邀人多次消费作累计计数）',
          check: false
        }
      ],
      // cardList: [] //卡券数据
    };
  },
  methods: {
    isRepeat(arr) {
      let hash = {};
      for (let i in arr) {
        if (hash[arr[i]]){
          return true;
        }
        hash[arr[i]] = true;
      }
      return false;
    },
    /**
     * 表单提交
     */
    submitForm() {
      const that = this;
      return new Promise(function(resolve, reject) {
        that.$refs['rewardForm'].validate(async valid => {
          if (valid) {
            /* if (that.compitionAward.dealNumberFlag == 1  && that.compitionAward.dealNumberSettingParam.length) {
              that.compitionAward.dealNumberSettingParam.forEach(ele => {
                if (!ele.cardCheck && ele.cardId){
                  ele.cardId = '';
                  ele.cardName = '';
                }

                if(!ele.pointCheck && ele.point) {
                  ele.point = '';
                }
              });
            }
            if (that.compitionAward.dealAmountFlag == 1  && that.compitionAward.dealAmountSettingParam.length) {
              that.compitionAward.dealAmountSettingParam.forEach(ele => {
                if (!ele.cardCheck && ele.cardId){
                  ele.cardId = '';
                  ele.cardName = '';
                }

                if(!ele.pointCheck && ele.point) {
                  ele.point = '';
                }
              });
            } */
            that.$emit('input', that.compitionAward);
            if (that.compitionAward.dealNumberFlag == 1 && !that.compitionAward.dealNumberSettingParam.length) {
              resolve({flag: false, msg: '请完善竞赛奖励中成交人数奖项'});
            }
            if (that.compitionAward.dealNumberFlag == 1  && that.compitionAward.dealNumberSettingParam.length) {
              let flag = true;
              let names = [];
              that.compitionAward.dealNumberSettingParam.forEach(ele => {
                if (!ele.awardName ||(ele.cardCheck && !ele.cardId)||(ele.pointCheck && !ele.point) || (!ele.pointCheck && !ele.cardCheck) ) {
                  flag = false;
                }
                names.push(ele.awardName);
              });
              let nameFlag = await that.isRepeat(names);
              console.log(nameFlag,flag)
              if(nameFlag){
                resolve({flag: false, msg: '竞赛奖励中成交人数奖项名称不能重复'});
              }

              if (!flag) {
                resolve({flag: false, msg: '请完善竞赛奖励中成交人数奖项'});
              }
            }
            // 阶梯奖励没有勾选无穷大判断
            /* if(that.compitionAward.dealNumberFlag == 1 && that.compitionAward.dealNumberSettingParam.length>1&&!that.compitionAward.dealNumberSettingParam[that.compitionAward.dealNumberSettingParam.length-1].infinity) {
              resolve(false);
            } */
            // 阶梯奖励中顺序值判断
            if(that.compitionAward.dealNumberFlag == 1 && that.compitionAward.dealNumberSettingParam.length>1){
              let flag = true;
              let arr = [];
              that.compitionAward.dealNumberSettingParam.forEach(ele => {
                if ((!ele.start  && ele.start != 0) || (!ele.end && ele.end != -1) ) {
                  flag = false;
                }
                arr.push(ele.start);
                if(ele.end != -1) {
                  arr.push(ele.end);
                }
              });

              for(let i = 0; i<arr.length-1; i++) {
                for(let j = i+1; j<arr.length; j++){
                  if(arr[i]>arr[j]){  // fix: 20201019去掉 = ，允许[1,2,2,3,3]这样的
                    flag = false;
                    break;
                  }
                }
                if (!flag) {
                  break;
                }
              }
              console.log(flag)
              if (!flag) {
                resolve({flag: false, msg: '竞赛奖励中排名区间值之间不允许存在间隔'});
              }
            }

            if (that.compitionAward.dealAmountFlag == 1 && !that.compitionAward.dealAmountSettingParam.length) {
              resolve({flag: false, msg: '请完善竞赛奖励中成交额奖项'});
            }
            if (that.compitionAward.dealAmountFlag == 1  && that.compitionAward.dealAmountSettingParam.length) {
              let flag = true;
              let names = [];
              that.compitionAward.dealAmountSettingParam.forEach(ele => {
                if (!ele.awardName ||(ele.cardCheck && !ele.cardId) || (!ele.pointCheck && !ele.cardCheck) ) {
                  flag = false;
                }
                names.push(ele.awardName);
              });
              let nameFlag = await that.isRepeat(names);
              console.log(nameFlag,flag)
              if(nameFlag){
                resolve({flag: false, msg: '竞赛奖励中成交额奖项名称不能重复'});
              }
              if (!flag) {
                resolve({flag: false, msg: '请完善竞赛奖励中成交额奖项'});
              }
            }
            // 阶梯奖励没有勾选无穷大判断
            /* if(that.compitionAward.dealAmountFlag == 1 && that.compitionAward.dealAmountSettingParam.length>1&&!that.compitionAward.dealAmountSettingParam[that.compitionAward.dealAmountSettingParam.length-1].infinity) {
              resolve(false);
            } */
            // 阶梯奖励中顺序值判断
            if(that.compitionAward.dealAmountFlag == 1 && that.compitionAward.dealAmountSettingParam.length>1){
              let flag = true;
              const arr = [];
              that.compitionAward.dealAmountSettingParam.forEach(ele => {
                if ((!ele.start && ele.start != 0) || (!ele.end && ele.end != -1) ) {
                  flag = false;
                }
                arr.push(ele.start);
                if(ele.end != -1) {
                  arr.push(ele.end);
                }
              });
              for(let i = 0; i<arr.length-1; i++) {
                for(let j = i+1; j<arr.length; j++){
                  if(arr[i]>arr[j]){ // fix: 20201019去掉 = ，允许[1,2,2,3,3]这样的
                    flag = false;
                    break;
                  }
                }
                if (!flag) {
                  break;
                }
              }
              if (!flag) {
                resolve({flag: false, msg: '竞赛奖励中排名区间值之间不允许存在间隔'});
              }
            }
            resolve(that.compitionAward);
          } else {
            resolve(false);
          }
        });
      });
    },
    /**
     * 选择即时奖励模式：
     */
    selectStore(item) {
      const that = this;
      if (that.$route.query.hasOwnProperty('editFlag')) {
        return false;
      }
      if (item.goalId == 1) {
        that.compitionAward.dealNumberFlag = that.compitionAward.dealNumberFlag == 0 ? 1 : 0;
      } else {
        that.compitionAward.dealAmountFlag = that.compitionAward.dealAmountFlag == 0 ? 1 : 0;
      }
    },
    /**
     * 删除：
     */
    deleteRow(index, arr) {
      // const that = this;
      arr.splice(index, 1);
    },
    /**
     * 阶梯奖励无穷大奖项：
     */
    changeEnd(e, row) {
      row.end = e ? -1 : '';
    },
    /**
     * 阶梯奖励end奖项：
     */
    changeEndNum(e, index, row, flag) {
      const that = this;
      if (flag == 1) {
        if (index < that.compitionAward.dealNumberSettingParam.length-1) {
          that.compitionAward.dealNumberSettingParam[index +1].start = e + 1;
        }
      }else {
        if (index < that.compitionAward.dealAmountSettingParam.length-1) {
          that.compitionAward.dealAmountSettingParam[index +1].start = e + 1;
        }
      }

    },

    /**
     * 成交人添加奖项：
     */
    addPeopleItem() {
      const that = this;
      if (that.$route.query.hasOwnProperty('editFlag')) {
        return false;
      }
      // if(that.compitionAward.dealNumberSettingParam.length < 2 || !that.compitionAward.dealNumberSettingParam.map(ele=>ele.infinity).includes(true)) {
      that.compitionAward.dealNumberSettingParam.push({
        awardName: '',
        start: that.compitionAward.dealNumberSettingParam.length == 0? 0 : that.compitionAward.dealNumberSettingParam[that.compitionAward.dealNumberSettingParam.length-1].end +1,
        end: 5,
        infinity: false,
        point: 1,
        pointCheck: false,
        cardId: '',
        cardName: '',
        cardCheck: false
      });
      /* return false;
      } */
      /* if(that.compitionAward.dealNumberSettingParam.length >= 2 && that.compitionAward.dealNumberSettingParam.map(ele=>ele.infinity).includes(true)) {
        that.compitionAward.dealNumberSettingParam.splice(-1, 0,{
          awardName: '',
          start: that.compitionAward.dealNumberSettingParam[that.compitionAward.dealNumberSettingParam.length-1].end +1,
          end: 5,
          infinity: false,
          point: 1,
          pointCheck: false,
          cardId: '',
          cardName: '',
          cardCheck: false
        });
      } */
    },
    addMoneyItem() {
      const that = this; //成交额奖项 成交额奖项json
      if (that.$route.query.hasOwnProperty('editFlag')) {
        return false;
      }
      // if(that.compitionAward.dealAmountSettingParam.length < 2 || !that.compitionAward.dealAmountSettingParam.map(ele=>ele.infinity).includes(true)) {
      that.compitionAward.dealAmountSettingParam.push({
        awardName: '',
        start: that.compitionAward.dealAmountSettingParam.length == 0? 0 : that.compitionAward.dealAmountSettingParam[that.compitionAward.dealAmountSettingParam.length-1 ].end +1,
        end: 5,
        infinity: false,
        point: 1,
        pointCheck: false,
        cardId: '',
        cardName: '',
        cardCheck: false
      });
      /*   return false;
      }
      if(that.compitionAward.dealAmountSettingParam.length >= 2 && that.compitionAward.dealAmountSettingParam.map(ele=>ele.infinity).includes(true)) {
        that.compitionAward.dealAmountSettingParam.splice(-1, 0,{
          awardName: '',
          start: that.compitionAward.dealAmountSettingParam[that.compitionAward.dealAmountSettingParam.length-1 ].end +1,
          end: 5,
          infinity: false,
          point: 1,
          pointCheck: false,
          cardId: '',
          cardName: '',
          cardCheck: false
        });
      } */
    }
  },
  watch: {
    value(newData) {
      const that = this;
      that.compitionAward = JSON.parse(JSON.stringify(newData));
      console.log('compitionAward:',that.compitionAward)
    }
  },
  mounted() {
    const that = this;
    // that.getCardList();
    that.compitionAward = JSON.parse(JSON.stringify(that.value));
    if (Object.keys(that.$store.state.baseInfo).length) {
      that.basePath = JSON.parse(JSON.stringify(that.$store.state.baseInfo)).router;
      console.log(that.basePath)
    }
  }
};
</script>
<style lang="less" scoped>
.p-l-3 {
  padding-left: 3px;
}
.p-l-10 {
  padding-left: 10px;
}
.p-r-10 {
  padding-right: 10px;
}
.m-l-10 {
  margin-left: 10px;
}
.m-l-16 {
  margin-left: 16px;
}
.m-t-10 {
  margin-top: 10px;
}
.w-140 {
  width: 140px;
}
.w-146 {
  width: 146px;
}
.w-912 {
  width: 912px;
}
.l-h-40 {
  line-height: 40px;
}
.competition-award {
  width: 100%;
  padding: 20px;
  background: #fff;
  .competition-award-title {
    margin: 0 auto;
    text-align: center;
    font-weight: 600;
    line-height: 30px;
    padding-top: 27px;
    margin-bottom: 48px;
  }
  .m-b-0 {
    margin-bottom: 0;
  }
  .m-t-48 {
    margin-top: 48px;
  }
  .m-t-50 {
    margin-top: 50px;
  }
  .competition-award-subtitle {
    width: 800px;
    margin: 14px auto;
    line-height: 20px;
    font-weight: 500;
    text-align: center;
  }
  ul {
    .li-cell {
      position: relative;
      width: 427px;
      // height: 131px;
      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%;
      transition: all 0.3s;
      &:hover {
        -webkit-transform: translateY(-10px);
        -moz-transform: translateY(-10px);
        -o-transform: translateY(-10px);
        transform: translateY(-10px);
        box-shadow: 0px 2px 10px 0 rgba(174, 181, 189, 0.5);
      }
      &: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 {
            margin-top: 13px;
            font-weight: 500;
            line-height: 20px;
          }
        }
      }
      .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: #1890ff;
            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: #fff;
              -webkit-transform: rotate(45deg);
              -moz-transform: rotate(45deg);
              transform: rotate(45deg);
            }
          }
        }
      }
      /* 二级 */
      &.li-second-cell {
        max-width: 265px;
        // 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: 3; //规定几行显示省略号
                -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(47, 84, 235, 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;
          }
        }
      }
    }
  }
  .add-line {
    height: 50px;
    line-height: 50px;
    background: #fff;
    border-bottom: 1px solid #ebeef5;
  }
  .store-select-wrap {
    width: 580px;
    // height: 470px;
    margin-top: 10px;
    padding: 20px;
    background: rgba(245, 247, 250, 1);
    &.w-845 {
      width: 845px;
    }
    .add-line {
      height: 50px;
      line-height: 50px;
      background: #fff;
    }
    .el-input-number {
      width: 123px;
    }
    .store-select-body {
      margin-top: 20px;
    }
    &.child-select-wrap {
      padding-left: 20px;
      .el-input-number {
        width: 123px;
      }
    }
  }
}
</style>
