<template>
    <view>
        <!-- home.wxml -->
        <nav-bar :navbarData="navbarData"></nav-bar>
        <view class="container" :style="'margin-top: ' + (height * 2 + 10) + 'rpx; min-height: calc(100vh - ' + (height * 2 + 10) + 'rpx)'">
            <view class="workbench-top" :style="'background-image: url(' + imgDomain + '/images/icon/doctor/workback.png);'">
                <view class="greeting">
                    <text class="datetime">{{ dateStr }}</text>
                    <text class="regard">{{ userData.userName }}，您好！</text>
                </view>
                <view class="homeContent">
                    <view class="stat-cards">
                        <view class="stat-card stat-card-waiting">
                            <view class="stat-card-num">{{ num1 }}</view>
                            <view class="stat-card-label"><text class="label-text">待接诊</text>人数</view>
                        </view>
                        <view class="stat-card stat-card-inprogress">
                            <view class="stat-card-num">{{ inProgressImageNum }}</view>
                            <view class="stat-card-label"><text class="label-text">就诊中</text>人数</view>
                        </view>
                        <view class="stat-card stat-card-finish">
                            <view class="stat-card-num">{{ finishImageNum }}</view>
                            <view class="stat-card-label"><text class="label-text">已完成</text>人数</view>
                        </view>
                    </view>
                </view>
            </view>
            <view class="msgTips">图文咨询</view>
            <view class="home">
                <!-- 自定义日期范围弹层 -->
                <view v-if="calendarShow" class="dateRange-mask" @tap="onCalendarClose">
                    <view class="dateRange-panel" @tap.stop="">
                        <view class="dateRange-title">选择起止日期</view>
                        <view class="dateRange-row" @tap="openWheel('from')">
                            <view class="dateRange-label">开始日期</view>
                            <view class="dateRange-value">{{ dateFromStr || '请选择' }}</view>
                        </view>
                        <view class="dateRange-row" @tap="openWheel('to')">
                            <view class="dateRange-label">结束日期</view>
                            <view class="dateRange-value">{{ dateToStr || '请选择' }}</view>
                        </view>
                        <view class="dateRange-actions">
                            <view class="dateRange-btn dateRange-btn-cancel" @tap="onCalendarClose">取消</view>
                            <view class="dateRange-btn dateRange-btn-confirm" @tap="onDateRangeConfirm">确定</view>
                        </view>
                    </view>
                </view>

                <!-- 滚轮列弹层 -->
                <view v-if="calendarShow && activePicker" class="dateRange-wheel-mask" @tap="onWheelClose">
                    <view class="dateRange-wheel" @tap.stop="">
                        <view class="dateRange-wheel-bar">
                            <view class="dateRange-wheel-cancel" @tap="onWheelClose">取消</view>
                            <view class="dateRange-wheel-title">{{ activePicker === 'from' ? '选择开始日期' : '选择结束日期' }}</view>
                            <view class="dateRange-wheel-confirm" @tap="onWheelConfirm">完成</view>
                        </view>
                        <picker-view
                            class="dateRange-wheel-view"
                            :value="wheelIndex"
                            @change="onWheelChange"
                            :indicator-style="wheelIndicatorStyle"
                        >
                            <picker-view-column>
                                <view class="dateRange-wheel-item" v-for="(y, i) in wheelYears" :key="'y' + i">{{ y }}年</view>
                            </picker-view-column>
                            <picker-view-column>
                                <view class="dateRange-wheel-item" v-for="(m, i) in wheelMonths" :key="'m' + i">{{ m }}月</view>
                            </picker-view-column>
                            <picker-view-column>
                                <view class="dateRange-wheel-item" v-for="(d, i) in wheelDays" :key="'d' + i">{{ d }}日</view>
                            </picker-view-column>
                        </picker-view>
                    </view>
                </view>

                <view class="view-query">
                    <view class="view-query-date">
                        <view
                            :data-code="item.code"
                            @tap="changeQueryDate"
                            :class="'view-query-dateBtn ' + (item.code == queryDateCode ? 'view-query-dateBtn-clicked' : '')"
                            :style="'width: ' + item.width"
                            v-for="(item, index) in queryDateRang"
                            :key="index"
                            hover-class="view-query-dateBtn-hover"
                            hover-stay-time="80"
                        >
                            <view class="buttontext">{{ item.desc }}</view>
                            <view v-if="item.code == 'dayRang'" class="dateBtn-arrow"></view>
                        </view>
                    </view>
                    <view class="view-query-search" @tap="searchFun" hover-class="view-query-search-hover" hover-stay-time="80">
                        <i class="iconfont icon-sousuo view-query-search-icon"></i>
                    </view>
                </view>

                <view class="page__bd" v-if="showSearch">
                    <view class="searchBar">
                        <i class="iconfont icon-sousuo searchBar-icon"></i>
                        <input
                            class="searchBar-input"
                            type="text"
                            placeholder="输入病人姓名查找"
                            :value="patName"
                            :focus="true"
                            confirm-type="search"
                            @input="selectPatient"
                            @confirm="onSearchConfirm"
                        />
                        <view class="searchBar-cancel" @tap="searchCancel">取消</view>
                    </view>
                </view>

                <view class="head">
                    <scroll-view class="tab-h" :scroll-left="scrollLeft">
                        <view
                            :class="'tab-item ' + (currentTab == index ? 'active' : '')"
                            :data-current="index"
                            :data-code="item.statusCode"
                            @tap="currentTabFun"
                            v-for="(item, index) in navTab"
                            :key="index"
                        >
                            <text>{{ item.descripts }}</text>
                        </view>
                    </scroll-view>
                </view>
                <view class="body" v-if="dataList.length > 0">
                    <view class="card" v-for="(item, index) in dataList" :key="index">
                        <view class="personInfo">
                            <view class="admInfo">
                                <text class="admStatus">{{ item.status }}</text>
                                <text class="status" v-if="item.statusCode == 'A'">{{ item.receiveDate }} {{ item.receiveTime }}</text>
                                <text class="status" v-if="item.statusCode == 'F'">{{ item.finishDate }} {{ item.finishTime }}</text>
                                <text class="status" v-if="item.statusCode == 'R'">距离取消：{{ item.countdown }}</text>
                            </view>
                            <view class="patient-content">
                                <view class="userIcon">
                                    <image
                                        v-if="item.patImage && !patientImageError[getPatientKey(item, index)]"
                                        :src="getFullImageUrl(item.patImage)"
                                        class="patImage"
                                        @error="onPatientImageError(item, index)"
                                    ></image>
                                    <image v-else :src="getDefaultPatientAvatar(item)" class="patImage patImageFallback"></image>
                                </view>
                                <view class="info-col">
                                    <view class="info-row">
                                        <text class="person patName">{{ item.patName }}</text>
                                        <text class="person patNo">{{ item.hisPatientNo }}</text>
                                        <image class="sex person" :src="item.patSexDesc == '男' ? male : female"></image>
                                        <text class="person age">{{ item.patAge }}</text>
                                    </view>
                                    <view class="info-row">
                                        <view class="detail">时间:{{ item.admDate }} {{ item.admTime }}</view>
                                    </view>
                                </view>
                            </view>
                        </view>

                        <view class="personDesc">
                            {{ item.symptom }}
                        </view>

                        <view class="row buttonArr">
                            <view class="startview" v-if="item.statusCode == 'R'">
                                <button data-btncode="S" :data-index="index" class="button noStart" @tap.stop.prevent="lookPatient">
                                    <text class="buttonDesc">开始接诊</text>
                                </button>
                            </view>
                            <view class="startview" v-if="item.statusCode == 'F'">
                                <button data-btncode="Z" :data-index="index" class="button lookDateil" @tap.stop.prevent="lookPatient">
                                    <text class="buttonDesc">咨询记录</text>
                                </button>
                            </view>
                            <!-- <view class="startview" v-if="item.statusCode == 'A'">
                                <button :disabled="btnState" data-btncode="AR" :data-index="index" class="button refuseButton1" @tap.stop.prevent="lookPatient">
                                    <text class="buttonDesc" style="color: red">取消接诊</text>
                                </button>
                            </view> -->
                            <view class="startview" v-if="item.statusCode == 'A'">
                                <button data-btncode="C" :data-index="index" class="button noStart" @tap.stop.prevent="lookPatient">
                                    <text class="buttonDesc">继续接诊</text>
                                </button>
                            </view>
                            <view class="startview">
                                <button data-btncode="D" :data-index="index" class="button lookDateil" @tap.stop.prevent="lookPatient">
                                    <text class="buttonDesc">查看详情</text>
                                </button>
                            </view>
                        </view>
                    </view>
                </view>

                <view v-else class="none-container">
                    <image src="https://chis.e24health.com/images/icon/doctor/none.png" class="none"></image>
                    <view style="text-align: center; color: #999999">暂无患者</view>
                </view>
            </view>
        </view>
    </view>
