<template>
  <view class="outpatient-page">
    <!-- 导航栏 -->
     <view class="navbox">
       <view class="status_bar"></view>
       <uni-nav-bar
			left-icon="left"
			title="出/停诊公告"
			@clickLeft="goBack"
		
			color="#8B2316"
		
			:border="false"
			backgroundColor="#eee"
		>
			<template #right>
				<view class="nav-right">
          <up-image :src="shareIcon" width="36rpx" height="36rpx" @click="shareToggle"></up-image>
					<!-- <up-icon name="share" color="#8B2316" size="24" @click="shareToggle"></up-icon> -->
					<up-image :src="siteImg" width="36rpx" height="36rpx" @click="goSite"></up-image>
				</view>
			</template>
		</uni-nav-bar>
     </view>

    <!-- 标签页 -->
    <view class="tab-container">
      <view class="tab-item" :class="{ active: currentTab === 'suspension' }" @click="switchTab('suspension')">
        <text class="tab-text">停诊公告</text>
      </view>
      <view class="tab-divider"></view>
      <view class="tab-item" :class="{ active: currentTab === 'outpatient' }" @click="switchTab('outpatient')">
        <text class="tab-text">门诊安排</text>
      </view>
    </view>

    <!-- 主内容区域 -->
    <!-- <view class="content-area"> -->
      <scroll-view
        class="content-scroll"
        scroll-y
        refresher-enabled
        :refresher-triggered="isRefreshing"
        @refresherrefresh="onRefresh"
        @scrolltolower="onScrollToLower"
      >
      <!-- 停诊公告卡片 -->
      <view v-if="currentTab === 'suspension'">
        <view class="announcement-card" v-for="announcement in stopOutPatientList" :key="announcement.uuid">
          <image :src="dateBg" mode="widthFix" class="date-bg"></image>
          <view class="card-header">
            <view class="date-tag" >
            
              <text class="tag-date">{{ formatDate(announcement.expire_date) }}</text>
            </view>
            <view class="delete-btn" @click="deleteAnnouncement(announcement.uuid)">
              <uni-icons type="minus" size="30" color="#8B2316" ></uni-icons>
            </view>
          </view>
          
          <view class="card-content">
            <view class="info-row">
              <text class="info-label">停诊原因:</text>
              <text class="info-value">{{ getStopReason(announcement.type) }}</text>
            </view>
            
            <view class="info-row">
              <text class="info-label">停诊时间:</text>
              <text class="info-value">{{ announcement.date_list[0]?.param1 }} ~ {{ announcement.date_list[0]?.param2 }}</text>
            </view>
            <view class="divider"></view>
            <view class="info-row remarks-row">
              <text class="info-label">备注:</text>
              <view class="remarks-input" v-if="announcement.note">{{ announcement.note }}</view>
            </view>
          </view>
        </view>
        
        <!-- 空状态 -->
        <view v-if="stopOutPatientList.length === 0" class="empty-state">
          <empty  :emptyDesc="'暂无停诊公告'"></empty>
        </view>
      </view>

      <!-- 门诊安排内容 -->
      <view v-if="currentTab === 'outpatient'">
        <view v-if="outPatientList.length > 0" class="schedule-list">
          <!-- 门诊安排列表 -->
          <view class="schedule-card" v-for="schedule in outPatientList" :key="schedule.uuid">

             <view class="cell-content">
                <view class="schedule-left">
              <view class="weekday">{{ getWeekdayByWeek(schedule.week) }}</view>
              <view class="time-period">{{ getTimePeriod(schedule.day) }}</view>
            </view>
            
            <view class="schedule-right">
              <view class="hospital-info">
                <text class="hospital-name">{{ schedule.hospital_name || '首都医科大学附属北京佑安医院' }}</text>
                <view class="office-info">
                  <text class="office-name">{{ schedule.office_name || '肝病科' }}</text>
                </view>
                <view class="location-info">
                  <text class="location">{{ schedule.location || '北京' }}</text>
                  <view class="type-tag" v-if="schedule.type">
                    {{ getTypeText(schedule.type) }}
                  </view>
                </view>
              </view>

             </view>
             
              
             
            </view>
            <view class="schedule-actions">
                <view class="action-btn edit-btn" @click="editSchedule(schedule)">
                  <up-image :src="editImg" width="30rpx" height="30rpx"></up-image>
                  <text class="action-text">编辑</text>
                </view>
                <view class="action-btn delete-btn" @click="deleteSchedule(schedule.uuid)">
                  <up-image :src="deleteImg" width="30rpx" height="30rpx"></up-image>
                  <text class="action-text">删除</text>
                </view>
              </view>
            
          </view>
        </view>
        <view v-else class="empty-state">
          <empty  :emptyDesc="'暂无门诊安排'"></empty>
        </view>
        <view v-if="outPatientList.length > 0" class="load-more-tip">
          <text>{{ outPatientLoading ? '加载中...' : (hasMoreOutPatient ? '上拉加载更多' : '没有更多数据了') }}</text>
        </view>
      </view>
      </scroll-view>
    <!-- </view> -->

    <!-- 底部操作按钮 -->
    <view class="bottom-actions">
      <view class="publish-btn" @click="currentTab === 'suspension' ? publishNew() : addSchedule()">
        <text class="btn-text">{{ currentTab === 'suspension' ? '发布新的停诊' : '增加门诊安排' }}</text>
      </view>
    </view>

    <!-- 浮动编辑按钮 -->
    <view class="floating-edit-btn" @click="editAnnouncement">
      <up-image :src="sendImg" width="88rpx" height="88rpx"></up-image>
    </view>

    <!-- 分享弹窗 -->
    <uni-popup ref="shareRef" type="bottom" safeArea backgroundColor="#fff">
      <view class="share-popup">
        <view class="share-title">分享到</view>
        <view class="share-content">
          <view class="share-item" @click="shareToWechat">
            <view class="share-icon wechat-icon">
              <image class="share-img" :src="wxImg" mode="aspectFill" />
            </view>
            <text class="share-text">微信</text>
          </view>
          <view class="share-item" @click="shareToMoments">
            <view class="share-icon moments-icon">
              <image class="share-img" :src="friendImg" mode="aspectFill" />
            </view>
            <text class="share-text">朋友圈</text>
          </view>
          <view class="share-item" @click="shareToWeibo">
            <view class="share-icon weibo-icon">
              <image class="share-img" :src="sinaImg" mode="aspectFill" />
            </view>
            <text class="share-text">新浪微博</text>
          </view>
        </view>
        <view class="share-cancel" @click="closeShare">
          <text>取消</text>
        </view>
      </view>
    </uni-popup>
  </view>

  <unidialog
    :visible="noticeVisible"
    :content="content"
    @close="noticeCancel"
    @confirm="noticeConfirm"
  >
  
  </unidialog>
