<template>
  <div class="module">
    <div class="displayFlex left_bg">
      <div class="flex1">
        <div
          class="yd_title"
          :class="zxjz ? 'left_1' : 'left_1_1'"
          @click="zxjzChange()"
          style="cursor: pointer"
        ></div>
        <div class="choose">
          <div
            :class="jz[0].choose == '1' ? 'choose_1' : 'choose_2'"
            @click="jzChange(0, '1')"
          >
            教育
          </div>
          <div
            :class="jz[0].choose == '2' ? 'choose_1' : 'choose_2'"
            @click="jzChange(0, '2')"
          >
            医疗
          </div>
          <div
            :class="jz[0].choose == '3' ? 'choose_1' : 'choose_2'"
            @click="jzChange(0, '3')"
          >
            就业
          </div>
        </div>
        <eP1></eP1>
        <div class="choose">
          <div
            :class="jz[1].choose == '1' ? 'choose_1' : 'choose_2'"
            @click="jzChange(1, '1')"
          >
            住房
          </div>
          <div
            :class="jz[1].choose == '2' ? 'choose_1' : 'choose_2'"
            @click="jzChange(1, '2')"
          >
            自然灾害
          </div>
          <div
            :class="jz[1].choose == '3' ? 'choose_1' : 'choose_2'"
            @click="jzChange(1, '3')"
          >
            临时救助
          </div>
        </div>
        <eP2></eP2>
      </div>
    </div>
    <div class="displayFlex center_bg">
      <div class="flex1">
        <div class="yd_title center_0"></div>
        <div class="school">
          <ePjz></ePjz>
        </div>
      </div>
      <div class="flex1">
        <div class="yd_title center_1"></div>
        <eP3></eP3>
      </div>
      <div class="flex1">
        <div class="fundingBox">
          <div class="funding">
            <span>一卡通财政补贴（补贴总额：3,989）</span>
            <span>金额(元)</span>
            <!-- <span>数据对比</span> -->
          </div>
          <div class="rolling">
            <div
              v-for="(item, index) in data.lifeAssistance.subsidyInformation"
              :key="index"
              class="fundingContent"
            >
              <span class="spot">{{ item.btsx }}</span>
              <span class="spot">{{ item.btje }}</span>
              <!-- <span class="spot">70.88</span> -->
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="displayFlex right_bg">
      <div class="flex1">
        <div class="yd_title right_1"></div>
        <div class="choose">
          <div
            :class="jz[2].choose == '1' ? 'choose_1' : 'choose_2'"
            @click="jzChange(2, '1')"
          >
            困难残疾人
          </div>
          <div
            :class="jz[2].choose == '2' ? 'choose_1' : 'choose_2'"
            @click="jzChange(2, '2')"
          >
            困难军人
          </div>
          <div
            :class="jz[2].choose == '3' ? 'choose_1' : 'choose_2'"
            @click="jzChange(2, '3')"
          >
            困难职工
          </div>
        </div>
        <eP4></eP4>
      </div>
      <div class="flex1">
        <div class="yd_title right_2"></div>
        <div style="margin-top: 20px">
          <div class="czr-bj">
            <div class="czrBox">
              <div class="situation situation1"></div>
              <div class="column">
                <!-- <div v-for="item in data.diversification.hszhxms">
                  发起单位: {{ item.fqdw }}
                  <br>
                  项目名称: {{item.xmmc}}
                  <br>
                  公众筹款金额(元): {{ item.gzzcje }}
                  <br>
                  捐赠支出金额: {{ item.jzzcje }}
                  <br>
                  捐赠人次: {{ item.jzrc }}
                </div> -->
              </div>
            </div>
            <div class="czrBox">
              <div class="situation situation2"></div>
              <div class="column">
                <div v-for="item in data.diversification.hszhxms">
                  发起单位: {{ item.fqdw }}
                  <br />
                  项目名称: {{ item.xmmc }}
                  <br />
                  公众筹款金额(元): {{ item.gzzcje }}
                  <br />
                  捐赠支出金额: {{ item.jzzcje }}
                  <br />
                  捐赠人次: {{ item.jzrc }}
                </div>
              </div>
            </div>
            <div class="czrBox">
              <div class="situation situation3"></div>
            </div>
          </div>
        </div>
        <!-- <eBubble></eBubble> -->
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref, reactive, onMounted, onBeforeMount, computed } from "vue";
import eP1 from "./echarts_work/eP1.vue";
import eP2 from "./echarts_work/eP2.vue";
import eP3 from "./echarts_work/eP3.vue";
import eP4 from "./echarts_work/eP4.vue";
import ePjz from "./echarts_work/ePjz.vue";
import http from "@/utils/request.js";
// 专项&其他救助切换
const zxjz = ref(true);
const zxjzChange = () => {
  zxjz.value = !zxjz.value;
};
// 救助tap切换
const jz = ref([
  {
    choose: "1",
  },
  {
    choose: "1",
  },
  {
    choose: "1",
  },
]);
const jzChange = (index, value) => {
  jz.value[index].choose = value;
};