</template>

<script>
import Cache from '../../../utils/cache';
import notice from '@/pages/components/notice/notice';
import navBar from '@/pages/components/navbar/index';
import Dialog from '../../../utils/dialog';
//home.js
//获取应用实例
const app = getApp();
import { $http } from '../../../config/https';
import { httpconfig } from '../../../config/httpconfig';
import messageUtil from '../../../utils/message.js';
import Util from '../../../utils/util.js';
import unreadMessageUtil from '../../../utils/unreadMessage.js';
const nowDate = new Date();
export default {
    components: {
        notice,
        navBar
    },
    data() {
        return {
            imgDomain: httpconfig.imgDomain,
            dateStr: '',

            userData: {
                userName: ''
            },

            num1: 0,
            num2: 0,
            imageText: '',
            videoText: '',
            inProgressImageNum: 0,
            finishImageNum: 0,
            navbarData: {
                background: '#2B84FF',
                title: '工作台',
                //导航栏 中间的标题
                height: '100',
                bottom: false,
                cleanPat: 'Y'
            },

            height: app.globalData.height,
            ip: '',
            loginStaus: '',

            // 图文咨询相关
            btnState: false,
            male: httpconfig.imgDomain + '/images/icon/doctor/male.png',
            female: httpconfig.imgDomain + '/images/icon/doctor/female.png',
            navTab: [],
            currentTab: 1,
            dataList: [],
            sendList: [],
            statusCode: 'R',
            showSearch: false,
            patName: '',
            // 以就诊/患者 ID 记录头像加载失败状态，避免失败后仍显示空白圆形。
            patientImageError: {},
            patientData: Cache.get('patientData'),

            queryDateRang: [
                { id: 0, code: 'currentDay', desc: '今日', width: '20%' },
                { id: 1, code: 'threeDay', desc: '3天', width: '20%' },
                { id: 2, code: 'sevenDay', desc: '7天', width: '20%' },
                { id: 3, code: 'dayRang', desc: '自定义', width: 'auto' }
            ],

            queryDateCode: 'threeDay',
            calendarShow: false,
            minCalendarDate: new Date(nowDate.getFullYear(), nowDate.getMonth(), nowDate.getDate() - 30).getTime(),
            maxCalendarDate: new Date(nowDate.getFullYear(), nowDate.getMonth(), nowDate.getDate()).getTime(),
            dateFrom: '',
            dateTo: '',
            dateFromStr: '',
            dateToStr: '',
            dateFromStartStr: '',
            dateFromEndStr: '',

            activePicker: '',
            wheelYears: [],
            wheelMonths: [],
            wheelDays: [],
            wheelIndex: [0, 0, 0],
            wheelIndicatorStyle: 'height: 80rpx; line-height: 80rpx;',

            defaultDate: [
                new Date(nowDate.getFullYear(), nowDate.getMonth(), nowDate.getDate() - 2).getTime(),
                new Date(nowDate.getFullYear(), nowDate.getMonth(), nowDate.getDate()).getTime()
            ],
            scrollLeft: 0
        };
    },
    onLoad: function (options) {
        // 页面初始化 options为页面跳转所带来的参数
        console.log('App onLoad');
        this.getLoginInfo();
    },
    onReady: function () {
        // 页面渲染完成
        console.log('App onReady');
    },
    onShow: function () {
        this.onShowClone3389();
    },
    onHide: function () {
        // 页面隐藏
        console.log('App onHide');
    },
    onUnload: function () {
        // 页面关闭
        console.log('App onUnload');
    },
    onTabItemTap: function (e) {
        let userData = Cache.get('userData');
        if (!userData || !userData.userID) {
            uni.showToast({
                title: '请先登录',
                icon: 'none'
            });
            setTimeout(() => {
                uni.switchTab({
                    url: '/pages/tabBar/login/login'
                });
            }, 1500);
        }
    },
    methods: {
        onShowClone3389: function () {
            // 页面显示
            console.log('App onShow');
            const userData = Cache.get('userData');
            // 每次进入首页或切换 tab 时检查未读消息，更新消息 tab 红点
            this.getUnreadMessageCount();
            if (userData && userData.userID) {
                this.setData({
                    userData
                });
                this.showTime();
                this.getNumber();
                this.getColum();
                this.getData();
            }
        },

        tapName: function (event) {
            console.log(event);
            let { currentTarget } = event;
            let dataset = currentTarget.dataset;
            uni.navigateTo({
                //目的页面地址
                url: dataset.url,
                success: function (res) {},
                fail: function (res) {
                    console.log(res);
                }
            });
        },

        showTime: function () {
            let show_day = new Array('星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六');
            let time = new Date();
            let year = time.getFullYear();
            let month = time.getMonth() + 1;
            let date = time.getDate();
            let day = time.getDay();
            let hour = time.getHours();
            let minutes = time.getMinutes();
            let second = time.getSeconds();
            if (month < 10) {
                month = '0' + month;
            } else {
                month;
            }
            if (hour < 10) {
                hour = '0' + hour;
            } else {
                hour;
            }
            minutes < 10 ? (minutes = '0' + minutes) : minutes;
            second < 10 ? (second = '0' + second) : second;
            let now_time = year + '-' + month + '-' + date + ' ' + hour + ':' + minutes + ':' + second + ' ' + show_day[day];
            this.setData({
                dateStr: now_time
            });
        },

        getNumber: function () {
            const userData = Cache.get('userData');
            if (!userData || !userData.userID) {
                return;
            }
            // 计算日期范围
            let dateFrom = '';
            let dateTo = '';
            const today = new Date();
            const fmt = (d) => {
                return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`;
            };
            if (this.queryDateCode === 'currentDay') {
                dateFrom = fmt(today);
                dateTo = fmt(today);
            } else if (this.queryDateCode === 'threeDay') {
                const threeDaysAgo = new Date(today);
                threeDaysAgo.setDate(today.getDate() - 2);
                dateFrom = fmt(threeDaysAgo);
                dateTo = fmt(today);
            } else if (this.queryDateCode === 'sevenDay') {
                const sevenDaysAgo = new Date(today);
                sevenDaysAgo.setDate(today.getDate() - 6);
                dateFrom = fmt(sevenDaysAgo);
                dateTo = fmt(today);
            } else if (this.queryDateCode === 'dayRang') {
                if (this.dateFrom && this.dateTo) {
                    dateFrom = fmt(this.dateFrom);
                    dateTo = fmt(this.dateTo);
                }
            }
            $http.post('urlDeault', this, {
                code: '03100073',
                data: {
                    params: [
                        {
                            userID: userData.userID,
                            locID: userData.locID,
                            hospID: userData.hospID,
                            dateFrom: dateFrom,
                            dateTo: dateTo
                        }
                    ]
                },
                success: function (res) {
                    let errorCode = res.errorCode;
                    if (errorCode === '0') {
                        console.log(res.result);
                        this.setData({
                            num1: res.result.imageNum,
                            inProgressImageNum: res.result.inProgressImageNum,
                            finishImageNum: res.result.finishImageNum || 0,
                            num2: res.result.videoNum,
                            imageText: res.result.imageText ? res.result.imageText : '暂无患者咨询',
                            videoText: res.result.videoText ? res.result.videoText : '暂无待诊患者'
                        });
                    }
                }
            });
        },

        // ========== 图文咨询相关方法 ==========

        /**
         * 获取未读消息总数，更新消息 tab 红点
         * 接口文档：docs/文档.md (code: 04180005)
         */
        getUnreadMessageCount: function () {
            const userData = Cache.get('userData');
            if (!userData || !userData.userID) {
                unreadMessageUtil.updateMessageRedDot(0);
                return;
            }
            var that = this;
            unreadMessageUtil.fetchUnreadMessages({
                success: function (res) {
                    unreadMessageUtil.updateMessageRedDot(res.total);
                }
            });
        },

        getFullImageUrl: function (url) {
            if (!url) return '';
            const imageUrl = String(url).trim();
            if (/^(https?:)?\/\//i.test(imageUrl) || imageUrl.startsWith('data:')) {
                return imageUrl;
            }

            // 接口会返回 /patientapp/images/...，但图片服务实际公开路径为 /images/...
            // 统一改写后再补全域名，避免 H5 环境请求到不存在的 /patientapp/images 路径。
            const imagePath = imageUrl.replace(/^\/?patientapp\/images(?=\/|$)/i, '/images');
            return this.imgDomain.replace(/\/$/, '') + (imagePath.startsWith('/') ? imagePath : '/' + imagePath);
        },

        getPatientKey: function (item, index) {
            return String(item.admID || item.patID || item.hisPatientNo || index);
        },

        onPatientImageError: function (item, index) {
            const key = this.getPatientKey(item, index);
            if (this.patientImageError[key]) return;
            this.setData({
                patientImageError: {
                    ...this.patientImageError,
                    [key]: true
                }
            });
        },

        getDefaultPatientAvatar: function (item) {
            return item.patSexDesc === '男'
                ? 'https://hlwyy.scsmysgkyy.cn/images/icon/gender-male.png'
                : 'https://hlwyy.scsmysgkyy.cn/images/icon/gender-female.png';
        },

        selectPatient: function (e) {
            this.setData(
                {
                    patName: e.detail.value
                },
                () => {
                    this.getData();
                }
            );
        },

        searchCancel: function (e) {
            this.setData(
                {
                    patName: '',
                    showSearch: false
                },
                () => {
                    this.getData();
                }
            );
        },

        searchFun: function () {
            this.setData({
                showSearch: !this.showSearch
            });
        },

        currentTabFun: function (e) {
            if (this.currentTab == e.currentTarget.dataset.current) {
                return;
            }
            this.setData(
                {
                    currentTab: e.currentTarget.dataset.current,
                    statusCode: e.currentTarget.dataset.code
                },
                () => {
                    this.getData();
                }
            );
            this.sendList = [];
        },

        getColum: function () {
            let data = {
                params: [
                    {
                        hospID: this.userData.hospID,
                        userID: this.userData.userID,
                        locID: this.userData.locID
                    }
                ]
            };
            $http.post('urlDeault', this, {
                code: '03100010',
                data: data,
                success: function (res) {
                    if (res.errorCode == '0') {
                        this.setData({
                            navTab: res.result
                        });
                    }
                }
            });
        },

        getData: function () {
            let that = this;
            var dateFrom = this.dateFrom;
            var dateTo = this.dateTo;
            if (dateFrom != '' && dateTo != '') {
                dateFrom = `${dateFrom.getFullYear()}-${dateFrom.getMonth() + 1}-${dateFrom.getDate()}`;
                dateTo = `${dateTo.getFullYear()}-${dateTo.getMonth() + 1}-${dateTo.getDate()}`;
            }
            let data = {
                params: [
                    {
                        hospID: this.userData.hospID,
                        userID: this.userData.userID,
                        locID: this.userData.locID,
                        statusCode: that.statusCode,
                        dateFrom: dateFrom,
                        dateTo: dateTo,
                        dateRangeCode: this.queryDateCode,
                        patName: this.patName
                    }
                ]
            };
            $http.post('urlDeault', this, {
                code: '03100011',
                data: data,
                success: function (res) {
                    if (res.errorCode == '0') {
                        this.setData({
                            dataList: res.result.data,
                            // 刷新列表时允许新返回的头像重新加载。
                            patientImageError: {}
                        });
                    }
                }
            });
        },

        lookPatient: function (e) {
            var btncode = e.currentTarget.dataset.btncode;
            var index = e.currentTarget.dataset.index;
            Cache.set('patientData', this.dataList[index]);
            if (btncode == 'S') {
                if (!this.ifOnline()) {
                    return;
                }
            }
            if (btncode == 'S') {
                var admType = 'graphic';
                uni.navigateTo({
                    url: '../../myConsultRoom/page/treatment/treatment?admtype=' + admType
                });
            }
            if (btncode == 'C') {
                var admType = 'graphic';
                uni.navigateTo({
                    url: '../../myConsultRoom/page/treatment/treatment?admtype=' + admType
                });
            }
            if (btncode == 'Z') {
                uni.navigateTo({
                    url: '../../myConsultRoom/page/treatmentrecord/treatmentrecord'
                });
            }
            if (btncode == 'D') {
                uni.navigateTo({
                    url: '../../myConsultRoom/page/graphicDateil/graphicDateil'
                });
            }
            if (btncode == 'AR') {
                this.setData({
                    btnState: true
                });
                let userData = Cache.get('userData');
                let data = {
                    params: [
                        {
                            hospID: userData.hospID,
                            userID: userData.userID,
                            admID: this.dataList[index].admID
                        }
                    ]
                };
                $http.post(
                    'urlDeault',
                    this,
                    {
                        code: '03100107',
                        data: data,
                        success: function (res) {
                            if (res.errorCode == '0') {
                                this.setData({
                                    btnState: false
                                });
                                this.getData();
                            } else {
                                this.setData({
                                    btnState: false
                                });
                                Dialog.alert({
                                    title: '提示',
                                    message: res.errorMessage,
                                    context: this
                                });
                            }
                        }
                    },
                    {
                        error: 'Y'
                    }
                );
            }
        },

        changeQueryDate: function (e) {
            let queryDateCode = e.currentTarget.dataset.code;
            this.setData({
                queryDateCode: queryDateCode
            });
            if (queryDateCode === 'dayRang') {
                const fmt = (d) => {
                    return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`;
                };
                const today = new Date();
                const start = new Date(today.getFullYear(), today.getMonth(), today.getDate() - 30);
                this.setData({
                    calendarShow: true,
                    activePicker: '',
                    dateFromStr: this.dateFrom ? fmt(this.dateFrom) : '',
                    dateToStr: this.dateTo ? fmt(this.dateTo) : '',
                    dateFromStartStr: fmt(start),
                    dateFromEndStr: fmt(today)
                });
            } else {
                this.setData({
                    dateFrom: '',
                    dateTo: '',
                    dateFromStr: '',
                    dateToStr: ''
                });
                this.getData();
                this.getNumber();
            }
        },

        onCalendarClose: function () {
            this.setData({
                calendarShow: false,
                activePicker: ''
            });
        },

        openWheel: function (type) {
            const fmt = (d) => `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`;
            const today = new Date();
            const min = this.dateFromStartStr ? new Date(this.dateFromStartStr) : new Date(today.getFullYear() - 5, 0, 1);
            const max = this.dateFromEndStr ? new Date(this.dateFromEndStr) : today;

            const years = [];
            for (let y = min.getFullYear(); y <= max.getFullYear(); y++) years.push(y);
            const months = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];

            const curStr = type === 'from' ? this.dateFromStr : this.dateToStr;
            let cur = curStr ? new Date(curStr) : today;
            if (cur < min) cur = min;
            if (cur > max) cur = max;

            const daysInMonth = new Date(cur.getFullYear(), cur.getMonth() + 1, 0).getDate();
            const days = [];
            for (let d = 1; d <= daysInMonth; d++) days.push(d);

            const yearIdx = years.indexOf(cur.getFullYear());
            const monthIdx = cur.getMonth();
            const dayIdx = cur.getDate() - 1;

            this.setData({
                activePicker: type,
                wheelYears: years,
                wheelMonths: months,
                wheelDays: days,
                wheelIndex: [Math.max(0, yearIdx), monthIdx, Math.max(0, dayIdx)]
            });
        },

        onWheelChange: function (e) {
            const val = e.detail.value;
            const [yIdx, mIdx, dIdx] = val;
            const year = this.wheelYears[yIdx] || this.wheelYears[0];
            const month = this.wheelMonths[mIdx] || 1;
            const daysInMonth = new Date(year, month, 0).getDate();
            let days = this.wheelDays;
            if (days.length !== daysInMonth) {
                days = [];
                for (let d = 1; d <= daysInMonth; d++) days.push(d);
            }
            let dayIdx = dIdx;
            if (dayIdx > days.length - 1) dayIdx = days.length - 1;
            this.setData({
                wheelDays: days,
                wheelIndex: [yIdx, mIdx, dayIdx]
            });
        },

        onWheelConfirm: function () {
            const [yIdx, mIdx, dIdx] = this.wheelIndex;
            const year = this.wheelYears[yIdx];
            const month = this.wheelMonths[mIdx];
            const day = this.wheelDays[dIdx];
            if (!year || !month || !day) {
                this.setData({ activePicker: '' });
                return;
            }
            const pad = (n) => String(n).padStart(2, '0');
            const str = `${year}-${pad(month)}-${pad(day)}`;

            if (this.activePicker === 'from') {
                if (this.dateToStr && str > this.dateToStr) {
                    Dialog.alert({ title: '提示', message: '开始日期不能晚于结束日期', context: this });
                    return;
                }
                this.setData({ dateFromStr: str, activePicker: '' });
            } else if (this.activePicker === 'to') {
                if (this.dateFromStr && str < this.dateFromStr) {
                    Dialog.alert({ title: '提示', message: '结束日期不能早于开始日期', context: this });
                    return;
                }
                this.setData({ dateToStr: str, activePicker: '' });
            } else {
                this.setData({ activePicker: '' });
            }
        },

        onWheelClose: function () {
            this.setData({ activePicker: '' });
        },

        onDateRangeConfirm: function () {
            if (!this.dateFromStr || !this.dateToStr) {
                Dialog.alert({ title: '提示', message: '请选择完整的开始和结束日期', context: this });
                return;
            }
            const parse = (str) => {
                const parts = str.split('-');
                return new Date(+parts[0], +parts[1] - 1, +parts[2]);
            };
            this.setData({
                calendarShow: false,
                activePicker: '',
                dateFrom: parse(this.dateFromStr),
                dateTo: parse(this.dateToStr)
            });
            this.getData();
            this.getNumber();
        },

        ifOnline: function () {
            let TIMInfo = Cache.get('TIMInfo');
            let navbarData = this.navbarData;
            if (TIMInfo.loginStatus == 'N') {
                navbarData.overlayVisible = true;
                navbarData.message = '您处于离线状态，请先登录';
                navbarData.login = true;
                this.setData({
                    navbarData
                });
                return false;
            } else {
                return true;
            }
        },

        onSearchConfirm: function () {
            this.getData();
        },

        /**
         * 获取登录信息
         */
        getLoginInfo: function () {
            var that = this;
            uni.request({
                url: httpconfig.domain + '/localIP',
                success: function (e) {
                    that.setData({
                        ip: e.data.ipv4
                    });
                }
            });
            const cacheUserData = Cache.get('userData');
            if (cacheUserData && cacheUserData.userID) {
                this.setData({
                    loginStaus: 'Y'
                });
                let TIMInfo = Cache.get('TIMInfo') || {};
                if (TIMInfo.loginStatus !== 'Y') {
                    messageUtil.initTim();
                }
                this.onShowClone3389({});
                return;
            }
            // #ifdef H5
            // 单点登录进行中时，不跳登录页，等待 SSO 完成后页面会自动刷新
            if (app.globalData && app.globalData.ssoPending) {
                return;
            }
            this.goLogin();
            return;
            // #endif
            var accountInfo = typeof uni.getAccountInfoSync === 'function' ? uni.getAccountInfoSync() : { miniProgram: { appId: '' } };
            var appID = accountInfo.miniProgram.appId;
            uni.login({
                success(res) {
                    if (res.code) {
                        Util.getOpenID(res.code, (openid) => {
                            // 登录接口
                            let data = {
                                params: [
                                    {
                                        openID: openid,
                                        appID: appID,
                                        status: 'Y'
                                    }
                                ]
                            };
                            $http.post('urlDeault', this, {
                                code: '03100014',
                                data: data,
                                success: function (res) {
                                    if (res.errorCode == '0') {
                                        if (res.result && res.result.userID) {
                                            uni.setStorage({
                                                key: 'userData',
                                                data: res.result,
                                                success: function () {
                                                    let TIMInfo = Cache.get('TIMInfo');
                                                    if (TIMInfo == '' || TIMInfo.loginStatus == 'N') {
                                                        messageUtil.initTim();
                                                    }
                                                    that.onShowClone3389({});
                                                }
                                            });
                                            let background = "url('" + httpconfig.domain + "/images/icon/myhead.png')";
                                            that.setData({
                                                loginStaus: 'Y',
                                                navbarData: {
                                                    background: background,
                                                    title: '我的',
                                                    //导航栏 中间的标题
                                                    height: '100',
                                                    bottom: false
                                                }
                                            });
                                        } else {
                                            that.goLogin();
                                        }
                                    } else {
                                        that.goLogin();
                                    }
                                },
                                fail: function (res) {
                                    that.goLogin();
                                }
                            });
                        });
                    }
                },
                fail: function () {
                    that.goLogin();
                }
            });
        },

        /**
         * 跳转登录
         */
        goLogin: function () {
            uni.showToast({
                title: '请先登录',
                icon: 'none'
            });
            setTimeout(() => {
                uni.switchTab({
                    url: '/pages/tabBar/login/login'
                });
            }, 1500);
        }
    }
};
</script>
<style>
@import '../../../assets/css/iconfont.css';
</style>
<style>
/**home.wxss**/