</template>

<script setup>
import { ref, reactive } from 'vue'
import api from '@/api/api'
import {onShow,onUnload,onLoad,onBackPress} from '@dcloudio/uni-app'
import navTo from '@/utils/navTo'
import other_host from '@/utils/otherHost'
import siteImg from '@/static/zhiyedidian.png'
import empty from '@/components/empty/empty.vue'
import sendImg from '@/static/send_feed.png'
import dateBg from '@/static/data_sign.png'
import editImg from '@/static/edit_icon.png'
import shareIcon from '@/static/icon_share.png'
import unidialog from '@/components/dialog/dialog.vue'
import deleteImg from '@/static/delete_icon.png'
import sinaImg from "@/static/share_sina.png"
import wxImg from "@/static/share_weixin.png"
import friendImg from "@/static/share_wxc.png"
import logoImg from "@/static/weiboShare.png"
const isEdit = ref(false);
const noticeVisible = ref(false);
const SHARE_TITLE = ref('医生门诊详情')
const SHARE_SUMMARY = '肝胆相照®肝胆病在线服务平台'
const content = ref('您的出/停诊信息有改动，是否通知您的患者？');
const page=ref(1);
const isRefreshing = ref(false)
const outPatientLoading = ref(false)
const hasMoreOutPatient = ref(true)
const addressList = ref([]);
const shareRef = ref()
const shareLink = ref('')
const patient_user_uuid = ref('');
const isLock=ref(true)
// 响应式数据
const from = ref('');
const currentTab = ref('suspension')
const remarks = ref('')

