|
|
@@ -0,0 +1,64 @@
|
|
|
+<!--
|
|
|
+ 发货状态标签
|
|
|
+ 用法:
|
|
|
+ <send-status-tag :status="row.sendStatus" />
|
|
|
+ <send-status-tag :status="row.sendStatus" default-text="未收货" />
|
|
|
+-->
|
|
|
+<template>
|
|
|
+ <el-tag :type="tagType">{{ tagLabel }}</el-tag>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ // 发货状态码 → 文案/tag 类型 映射
|
|
|
+ // value 0 同时承担「未发货/未收货」两种语义,由 defaultText 控制默认文案
|
|
|
+ const SEND_STATUS_LIST = [
|
|
|
+ { value: 0, label: '未发货' },
|
|
|
+ { value: 1, label: '已发货', type: 'success' },
|
|
|
+ { value: 2, label: '已收货', type: 'success' },
|
|
|
+ { value: 3, label: '受托已发', type: 'success' },
|
|
|
+ { value: 4, label: '请托已收', type: 'success' },
|
|
|
+ { value: 5, label: '受托拒收', type: 'success' },
|
|
|
+ { value: 6, label: '请托拒收', type: 'success' },
|
|
|
+ { value: 7, label: '部分发货', type: 'success' },
|
|
|
+ { value: 8, label: '部分收货', type: 'success' },
|
|
|
+ { value: 9, label: '部分驳回', type: 'success' },
|
|
|
+ { value: 10, label: '受托部分已发', type: 'success' },
|
|
|
+ { value: 11, label: '请托部分已收', type: 'success' }
|
|
|
+ ];
|
|
|
+
|
|
|
+ export default {
|
|
|
+ name: 'SendStatusTag',
|
|
|
+ props: {
|
|
|
+ // 兼容 Number / String,与后端返回类型保持宽松
|
|
|
+ status: {
|
|
|
+ type: [Number, String],
|
|
|
+ default: 0
|
|
|
+ },
|
|
|
+ // 受托方展示「未收货」,请托方/委外展示「未发货」
|
|
|
+ defaultText: {
|
|
|
+ type: String,
|
|
|
+ default: '未发货'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ // 0 / 未定义 / 空串 都视为「默认」状态
|
|
|
+ isDefault() {
|
|
|
+ const s = this.status;
|
|
|
+ return (
|
|
|
+ s === 0 || s === '0' || s === undefined || s === null || s === ''
|
|
|
+ );
|
|
|
+ },
|
|
|
+ currentItem() {
|
|
|
+ return SEND_STATUS_LIST.find((i) => i.value === Number(this.status));
|
|
|
+ },
|
|
|
+ tagLabel() {
|
|
|
+ return this.isDefault
|
|
|
+ ? this.defaultText
|
|
|
+ : this.currentItem?.label ?? String(this.status);
|
|
|
+ },
|
|
|
+ tagType() {
|
|
|
+ return this.isDefault ? undefined : this.currentItem?.type;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+</script>
|