90 lines
1.8 KiB
Vue
90 lines
1.8 KiB
Vue
<template>
|
|
<div class="order-detail-view">
|
|
<el-descriptions :column="column || 3" border>
|
|
<el-descriptions-item
|
|
v-for="item in config"
|
|
:key="item.prop"
|
|
:label="item.label"
|
|
:span="item.span || 1"
|
|
>
|
|
<template v-if="item.prop === 'items'">
|
|
<div v-if="displayValue(item.prop) !== '-'">
|
|
{{ displayValue(item.prop) }}
|
|
</div>
|
|
<span v-else>-</span>
|
|
</template>
|
|
<template v-else>
|
|
{{ displayValue(item.prop) }}
|
|
</template>
|
|
</el-descriptions-item>
|
|
</el-descriptions>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { translateOrderField } from '../config/order-common-config'
|
|
|
|
interface ConfigItem {
|
|
label: string
|
|
prop: string
|
|
span?: number
|
|
}
|
|
|
|
const props = defineProps<{
|
|
data: any
|
|
config: ConfigItem[]
|
|
column?: number
|
|
}>()
|
|
|
|
const needTranslateFields = new Set([
|
|
'status',
|
|
'inspection_status',
|
|
'is_urgency',
|
|
'sync_status',
|
|
'invoice_flag',
|
|
'post_status',
|
|
'storage_status',
|
|
'pick_status',
|
|
'print_status',
|
|
'order_status',
|
|
'intercept_status',
|
|
'source_platform_code'
|
|
])
|
|
|
|
function displayValue(prop: string) {
|
|
if (!props.data) return '-'
|
|
|
|
if (prop === 'full_address') {
|
|
const address = [
|
|
props.data.province,
|
|
props.data.city,
|
|
props.data.area,
|
|
props.data.town,
|
|
props.data.detail_address
|
|
]
|
|
.filter((part: any) => part !== undefined && part !== null && `${part}`.trim() !== '')
|
|
.join(' ')
|
|
return address || '-'
|
|
}
|
|
|
|
const raw = props.data[prop]
|
|
if (raw === undefined || raw === null || raw === '') {
|
|
return '-'
|
|
}
|
|
|
|
if (needTranslateFields.has(prop)) {
|
|
return translateOrderField(prop, raw)
|
|
}
|
|
|
|
return raw
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.order-detail-view {
|
|
padding: 10px;
|
|
height: 100%;
|
|
box-sizing: border-box;
|
|
}
|
|
</style>
|