const note = ref('')
const patientList = ref([]);
const outpatientSchedules = ref([])
const outPatientList = ref([]);
const patientListByGBK=()=>{
  api.patientListByGBK().then(res=>{
    if(res.code==1){
      isLock.value = false;
      patientList.value = res.data;
      console.log(res.data)
       
    }
  })
}
const noticeConfirm = () => {
  noticeVisible.value = false;
  if(patientList.value.length >= 200 || isLock.value){
            uni.sendNativeEvent(
                    "goGroupMessagePage",
                    {
                      msg: "goGroupMessagePage",
                    },
                    (ret) => {
                      console.log(ret);
                    }
                  );
    //  navTo({
    //   url:'/pages_chat/groupMessage/groupMessage?from=outPatient'
    //  })
  }else{
    publishOutPatient();
  }
  
}
const noticeCancel=()=>{
  noticeVisible.value = false;
  if(!from.value){
		plus.runtime.quit();
	}else{
		uni.navigateBack();
	}
}
onBackPress(() => {
	if(!from.value){
		plus.runtime.quit();
		return true;
	}
});
onLoad((options) => {
	if(options.from){
		from.value = options.from;
	}
  try {
    const userInfo = uni.getStorageSync('userInfo') || {}
    console.log(userInfo.realName)
    const expertUuid = userInfo.uuid;
    shareLink.value = other_host+'/wxPatient/index.htm#/outPatient?link=share&expertUuid='+expertUuid+'&from=doctor'
    SHARE_TITLE.value = userInfo.realName+'医生门诊详情'

    uni.sendNativeEvent("portraitReport",{
      msg:{
        event_nickname: "list_page",
        page_type: "出/停诊公告",
      },
    });
  } catch (error) {
    console.log(error)
  }
  patientListByGBK();
});
const getListOutPatient = async (reset = false) => {
  if (outPatientLoading.value) return;
  if (!reset && !hasMoreOutPatient.value) return;

  if (reset) {
    page.value = 1;
    hasMoreOutPatient.value = true;
  }

  outPatientLoading.value = true;
  try {
    const res = await api.listOutPatient({
      page:page.value,
    });
    if(res.code == 200){
      const pageData = res.data?.list || {};
      const newList = Array.isArray(pageData.list) ? pageData.list : [];

      if (reset) {
        outPatientList.value = newList;
      } else {
        outPatientList.value = [...outPatientList.value, ...newList];
      }

      // 兼容不同分页字段结构
      if (typeof pageData.totalPage === 'number' && typeof pageData.pageNumber === 'number') {
        hasMoreOutPatient.value = pageData.pageNumber < pageData.totalPage;
      } else if (typeof pageData.last_page === 'number' && typeof pageData.current_page === 'number') {
        hasMoreOutPatient.value = pageData.current_page < pageData.last_page;
      } else if (typeof pageData.pages === 'number' && typeof pageData.pageNum === 'number') {
        hasMoreOutPatient.value = pageData.pageNum < pageData.pages;
      } else if (typeof pageData.isLastPage === 'boolean') {
        hasMoreOutPatient.value = !pageData.isLastPage;
      } else {
        hasMoreOutPatient.value = newList.length > 0;
      }

      if (hasMoreOutPatient.value) {
        page.value += 1;
      }
      console.log(res.data.note)
      note.value = res.data?.note?.note || '';
    }
  } finally {
    outPatientLoading.value = false;
  }
}
const stopOutPatientList = ref([]);
const getStopOutPatientList = async () => {
  const res = await api.stopOutPatientList();
  if(res.code == 200){
    stopOutPatientList.value = res.data;
  }
}

// 数据转换函数
const formatDate = (timestamp) => {
  if (!timestamp) return '';
  const date = new Date(timestamp * 1000);
  const year = date.getFullYear();
  const month = String(date.getMonth() + 1).padStart(2, '0');
  const day = String(date.getDate()).padStart(2, '0');
  return `${year}-${month}-${day}`;
}
const goSite = () => {
  navTo({
    url: '/pages_chat/addAddress/addAddress'
  })
}
const publishOutPatient = async (uuid) => {
  let uuids='';
  for(let i=0;i<patientList.value.length;i++){
         if(uuids){
          uuids+=','+patientList.value[i].uuid;
         }else{
          uuids += patientList.value[i].uuid;
         }
       }
  const res = await api.publishOutPatient({
    msg_type:'5',
    msg_content:'',
    patient_user_uuid:uuids
  })
  if(!from.value){
		plus.runtime.quit();
	}else{
		uni.navigateBack();
	}
}
const getStopReason = (type) => {
  const reasonMap = {
    1: '出差',
    2: '休假',
    3: '临时安排',
    4: '其他'
  };
  return reasonMap[type] || '其他';
}

