浏览代码

feat(goodsDetail): 添加发货状态的标签显示和逻辑处理

xieyong 3 天之前
父节点
当前提交
ca8f3c6369
共有 2 个文件被更改,包括 27 次插入4 次删除
  1. 17 3
      src/views/entrust/components/goodsDetail.vue
  2. 10 1
      src/views/entrust/index.vue

+ 17 - 3
src/views/entrust/components/goodsDetail.vue

@@ -52,8 +52,8 @@
       </template>
 
       <template v-slot:status="{ row }">
-        <el-tag :type="Number(row.status) === 0 ? 'info' : 'success'">
-          {{ Number(row.status) === 0 ? '待发货' : row.status == 1 ? "已发货" : row.status == 2 ? "已收货" : "驳回" }}
+        <el-tag :type="getStatusInfo(row.status).type">
+          {{ getStatusInfo(row.status).label }}
         </el-tag>
       </template>
     </ele-pro-table>
@@ -96,7 +96,16 @@
         title: '',
         type: '',
         itemData: {},
-        loading: null
+        loading: null,
+        // 在制品发货状态:键为后端 status,值为 el-tag 显示配置
+        statusMap: {
+          0: { label: '待发货', type: 'info' },
+          1: { label: '已发货', type: 'success' },
+          2: { label: '已收货', type: 'success' },
+          7: { label: '部分发货', type: 'success' },
+          8: { label: '部分收货', type: 'success' },
+          9: { label: '部分驳回', type: 'success' }
+        }
       };
     },
 
@@ -216,6 +225,11 @@
     },
 
     methods: {
+      // 根据后端 status 返回对应的展示文案和 el-tag 类型,未匹配时回落为驳回
+      getStatusInfo(status) {
+        return this.statusMap[Number(status)] || { label: '驳回', type: 'success' };
+      },
+
       open(item, type) {
         this.visible = true;
         this.type = type;

+ 10 - 1
src/views/entrust/index.vue

@@ -50,6 +50,15 @@
           <el-tag v-else-if="row.sendStatus == 6" type="success">{{
             '请托拒收'
           }}</el-tag>
+          <el-tag v-else-if="row.sendStatus == 7" type="success">{{
+            '部分发货'
+          }}</el-tag>
+          <el-tag v-else-if="row.sendStatus == 8" type="success">{{
+            '部分收货'
+          }}</el-tag>
+          <el-tag v-else-if="row.sendStatus == 9" type="success">{{
+            '部分驳回'
+          }}</el-tag>
         </template>
 
         <template v-slot:approvalStatus="{ row }">
@@ -140,7 +149,7 @@
             @click="sendGoods(row, 'add')"
             v-if="
               row.approvalStatus == 2 &&
-              (row.sendStatus == 0 || !row.sendStatus || row.sendStatus == 5)
+              (row.sendStatus == 0 || !row.sendStatus || row.sendStatus == 5 || row.sendStatus == 7 || row.sendStatus == 9)
             "
           >
             发货