<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">
            <Card class="item" v-for="item in num" :key="item">
                <template #header>
                    <view class="top">
                        <text>住院号：000000</text>
                        <text>2020-12-22</text>
                        <text>手术次数：{{ item }}{{ num }}</text>
                    </view>
                </template>
                <view class="content">
                    <view>患者姓名：xxx</view>
                    <view>手机号码：11111111111</view>
                    <view>植入物品牌：索菲萨</view>
                    <view>原发病：小脑但脂瘤</view>
                    <view class="bright">当前压力：110</view>
                    <view>初始压力：110</view>
                    <view>脑积水类型：交通性，高压性</view>
                </view>
                <template #footer>
                    <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>
                </template>
            </Card>
        </view>
    </view>
    <LoadMore :number="num" :total="20" @reachBottom="reachBottom"></LoadMore>
</template>

<style lang="scss" scoped>
@import "/static/css/variables.scss";
.fab {
    view {
        background: $blue;
        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;
        box-shadow: 0 -10px 4px #fff;

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

    .active {
        background: $blue;
        color: #ffffff;
        border: 1rpx solid $blue;
    }
}

.patient_list {
    padding-top: 20rpx;
    .item {
        .top {
            display: flex;
            justify-content: space-between;
        }

        .content {
            display: flex;
            flex-wrap: wrap;
            view {
                width: 50%;
                margin-bottom: 10rpx;

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

            .bright {
                font-weight: bold;
                color: $blue;
            }
        }

        .btns {
            display: flex;
            justify-content: space-between;
            button {
                padding: 0 20rpx;
                margin: 0;
            }

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

        }
    }
}
</style>