const data = reactive({
  education: {
    data: [
      {
        nf: "2019", //救助年份
        jzrs: "4202", //救助人数
        jzje: "1523", //救助金额
      },
    ],
    year: ["2019"],
  }, //教育
  housing: {
    data: [
      {
        nf: "2019", //救助年份
        jzrs: "4202", //救助人数
        jzje: "1523", //救助金额
      },
    ],
    year: ["2019"],
  }, //住房
  lifeAssistance: {
    subsidyInformation: [
      {
        btsx: "80至99岁老人生活补助", //补贴事项
        btje: "11515620", //补贴金额
      },
    ],
  }, //生活类救助模块
  diversification: {
    hszhxms: [
      {
        fqdw: "龙游县红十字会", //发起单位
        xmmc: "防溺水设施配置", //项目名称
        gzzcje: "10800.42", //公众筹款金额（元）
        jzzcje: "0", //捐赠支出金额
        jzrc: "444", //捐赠人次
      },
    ],
  }, //多元化力量参与模块
});
// 添加千位分隔符
const addThousandSeparator = (numberString) => {
  return parseInt(numberString.trim(), 10).toLocaleString("en-US");
};

const getData = async () => {
  await http.get("/api/ggfwyth/succour").then((res) => {
    if (res.code == 200) {
      console.log(res.data);
      // 专项救助模块
      // 教育&医疗&就业
      data.education.data = res.data.specialAssistance.education.data;
      data.education.year = res.data.specialAssistance.education.year;
      // 住房&自然灾害&临时救助
      data.housing.data = res.data.specialAssistance.housing.data;
      data.housing.year = res.data.specialAssistance.housing.year;
      // 救助概况
      // 生活类救助模块
      // 一卡通补贴
      data.lifeAssistance.subsidyInformation =
        res.data.lifeAssistance.subsidyInformation;
      res.data.lifeAssistance.subsidyInformation.forEach((item, index) => {
        data.lifeAssistance.subsidyInformation[index].btje =
          addThousandSeparator(item.btje);
      });
      // 弱势群体补贴
      // 困难残疾人&困难军人&困难职工
      // 多元化力量参与
      data.diversification.hszhxms = res.data.diversification.hszhxms;
    }
  });
};
onBeforeMount(() => {
  getData();
});
</script>

<style lang="scss" scoped>
.displayFlex {
  box-sizing: border-box;
  height: 100%;
  display: flex;
  flex-direction: column;
  // flex: 1;
  width: 30%;
}

.flex1 {
  flex: 1;
  // padding: 0 28px;
  box-sizing: border-box;
}

.module {
  display: flex;
  width: 100%;
}