.container {
    min-height: 100vh;
    background-color: #f5f4f4;
    display: flex;
    flex-direction: column;
}

page {
    height: 100%;
}

.home {
    padding: 0 20rpx 20rpx 20rpx;
    width: 100%;
    flex: 1;
    min-height: 360rpx;
    overflow-y: auto;
    box-sizing: border-box;
}

.homeContent {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 18rpx;
    padding: 0 20rpx 24rpx;
    box-sizing: border-box;
}

.homeBox {
    height: 150rpx;
    line-height: 110rpx;
    border: 1rpx solid #eee;
    border-top: none;
    margin-left: -6rpx;
    font-size: 30rpx;
    color: #666;
    position: relative;
}

.homeBox .iconImg {
    line-height: 150rpx;
}

.homeBox_label {
    position: absolute;
    height: 20rpx;
    line-height: 20rpx;
    left: 0;
    top: 80rpx;
    color: #ccc;
    width: 100%;
    text-align: left;
    font-size: 20rpx;
}

.homeBox_label2 {
    top: 110rpx;
    color: #f93;
}

.messageview {
    height: calc(100% - 3px);
    width: 100%;
    padding-top: 3px;
}

.homeMessageTitle {
    padding: 0 20rpx;
    font-size: 25rpx;
    border: 2rpx solid #eee;
    border-bottom: none;
    height: 60rpx;
    line-height: 60rpx;
}

