<template>
  <Page title="访客计划详情">
    <template v-slot:body>
      <!-- 头部 -->
      <div class="planDetailsHead">
        <div class="w-full flex items-center justify-between">
          <div class="text-size-in font-bold text-[#474A56]">{{ detailedData.planName }}</div>
          <div :class="`labelTag ${detailedData.finishState == 0 ? 'toBeCompleted' : 'completed'}`">{{ ['未完成', '已完成'][detailedData.finishState] }}</div>
        </div>
        <div class="w-full mt-4">拜访目的：{{ detailedData.visitGoalName }}</div>
        <div class="w-full mt-4">拜访时间： {{ detailedData.visitTime }}</div>
        <div class="line"></div>
        <div class="w-full flex items-center">
          <van-icon name="user-circle-o" class="text-size-in mr-2" />
          客户:
          <div class="ml-2 themeTextColor decoration-auto underline">{{ detailedData.customName }}</div>
        </div>
      </div>

      <!-- 主体 -->
      <van-cell-group>
        <van-cell title="计划名称" :value="detailedData.planName" />
        <van-cell title="客户姓名" :value="detailedData.customName" />
        <van-cell title="负责人" :value="detailedData.inchargerName" />
        <van-cell title="拜访目的" :value="detailedData.visitGoalName" />
        <van-cell title="拜访时间" :value="detailedData.visitTime" />
        <van-cell title="提醒" :value="detailedData.remindTypeName" />
        <van-cell title="提醒时间" :value="detailedData.remindTime" v-if="detailedData.remindType == -1" />
        <van-cell title="备注" :value="detailedData.remark" />
      </van-cell-group>
      <div class="h-10"></div>
    </template>

    <template v-slot:footer>
      <div class="w-full flex justify-between layout">
        <div class="footerBtnLeft layouts">
          <div class="imgClss"></div>
          联系人
        </div>
        <div class="footerBtnRight layouts">
          <div class="imgClss"></div>
          延期
        </div>
        <div class="coverWithWhite"></div>
        <div class="bigCircle">
          <div class="imgClss"></div>
          完成
        </div>
      </div>
    </template>
  </Page>
</template>

<script setup>
import { ref } from "vue";
import { useLifecycle } from "@hooks/useCommon.js";
import useToast from "@hooks/useToast"
import requests from "@common/requests";
import useRouterStore from "@store/useRouterStore.js";
import useFixedData from "@store/useFixedData.js";
import PullDownSelector from "@components/common/pullDownSelector.vue";

const router = useRouterStore();
const detailedData = ref({});

function processingDataSource(data) {
  const row = JSON.parse(data.row);
  detailedData.value = row || {}
}

useLifecycle({
  load: () => {
    router.on("visitorDetailsParameter", (data) => {
      processingDataSource(data);
    });
  },
});
</script>

<style lang="scss" scoped>
.planDetailsHead {
  background: #ffa35919;
  padding: 14px 18px;
  margin: 10px;

  .toBeCompleted {
    background: rgba($color: #f38b3c, $alpha: 0.1);
    border-color: #f38b3c;
    color: #f38b3c;
  }

  .completed {
    background: rgba($color: #07c160, $alpha: 0.1);
    border-color: #07c160;
    color: #07c160;
  }

  .labelTag {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid;
  }

  .line {
    width: 100%;
    height: 1px;
    background-color: #E6D3C7;
    margin: 14px 0;
  }
}

.layout {
  height: 90px;
  position: relative;

  .layouts {
    width: 40%;
    height: 100%;
    background: #fff;
    box-shadow: 0px -2px 30px 0px #00000014;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .footerBtnLeft {
    border-top-right-radius: 25px;

    .imgClss {
      width: 30px;
      height: 30px;
      background-color: #000;
      margin-bottom: 6px;
    }
  }

  .footerBtnRight {
    border-top-left-radius: 25px;

    .imgClss {
      width: 26px;
      height: 24px;
      background-color: #000;
      margin-bottom: 9px;
    }
  }

  .coverWithWhite {
    width: 20%;
    background: #fff;
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    height: 70px;
    z-index: 1;
  }

  .bigCircle {
    width: 80px;
    height: 80px;
    ;
    border-radius: 50%;
    background: $themeColor;
    box-shadow: 0px -2px 30px 0px #00000014;
    position: absolute;
    bottom: 27px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;

    .imgClss {
      width: 25.5px;
      height: 25.5px;
      margin-bottom: 4px;
      background: #000;
    }
  }
}
</style>
