<template>
  <div class="coreItem">
    <div class="item item1">
      <div class="unit">总成本·元/㎡</div>
      <div class="item-content">
        <!-- 左右内容容器：包裹 left、line、right -->
        <div class="content-wrapper">
          <div class="left">
            <div class="number">16</div>
            <div class="title">预算值</div>
          </div>
          <div class="line"></div>
          <div class="right">
            <div class="number">16</div>
            <div class="title">预算值</div>
          </div>
        </div>
        <!-- 进度条和百分比容器：横向排列 -->
        <div class="progress-group">
          <div class="progress-container">
            <div class="progress-bar" :style="{
              width: (90) + '%',
            }"></div>
          </div>
          <!-- 百分比文本 -->
          <div class="progress-percent">90%</div>
        </div>
      </div>
    </div>
    <div class="item item2">
      <div class="unit">原片成本·元/㎡</div>
      <div class="item-content">
        <!-- 左右内容容器：包裹 left、line、right -->
        <div class="content-wrapper">
          <div class="left">
            <div class="number">16</div>
            <div class="title">预算值</div>
          </div>
          <div class="line"></div>
          <div class="right">
            <div class="number">16</div>
            <div class="title">预算值</div>
          </div>
        </div>
        <!-- 进度条和百分比容器：横向排列 -->
        <div class="progress-group">
          <div class="progress-container">
            <div class="progress-bar" :style="{
              width: (90) + '%',
            }"></div>
          </div>
          <!-- 百分比文本 -->
          <div class="progress-percent">90%</div>
        </div>
      </div>
    </div>
    <div class="item item3">
      <div class="unit">加工成本·元/㎡</div>
      <div class="item-content">
        <!-- 左右内容容器：包裹 left、line、right -->
        <div class="content-wrapper">
          <div class="left">
            <div class="number">16</div>
            <div class="title">预算值</div>
          </div>
          <div class="line"></div>
          <div class="right">
            <div class="number">16</div>
            <div class="title">预算值</div>
          </div>
        </div>
        <!-- 进度条和百分比容器：横向排列 -->
        <div class="progress-group">
          <div class="progress-container">
            <div class="progress-bar" :style="{
              width: (90) + '%',
            }"></div>
          </div>
          <!-- 百分比文本 -->
          <div class="progress-percent">90%</div>
        </div>
      </div>
    </div>
    <div class="item item4">
      <div class="unit">原片成品率·%</div>
      <div class="item-content">
        <!-- 左右内容容器：包裹 left、line、right -->
        <div class="content-wrapper">
          <div class="left">
            <div class="number">16</div>
            <div class="title">预算值</div>
          </div>
          <div class="line"></div>
          <div class="right">
            <div class="number">16</div>
            <div class="title">预算值</div>
          </div>
        </div>
        <!-- 进度条和百分比容器：横向排列 -->
        <div class="progress-group">
          <div class="progress-container">
            <div class="progress-bar" :style="{
              width: (90) + '%',
            }"></div>
          </div>
          <!-- 百分比文本 -->
          <div class="progress-percent">90%</div>
        </div>
      </div>
    </div>
    <div class="item item5">
      <div class="unit">投入产出率·%</div>
      <div class="item-content">
        <!-- 左右内容容器：包裹 left、line、right -->
        <div class="content-wrapper">
          <div class="left">
            <div class="number">16</div>
            <div class="title">预算值</div>
          </div>
          <div class="line"></div>
          <div class="right">
            <div class="number">16</div>
            <div class="title">预算值</div>
          </div>
        </div>
        <!-- 进度条和百分比容器：横向排列 -->
        <div class="progress-group">
          <div class="progress-container">
            <div class="progress-bar" :style="{
              width: (90) + '%',
            }"></div>
          </div>
          <!-- 百分比文本 -->
          <div class="progress-percent">90%</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "Container",
  components: {},
  props: ["name", "size", "icon"],
  data() {
    return {
      progress: 90, // 进度值，方便统一控制
    };
  },
  computed: {},
  methods: {},
};
</script>

<style scoped lang="scss">
.coreItem {
  display: flex;
  flex-wrap: wrap;
  /* 允许元素换行 */
  // justify-content: center;
  /* 整体水平居中 */
  gap: 8px;
  /* 元素之间的间距（水平+垂直） */
  // width: 100%;
  box-sizing: border-box;
  // padding: 8px;
}

/* 需给子元素指定对应的区域名 */
.coreItem> :nth-child(1) {
  grid-area: item1;
}

.coreItem> :nth-child(2) {
  grid-area: item2;
}

.coreItem> :nth-child(3) {
  grid-area: item3;
}

.coreItem> :nth-child(4) {
  grid-area: item4;
}

.coreItem> :nth-child(5) {
  grid-area: item5;
}

.item {
  width: 252px;
  height: 110px;
  background: #f9fcff;
  padding: 12px;
  box-sizing: border-box;

  .unit {
    // width: 124px;
    height: 18px;
    font-family: PingFangSC, PingFang SC;
    font-weight: 400;
    font-size: 18px;
    color: #000000;
    line-height: 18px;
    letter-spacing: 1px;
    text-align: left;
    font-style: normal;
    margin-bottom: 8px;
  }

  .item-content {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: calc(100% - 26px);
  }

  .content-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-around;
    flex: 1;
  }

  .line {
    width: 1px;
    height: 46px;
    background: linear-gradient(to bottom,
        rgba(255, 0, 0, 0),
        #cbcbcb);
  }

  .left,
  .right {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2px;
    flex: 1;
  }

  .number {
    height: 22px;
    font-family: PingFangSC, PingFang SC;
    font-weight: 600;
    font-size: 24px;
    color: rgba(103, 103, 103, 0.79);
    line-height: 22px;
    text-align: center;
    font-style: normal;
  }

  .title {
    height: 14px;
    font-family: PingFangSC, PingFang SC;
    font-weight: 400;
    font-size: 12px;
    color: #868687;
    line-height: 14px;
    text-align: center;
    font-style: normal;
  }

  /* 进度条和百分比的外层容器 */
  .progress-group {
    display: flex;
    align-items: center;
    gap: 8px;
    /* 进度条和百分比的间距 */
  }

  .progress-container {
    width: 190px;
    height: 10px;
    background: #ECEFF7;
    border-radius: 8px;
    overflow: hidden;
  }

  .progress-bar {
    height: 100%;
    background: #28CB97;
    border-radius: 8px;
    opacity: 0.6;
  }

  /* 百分比文本样式 */
  .progress-percent {
    font-family: PingFangSC, PingFang SC;
    font-weight: 400;
    font-size: 12px;
    color: #868687;
    line-height: 1;
  }
}
.item1,.item2,.item3{
  width: 166px;
}
</style>