.homeMessageContent {
    background-color: #f5f4f4;
    overflow: scroll;
}

.homeMessageBox {
    height: 200rpx;
    font-size: 30rpx;
    color: #666;
    position: relative;
    background-color: #fff;
    margin: 1px 0 2rpx 20rpx;
    width: 95%;
    border-radius: 10rpx;
}

.homeMessageBox .iconImg {
    line-height: 120rpx;
}

.homeMessageBox_label1 {
    position: absolute;
    left: 0;
    top: 10rpx;
    font-size: 30rpx;
    color: #666;
    text-align: left;
}

.homeMessageBox_label2 {
    top: 40rpx;
    right: 20rpx;
    text-align: right;
    font-size: 20rpx;
    color: #ccc;
}

.homeMessageBox_label3 {
    top: 70rpx;
    font-size: 25rpx;
    color: #f93;
}

.moudle {
    display: flex;
    align-items: center;
    margin: 0;
    background-color: #fff;
    border-radius: 14rpx;
    width: 100%;
    min-height: 132rpx;
    height: auto;
    box-shadow: 0 8rpx 24rpx rgba(25, 82, 150, 0.08);
    border: 1px solid rgba(232, 238, 248, 0.9);
    box-sizing: border-box;
}

.moudle:active {
    background-color: #f7f7f7;
}