// 获取星期几
const getWeekday = (date) => {
  if (!date) return '周一';
  const weekdays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
  const d = new Date(date);
  return weekdays[d.getDay()];
}

// 根据week字段获取星期几
const getWeekdayByWeek = (week) => {
  const weekdays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
  return weekdays[week] || '周一';
}

// 根据day字段获取时间段
const getTimePeriod = (day) => {
  const timeMap = {
    'a': '上午',
    'b': '下午', 
    'c': '晚上',
    'd': '全天'
  };
  return timeMap[day] || '晚上';
}

// 根据type字段获取类型文本
const getTypeText = (type) => {
  const typeMap = {
    1: '普通门诊',
    2: '专家门诊',
    3: '特需门诊',
    4: '专科/专病门诊'
  };
  return typeMap[type] || '普通门诊';
}
// 方法
const goBack = () => {
  console.log(isEdit.value);
  if(isEdit.value){
    noticeVisible.value = true;
  }else{
      if(!from.value){
      plus.runtime.quit();
    }else{
      uni.navigateBack();
    }
  }
}

const shareToggle = () => {
  shareRef.value && shareRef.value.open()
}

const closeShare = () => {
  shareRef.value && shareRef.value.close()
}

const shareToWechat = () => {
  // #ifdef APP-PLUS
  uni.downloadFile({
    url: 'https://doc.igandan.com/app/html/img/2016/20160714132557.png',
    success: function (res) {
      uni.compressImage({
        src: res.tempFilePath,
        quality: 60,
        success: function (res2) {
          uni.share({
            provider: "weixin",
            scene: "WXSceneSession",
            type: 0,
            title: SHARE_TITLE.value,
            summary: SHARE_SUMMARY,
            href: shareLink.value,
            imageUrl: res2.tempFilePath,
          });
        },
      });
    },
  });
  // #endif

  // #ifdef H5
  if (navigator.share) {
    navigator
      .share({
        title: SHARE_TITLE.value,
        text: SHARE_SUMMARY,
        url: shareLink.value,
      })
      .catch(() => {});
  } else {
    uni.setClipboardData({
      data: `${SHARE_TITLE.value}：${shareLink.value}`,
      success: () => {
        uni.showToast({ title: "已复制到剪贴板", icon: "success" });
      },
    });
  }
  // #endif

  // #ifdef MP-WEIXIN
  uni.showShareMenu({
    withShareTicket: true,
    menus: ["shareAppMessage", "shareTimeline"],
  });
  // #endif
  closeShare();
}

const shareToMoments = () => {
  // #ifdef APP-PLUS
  uni.downloadFile({
    url: 'https://doc.igandan.com/app/html/img/2016/20160714132557.png',
    success: function (res) {
      uni.compressImage({
        src: res.tempFilePath,
        quality: 60,
        success: function (res2) {
          uni.share({
            provider: "weixin",
            scene: "WXSceneTimeline",
            type: 0,
            title: SHARE_TITLE.value,
            summary: SHARE_SUMMARY,
            href: shareLink.value,
            imageUrl: res2.tempFilePath,
          });
        },
      });
    },
  });
  // #endif

  // #ifdef H5
  uni.setClipboardData({
    data: `${SHARE_TITLE.value}：${shareLink.value}`,
    success: () => {
      uni.showToast({ title: "已复制到剪贴板，可分享到朋友圈", icon: "success" });
    },
  });
  // #endif

  // #ifdef MP-WEIXIN
  uni.showShareMenu({
    withShareTicket: true,
    menus: ["shareAppMessage", "shareTimeline"],
  });
  // #endif
  closeShare();
}

