<template>
    <div :class="sizeTypeClass">
        <div class="print-title">{{ storeInfo.name }}团队入住单</div>

        <div class="print-fee-info">
            <div class="print-fee-item-wrapper small-item">
                <div class="print-fee-title">编号<span v-if="sizeTypeClass == 'a5'">/ID</span>:</div>
                <div class="print-fee-value">{{ feeInfo.no }}</div>
            </div>
            <div class="print-fee-item-wrapper">
                <div class="print-fee-title">名称<span v-if="sizeTypeClass == 'a5'">/Name</span>:</div>
                <div class="print-fee-value">{{ feeInfo.name }}</div>
            </div>
            <div class="print-fee-item-wrapper row">
                <div class="print-fee-title">公付<span v-if="sizeTypeClass == 'a5'">/Public Pay</span>:</div>
                <div class="print-fee-value">{{ feeInfo.publicPay }}</div>
            </div>
            <div class="print-fee-item-wrapper small-item">
                <div class="print-fee-title">领队<span v-if="sizeTypeClass == 'a5'">/Leader</span>:</div>
                <div class="print-fee-value">{{ feeInfo.leader }}</div>
            </div>
            <div class="print-fee-item-wrapper">
                <div class="print-fee-title">联系人<span v-if="sizeTypeClass == 'a5'">/Contact</span>:</div>
                <div class="print-fee-value">{{ feeInfo.contact }}</div>
            </div>
            <div class="print-fee-item-wrapper row">
                <div class="print-fee-title">电话<span v-if="sizeTypeClass == 'a5'">/Tel</span>:</div>
                <div class="print-fee-value">{{ feeInfo.tel }}</div>
            </div>
            <div class="print-fee-item-wrapper small-item">
                <div class="print-fee-title">客人来源<span v-if="sizeTypeClass == 'a5'">/Source</span>:</div>
                <div class="print-fee-value">{{ feeInfo.source }}</div>
            </div>
            <div class="print-fee-item-wrapper">
                <div class="print-fee-title">客人类型<span v-if="sizeTypeClass == 'a5'">/Type</span>:</div>
                <div class="print-fee-value">{{ (feeInfo.type) }}</div>
            </div>
            <div class="print-fee-item-wrapper row">
                <div class="print-fee-title">协议单位<span v-if="sizeTypeClass == 'a5'">/Company</span>:</div>
                <div class="print-fee-value">{{ feeInfo.contractInfo ? feeInfo.contractInfo.name : '无' }}</div>
            </div>
            <div class="print-fee-item-wrapper small-item">
                <div class="print-fee-title">到时<span v-if="sizeTypeClass == 'a5'">/CheckIn</span>:</div>
                <div class="print-fee-value">{{ feeInfo.arrivalTime }}</div>
            </div>
            <div class="print-fee-item-wrapper  small-item">
                <div class="print-fee-title">离时<span v-if="sizeTypeClass == 'a5'">/CheckOut</span>:</div>
                <div class="print-fee-value">{{ feeInfo.dueOutTime }}</div>
            </div>
            <div class="print-fee-item-wrapper row" v-if="defModel.isShowBreakfast == 0">
                <div class="print-fee-title">早餐<span v-if="sizeTypeClass == 'a5'">/Breakfirst</span>:</div>
                <div class="print-fee-value">{{ feeInfo.breakFirst }}</div>
            </div>
            <div class="print-fee-item-wrapper row row1">
                <div class="print-fee-title">收款<span v-if="sizeTypeClass == 'a5'">/Payment</span>:</div>
                <div class="print-fee-value">{{ feeInfo.payment }}</div>
            </div>
            <div class="print-fee-item-wrapper row row1">
                <div class="print-fee-title">押金<span v-if="sizeTypeClass == 'a5'">/Money</span>:</div>
                <div class="print-fee-value">{{ feeInfo.deposit }}</div>
            </div>
        </div>

        <div class="print-fees">
            <div class="print-fees-header fee-row">
                <div class="fee-cell flex-2">房号</div>
                <div class="fee-cell">姓名</div>
                <div class="fee-cell">房型</div>
                <div class="fee-cell">天数</div>
                <div class="fee-cell flex-3">房价</div>
            </div>
        </div>

        <div class="info-split"></div>
        <div class="info-split-dashed"></div>
        <div class="print-fees-header fee-row" style="padding-bottom: 5px" v-for="(item,index) in dataSource">
            <div class="fee-cell flex-2">{{item.roomNo}}</div>
            <div class="fee-cell">{{item.customerName}}</div>
            <div class="fee-cell">{{item.layoutName}}</div>
            <div class="fee-cell">{{item.dayCount}}</div>
            <div class="fee-cell flex-3">{{item.money}}</div>
        </div>
        <div class="info-split"></div>

        <pre style="white-space: pre-wrap;" class="print-def-content">{{ defContent }}</pre>

        <div class="a5-partail">
            <div class="print-fee-item-wrapper">
                <div class="print-fee-title">酒店地址:</div>
                <div class="print-fee-value">{{ storeInfo.address }}</div>
            </div>
            <div class="print-fee-item-wrapper">
                <div class="print-fee-title">预定电话:</div>
                <div class="print-fee-value">{{ storeInfo.linkTel }}</div>
            </div>
            <div class="print-fee-item-wrapper" v-if="sizeTypeClass == 'a5'">
                <div class="print-fee-title">打印人:</div>
                <div class="print-fee-value">{{ nickname() }}</div>
            </div>
            <div class="print-fee-item-wrapper time">
                <div class="print-fee-title">打印时间<span v-if="sizeTypeClass == 'a5'">/Print Time</span>:</div>
                <div class="print-fee-value">{{ printDate }}</div>
            </div>
        </div>
        <div class="print-fee-item-wrapper">
            <div>确认签字:</div>
            <div class="print-fee-value value-underline"></div>
        </div>
    </div>