cover-image {
    height: 120rpx;
    width: 120rpx;
    margin: 12rpx 0 0 11rpx;
}

.title {
    display: inline-block;
    font-size: 32rpx;
    font-weight: 700;
    color: #1f2937;
    line-height: 42rpx;
}

.note {
    display: block;
    margin-top: 8rpx;
    font-size: 26rpx;
    color: #999;
    position: static;
    height: auto;
    line-height: 34rpx;
    width: 100%;
}

.sub-title {
    display: inline-block;
    font-size: 26rpx;
    color: #999;
    margin-left: 16rpx;
    line-height: 36rpx;
}

.module-icon {
    height: auto;
    flex: 0 0 136rpx;
    display: flex;
    justify-content: center;
    align-items: center;
}

.col-9 {
    margin-top: 15rpx;
}

.stat-cards {
    display: flex;
    flex-direction: row;
    gap: 16rpx;
    padding: 0 20rpx 24rpx;
}

.stat-card {
    flex: 1;
    height: 160rpx;
    border-radius: 16rpx;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.stat-card-waiting {
    background: linear-gradient(145deg, #f0f4ff 0%, #e6ecff 100%);
}

.stat-card-inprogress {
    background: linear-gradient(145deg, #fff0f5 0%, #ffe6ee 100%);
}

.stat-card-finish {
    background: linear-gradient(145deg, #f0fff4 0%, #e3fcef 100%);
}

.stat-card-num {
    font-size: 48rpx;
    font-weight: 700;
    color: #5b8def;
    line-height: 1.2;
}

.stat-card-inprogress .stat-card-num {
    color: #e86885;
}

.stat-card-finish .stat-card-num {
    color: #52c4a1;
}

.stat-card-label {
    font-size: 24rpx;
    color: #666;
    margin-top: 8rpx;
}

.label-text {
    color: #1f2937;
    font-weight: 600;
}

.greeting {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    min-height: 140rpx;
    height: auto;
    font-size: 1rem;
    margin: 0;
    padding: 88rpx 28rpx 18rpx;
    color: #fff;
}

.datetime {
    font-size: 24rpx;
    line-height: 34rpx;
}

.regard {
    margin-top: 8rpx;
    font-size: 34rpx;
    line-height: 44rpx;
    font-weight: 700;
}

.title-center {
    height: 55rpx;
    margin: 0rpx 0 10rpx 20rpx;
}

.patientInfo1 {
    float: left;
}

.patientInfo2 {
    float: left;
    margin-top: 5rpx;
}

.patientInfo3 {
    background: #ffbe32;
    color: white;
    font-size: 30rpx;
}

.person {
    margin-left: 7px;
}

.message {
    height: 80rpx;
    border-bottom: 1rpx solid #f5f4f4;
    color: #333;
}

.label {
    margin: 10rpx 0 0 20rpx;
}

.weui-badge {
    margin-top: 46rpx;
}

.workbench-top {
    min-height: 238rpx;
    height: auto;
    width: 100%;
    margin-top: -2.0009rpx;
    background-repeat: no-repeat;
    background-size: 100% 220rpx;
    background-color: #2b84ff;
    padding-bottom: 10rpx;
    box-sizing: border-box;
    position: relative;
    z-index: 0;
}

.msgTips {
    width: calc(100% - 40rpx);
    margin: 22rpx 20rpx 16rpx;
    padding: 0 20rpx;
    height: 40rpx;
    line-height: 40rpx;
    font-size: 32rpx;
    font-family: PingFang SC;
    font-weight: bold;
    color: rgba(51, 51, 51, 1);
    border-left: 2px solid #1890ff;
    box-sizing: border-box;
}
.myloc {
    height: 92rpx;
    width: 92rpx;
    padding: 0;
}

.module-main {
    margin-top: 0;
    flex: 1;
    min-width: 0;
}

.module-arrow {
    flex: 0 0 48rpx;
    display: flex;
    align-items: center;
    justify-content: center;
}

.module-arrow-icon {
    width: 16rpx;
    height: 16rpx;
    border-top: 3rpx solid #c9cdd4;
    border-right: 3rpx solid #c9cdd4;
    transform: rotate(45deg);
}

/* ========== 图文咨询内嵌样式 ========== */

.view-query {
    flex-shrink: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    height: auto;
    padding: 16rpx 0 10rpx;
}

.view-query-date {
    flex: 1;
    min-width: 0;
    margin: 0;
    background: #ffffff;
    border-radius: 16rpx;
    padding: 8rpx;
    box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.04);
    box-sizing: border-box;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4rpx;
}

.view-query-dateBtn {
    flex: 1 1 0;
    min-width: 0;
    height: 64rpx;
    padding: 0 6rpx;
    border-radius: 12rpx;
    background: transparent;
    font-size: 28rpx;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #4a5160;
    line-height: 64rpx;
    text-align: center;
    box-sizing: border-box;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    position: relative;
}

.view-query-dateBtn-hover {
    background: #f4f7fb;
    opacity: 1;
}

.view-query-dateBtn:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 16rpx;
    bottom: 16rpx;
    width: 1rpx;
    background: #eef0f3;
}

.view-query-dateBtn-clicked {
    background: #eaf4ff;
    color: #1687ff;
    font-weight: 600;
}

.view-query-dateBtn-clicked::after {
    display: none;
}

.buttontext {
    line-height: 64rpx;
    height: 64rpx;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dateBtn-arrow {
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 8rpx;
    border-left: 8rpx solid transparent;
    border-right: 8rpx solid transparent;
    border-top: 8rpx solid currentColor;
    opacity: 0.6;
    flex-shrink: 0;
}

.view-query-search {
    flex: 0 0 76rpx;
    width: 76rpx;
    height: 76rpx;
    margin: 0 0 0 12rpx;
    padding: 0;
    border-radius: 18rpx;
    background-color: #ffffff;
    box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.view-query-search-hover {
    background-color: #f2f5fa;
    box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
}

.view-query-search-icon {
    font-size: 36rpx !important;
    line-height: 1;
    color: #5f6b7a;
    display: inline-block;
}

.page__bd {
    flex-shrink: 0;
    padding: 16rpx 0 10rpx;
}

.searchBar {
    display: flex;
    flex-direction: row;
    align-items: center;
    height: 76rpx;
    width: 100%;
    padding: 0 20rpx;
    background: #ffffff;
    border-radius: 18rpx;
    box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.04);
    box-sizing: border-box;
}

.searchBar-icon {
    flex: 0 0 auto;
    font-size: 36rpx !important;
    line-height: 1;
    color: #5f6b7a;
    margin-right: 16rpx;
    display: inline-block;
}

.searchBar-input {
    flex: 1;
    min-width: 0;
    height: 76rpx;
    line-height: 76rpx;
    font-size: 28rpx;
    color: #1f2329;
    background: transparent;
    border: 0;
    padding: 0;
    box-sizing: border-box;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

.searchBar-input::placeholder {
    color: #b6bcc7;
    font-size: 28rpx;
}

.searchBar-cancel {
    flex: 0 0 auto;
    margin-left: 20rpx;
    padding: 0 8rpx;
    height: 76rpx;
    line-height: 76rpx;
    font-size: 28rpx;
    color: #4a5160;
    white-space: nowrap;
}

.head {
    flex-shrink: 0;
    height: auto;
    margin-bottom: 14rpx;
}

.tab-h {
    height: 88rpx;
    width: 100%;
    margin: 0;
    box-sizing: border-box;
    overflow: hidden;
    line-height: 88rpx;
    font-size: 28rpx;
    white-space: nowrap;
    background: #ffffff;
    border-radius: 16rpx;
    box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.04);
}

.tab-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 136rpx;
    height: 88rpx;
    margin: 0;
    padding: 0 16rpx;
    box-sizing: border-box;
    position: relative;
    color: #4a5160;
}

.tab-item.active {
    font-size: 30rpx;
    font-family: Microsoft YaHei;
    font-weight: 600;
    color: #1687ff;
    border-bottom: 0;
    height: 88rpx;
}

.tab-item.active::after {
    content: '';
    position: absolute;
    left: 34rpx;
    right: 34rpx;
    bottom: 0;
    height: 4rpx;
    border-radius: 4rpx;
    background: #1687ff;
}

.body {
    flex: 1;
    min-height: 0;
    width: 100%;
    margin-top: 0;
    overflow-y: auto;
    padding-bottom: 12rpx;
    box-sizing: border-box;
}

.card {
    width: 100%;
    box-sizing: border-box;
    background-color: #fff;
    position: relative;
    margin: 0 0 20rpx;
    color: #4a5160;
    border: 0;
    border-radius: 18rpx;
    overflow: hidden;
    box-shadow: 0 8rpx 24rpx rgba(15, 23, 42, 0.06);
}

.personInfo {
    color: #1f2329;
    font-size: 30rpx;
    margin: 0;
}

.patient-content {
    padding: 18rpx 24rpx 20rpx;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20rpx;
    box-sizing: border-box;
}

.info-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.info-row {
    min-height: 40rpx;
    line-height: 40rpx;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    flex-direction: row;
    align-items: center;
}

.info-row + .info-row {
    margin-top: 8rpx;
}

.personDesc {
    min-height: 60rpx;
    width: auto;
    color: #3f4a5a;
    font-size: 28rpx;
    padding: 16rpx 20rpx;
    margin: 0 24rpx 16rpx;
    background: #f7f9fc;
    border-radius: 12rpx;
    box-sizing: border-box;
    line-height: 40rpx;
    display: -webkit-box;
    /* -webkit-line-clamp: 2; */
    -webkit-box-orient: vertical;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-all;
}

.buttonArr {
    width: 100%;
    margin: 0;
    min-height: 96rpx;
    height: auto;
    border-top: 1rpx solid #edf1f6;
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    padding: 14rpx 20rpx;
    box-sizing: border-box;
    gap: 12rpx;
}

.startview {
    width: auto;
    height: auto;
    margin: 0;
    text-align: right;
    display: flex;
    float: none;
}

.userIcon {
    flex: 0 0 88rpx;
    width: 88rpx;
    height: 88rpx;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admStatus {
    font-size: 28rpx;
    font-weight: 600;
    color: #1f2329;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admInfo {
    padding: 18rpx 24rpx;
    border-bottom: 1rpx solid #edf1f6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16rpx;
    box-sizing: border-box;
}

.detail {
    font-size: 26rpx;
    color: #8b98a8;
    line-height: 40rpx;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status {
    margin-top: 0;
    text-align: right;
    float: none;
    font-size: 26rpx;
    color: #8b98a8;
    white-space: nowrap;
    flex-shrink: 0;
}

.button {
    height: 60rpx;
    width: auto;
    min-width: 140rpx;
    border-radius: 30rpx;
    line-height: 58rpx;
    font-size: 26rpx;
    padding: 0 24rpx;
    margin: 0;
    box-sizing: border-box;
    font-family: Microsoft YaHei;
}

.noStart {
    background-color: #1687ff;
    border: 1rpx solid #1687ff;
    color: #ffffff;
}

.buttonDesc {
    width: auto;
    margin-left: 0 !important;
    padding: 0 !important;
    font-size: 26rpx;
    line-height: 58rpx;
}

.lookDateil {
    background-color: #ffffff;
    border: 1rpx solid #1687ff;
    color: #1687ff;
}

.refuseButton1 {
    background-color: #ffffff;
    border: 1rpx solid #f56c6c;
    color: #f56c6c;
}

button:after {
    border-radius: 0;
    border: 0;
}

.age {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44rpx;
    max-width: 100rpx;
    background: #eaf4ff;
    color: #1687ff;
    font-size: 22rpx;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 32rpx;
    height: 32rpx;
    padding: 0 8rpx;
    border-radius: 4rpx;
    text-align: center;
    box-sizing: border-box;
    flex-shrink: 0;
}

.sex {
    height: 32rpx;
    width: 32rpx;
    padding-top: 0;
    flex-shrink: 0;
    margin-right: 8rpx;
}

.person {
    float: none;
    color: #1f2329;
    font-size: 30rpx;
    line-height: 40rpx;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.patName {
    font-size: 32rpx;
    font-weight: 600;
    max-width: 200rpx;
}

.patNo {
    color: #8b98a8;
    font-size: 26rpx;
    margin-left: 12rpx;
    max-width: 200rpx;
    font-weight: 400;
}

.patImage {
    width: 80rpx;
    height: 80rpx;
    padding: 0;
    border-radius: 50%;
    background: #eef2f7;
    display: block;
}

.patImageFallback {
    width: 80rpx;
    height: 80rpx;
    line-height: 80rpx;
    border-radius: 50%;
    background: #5cadff;
    color: #ffffff;
    font-size: 32rpx;
    font-weight: 500;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.none-container {
    padding-top: 60rpx;
}

.none {
    height: 264rpx;
    width: 300rpx;
    display: block;
    margin: 0 auto 10rpx;
}

/* ========== 自定义日期范围弹层 ========== */
.dateRange-mask {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dateRange-panel {
    width: 600rpx;
    max-width: 90vw;
    background: #ffffff;
    border-radius: 16rpx;
    padding: 32rpx 32rpx 24rpx;
    box-sizing: border-box;
    box-shadow: 0 12rpx 40rpx rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
}

.dateRange-title {
    font-size: 32rpx;
    font-weight: 600;
    color: #1f2329;
    text-align: center;
    line-height: 44rpx;
    margin-bottom: 24rpx;
}

.dateRange-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    height: 80rpx;
    line-height: 80rpx;
    padding: 0 20rpx;
    margin-bottom: 16rpx;
    background: #f7f9fc;
    border-radius: 12rpx;
    box-sizing: border-box;
    font-size: 28rpx;
}

.dateRange-label {
    flex: 0 0 auto;
    color: #4a5160;
    font-size: 28rpx;
    white-space: nowrap;
    margin-right: 16rpx;
}

.dateRange-value {
    color: #1f2329;
    font-size: 28rpx;
    line-height: 80rpx;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.dateRange-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    margin-top: 16rpx;
    gap: 20rpx;
}

.dateRange-btn {
    flex: 1;
    height: 72rpx;
    line-height: 72rpx;
    text-align: center;
    border-radius: 36rpx;
    font-size: 28rpx;
    box-sizing: border-box;
    border: 1rpx solid transparent;
}

.dateRange-btn-cancel {
    background: #f4f6fa;
    color: #4a5160;
    border-color: #e5e9f0;
}

.dateRange-btn-confirm {
    background: #1687ff;
    color: #ffffff;
    border-color: #1687ff;
}

/* ========== picker-view 滚轮弹层 ========== */
.dateRange-wheel-mask {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.dateRange-wheel {
    width: 100%;
    background: #ffffff;
    border-top-left-radius: 24rpx;
    border-top-right-radius: 24rpx;
    box-sizing: border-box;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.dateRange-wheel-bar {
    height: 88rpx;
    line-height: 88rpx;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0 24rpx;
    border-bottom: 1rpx solid #edf1f6;
    background: #fafbfc;
    font-size: 28rpx;
}

.dateRange-wheel-title {
    flex: 1;
    text-align: center;
    color: #1f2329;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dateRange-wheel-cancel {
    flex: 0 0 auto;
    color: #8b98a8;
    padding: 0 8rpx;
}

.dateRange-wheel-confirm {
    flex: 0 0 auto;
    color: #1687ff;
    font-weight: 600;
    padding: 0 8rpx;
}

.dateRange-wheel-view {
    width: 100%;
    height: 480rpx;
    background: #ffffff;
}

.dateRange-wheel-item {
    line-height: 80rpx;
    height: 80rpx;
    text-align: center;
    font-size: 30rpx;
    color: #1f2329;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
</style>