const shareToWeibo = () => {
  // #ifdef APP-PLUS
  uni.share({
    provider: "sinaweibo",
    type: 0,
    title: SHARE_TITLE.value,
    summary: SHARE_SUMMARY,
    href: shareLink.value,
    imageUrl: logoImg,
  });
  // #endif

  // #ifdef H5
  uni.setClipboardData({
    data: `${SHARE_TITLE.value}：${shareLink.value}`,
    success: () => {
      uni.showToast({ title: "已复制到剪贴板，可分享到微博", icon: "success" });
    },
  });
  // #endif
  closeShare();
}
const fetchList = async () => {
  const res = await api.listWorkPlace({})
  if (res && res.code === 200 && Array.isArray(res.data)) {
    addressList.value = res.data
  }
}

const addNew = () => {
  uni.showToast({
    title: '添加新内容',
    icon: 'none'
  })
}

onShow(() => {
    console.log('onShow')
    getStopOutPatientList();
    getListOutPatient(true);
    fetchList();
    uni.$on('updateOutPatient',()=>{
      isEdit.value = true;
      console.log('更新');
    })
 
})

const switchTab = (tab) => {
  currentTab.value = tab;
  if(tab=='suspension'){
    getStopOutPatientList();
  }else{
    getListOutPatient(true);
  }
}

const deleteAnnouncement = async (uuid) => {
  uni.showModal({
    title: '确认删除',
    content: '确定要删除这条停诊公告吗？',
    success: async (res) => {
      if (res.confirm) {
        try {
          const deleteRes = await api.deleteStopPatient({ uuid });
          if (deleteRes.code === 200) {
           
            uni.showToast({
              title: '删除成功',
              icon: 'none'
            });
            if(stopOutPatientList.value.length-1>0){
              isEdit.value=true;
            }else{
              isEdit.value=false;
            }
            getStopOutPatientList();
          } else {
            uni.showToast({
              title: deleteRes.msg || '删除失败',
              icon: 'none'
            });
          }
        } catch (error) {
          uni.showToast({
            title: '删除失败',
            icon: 'none'
          });
        }
      }
    }
  })
}

const publishNew = () => {
  if(stopOutPatientList.value.length>=2){
    uni.showToast({
      title: '最多发布2条停诊公告',
      icon: 'none'
    })
    return
  }
  // 跳转到发布新停诊页面
  navTo({
    url: '/pages_chat/stopPatient/stopPatient'
  })
}

const editAnnouncement = () => {
  navTo({
    url: '/pages_chat/note/note?note='+note.value
  })
}

// 刷新数据
const refreshData = () => {
  getListOutPatient(true);
  getStopOutPatientList();
}

// 门诊安排相关方法
const addSchedule = () => {
  if(addressList.value.length === 0){
    uni.showToast({
      title: '请先点击右上角设置执业地点',
      icon: 'none'
    })
   
  }else{
    navTo({
    url: '/pages_chat/outManage/outManage'
  })
  }
  
}

const editSchedule = (schedule) => {
  uni.navigateTo({
    url: `/pages_chat/outManage/outManage?uuid=${schedule.uuid}&workplace_uuid=${schedule.workplace_uuid}&week=${schedule.week}&type=${schedule.day}`
  })
}

const deleteSchedule = async (uuid) => {
  uni.showModal({
    title: '确认删除',
    content: '确定要删除这条门诊安排吗？',
    success: async (res) => {
      if (res.confirm) {
        try {
          const deleteRes = await api.deleteOutPatient({ uuid });
          if (deleteRes.code === 200) {
            outPatientList.value = outPatientList.value.filter(item => item.uuid !== uuid);
            if(outPatientList.value.length>0){
              isEdit.value=true;
            }else{
              isEdit.value=false;
            }
            uni.showToast({
              title: '删除成功',
              icon: 'none'
            });
            getListOutPatient(true);
          } else {
            uni.showToast({
              title: deleteRes.msg || '删除失败',
              icon: 'none'
            });
          }
        } catch (error) {
          uni.showToast({
            title: '删除失败',
            icon: 'none'
          });
        }
      }
    }
  })
}

const onRefresh = async () => {
  isRefreshing.value = true;
  try {
    if (currentTab.value === 'suspension') {
      await getStopOutPatientList();
    } else {
      await getListOutPatient(true);
    }
  } finally {
    isRefreshing.value = false;
  }
}

const onScrollToLower = () => {
  if (currentTab.value !== 'outpatient') return;
  getListOutPatient(false);
}
</script>

<style lang="scss" scoped>
.outpatient-page {
  min-height: 100vh;
  background-color: #f5f5f5;
  position: relative;
}

