<template>
    <div class="page_waitingCalled">
        <div class="waitingOne" v-for="(item,index) in waitingCalled" :key="index">
            <div class="waitingOneLeft">
                <img src="https://images.shengws.com/201809182128111.png?imageView2/2/w/500/h/500/q/90" alt="">
                <div class="name">
                    <p>{{ item.patient_name }}</p>
                    <p>签到时间：{{ item.create_time }}</p>
                </div>
            </div>
            <div class="waitingOneRight">
                <div>
                    <span v-if="item.schedule_type == 1">上午</span>
                    <span v-if="item.schedule_type == 2">下午</span>
                    <span v-if="item.schedule_type == 3">晚上</span>
                    {{ item.queue_no }}号
                </div>
                <i class="el-icon-delete deleteIcon" @click="deletePatient(item.patient_id)"></i>
            </div>
        </div>
    </div>
</template>

<script>
import axios from 'axios'
import {Dialog, Toast} from 'vant'
export default {
    props:{
        waitingCalled:Array
    },
    data(){
        return{
        }
    },
    methods:{
        call(patient_id){
            // console.log('patient_id',patient_id)
            let org_id =  parseInt(sessionStorage.getItem("org_id"));
            let admin_user_id = parseInt(sessionStorage.getItem("admin_user_id"));
            axios.get('/api/index/callpatient?org_id=' + org_id + '&patient_id=' + patient_id + '&admin_user_id=' + admin_user_id).then(res => {
                // console.log(res)
                if(res.data.code == 200){
                    Toast.success('叫号成功');
                }
            })
        },
        deletePatient(patient_id){
            Dialog.confirm({
                title: '删除',
                message: '是否删除？',
            }).then(() => {
                // on confirm
                let org_id =  parseInt(sessionStorage.getItem("org_id"));
                let admin_user_id = parseInt(sessionStorage.getItem("admin_user_id"));
                axios.get('/api/index/delpatient?org_id=' + org_id + '&patient_id=' + patient_id + '&admin_user_id=' + admin_user_id).then(res => {
                if(res.data.code == 200){
                    Toast.success('删除成功');
                }
            })

            })
            .catch(() => {
                // on cancel
            });
        }
    }
}
</script>


<style lang="scss" scoped>
.page_waitingCalled{
    .waitingOne{
        display: flex;
        padding: 0.46rem 0.43rem;
        border: 1px solid #e5e5ee;
        border-radius: 5px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.5rem;
        .waitingOneLeft{
            display: flex;
            img{
                width: 1rem;
                height: 1rem;
                border-radius: 50%;
                margin-right: 0.33rem;
            }
            .name{
                >p:first-child{
                    font-size: 0.53rem;
                    font-weight: bold;
                    color:#000;
                }
                >p:last-child{
                    font-size: 0.4rem;
                    color:#999999;
                    margin-top: 0.15rem;
                }
            }
            
        }
        .waitingOneRight{
            text-align: center;
            .van-icon {
                color: #3389FB;
                font-size: 1rem;
                margin-top: 0.1rem;
            }
            .deleteIcon{
                font-size: 0.8rem;
                color:red;
                margin-top: 0.33rem;
            }
        }
    }
}
</style>
