Просмотр исходного кода

fix:待审核商品展示状态

ct 2 недель назад
Родитель
Сommit
173e9a8e3e
1 измененных файлов с 20 добавлено и 1 удалено
  1. 20 1
      src/views/hisStore/storeProduct/index.vue

+ 20 - 1
src/views/hisStore/storeProduct/index.vue

@@ -326,7 +326,9 @@
       </el-table-column>
       <el-table-column label="状态" align="center" prop="isShow" >
         <template slot-scope="scope">
-          <el-tag prop="status" v-for="(item, index) in isShowOptions"    v-if="scope.row.isShow==item.dictValue">{{item.dictLabel}}</el-tag>
+          <el-tag :type="getStatusType(scope.row)" prop="status">
+            {{ getStatusText(scope.row) }}
+          </el-tag>
         </template>
       </el-table-column>
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
@@ -1205,6 +1207,23 @@ export default {
     this.getList();
   },
   methods: {
+    getStatusText(row) {
+      console.log()
+      if (row.isAudit == 0) {
+        return '待审核';
+      }
+      const option = this.isShowOptions.find(item => item.dictValue == row.isShow);
+      return option ? option.dictLabel : '未知状态';
+    },
+    
+    getStatusType(row) {
+      console.log(row)
+      if (row.isAudit == 0) {
+        return 'warning';
+      }
+      // 根据你的业务逻辑返回不同的类型,如:success, danger, info等
+      return row.isShow == 1 ? 'success' : 'info';
+    },
     cancel1(){
       this.open1 = false;
     },