2026-07-09 18:14:25 +08:00

162 lines
5.7 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="store-details-container">
<el-descriptions v-if="row" :column="2" border size="small" class="details-panel">
<template v-for="(field, idx) in detailPanel" :key="field.prop || idx">
<el-descriptions-item :label="field.label" :span="field.span || 1">
<template v-if="field.prop === 'current_subject_role'">
<el-tag size="small" :type="row.current_subject_role === 'warehouse' ? 'primary' : 'warning'" effect="light">
{{ row.current_subject_role === 'warehouse' ? '仓库方' : '货主方' }}
</el-tag>
</template>
<template v-else-if="field.prop === 'auth_status'">
<el-tag size="small" :type="getAuthStatusType(row.auth_status)" effect="light">
{{ row.auth_status_label || getAuthStatusLabel(row.auth_status) }}
</el-tag>
</template>
<template v-else-if="field.prop === 'warehouse_use_status'">
<el-tag size="small" :type="row.warehouse_use_status === 1 ? 'success' : 'info'" effect="light">
{{ row.warehouse_use_status === 1 ? '启用' : '禁用' }}
</el-tag>
</template>
<template v-else-if="field.prop === 'is_auth_valid'">
<el-tag size="small" :type="row.is_auth_valid ? 'success' : 'warning'" effect="plain">
{{ row.is_auth_valid ? '有效' : '无效' }}
</el-tag>
</template>
<template v-else-if="field.prop === 'remaining_days'">
{{ row.remaining_days > 0 ? row.remaining_days + '天' : '—' }}
</template>
<template v-else-if="field.prop === 'auth_start' || field.prop === 'auth_end' || field.prop === 'apply_time' || field.prop === 'review_time'">
{{ formatDate(row[field.prop]) || '—' }}
</template>
<template v-else-if="field.prop === 'auth_period'">
{{ formatDate(row.auth_start) || '—' }} ~ {{ formatDate(row.auth_end) || '—' }}
</template>
<template v-else-if="field.prop === 'apply_reason' || field.prop === 'review_comment'">
{{ row[field.prop] || '—' }}
</template>
<template v-else-if="field.prop === 'has_qimen_config'">
<el-tag size="small" :type="row.has_qimen_config ? 'success' : 'info'" effect="plain">
{{ row.has_qimen_config ? '已配置' : '未配置' }}
</el-tag>
</template>
<template v-else-if="field.prop === 'qimen_config'">
<template v-if="row.qimen_config && Array.isArray(row.qimen_config) && row.qimen_config.length">
<div v-for="(cfg, idx2) in row.qimen_config" :key="cfg.id || idx2" class="qimen-block">
<div class="qimen-summary">
<strong>{{ cfg.app_name }}</strong>
<el-tag size="small" :type="cfg.is_enabled ? 'success' : 'info'" style="margin-left:6px">
{{ cfg.is_enabled ? '启用' : '停用' }}
</el-tag>
<span class="qimen-meta">{{ cfg.interface_name || cfg.interface_category || cfg.interface_code }}</span>
</div>
<div class="qimen-info">
<span>ERP:{{ getQimenErpDisplay(cfg) }}</span>
<span>仓库编码:{{ cfg.qimen_warehouse_code }}</span>
</div>
</div>
</template>
<template v-else-if="row.qimen_config && typeof row.qimen_config === 'object'">
<div class="qimen-summary">
<strong>{{ row.qimen_config.app_name }}</strong>
<el-tag size="small" :type="row.qimen_config.is_enabled ? 'success' : 'info'" style="margin-left:6px">
{{ row.qimen_config.is_enabled ? '启用' : '停用' }}
</el-tag>
</div>
<div class="qimen-info">
<span>ERP:{{ getQimenErpDisplay(row.qimen_config) }}</span>
<span>仓库编码:{{ row.qimen_config.qimen_warehouse_code }}</span>
</div>
</template>
<span v-else class="text-muted">未配置</span>
</template>
<template v-else>
{{ row[field.prop] || '—' }}
</template>
</el-descriptions-item>
</template>
</el-descriptions>
<div v-else class="empty-tip">暂无详情数据</div>
</div>
</template>
<script setup lang="ts">
import { detailPanel } from '../store-config'
const props = defineProps<{
id?: number | string
row?: any
getAuthStatusType: (status: number) => string
getAuthStatusLabel: (status: number) => string
formatDate: (dateStr: string | null | undefined) => string
}>()
function getQimenErpDisplay(config: any): string {
return String(config?.erp_name || config?.erpName || config?.qimen_app_key || '').trim() || '—'
}
</script>
<style scoped lang="scss">
.store-details-container {
height: 100%;
width: 100%;
box-sizing: border-box;
display: flex;
flex-direction: column;
overflow-y: auto;
padding: 6px 10px 8px;
background-color: #fff;
&::-webkit-scrollbar {
display: none;
}
-ms-overflow-style: none;
scrollbar-width: none;
}
.details-panel {
width: 100%;
}
.qimen-block {
margin-bottom: 8px;
&:last-child {
margin-bottom: 0;
}
}
.qimen-summary {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 4px;
}
.qimen-meta {
margin-left: 8px;
color: #999;
font-size: 12px;
}
.qimen-info {
margin-top: 4px;
font-size: 12px;
color: #888;
display: flex;
flex-wrap: wrap;
gap: 12px;
}
.text-muted {
color: #aaa;
}
.empty-tip {
text-align: center;
color: #909399;
font-size: 13px;
padding: 24px 0;
}
</style>