<template>
    <div class="recycle-order-number">
        <div class="common-text" v-if="!isReturn">
            <el-text>用户名：</el-text>
            <el-text>{{ row.userNick }}</el-text>
        </div>
        <div class="common-text" v-if="isReturn">
            <el-text>昵称：</el-text>
            <el-text>{{ row.userNick }}
                <el-tag type="success" size="small" v-if="platformType">
                    {{ platformType }}
                </el-tag>
            </el-text>
        </div>
        <div class="common-text">
            <el-text>发件人：</el-text>
            <el-text v-if="!row.sendName">暂无信息</el-text>
            <el-text v-else>{{ formatName(row.sendName) }}（{{ formatPhone(row.sendMobile) }}）</el-text>
        </div>
        <div class="common-text">
            <el-text>省市区：</el-text>
            <el-text>{{ row.sendSsq || '-' }}</el-text>
        </div>
        <div class="common-text">
            <el-text>地址：</el-text>
            <el-text>{{ row.sendAddress || '-' }}</el-text>
        </div>
        <div class="common-text" v-if="!isReturn">
            <el-text>标签：</el-text>
            <el-text v-if="row.userTags">{{ row.userTags.join(',') }}</el-text>
            <el-text v-else>暂无标签</el-text>
        </div>
    </div>
</template>

<script setup>
import { formatName, formatPhone } from '@/utils/common';
import { computed } from 'vue';

const props = defineProps({
    row: {
        type: Object,
        default: () => { }
    },
    isReturn: {
        type: Boolean,
        default: false
    }
});

const platformType = computed(() => {
    const value = props.row.orderFrom || props.row.plat;
    if (value === 1) return '微信';
    if (value === 2) return '支付宝';
    return '';
});
</script>
