瀏覽代碼

修改评价删除

YY 2 年之前
父節點
當前提交
dd7628597b
共有 1 個文件被更改,包括 11 次插入6 次删除
  1. 11 6
      src/views/selfShop/goodsRate/detail.vue

+ 11 - 6
src/views/selfShop/goodsRate/detail.vue

@@ -95,7 +95,7 @@ export default {
     await this.search();
     await this.search();
   },
   },
   methods: {
   methods: {
-    ...mapActions(['query', 'fetch', 'create', 'update']),
+    ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
     // 查询
     // 查询
     async search({ skip = 0, limit = 5, ...info } = {}) {
     async search({ skip = 0, limit = 5, ...info } = {}) {
       info.goods = this.id;
       info.goods = this.id;
@@ -135,16 +135,21 @@ export default {
         cancelButtonText: '取消',
         cancelButtonText: '取消',
         type: 'warning',
         type: 'warning',
       }).then(async () => {
       }).then(async () => {
+        let res;
         let list = data.reply;
         let list = data.reply;
         if (index == '0') {
         if (index == '0') {
-          list = [];
+          res = await this.delete(data.id);
+          if (this.$checkRes(res)) {
+            this.$message({ type: `success`, message: `刪除成功` });
+          }
         } else {
         } else {
           list.splice(index, 1);
           list.splice(index, 1);
+          if (data.id) res = await this.update(data);
+          if (this.$checkRes(res)) {
+            this.$message({ type: `success`, message: `删除成功` });
+          }
         }
         }
-        if (data.id) res = await this.update(data);
-        if (this.$checkRes(res)) {
-          this.$message({ type: `success`, message: `删除成功` });
-        }
+
         this.search();
         this.search();
       });
       });
     },
     },