<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 ? '登录提醒' : '交易提醒' }}
          </div>
        </div>
        <div class="li">
          <div class="icon"></div>
          <div class="text">
            触发条件：<span style="font-weight: bold;">立刻对目标用户进行触达</span>
          </div>
        </div>
      </div>
    </div>
    <div class="card">
      <div class="title">展示内容</div>
      <div class="right-box">
        <div class="card-msg" v-if="data.stepTwo.index == 0">
          <div class="top">
            <div class="title">用户登录提醒</div>
            <div class="phone-content">
              <div class="lable">标题：</div>
              <div class="value">{{ data.stepThree.title}}</div>
            </div>
            <div class="phone-content">
              <div class="lable">内容：</div>
              <div class="value">{{ data.stepThree.content  }}</div>
            </div>
          </div>
          <div class="btn">
            <div class="text">详情</div>
            <div class="el-icon-arrow-right"></div>
          </div>
        </div>
        <div class="card-money" v-else>
          <img src="https://webapp-pub.ezijing.com/x-training-new/wx-fk.png">
          <div class="bz">
            <div class="label">备注：</div>
            <div class="con-txt">{{ data.stepThree.content }}</div>
            <div class="el-icon-arrow-right"></div>
          </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;
        }
      }
    }
  }
}
.right-box {
  margin: 0 auto;
  width: 236px;
  height: 474px;
  background: url(https://webapp-pub.ezijing.com/x-training-new/phone-wxgzh.png);
  background-size: 100% 100%;
  position: relative;
  .card-money{
    background: #fff;
    width: 188px;
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    padding-top: 8px;
    .bz{
      padding: 8px 10px;
      border-top: 1px solid #ccc;
      display: flex;
      align-items: center;
      .label{
        font-size: 12px;
        color: #333333;
      }
      .con-txt{
        font-size: 12px;
        color: #333333;
        width: 100px;
        margin-right: 15px;
      }
    }
  }
  .card-msg{
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    width: 188px;
    background: rgba(255, 255, 255, .4);
    opacity: 1;
    border-radius: 2px;
    .btn{
      height: 26px;
      border-top: 1px solid #EAEAEA;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 10px;
      .text{
        font-size: 10px;
        color: #333333;
        line-height: 100%;
      }
    }
    .top{
      padding: 10px;
    }
    .title{
      font-size: 12px;
      line-height: 100%;
      color: #333333;
    }
    .phone-content{
      display: flex;
      margin-top: 5px;
      .lable{
        min-width: 38px;
        font-size: 10px;
        color: #999999;
      }
      .value{
        font-size: 10px;
        color: #333333;
      }
    }
  }
}
</style>
