<template>
	<div class="keyboard">
		<bottom-popup class="popup-wrap" :show="show" maskBgcolor="none" @close="comfirm">
			<div class="ui-keyboard">
				<ul class="ui-keyboard-numbers">
					<li :class="{'zero': item == 0}" v-for="(item, index) in keyLeftData" :key="index" @click="clickKeyFn(item)">{{ item }}</li>
				</ul>
				<ul class="ui-keyboard-btn">
					<li class="btn-del" @click="del">
                        <i class="iconfont iconshanchu"></i>
                    </li>
					<li class="btn-ok" @click="comfirm">完成</li>
				</ul>
			</div>
		</bottom-popup>
	</div>
</template>

<script>
import BottomPopup from '@/components/plugin/bottom-popup'
export default {
	name: 'keyboard',
	components: {
		BottomPopup
	},
	props: {
		show: {
			type: Boolean,
			default: false
		}
	},
	data() {
		return {
			keyLeftData: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '.']
		}
	},
	methods: {
		close() {
			this.$emit('comfirm')
		},
		// 点击数字键盘
		clickKeyFn(val) {
			this.$emit('clickKey', val)
		},
		// 确认
		comfirm() {
			this.$emit('comfirm')
		},
		// 删除
		del() {
			this.$emit('del')
		}
	}
}
</script>

<style lang="scss" scoped>
    .popup-wrap {
        .ui-keyboard {
            @include disFlex(center, center);
            padding: 0 20px 20px 20px;
            background-color: $backColor;
            box-shadow: 0 -8px 16px #ddd;
            // 左侧键盘
            .ui-keyboard-numbers {
                width: 78%;
                display: flex;
                align-items: center;
                flex-wrap: wrap;
                li {
                    width: calc(33.33% - 20px);
                }
                li.zero {
                    width: calc(66.66% - 20px);
                }
            }
            // 右侧键盘
            .ui-keyboard-btn {
                width: 22%;
                li {
                    margin-right: 0;
                }
                li.btn-ok {
                    height: 310px;
                    color: #fff;
                    background-color: $mainColor;
                    // line-height: 310px
                }
            }
            li {
                @include disFlex(center, center);
                height: 90px;
                // line-height: 90px;
                text-align: center;
                border-radius: 10px;
                background-color: #fff;
                margin-top: 20px;
                margin-right: 20px;
                font-size: 38px;
                font-weight: bold;
                box-shadow: 0 2px 10px #ddd;
            }
            li:active {
                background-color: rgba(0, 0, 0, 0.1);
            }
        }
    }
</style>
