<!-- 排队进度 -->
<template>
    <nav-bar :navbar-data='navbarData'></nav-bar>
    <view :style="{marginTop: height +'px'}" class="waiting-progress">
        <view class="waiting-progress-title" v-if="userData">
            尊敬的{{userData.patDesc}}{{userData.patSexDesc==='男'?'先生':'女士'}}，您当前有以下诊疗项目正在排队，请您注意不要过号：
        </view>
        <view class="waiting-progress-card">
            <view class="waiting-progress-content" v-for="(item,index) in waitList" :key="index">
                <view class="waiting-progress-card-head">
                    <view class="waiting-progress-head-loc">{{item.admTypeDesc}}</view>
                    <view>{{item.queueDesc}}</view>
                    <!-- <view class="waiting-progress-head-status">已过号</view> -->
                </view>
                <view class="waiting-progress-card-boby">
                    <view>
                        <view class="wpcb-label">当前排队号：</view>
                        <view class="wpcb-value FF9933">{{item.curQueue}}</view>
                    </view>
                    <view>
                        <view class="wpcb-label">您的排队号：</view>
                        <view class="wpcb-value FF9933">{{item.seqNo}}</view>
                    </view>
                    <view>
                        <view class="wpcb-label">您的前面还有：</view>
                        <view class="wpcb-value FF9933">{{item.waitNum}}</view>
                    </view>
                    <view>
                        <view class="wpcb-label">排队时间：</view>
                        <view class="wpcb-value">{{item. admDate}}</view>
                    </view>
                    <view>
                        <view class="wpcb-label">排队科室：</view>
                        <view class="wpcb-value">{{item.locDesc}}</view>
                    </view>
                    <view>
                        <view class="wpcb-label">科室位置：</view>
                        <view class="wpcb-value">{{item.locLocation}}</view>
                    </view>
                    <view>
                        <view class="wpcb-label">注意事项：</view>
                        <view class="wpcb-value">{{item.note}}</view>
                    </view>
                </view>
                <!-- <view class="waiting-progress-card-footer">
            <van-button plain round type="info">查看详情</van-button>
          </view> -->
            </view>
            <view class="waiting-progress-btn">
                <van-button block round type="info" @tap="getWaitList">刷新最新排队进度</van-button>
            </view>
        </view>
    </view>
</template>

<script>
    import $http from "@/utils/https"
    import httpConfig from '@/utils/httpConfig'
    import navBar from '@/components/navBar/index'
    import VanButton from '@/components/button/index'
    const app = getApp();
    export default {
        components: {
            'nav-bar': navBar,
            'van-button': VanButton
        },
        data() {
            return {
                height: app.globalData.height,
                navbarData: {
                    isGoHome: true,
                    isGoBack: true,
                    title: "候诊进度"
                },
                waitList: [],
                userData: null
            }
        },
        onLoad() {
            this.setData({
                userData: this.$cache.get('userData')
            })
            this.getWaitList()
        },
        methods: {
            //获取候诊进度
            getWaitList: function() {
                let userData = this.$cache.get('userData');
                let data = {
                    params: [{
                        hospCode: userData.hisHospID || '',
                        patID: userData.hisPatID || '',
                        //patID:'36168',
                    }]
                }
                uni.showLoading({
                    mask: true
                })
                $http.post("urlS", this, {
                    code: "03100204",
                    data: data,
                    namespace: "Y",
                    success: function(res) {
                        uni.hideLoading();
                        if (+res.errorCode === 0) {
                            this.setData({
                                waitList: res.result
                            }, () => {
                                this.goTop()
                            })
                        } else {
                            this.setData({
                                waitList: []
                            })
                        }
                    }
                });
            },
            //回到顶部
            goTop: function(e) { // 一键回到顶部
                if (uni.pageScrollTo) {
                    uni.pageScrollTo({
                        scrollTop: 0
                    })
                } else {

                }
            },
        }
    }
</script>

<style lang="scss">
    $gray: #f2f2f2;
    $gray1: #333;
    $gray2: #666;
    $gray3: #999;

    .waiting-progress-title {
        width: 100%;
        padding: 24rpx 20rpx;
        line-height: 36rpx;
        box-sizing: border-box;
        color: $gray2;
        font-size: 26rpx;
    }

    .waiting-progress-card {
        width: 100%;
        padding: 0 24rpx;
        box-sizing: border-box;
    }

    .waiting-progress-content {
        width: 100%;
        background: #fff;
        margin-bottom: 8rpx;
    }

    .waiting-progress-card-head {
        height: 92rpx;
        line-height: 92rpx;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 48rpx 0 24rpx;
        box-sizing: border-box;
        color: $gray2;
        border-bottom: 1rpx solid $gray;
    }

    .waiting-progress-head-loc {
        font-size: 34rpx;
        font-weight: 600;
    }

    .waiting-progress-head-status {
        font-size: 32rpx;
        font-weight: 900;
        color: #df342a;
    }

    .waiting-progress-card-boby {
        width: 100%;
        padding: 12rpx 0;
        border-bottom: 1rpx solid $gray;
        box-sizing: border-box;
    }

    .waiting-progress-card-boby>view {
        width: 100%;
        display: flex;
        font-size: 26rpx;
        height: 56rpx;
        line-height: 56rpx;
    }

    .wpcb-label {
        width: 200rpx;
        color: $gray3;
        text-align: right;
    }

    .wpcb-value {
        width: calc(100% - 200rpx);
        padding-left: 24rpx;
        color: $gray1;
        box-sizing: border-box;
    }

    .waiting-progress .FF9933 {
        color: #FF9933;
        font-weight: 700;
    }

    .waiting-progress-card-footer {
        width: 100%;
        height: 92rpx;
        padding: 0 28rpx;
        box-sizing: border-box;
        display: flex;
        justify-content: flex-end;
        align-items: center;
    }

    .waiting-progress-card-footer .van-button {
        height: 64rpx;
        line-height: 64rpx;
    }

    .waiting-progress-btn {
        padding-top: 96rpx;
        margin-bottom: 30rpx;
    }

    .waiting-progress-btn .van-button {
        font-size: 32rpx;
    }
</style>