<template>
  <div class="four-box">
    <div class="card" v-for="(item, index) in data.stepOne" :key="index">
      <div class="title">{{ item.cardTitle }}</div>
      <div class="ul-list">
        <div class="li" v-for="(cItem, cIndex) in item.form.personAttribute" :key="cIndex + 'c'">
          <div class="icon"></div>
          <div class="text">
            {{ getPersonalMap(cItem).label }}&nbsp;&nbsp;{{
              cItem.equalMap.find(i => i.value === cItem.equal).label
            }}&nbsp;&nbsp;{{ getPersonalMap(cItem).children.find(i => i.value === cItem.range).label }}
          </div>
        </div>
      </div>
    </div>
    <div class="card">
      <div class="title">营销方案</div>
      <div class="ul-list">
        <div class="li">
          <div class="icon"></div>
          <div class="text">
            计划类型：{{ data.stepTwo.index === 0 ? '单次触发' : data.stepTwo.index === 1 ? '周期触发' : '节日触发' }}
          </div>
        </div>
        <template v-if="data.stepTwo.index === 0">
          <div class="li">
            <div class="icon"></div>
            <div class="text">触发时间：{{ data.stepTwo.triggerDate }}&nbsp;&nbsp;{{ data.stepTwo.triggerTime }}</div>
          </div>
        </template>
        <template v-else-if="data.stepTwo.index === 1">
          <div class="li">
            <div class="icon"></div>
            <div class="text">
              触发时间：<span style="font-weight: bold">{{ data.stepTwo.time_range[0] }}</span
              >至<span style="font-weight: bold">{{ data.stepTwo.time_range[1] }}</span
              >&nbsp;&nbsp;<span style="font-weight: bold">{{ data.stepTwo.times_every.toString() }}</span
              >&nbsp;&nbsp;<span style="font-weight: bold">{{ data.stepTwo.times_hour }}</span>
            </div>
          </div>
        </template>
        <template v-else>
          <div class="li">
            <div class="icon"></div>
            <div class="text">
              触发条件：
              <span style="font-weight: bold;" v-for="(item, index) in data.stepTwo.solarTermsList" :key="index"
                >{{ item.name }}{{ index != data.stepTwo.solarTermsList.length - 1 ? '，' : '' }}</span
              >&nbsp;&nbsp;<span style="font-weight: bold;">{{ data.stepTwo.times_send }}</span>触发
            </div>
          </div>
        </template>
      </div>
    </div>
    <div class="card">
      <div class="title">展示内容</div>
      <div class="content">
        <div class="phone-box">
          <div class="text">{{ `【${data.stepThree.title}】${data.stepThree.content}` }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    data: { type: Object }
  },
  mounted() {
    console.log(this.data, 'data')
  },
  methods: {
    getPersonalMap(item) {
      return item.personalMap.find(i => i.value === item.personal)
    },
    // 获取位置值
    getPosition(item) {
      if (item.left && item.top) {
        return `left: ${item.left}px;top: ${item.top}px;`
      } else {
        return item.left ? `left: ${item.left}px;` : item.top ? `top: ${item.top}px;` : ''
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.four-box {
  margin-bottom: 20px;
  .card {
    background: rgba(250, 250, 250, 0.39);
    border: 1px solid #e8e8e8;
    border-radius: 16px;
    margin-bottom: 20px;
    padding: 20px;
    .content {
      height: 500px;
      position: relative;
      .phone-box {
        margin: 0 auto;
        width: 236px;
        height: 474px;
        background: url(https://webapp-pub.ezijing.com/x-training-new/phone-sms.png);
        background-size: 100% 100%;
        position: relative;
        .text {
          padding: 9px;
          box-sizing: border-box;
          background: #e9e9eb;
          border-radius: 10px;
          width: 148px;
          position: absolute;
          top: 110px;
          left: 25px;
          font-size: 9px;
          color: #333333;
        }
      }
    }
    .title {
      font-size: 18px;
      font-weight: bold;
      line-height: 100%;
      color: #333333;
    }
    .ul-list {
      padding-top: 20px;
      .li {
        display: flex;
        align-items: center;
        margin-bottom: 15px;
        .icon {
          width: 6px;
          min-width: 6px;
          height: 6px;
          min-height: 6px;
          background: rgba(73, 187, 162, 0.39);
          border-radius: 50%;
        }
        .text {
          font-size: 16px;
          color: #666666;
          margin-left: 10px;
        }
      }
    }
  }
}
</style>