</template>
<script>
    import { mapActions, mapGetters, mapState } from 'vuex'
    export default {
        props: {
            title: {
                type: String,
                default: '团队入住单'
            },
            sizeTypeClass: {
                type: String,
                default: "mm58"
            },
            feeInfo: {
                type: Object,
                default() {
                    return {
                        no: "--",
                        name: '--',
                        publicPay:'--',
                        leader:'--',
                        contact:'--',
                        tel:'--',
                        source:'--',
                        type:'散客',
                        contractInfo: null,
                        arrivalTime: '--',
                        dueOutTime: '--',
                        breakFirst:'--',
                        payment:'--',
                        deposit:0,
                    }
                }
            },
            defContent: {
                type: String,
                default: ""
            },
            defModel:{
                type:Object,
                default(){
                    return {
                        isShowIdcard:0,
                        isShowBreakfast:0,
                        isShowAddress:0,
                        isShowPhone:0
                    }
                }
            },
            dataSource:{
                type:Array ,
                default() {
                    return [
                        {
                            roomNo:'8025',
                            customerName:'张三',
                            layoutName:'大床房',
                            dayCount:'8',
                            money:'969',
                        },
                        {
                            roomNo:'8025',
                            customerName:'张三',
                            layoutName:'大床房',
                            dayCount:'8',
                            money:'969',
                        },
                    ];
                }
            }
        },
        data() {
            let storeInfo = JSON.parse(localStorage.getItem("storeInfo"))
            return {
                storeInfo,
                printDate: new Date().format('yyyy/MM/dd hh:mm:ss')
            }
        },
        methods: {
            ...mapGetters(["nickname", "avatar", "userInfo"]),
        }
    }
</script>
<style lang="less">
    .mm58 {
        width: 58mm;
        border: 1px solid #00000055;

        .print-title {
            text-align: center;
            font-size: 16px;
            font-weight: 600;
        }
    }

    .mm80 {
        width: 80mm;
        border: 1px solid #00000055;
        padding-left: 3mm;

        .print-fee-info {
            display: flex;
            flex-wrap: wrap;

            .print-fee-item-wrapper {
                width: 60%;
            }
            .row {
                width: 100% !important;
            }

            .small-item {
                width: 40%;

                .print-fee-value {
                    margin-right: 3mm;
                }
            }

            .print-fee-title {
                /*width: fit-content;*/
                text-align: right;
            }
            .row .print-fee-title {
                width: 10% !important;
                text-align: left !important;
            }
        }

        .print-title {
            text-align: center;
            font-size: 16px;
            font-weight: 600;
        }
    }

    .a5 {
        width: 210mm;
        border: 1px solid #00000055;
        padding: 3mm;

        .print-fee-info {
            display: flex;
            flex-wrap: wrap;


            .print-fee-item-wrapper {
                width: 30%;
            }
            .row1 {
                width: 100%;
            }
            .row1 .print-fee-title {
                width: 15%;
                text-align: right;
            }
            .print-fee-title {
                width: 50%;
                text-align: right;
            }

        }

        .print-no{
            text-align: center;
        }
        .print-title {
            text-align: center;
            font-size: 16px;
            font-weight: 600;
        }
        .a5-partail{
            display: flex;
            flex-wrap: wrap;
            .print-fee-item-wrapper {
                margin: 3mm 0;
                width: 45%;
            }

            .time .print-fee-title {
                width: 40%;
            }
        }
    }

    .print-no {
        text-align: left;
        font-weight: 600;
    }

    .print-fee-item-wrapper {
        display: flex;
        width: 100%;
        padding: 4px 0;
        font-size: small;

        .print-fee-title {
            width: 65px;
            text-align: right;
        }

        .print-fee-value {
            flex: 1;
        }

        .value-underline {
            border-bottom: 1px solid #00000088;
        }
    }

    .print-fees {
        margin-bottom: 5px;
    }

    .fee-row {
        display: flex;
        margin-left: 2px;

        .fee-cell {
            color: black;
            flex: 1;
            margin: 0 3px;
            font-size: smaller;
            text-align: left;
        }

        .flex-2 {
            flex: 1.5;
        }

        .flex-3 {
            flex: 2;
        }
    }

    .info-split-dashed {
        margin: 8px 0;
        border: 1px dashed #000000;


    }

    .info-split {
        border: 1px solid #000000;
        width: 100%;
        margin: 8px 0;
    }

    .qr-code-wrapper {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;

    }

    .code-content {
        width: 150px;
        height: 150px;
        background-image: url('data:image/jpeg;base64,[encoded data, 25532 characters]');
    }
</style>
