<template>
    <div class="recycle-order-number">
        <div class="common-text">
            <el-text>预估书款：</el-text>
            <el-text type="danger">¥{{ row.expectMoney || 0 }}</el-text>
        </div>
        <div class="common-text">
            <el-text>审核书款：</el-text>
            <el-text v-if="typeof row.finalMoney == 'number'"
                >¥{{ row.finalMoney }}</el-text
            >
            <el-text v-else>待核算</el-text>
        </div>
        <div class="common-text">
            <el-text>运费：</el-text>
            <el-text type="danger">{{
                row.expressCharge ? '¥' + row.expressCharge : '-'
            }}</el-text>
        </div>

        <div class="common-text">
            <el-text>订单类型：</el-text>
            <el-text>{{ orderTypeText }}</el-text>
        </div>
        <div class="common-text">
            <el-text>取件方式：</el-text>
            <el-text>{{ expressTypeText }}</el-text>
        </div>
        <div class="common-text" v-if="verifyPeriodText">
            <el-text>结算方式：</el-text>
            <el-text>{{ verifyPeriodText }}</el-text>
        </div>
    </div>
</template>

<script setup>
    import { useDictData } from '@/utils/use-dict-data';

    const VERIFY_PERIOD_MAP = {
        7: '7天极速验货',
        15: '15天安心验货'
    };

    /** 字典数据 */
    const [orderTypeDicts, expressTypeDicts] = useDictData([
        'order_type',
        'express_type'
    ]);

    const orderTypeText = computed(() => {
        return orderTypeDicts.value.find(
            (v) => v.dictValue == props.row.orderType
        )?.dictLabel;
    });

    const expressTypeText = computed(() => {
        return expressTypeDicts.value.find(
            (v) => v.dictValue == props.row.expressType
        )?.dictLabel;
    });

    const verifyPeriodText = computed(() => {
        return VERIFY_PERIOD_MAP[props.row.verifyPeriodDays] || '';
    });

    const props = defineProps({
        row: {
            type: Object,
            default: () => {}
        }
    });
</script>