.left_bg {
  width: 642px;
  // height: 100%;
  box-sizing: border-box;
  padding-left: 50px;
  padding-right: 20px;
  margin-right: 28px;
  background-image: url(@/assets/images/left_bg.png);
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.center_bg {
  width: 582px;
  box-sizing: border-box;
  padding-left: 10px;
  padding-right: 10px;
  background-image: url(@/assets/images/center_bg.png);
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.right_bg {
  width: 642px;
  box-sizing: border-box;
  padding-right: 50px;
  padding-left: 20px;
  margin-left: 28px;
  background-image: url(@/assets/images/right_bg.png);
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.left_1 {
  background-image: url(@/assets/images/work/new_zxjz.png);
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
.left_1_1 {
  background-image: url(@/assets/images/work/new_qtjz.png);
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.left_2 {
  background-image: url(@/assets/eduImg/title2.png);
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.center_0 {
  background-image: url(@/assets/images/work/new_jzgk.png);
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.center_1 {
  background-image: url(@/assets/images/work/new_shljz.png);
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.right_1 {
  background-image: url(@/assets/images/work/new_rsqt.png);
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
.right_2 {
  background-image: url(@/assets/images/work/new_dyh.png);
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.basicInformation {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  padding-top: 22px;

  .basicInformation_item {
    flex: 0 0 50%;
    padding: 0 2px;
    margin-bottom: 10px;
    margin-top: 10px;
    box-sizing: border-box;
    display: flex;
    align-items: center;

    .icon {
      width: 79px;
      height: 47px;
    }

    .right {
      margin-left: 4px;

      .label {
        background-image: url(@/assets/img_11.png);
        background-size: 100%;
        background-repeat: no-repeat;
        background-position: bottom;
        margin-bottom: 4px;

        span {
          font-size: 12px;
          font-weight: 400;
          color: #eff0f1;
          line-height: 19px;
          margin-left: 2px;
        }
      }

      p {
        font-size: 16px;
        font-weight: bold;
        color: #6acbff;
        line-height: 24px;
      }
    }
  }
}

.visitLog {
  .visitLog_item {
    display: flex;
    align-items: center;
    background-image: url(@/assets/img_12.png);
    background-size: 100% 100%;
    margin-top: 16px;
    padding: 15px 8px;
    box-sizing: border-box;

    img {
      display: inline-block;
      margin-right: 10px;
    }

    .visitLog_item_box {
      flex: auto;

      h4 {
        font-size: 18px;
        font-family: MicrosoftYaHei;
        font-weight: bold;
        color: #0096ff;
        margin-bottom: 2px;
      }

      p {
        font-size: 12px;
        font-family: SourceHanSansCN;
        font-weight: 400;
        color: #ffffff;
        margin-top: 6px;
      }
    }

    .check {
      font-size: 12px;
      font-family: SourceHanSansCN;
      font-weight: 400;
      color: #0096ff;
      line-height: 20px;
    }
  }
}

.history {
  padding-top: 12px;

  p {
    margin-top: 12px;
    font-size: 12px;
    font-weight: 400;
    color: #ffffff;
    line-height: 28px;
    border-bottom: 13px solid rgba(57, 59, 109, 1);
  }
}

.concernLabel {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 12px 0 20px;

  span {
    text-align: center;
    background: rgba(0, 89, 130, 0.73);
    border-radius: 10px;
    width: 118px;
    height: 49px;
    line-height: 49px;
    font-size: 18px;
    font-weight: 400;
    color: #ffffff;
    margin: 0 10px;
  }
}

.property {
  display: flex;
  padding: 14px 0 10px;

  .property_box {
    background-image: url(@/assets/img_05.png);
    background-size: 100% 100%;
    background-repeat: no-repeat;
    width: 179px;
    height: 91px;
    margin: 0 12px;
    text-align: center;

    h5 {
      font-size: 14px;
      font-weight: 400;
      color: #ffffff;
      margin: 9px 0 16px;
    }

    p {
      font-size: 21px;
      font-weight: bold;
      color: #48ece7;
    }
  }
}

.activity {
  h5 {
    font-size: 14px;
    font-weight: bold;
    color: rgba(0, 164, 250, 0.8);
    line-height: 47px;
    border-bottom: 2px solid rgba(0, 164, 250, 1);
    margin-bottom: 17px;
  }

  .activity_content {
    margin: 0 -6px 12px;
    display: flex;

    .activity_box {
      width: 50%;
      display: inline-block;
      margin: 0 6px;
      box-sizing: border-box;
      background-color: rgba(15, 28, 54, 1);
      padding: 12px 12px 19px;

      p {
        font-size: 14px;
        font-weight: 400;
        color: #ffffff;
        line-height: 27px;
        height: 100%;
      }
    }
  }
}

.monitor {
  .monitor_box {
    display: flex;
    padding: 8px 0;
    border-bottom: 2px solid rgba(255, 255, 255, 0.67);

    img {
      width: 115px;
      height: 84px;
      margin-right: 21px;
    }

    .monitor_box_text {
      display: flex;
      flex-direction: column;
      justify-content: space-between;

      h4 {
        font-size: 14px;
        font-weight: 400;
        color: #ffffff;
        line-height: 20px;
      }

      p {
        font-size: 14px;
        font-weight: 400;
        color: #818181;
        line-height: 23px;
      }
    }
  }
}

.yd_title {
  box-sizing: border-box;
  width: 98%;
  height: 42px;
  position: relative;

  .text {
    display: flex;
    position: absolute;
    font-size: 16px;
    font-family: SourceHanSansCN;
    font-weight: bold;
    color: #ffffff;
    position: absolute;
    right: 5px;
    top: 3px;
  }
}
.choose {
  display: flex;
  justify-content: center;
  margin-top: 47px;
  margin-bottom: 20px;
  .choose_1 {
    cursor: pointer;
    width: 124px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 16px;
    color: #ffffff;
    line-height: 22px;
    margin-right: 15px;
    background-image: url(@/assets/images/work/choose.png);
    background-repeat: no-repeat;
    background-size: 100% 100%;
  }
  .choose_2 {
    cursor: pointer;
    width: 124px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 16px;
    color: #ffffff;
    line-height: 22px;
    margin-right: 15px;
    background-image: url(@/assets/images/work/noChoose.png);
    background-repeat: no-repeat;
    background-size: 100% 100%;
  }
}

.mechanism {
  background-image: url(@/assets/YLTitle/titleImg10.png);
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.flex11 {
  padding: 12px 0;
}
.czr-sl {
  display: flex;

  .historyimg {
    width: 255px;
    height: 56px;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding-left: 70px;

    span {
      font-weight: 400;
      font-size: 16px;
      color: #ffffff;
      line-height: 22px;
      letter-spacing: 2px;
      text-align: left;
      font-style: normal;
      font-family: PingFangSC, PingFang SC;
      padding-right: 10px;
    }
  }

  .historyimg1 {
    background-image: url(@/assets/eduImg/jyImg14.png);
    margin-right: 10px;
  }

  .historyimg2 {
    background-image: url(@/assets/eduImg/jyImg15.png);
  }
}

.earlyWarning {
  height: calc(100% - 10px);

  display: flex;
  align-items: center;
  justify-content: space-around;

  .earlyWarning1 {
    font-size: 26px;
    color: #ffffff;
    line-height: 30px;
    letter-spacing: 1px;
    text-align: center;
    font-style: normal;
    font-family: PangMenZhengDao;
    display: flex;
    flex-direction: column;
    align-items: center;

    img {
      width: 136px;
      height: 100px;
    }

    .green {
      font-size: 26px;
      font-weight: bold;
      letter-spacing: 2px;
      text-align: center;
      font-style: normal;
      font-family: TCloudNumber, TCloudNumber;
      background-image: linear-gradient(180deg, #7be546 0%, #38ffb1 100%);
      background-clip: text;
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
    }

    .yellow {
      font-size: 26px;
      font-weight: bold;
      letter-spacing: 2px;
      text-align: center;
      font-style: normal;
      font-family: TCloudNumber, TCloudNumber;
      background-image: linear-gradient(180deg, #ee8404 0%, #efd404 100%);
      background-clip: text;
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
    }

    .red {
      font-size: 26px;
      font-weight: bold;
      letter-spacing: 2px;
      text-align: center;
      font-style: normal;
      font-family: TCloudNumber, TCloudNumber;
      background-image: linear-gradient(180deg, #ff3e00 0%, #ed5a2d 100%);
      background-clip: text;
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
    }

    .historyimg {
      width: 133px;
      height: 19px;
      background-repeat: no-repeat;
      background-size: 100% 100%;
      margin-top: 20px;
      display: flex;
      align-items: center;
      justify-content: center;

      span {
        font-weight: 500;
        font-size: 14px;
        color: #ffffff;
        letter-spacing: 4px;
        font-style: normal;
        font-family: PingFangSC, PingFang SC;
      }
    }

    .historyimg1 {
      background-image: url(@/assets/eduImg/jyImg4.png);
    }

    .historyimg2 {
      background-image: url(@/assets/eduImg/jyImg6.png);
    }

    .historyimg3 {
      background-image: url(@/assets/eduImg/jyImg5.png);
    }
  }
}

.czr-bj {
  width: 529px;
  // height: 350px;
  // height: calc(100% - 26px);
  background: rgba(0, 103, 165, 0.18);
  box-shadow: inset 0px 0px 58px 0px rgba(37, 175, 252, 0.47);
  border-radius: 2px;
  padding: 20px 0 0 14px;
  // box-sizing: border-box;

  .czrBox {
    height: 118px;
    .column {
      height: calc(100% - 26px);
      overflow-y: auto;
      font-size: 14px;
      color: #ffffff;
      padding-left: 18px;
      padding-right: 18px;
    }
  }

  .situation {
    width: 495px;
    height: 26px;
    background-repeat: no-repeat;
    background-size: 100% 100%;
  }

  .situation1 {
    background-image: url(@/assets/images/work/dyh.png);
  }

  .situation2 {
    background-image: url(@/assets/images/work/dyh2.png);
  }

  .situation3 {
    background-image: url(@/assets/images/work/dyh1.png);
  }

}
.school {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
}
.fundingBox {
  display: flex;
  flex-direction: column;
  align-items: center;
  .funding {
    width: 520px;
    height: 34px;
    margin-top: 20px;
    // padding: 10px 0 14px 0;
    box-sizing: border-box;
    background-image: url(@/assets/eduImg/jyImg17.png);
    background-repeat: no-repeat;
    background-size: 100% 100%;
    display: flex;
    align-items: center;
    justify-content: space-around;
    // align-items: center;
    // justify-content: center;
    // flex-direction: column;
    // justify-content: space-between;
    span {
      font-family: PingFangSC, PingFang SC;
      font-weight: 500;
      font-size: 14px;
      color: #ffffff;
      line-height: 20px;
      letter-spacing: 3px;
    }
  }
  .rolling {
    width: 100%;
    height: 200px;
    // height: calc(100% - 26px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    // padding-left: 6px;

    .fundingContent {
      display: flex;
      align-items: center;
      justify-content: space-around;
      margin-top: 10px;
      width: 92%;
      // height: 34px;
      padding: 4px 0;
      box-sizing: border-box;
      background-image: url(@/assets/eduImg/jyImg16.png);

      span {
        font-family: PingFangSC, PingFang SC;
        font-weight: 400;
        font-size: 14px;
        color: #ffffff;
        letter-spacing: 3px;
        text-align: left;
        font-style: normal;
        width: 70%;
        padding-left: 38px;
      }
      span:nth-child(2) {
        width: 30%;
        // padding-left: 50px;
      }
    }
  }
}
.rating {
  width: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  .ratingBtn {
    display: flex;
    // align-items: center;

    .onImg {
      width: 62px;
      height: 29px;
      background-image: url(@/assets/eduImg/jyImg19.png);
      background-repeat: no-repeat;
      background-size: 100% 100%;
      cursor: pointer; /* 添加指针样式以指示可点击 */
    }

    .ratingImg {
      width: 62px;
      height: 29px;
      background-image: url(@/assets/eduImg/jyImg18.png);
      background-repeat: no-repeat;
      background-size: 100% 100%;
    }
    .onImg.active {
      width: 62px;
      height: 29px;
      background-image: url(@/assets/eduImg/jyImg18.png);
      background-repeat: no-repeat;
      background-size: 100% 100%;
    }
    span {
      height: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 400;
      font-size: 14px;
      color: #ffffff;
      letter-spacing: 1px;
      font-family: PingFangSC, PingFang SC;
    }
  }
}

.selectLint {
  width: 94%;
  display: flex;
  margin: 30px 0 10px;
  justify-content: space-between;

  .selectBox {
    width: 48%;
    background-image: url(@/assets/eduImg/jyImg7.png);
    background-repeat: no-repeat;
    background-size: 100% 100%;
  }
}

.column::-webkit-scrollbar {
  display: none; /* Chrome Safari */
}
/* 滚动条整体部分 */
.rolling::-webkit-scrollbar {
  width: 5px;
  // height: 10px;
}
/* 滚动槽 */
.rolling::-webkit-scrollbar-track {
  border-radius: 1px;
  background: rgba(0, 128, 231, 0.56);
  -webkit-box-shadow: inset 0 0 6px rgba(139, 139, 139, 0.3);
}
/* 滚动条滑块样式 */
.rolling::-webkit-scrollbar-thumb {
  background-clip: content-box;
  border-radius: 6px;
  background: rgba(0, 162, 231, 1);
  -webkit-box-shadow: inset 0 0 6px rgba(20, 20, 20, 0.3);
}
</style>
