<script setup>
import { ref } from 'vue';
import { onLoad } from "@dcloudio/uni-app"
import { getPatientList } from "@/services/patient"
let active = ref('all')
let num = ref(5)
// 切换导航
let cutNav = (type) => {
    active.value = type
}
onLoad(() => {
    // getPatientList()
})
const reachBottom = () => {
    if (num.value < 20) num.value += 5
}
</script>

<template>
    <!-- 病人管理 -->
    <view class="main">
        <wd-fab inactiveIcon="ellipsis" activeIcon="rollback">
            <view class="fab">
                <view>调压趋势</view>
                <view>新增任务</view>
                <view>新增手术</view>
            </view>
        </wd-fab>
        <view class="nav_bar">
            <view class="nav">
                <text @tap="cutNav('all')" :class="{ active: active === 'all' }">全部</text>
                <text @tap="cutNav('week')" :class="{ active: active === 'week' }">本周</text>
                <text @tap="cutNav('month')" :class="{ active: active === 'month' }">本月</text>
                <text @tap="cutNav('custom')" :class="{ active: active === 'custom' }">自定义</text>
            </view>
            <wd-search placeholder="住院号/病人名称/医生" hide-cancel />
        </view>
        <wd-gap height="190rpx"></wd-gap>
        <view class="patient_list">
            <wd-card custom-class="item" v-for="item in num" :key="item">
                <view class="top">
                    <text>住院号：000000</text>
                    <text>2020-12-22</text>
                    <text>手术次数：{{ item }}{{ num }}</text>
                </view>
                <view class="content">
                    <view>患者姓名：xxx</view>
                    <view>手机号码：11111111111</view>
                    <view>植入物品牌：索菲萨</view>
                    <view>原发病：小脑但脂瘤</view>
                    <view class="red">当前压力：110</view>
                    <view>初始压力：110</view>
                    <view>脑积水类型：交通性，高压性</view>
                </view>
                <view class="btns">
                    <button size="mini" plain="true">医生共享</button>
                    <button size="mini" plain="true">调压趋势</button>
                    <button size="mini" plain="true">手术详情</button>
                    <button size="mini" plain="true">一键调压</button>
                </view>

            </wd-card>
        </view>
    </view>
    <Loadmore :number="num" :total="20" @reachBottom="reachBottom"></Loadmore>
</template>

<style lang="scss" scoped>
.fab {
    view {
        background: #4d80f0;
        width: 112rpx;
        height: 112rpx;
        border-radius: 50%;
        color: #fff;
        box-sizing: border-box;
        line-height: 34rpx;
        padding: 20rpx 28rpx;
        font-size: 14px;
        margin-top: 18rpx;
    }
}

.nav_bar {
    position: fixed;
    top: 0;
    width: 100%;
    background-color: #fff;
    z-index: 10;
    box-shadow: 0px 2px 5px #c5c5c5;
    .nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
        font-size: 28rpx;
        color: #6b7280;
        padding: 10rpx;

        text {
            padding: 10rpx 16rpx;
            border-radius: 5rpx;
        }
    }

    .active {
        background: #3b82f6;
        color: #ffffff;
        border: 1rpx solid #3b82f6;
    }
}

.patient_list {
    padding-top: 20rpx;
    :deep(.item) {
        padding: 0;
        font-size: 24rpx;
        overflow: hidden;

        .top {
            display: flex;
            justify-content: space-between;
            background-color: #d4edda;
            padding: 20rpx;
            color: #155724;
        }

        .content {
            display: flex;
            padding: 20rpx;
            flex-wrap: wrap;
            font-size: 28rpx;
            color: #333;

            view {
                width: 50%;
                margin-bottom: 10rpx;

                &:last-child {
                    width: 100%;
                }
            }

            .red {
                font-weight: bold;
                color: rgb(255, 21, 21);
            }
        }

        .btns {
            display: flex;
            // gap: 15rpx;
            padding: 20rpx;
            justify-content: space-between;

            button {
                padding: 0 20rpx;
            }

            text {
                background-color: #f8f9fa;
                border-radius: 12rpx;
                flex: 1;
                padding: 16rpx 12rpx;
                text-align: center;
            }

            .add {
                background-color: #007bff;
                color: #ffffff;
            }
        }
    }
}
</style>
