From d6fb18b49cd61427a343fbe7a2a4f94e4b597bdc Mon Sep 17 00:00:00 2001
From: wl <173@qq.com>
Date: 星期四, 29 十二月 2022 14:00:41 +0800
Subject: [PATCH] fix:店铺状态

---
 src/views/operate/images/index.vue |  130 ++++++++++++++++++++++++-------------------
 1 files changed, 73 insertions(+), 57 deletions(-)

diff --git a/src/views/operate/images/index.vue b/src/views/operate/images/index.vue
index 56712ad..1a47a4b 100644
--- a/src/views/operate/images/index.vue
+++ b/src/views/operate/images/index.vue
@@ -20,21 +20,19 @@
               >鏌ヨ</el-button
             >
           </div>
-          <!-- <div class="findBtn">
-            <el-button
-              type="primary"
-              @click="handleUpdateImageResource(null, 'create')"
-              >娣诲姞鍥剧墖</el-button
-            >
-          </div> -->
         </div>
+        <div class="addBtn">
+            <el-button type="primary" @click="handleUpdateImageResource(null,'create')"
+              >鏂板</el-button
+            >
+          </div>
       </div>
     </header>
     <main>
       <div class="mainContent">
         <div class="type-nav">
           <div
-            @click="changeTypeChecked(index)"
+            @click="changeTypeChecked(item)"
             v-for="(item, index) in typeList"
             :key="item.name"
             :class="[item.checked ? 'is-active' : '', 'type-item']"
@@ -46,9 +44,6 @@
         <el-table
           ref="multipleTable"
           :header-cell-style="{
-            background: '#06122c',
-            'font-size': '12px',
-            color: '#4b9bb7',
             'font-weight': '650',
             'line-height': '45px',
           }"
@@ -57,7 +52,7 @@
           :row-class-name="tableRowClassName"
           @selection-change="tableChange"
         >
-          <el-table-column type="selection" min-width="5"> </el-table-column>
+          <el-table-column type="selection" min-width="5" :selectable="selectable"> </el-table-column>
           <el-table-column prop="code" label="鎵�灞炰簨浠剁紪鍙�" min-width="18">
           </el-table-column>
           <el-table-column prop="category" label="闂绫诲埆" min-width="8">
@@ -72,8 +67,6 @@
           </el-table-column>
           <el-table-column prop="regionName" label="绀惧尯鍚嶇О" min-width="8">
           </el-table-column>
-          <!-- <el-table-column prop="id" label="鍥剧墖Id" min-width="8">
-          </el-table-column> -->
           <el-table-column
             prop="createTime"
             label="涓婁紶鏃堕棿"
@@ -87,12 +80,12 @@
                 <span @click="handleUpdateImageResource(scope.row, 'view')"
                   >鏌ョ湅</span
                 >
-                <span class="line">|</span>
-                <span @click="handleUpdateImageResource(scope.row, 'update')"
+                <span v-if="mystatus === 3" class="line">|</span>
+                <span v-if="mystatus === 3" @click="handleUdeletepdateImageResource(scope.row, 'update')"
                   >淇敼</span
                 >
-                <span class="line">|</span>
-                <span @click="handleDelete(scope.row)">鍒犻櫎</span>
+                <span v-if="mystatus === 3"  class="line">|</span>
+                <span v-if="mystatus === 3"  @click="handleDelete(scope.row)">鍒犻櫎</span>
               </div>
             </template>
           </el-table-column>
@@ -127,8 +120,6 @@
               <el-select
                 v-model="myIdx"
                 placeholder="鎵归噺鎿嶄綔"
-                @change="selectChange"
-                disabled
               >
                 <el-option
                   v-for="item in options"
@@ -136,6 +127,7 @@
                   :label="item.label"
                   :value="item.value"
                   :disabled="item.disabled"
+                  @click.native="selectChange"
                 >
                 </el-option>
               </el-select>
@@ -208,14 +200,14 @@
           label: "鎵归噺鎿嶄綔",
           disabled: true,
         },
