<template>
    <div class="contenr_wrap" style="flex: 1;">
        <div class="box">
            <div class="box_top" @click="clickrecord">
                <div class="box_top_left" @click="router.back()">
                    <el-icon size="20">
                        <ArrowLeft />
                    </el-icon>
                    <div class="box_top_right">
                        交班记录
                    </div>
                </div>
            </div>
            <div class="box_content">
                <div class="box_content_left">
                    <div class="box_content_left_top">
                        <div class="box_content_left_top_item">
                            <div class="box_content_left_top_item_top">
                                <div>
                                    {{ infoData.total }}
                                </div>
                                <div>
                                    交班数
                                </div>
                            </div>
                            <div class="box_content_left_top_item_top">
                                <div>
                                    {{ formatDecimal(+infoData.amount) }}
                                </div>
                                <div>
                                    总收款
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="box_content_left_bouttom">
                        <div class="box_content_left_bouttomox">
                            <div class="box_content_left_bouttom_item" v-for="(item, index) in infoData.list"
                                :key="index">
                                <div class="wbox_content_left_bouttom_item_top">
                                    <div>
                                        {{ item.loginTime }}
                                    </div>
                                    <div>
                                        ￥{{ item.handAmount }}
                                    </div>
                                </div>
                                <div class="wbox_content_left_bouttom_item_topone">
                                    <div style="display: flex;">
                                        <span>收营员：</span>
                                        <span style="font-weight: bold;">{{ item.staffName }}</span>
                                    </div>
                                    <div style="display: flex;">
                                        <span>总订单数：</span>
                                        <span style="font-weight: bold;">{{ item.orderCount }}</span>
                                    </div>
                                </div>
                                <div class="wbox_content_left_bouttom_item_topone">
                                    <div style="display: flex;">
                                        <span>起止时间：</span>
                                        <span style="font-weight: bold;"> {{ item.loginTime }}</span>
                                    </div>
                                    <div style="display: flex;">
                                        <span>挂账金额</span>
                                        <span style="font-weight: bold;">{{ formatDecimal(+item.creditAmount) }}</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- <div class="box_content_right">
                <div class="box_content_right_tiem">
                    <div class="box_content_right_tiemleft">
                        上岗时间：
                    </div>
                    <div class="box_content_right_tiemright">
                        2024-03-05-19:33
                    </div>
                </div>
                <div class="box_content_right_tiem">
                    <div class="box_content_right_tiemleft">
                        交班时间：
                    </div>
                    <div class="box_content_right_tiemright">
                        2024-03-05-19:33
                    </div>
                </div>
                <div class="box_content_right_tiem">
                    <div class="box_content_right_tiemleft">
                        终端名称：
                    </div>
                    <div class="box_content_right_tiemright">
                        POS-1
                    </div>
                </div>
                <div class="box_content_right_tiem">
                    <div class="box_content_right_tiemleft">
                        备用金：
                    </div>
                    <div class="box_content_right_tiemright">
                        0.00
                    </div>
                </div>
                <div class="box_content_right_tiem">
                    <div class="box_content_right_tiemleft">
                        收营员：
                    </div>
                    <div class="box_content_right_tiemright">
                        测试
                    </div>
                </div>
                <div class="box_content_right_tiembutton">
                    关班/退出
                </div>
            </div> -->
            </div>
        </div>
    </div>
</template>

<script setup>
import { reactive, onMounted } from 'vue'
import { useRouter } from 'vue-router'
import { handoverRecordPage } from '@/api/account.js'
import { formatDecimal } from "@/utils/index.js";

const router = useRouter()

//详情数据
const infoData = reactive({
    list: [],
    total: 0,
    amount: 0
})

// 获取交班总记录
const infoshopInfoqueryDuty = async () => {
    let res = await handoverRecordPage({
        page: 1,
        size: 99999
    })
    infoData.list = res.records
    infoData.total = +res.totalRow

    let amount = 0

    res.records.map(item => {
        amount += item.handAmount
    })

    infoData.amount = amount
}
onMounted(() => {
    infoshopInfoqueryDuty()
})
</script>

<style scoped lang="scss">
.box {
    width: 100vw;
    padding: 16px;
    height: 100vh;
    background-color: #efefef;

    .box_top {
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: #fff;
        padding: 10px;
        border-radius: 10px;
        /* 取消下划线效果 */

        .box_top_left {
            display: flex;
            justify-content: flex-start;
            align-items: center;
            text-decoration: none;
            /* 取消下划线效果 */
        }

        .box_top_right {
            color: #161718;
            text-decoration: none;
            /* 取消下划线效果 */
        }
    }

    .box_content {
        margin-top: 10px;
        width: 100%;
        height: 92%;
        display: flex;

        .box_content_left {
            background: #fff;
            width: 100%;
            height: 100%;
            border-radius: 10px;
            // padding: 30px 20px;

            .box_content_left_top {
                display: flex;
                flex-direction: column;
                border-bottom: 1px solid #ccc;
                padding: 20px 0;
                border-radius: 6px 6px 0 0;
                background: #187ead;

                .box_content_left_top_item {
                    display: flex;
                    align-items: center;

                    .box_content_left_top_item_top {
                        color: #fff;
                        width: 50%;
                        display: flex;
                        align-items: center;
                        flex-direction: column;
                    }
                }
            }

            .box_content_left_bouttom {
                width: 100%;
                height: 85%;
                padding: 0 20px;
                overflow-y: auto;

                .box_content_left_bouttomox::after {
                    content: '';
                    display: inline-block;
                    width: 32%;
                }

                .box_content_left_bouttomox {
                    display: flex;
                    justify-content: space-between;
                    align-items: center;
                    flex-wrap: wrap;

                    .box_content_left_bouttom_item {
                        margin-top: 10px;
                        width: 32%;
                        background: #eeeeee;
                        padding: 12px 14px;
                        border-radius: 10px;

                        .wbox_content_left_bouttom_item_top {
                            display: flex;
                            justify-content: space-between;
                            align-items: center;
                            padding-bottom: 10px;
                            border-bottom: 1px solid #ccc;

                            div:nth-child(1) {
                                font-weight: bold;
                            }

                            div:nth-child(2) {
                                color: #ff5252;
                            }
                        }

                        .wbox_content_left_bouttom_item_topone {
                            display: flex;
                            justify-content: space-between;
                            align-items: center;
                            padding-top: 10px;

                            div:nth-child(1) {
                                font-size: 14px;
                            }

                            div:nth-child(2) {
                                font-size: 14px;

                            }
                        }
                    }
                }


            }
        }

        .box_content_right {
            width: 30%;
            height: 100%;
            background: #fff;
            margin-left: 10px;
            border-radius: 6px;
            padding: 10px 12px;
            position: relative;

            .box_content_right_tiem:nth-child(1) {
                margin-top: 0;
            }

            .box_content_right_tiem {
                margin-top: 10px;
                display: flex;
                justify-content: space-between;
                align-items: center;

                .box_content_right_tiemleft {
                    color: #9e9e9e;
                }

            }

            .box_content_right_tiembutton {
                position: absolute;
                bottom: 10px;
                left: 5%;
                background: #ba5050;
                width: 90%;
                border-radius: 5px;
                color: #fff;
                text-align: center;
                height: 60px;
                line-height: 60px;
            }

        }
    }
}
</style>