<template>
  <view class="followup-task-page">
    <scroll-view scroll-y class="content" :lower-threshold="80" @scrolltolower="onScrollToLower">
      <!-- 回访任务列表组件 -->
      <FollowUpManageTab
        :data="patientData"
        :archiveId="archiveId"
        :reachBottomTime="reachBottomTime"
        :floatingBottom="0"
        :fromChat="true"
      />
      <view class="scroll-spacer" />
    </scroll-view>
  </view>
</template>

<script setup>
import { ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import FollowUpManageTab from "./components/archive-detail/follow-up-manage-tab.vue";

const archiveId = ref("");
const patientData = ref({});
const reachBottomTime = ref("");

onLoad((options) => {
  archiveId.value = options.archiveId || "";
  patientData.value = {
    name: options.patientName || "",
  };
});

const handleBack = () => {
  uni.navigateBack();
};

function onScrollToLower() {
  reachBottomTime.value = Date.now();
}
</script>

<style scoped>
.followup-task-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: #f5f6f8;
}

.content {
  flex: 1;
  min-height: 0;
}

.scroll-spacer {
  height: calc(120px + env(safe-area-inset-bottom));
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  background: #0877f1;
  padding: 0 14px;
  color: #fff;
  position: relative;
}

.nav-back {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: -14px;
}

.nav-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}

.nav-placeholder {
  width: 44px;
}
</style>
