mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 18:29:19 +08:00
refactor: 调整订单表
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue';
|
||||
|
||||
import { Tag } from 'ant-design-vue';
|
||||
|
||||
import {
|
||||
getPlatformLabel,
|
||||
getPlatformTagColor,
|
||||
} from '#/utils/platform-display';
|
||||
|
||||
defineOptions({ name: 'PlatformTag' });
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
/** 平台代码(taobao/jd/pdd/...) */
|
||||
code?: null | string;
|
||||
/** 优先展示名(如后端 platformLabel / 字典 label) */
|
||||
label?: null | string;
|
||||
/** 无平台时是否显示「未关联平台」 */
|
||||
showEmpty?: boolean;
|
||||
size?: 'default' | 'small';
|
||||
}>(),
|
||||
{
|
||||
code: undefined,
|
||||
label: undefined,
|
||||
showEmpty: false,
|
||||
size: 'small',
|
||||
},
|
||||
);
|
||||
|
||||
const hasPlatform = computed(
|
||||
() => !!(props.code?.trim() || props.label?.trim()),
|
||||
);
|
||||
|
||||
const displayLabel = computed(() =>
|
||||
getPlatformLabel(props.code, props.label),
|
||||
);
|
||||
|
||||
const color = computed(() => getPlatformTagColor(props.code));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Tag
|
||||
v-if="hasPlatform"
|
||||
:color="color"
|
||||
:class="['platform-tag', size === 'small' ? 'platform-tag--sm' : '']"
|
||||
>
|
||||
{{ displayLabel }}
|
||||
</Tag>
|
||||
<Tag v-else-if="showEmpty" color="default" class="platform-tag platform-tag--sm">
|
||||
未关联平台
|
||||
</Tag>
|
||||
<span v-else class="platform-tag-empty">-</span>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.platform-tag {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.platform-tag--sm {
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
.platform-tag-empty {
|
||||
color: #bfbfbf;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user