<template>
    <div class="formula-list">
        <div class="title">费用类型（{{ feeItemText }}）</div>
        <!-- 费用类型 -->
        <!-- <div v-show="feeItemLists && feeItemLists.length > 0">
            <div class="title">费用类型</div>
            <div class="list-warp">
                <div v-for="item in feeItemLists" :key="item.id" class="item" @click="setFeeItem(item)">
                    {{ item.itemName }}
                </div>
            </div>
        </div> -->
        <!-- 计费参数 -->
        <div class="title">计费参数</div>
        <div class="list-warp">
            <div v-for="item in expenseType.EexpenseOne" :key="item.key" :title="item.value" class="item" @click="choice(item)">
                {{ item.value }}
            </div>
        </div>
        <!-- 计算符 -->
        <div class="title">计算符</div>
        <div class="flex calculator-warp">
            <div class="flex-1 list-warp calculator">
                <div v-for="item in expenseType.EexpenseTwo" :key="item.key" class="item" @click="choice(item)">
                    {{ item.value }}
                </div>
            </div>
            <div class="flex-1 list-warp calculator">
                <div v-for="item in expenseType.EexpenseThree" :key="item.key" class="item" @click="choice(item)">
                    {{ item.value }}
                </div>
            </div>
        </div>
        <div class="title">计算公式</div>
        <!-- 公式显示 -->
        <div class="h-18">
            <div v-show="calculatorList.length > 0">
                <span v-for="(item,index) in calculatorList" :key="index">{{ item.value }}</span>
            </div>
        </div>
    </div>
</template>
<script lang="ts" setup>
defineProps<{ expenseType: Recordable, calculatorList: Recordable[], feeItemText?: string }>()
const emit = defineEmits(['choice','setFeeItem'])
const choice = (params) => emit('choice', params)
// const setFeeItem = (params) => emit('setFeeItem', params)
</script>

<style lang="scss" scoped>
.formula-list {
    margin-bottom: 20px;

    .calculator-warp {
        width: 86%;
        margin: auto;
    }

    .h-18 {
        height: 18px;
        line-height: 18px;
    }
    .title {
        padding-top: 10px;
        padding-bottom: 10px;
        margin-bottom: 10px;
        border-bottom: 1px solid #f2f2f2;
        font-size: 16px;
        font-weight: bold;
    }

    .list-warp {
        display: grid;
        grid-row-gap: 13px;
        grid-column-gap: 13px;
        grid-template-columns: repeat(auto-fill, 100px);


        // flex-wrap: wrap;
        &.calculator {
            grid-template-columns: repeat(3, 100px);

            .item {
                // background-color: var(--bg);
                background: #006e62;
                background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #00544b), color-stop(1, #006e62));
                font-size: 17px;
            }
        }

        .item-type {
            flex-basis: 96px;
        }

        .item-symbol {
            flex: 1;
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
        }

        .item-number {
            flex: 1;
            display: inline-flex;
            flex-wrap: wrap;
            justify-content: space-between;

        }

        .item {
            background: #409eff;
            background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #409eff), color-stop(1, #3681cf));
            font-size: 14px;
            height: 32px;
            line-height: 32px;
            min-width: 80px;
            text-align: center;
            color: #fff;
            cursor: pointer;
            user-select: none;
        }
    }
}
</style>