/* 状态栏样式 */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20rpx 30rpx;
  background-color: #fff;
  font-size: 28rpx;
  color: #333;
}

.status-right {
  display: flex;
  align-items: center;
  gap: 10rpx;
}

.network-type {
  font-size: 24rpx;
  color: #666;
}

.signal-bars {
  display: flex;
  align-items: end;
  gap: 2rpx;
  margin: 0 10rpx;
}

.bar {
  width: 4rpx;
  background-color: #333;
  border-radius: 1rpx;
}

.bar:nth-child(1) { height: 8rpx; }
.bar:nth-child(2) { height: 12rpx; }
.bar:nth-child(3) { height: 16rpx; }
.bar:nth-child(4) { height: 20rpx; }

.battery {
  display: flex;
  align-items: center;
}

.battery-text {
  font-size: 24rpx;
  color: #333;
}
.divider{
  width: 100%;
  height: 2rpx;
  background-color: #ccc;
  margin: 20rpx 0;
}
/* 导航栏样式 */
.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20rpx 30rpx;
  background-color: #fff;
  border-bottom: 1rpx solid #eee;
}

.nav-left {
  width: 60rpx;
}

.back-arrow {
  font-size: 50rpx;
  color: #8B2316;
}

.nav-center {
  flex: 1;
  text-align: center;
}

.nav-title {
  font-size: 34rpx;
  color: #8B2316;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 20rpx;
  width: 60rpx;
  justify-content: flex-end;
}