-        {
-          value: 1,
-          label: "鎵归噺鍚敤",
-        },
-        {
-          value: 2,
-          label: "鎵归噺绂佺敤",
-        },
+        // {
+        //   value: 1,
+        //   label: "鎵归噺鍚敤",
+        // },
+        // {
+        //   value: 2,
+        //   label: "鎵归噺绂佺敤",
+        // },
         {
           value: 3,
           label: "鎵归噺鍒犻櫎",
@@ -225,7 +217,7 @@
       typeList: [
         {
           name: "鎽勫儚澶存帹閫�",
-          value: null,
+          value: "01",
           checked: true,
         },
         {
@@ -255,21 +247,35 @@
 
     // 鎵归噺鍒犻櫎
     mulDelete(idArr) {
-      imageManagement
-        .deleteImageResources({ ids: idArr })
-        .then(() => {
-          this.$message.success("鎿嶄綔鎴愬姛");
-          this.getImageResourceList();
-        })
-        .catch((err) => this.$message.error(`${err}`));
+      this.$confirm("鎮ㄧ‘瀹氳鎵归噺鍒犻櫎鍥剧墖鍚�?")
+                .then((_) => {
+                    this.$axios({
+                        method: "delete",
+                        url: "/sccg/image_resources/deletion_batch?ids=" + idArr,
+                    }).then((res) => {
+                        if (res.code === 200) {
+                            this.$message({
+                                type: "success",
+                                message: "鎵归噺鍒犻櫎鍥剧墖鎴愬姛",
+                            });
+                            this.getImageResourceList();
+                        } else {
+                            this.$message({
+                                type: "error",
+                                message: res.message,
+                            });
+                        }
+                    });
+                })
+                .catch((err) => {
+                    console.log(err);
+                });
     },
     // 鎵ц涓嬫媺妗嗘搷浣�
     selectChange(list) {
       if (this.tempList.length !== 0) {
-        if (list === 3) {
           this.preMyIdx = list;
           this.mulDelete(this.tempList);
-        }
       } else {
         this.myIdx = this.preMyIdx;
         this.$message({
@@ -282,7 +288,7 @@
     tableChange(list) {
       this.tempList = [];
       list.forEach((item) => {
-        this.tempList.push(item.code);
+        this.tempList.push(item.id);
       });
       this.all = list.length === this.tableData.length;
     },
@@ -303,6 +309,7 @@
           .deleteImageResource({ id: id })
           .then(() => {
             this.$message.success("鎿嶄綔鎴愬姛");
+            this.getImageResourceList();
           })
           .catch((err) => this.$message.error(`${err}`));
       });
@@ -328,12 +335,13 @@
         .catch((err) => this.$message({ type: "error", message: err }));
     },
     // 鏇存敼杩濊/杩濆缓
-    changeTypeChecked(idx) {
-      this.typeList.forEach((item) => {
-        item.checked = item.value === idx;
-      });
-      this.mystatus = idx + 1;
-      this.size = idx;
+    changeTypeChecked(data) {
+      this.typeList.forEach(item => {
+        item.checked = data.name === item.name;
+      })
+      const checkedType = this.typeList.find(item => item.checked);
+      this.mystatus = +checkedType.value;
+      this.size = checkedType.value;
       this.getImageResourceList();
     },
     // 璁剧疆琛ㄦ牸鏂戦┈绾�
@@ -367,6 +375,13 @@
     getEventSource(value) {
       return EVENT_SOURCE.find((item) => item.value === value);
     },
+    selectable(row,index){
+         if(this.mystatus == '1'){
+           return false;//绂佺敤鐘舵��
+         }else{
+           return true;//闈炵鐢ㄧ姸鎬�
+         }
+    },
   },
 };
 </script>
@@ -377,7 +392,7 @@
   color: #4b9bb7;
 
   header {
-    background-color: #09152f;
+    background-color: white;
 
     .headerContent {
       padding: 0 40px;
@@ -399,7 +414,7 @@
           color: #1d3f57;
 
           &::v-deep .el-input__inner {
-            background-color: #09152f;
+            // background-color: #09152f;
             border: 1px solid #17324c;
           }
         }
@@ -419,7 +434,7 @@
       }
 
       .addBtn {
-        background-color: #eb5d01;
+        // background-color: #eb5d01;
         border: none;
         border-radius: 20px;
         padding: 12px 30px;
@@ -428,12 +443,12 @@
   }
 
   &::v-deep .el-input__inner {
-    background-color: #09152f;
+    // background-color: #09152f;
     border: 1px solid #17324c;
   }
 
   main {
-    background-color: #09152f;
+    // background-color: #09152f;
     margin-top: 20px;
     padding-bottom: 50px;
 
@@ -459,9 +474,10 @@
       }
 
       .is-active {
-        background-color: #070f22;
+        // background-color: #070f22;
         border-radius: 4px;
-        color: #fff;
+          color: #333;
+        font-size: 500;
       }
     }
 
@@ -515,7 +531,7 @@
           &::v-deep li,
           &::v-deep .btn-prev,
           &::v-deep .btn-next {
-            background-color: #071f39;
+            // background-color: #071f39;
             color: #4b9bb7;
           }
 
@@ -528,8 +544,8 @@
     }
 
     .el-table {
-      color: #4b9bb7;
-      font-size: 10px;
+      // color: #4b9bb7;
+      // font-size: 10px;
 
       &::v-deep .cell {
         text-overflow: ellipsis;
@@ -556,7 +572,7 @@
   }
 
   :deep(.el-range-input) {
-    background-color: #09152f;
+    // background-color: #09152f;
   }
 }
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.8.0