.nav-icon {
  width: 40rpx;
  height: 40rpx;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-share {
  font-size: 32rpx;
  color: #666;
}

.add-icon {
  background-color: #8B2316;
  border-radius: 50%;
}

.icon-add {
  font-size: 28rpx;
  color: #fff;
}

/* 标签页样式 */
.tab-container {
 position: fixed;
 top: calc(var(--status-bar-height) + 44px);
 left: 0;
 right: 0;
  display: flex;
  align-items: center;
  background-color: #fff;
  padding: 0 30rpx;
  border-bottom: 1rpx solid #eee;
}

.tab-item {
  flex: 1;
  text-align: center;
  padding: 30rpx 0;
  position: relative;
}

.tab-item.active .tab-text {
  color: #8B2316;
}

.tab-text {
  font-size: 30rpx;
  color: #666;
}

.tab-divider {
  width: 2rpx;
  height: 40rpx;
  background-color: #ddd;
}

/* 主内容区域 */

.content-scroll {
  top: calc(var(--status-bar-height) + 44px + 118rpx);
  position: fixed;
  left: 0;
  right: 0;
 width: 100%;
bottom: 152rpx;

 box-sizing: border-box;
}

/* 停诊公告卡片 */
.announcement-card {
  background-color: #fff;
  border-radius: 16rpx;
  
  margin:0 30rpx 20rpx;
  position: relative;
  .date-bg{
    position: absolute;
    top: 30rpx;
    left: -12rpx;;
    width: 241rpx;
    height: 64rpx;
    z-index: 1;
  }
}

.card-header {
  padding:30rpx 30rpx 0 30rpx;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30rpx;
}

.date-tag {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  padding: 10rpx 8rpx;
  border-radius: 20rpx;
  
}



.tag-date {
  color: #fff;
  font-size: 28rpx;
}

.announcement-card .delete-btn {
  width: 40rpx;
  height: 40rpx;
  
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.delete-icon {
  color: #fff;
  font-size: 24rpx;
}

.card-content {
  /* 卡片内容样式 */
  display: flex;
  flex-direction: column;
}

.info-row {
  display: flex;
  align-items: center;
  margin: 0 30rpx 20rpx;

}

.info-label {
  font-size: 28rpx;
  color: #333;
  margin-right: 20rpx;
  min-width: 120rpx;
}

.info-value {
  font-size: 28rpx;
  color: #666;
  flex: 1;
}

.remarks-row {
  align-items: flex-start;
  .info-label{
    font-size: 26rpx;
   
  }
  .info-value{
    font-size: 26rpx;
  
  }
}

.remarks-input {
  flex: 1;
  background-color: #fff;
  border-radius: 8rpx;
  font-size: 28rpx;
  color: #333;
}

/* 空状态样式 */
.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 400rpx;
}

.empty-text {
  font-size: 28rpx;
  color: #999;
}

/* 门诊安排样式 */
.schedule-list {
  display: flex;
  flex-direction: column;
  margin:0rpx 30rpx 0;
}
.load-more-tip {
  display: flex;
  justify-content: center;
  align-items: center;
  color: #999;
  font-size: 24rpx;
  padding: 20rpx 0 30rpx;
}

.schedule-card {
  background-color: #fff;
  border-radius: 12rpx;
  margin-bottom: 20rpx;
  box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
}
.cell-content {
    padding: 0 30rpx;
    display: flex;
    align-items: flex-start;
}
.schedule-left {
   min-height: 200rpx;
   padding:20rpx 0;
   
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-width: 120rpx;
}

.weekday {
  font-size: 36rpx;
  color: #333;
  margin-bottom: 10rpx;
}

.time-period {
  font-size: 24rpx;
  color: #666;
}

.schedule-right {
  border-left: 2rpx solid #f0f0f0;
  flex: 1;
  min-height: 200rpx;
  padding:20rpx 0;
  margin-left: 30prx;
  display: flex;
  flex-direction: column;
  justify-content: center;
}



.hospital-name {
  font-size: 28rpx;
  color: #333;
  line-height: 1.4;
  margin-bottom: 15rpx;
  display: block;
}

.office-info {
  margin-bottom: 15rpx;
}

.office-name {
  font-size: 32rpx;
  color: #333;
}



.location {
  display: inline-block;
  font-size: 28rpx;
  color: #666;
}

.price-info {
  display: flex;
  align-items: center;
  gap: 15rpx;
}
.hospital-info {
 padding-left: 30rpx;
}
.price {
  font-size: 32rpx;
  color: #333;
}

.type-tag {
  background-color: transparent;
  border: 2rpx solid #8B2316;
  border-radius: 20rpx;
  padding:2rpx 16rpx;
  white-space: nowrap;
  font-size: 20rpx;
  color: #8B2316;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}



.schedule-actions {
    padding: 30rpx;
    border-top: 2rpx solid #f0f0f0;
  display: flex;
  gap: 30rpx;
  justify-content: flex-end;
}

.action-btn {
  display: flex;
  align-items: center;

  padding: 10rpx 20rpx;
  border-radius: 8rpx;
  cursor: pointer;
}

.edit-btn {
    white-space: nowrap;
 
}

.action-icon {
  font-size: 24rpx;
}

.action-text {
    white-space: nowrap;
  font-size: 24rpx;
  color: #666;
  margin-top: 5rpx;
  margin-left: 8rpx;
}

.edit-btn .action-text {
  color: #495057;
}

.delete-btn .action-text {
  color: #666;
}

/* 底部操作按钮 */
.bottom-actions {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1;
  padding: 30rpx;
  background-color: #fff;
  border-top: 1rpx solid #eee;
}

.publish-btn {
  background-color: #8B2316;
  border-radius: 12rpx;
  padding: 25rpx;
  text-align: center;
}

.btn-text {
  color: #fff;
  font-size: 32rpx;
}

/* 浮动编辑按钮 */
.floating-edit-btn {
  position: fixed;
  bottom: 180rpx;
  right: 30rpx;
  width: 80rpx;
  height: 80rpx;
  background-color: #20c997;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4rpx 12rpx rgba(32, 201, 151, 0.3);
}

.edit-icon {
  color: #fff;
  font-size: 32rpx;
}

/* 分享弹窗样式 */
.share-popup {
  background-color: #fff;
  border-radius: 20rpx 20rpx 0 0;
  padding: 40rpx 0 0;
}

.share-title {
  text-align: center;
  font-size: 32rpx;
  color: #333;
  margin-bottom: 40rpx;
  font-weight: 500;
}

.share-content {
  display: flex;
  justify-content: space-around;
  padding: 0 40rpx 40rpx;
}

.share-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.share-icon {
  width: 100rpx;
  height: 100rpx;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20rpx;
}

.share-img {
  width: 100rpx;
  height:100rpx;
}




.weibo-icon {
  background-color: #e6162d;
}

.share-text {
  font-size: 24rpx;
  color: #666;
}

.share-cancel {
  height: 100rpx;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 1rpx solid #f0f0f0;
  font-size: 32rpx;
  color: #333;
}
</style>
