xiaodai2022 2 tahun lalu
induk
melakukan
6564af573c

+ 3 - 3
src/views/youzan/othGoodFieldLog/index.vue

@@ -228,9 +228,9 @@ export default {
       this.loading = true;
       const { code, data } = await asyncRequest.list(this.parmValue);
       if (code === 0) {
-        const { list, count } = data;
-        this.tableData = list;
-        this.pageInfo.total = count;
+        const { list, count } = data ?? {};
+        this.tableData = list ?? [];
+        this.pageInfo.total = count ?? 0;
       } else if (code >= 100 && code <= 104) {
         await this.logout();
       } else {

+ 3 - 3
src/views/youzan/othGoodLog/index.vue

@@ -271,9 +271,9 @@ export default {
       this.loading = true;
       const { code, data } = await asyncRequest.list(this.parmValue);
       if (code === 0) {
-        const { list, count } = data;
+        const { list, count } = data ?? {};
 
-        let arr = list;
+        let arr = list ?? [];
         arr.map((e) => {
           for (let key in e.data) {
             e[`key_${key}`] = e.data[key];
@@ -281,7 +281,7 @@ export default {
           return e;
         });
         this.tableData = arr;
-        this.pageInfo.total = count;
+        this.pageInfo.total = count ?? 0;
       } else if (code >= 100 && code <= 104) {
         await this.logout();
       } else {

+ 6 - 7
src/views/youzan/othOrder/index.vue

@@ -171,7 +171,6 @@
                   重置
                 </el-button>
               </el-col>
-
             </el-row>
           </div>
         </template>
@@ -228,7 +227,6 @@
         </template>
       </ex-table>
 
-  
       <!--订单用途设置-->
       <user-add-edit
         :code="orderCodeList"
@@ -476,9 +474,10 @@ export default {
 
       this.parmValue.company_name = this.select === "company_name" ? this.input : "";
 
-      const res = await asyncRequest.list(this.parmValue);
-      if (res && res.code === 0 && res.data) {
-        this.tableData = res.data.list;
+      const { code, data } = await asyncRequest.list(this.parmValue);
+      if (code === 0) {
+        const { list, count } = data ?? {};
+        this.tableData = list ?? [];
         this.tableData.forEach((v) => {
           v.good_class = "";
           if (v.can && v.can.length > 0) {
@@ -487,8 +486,8 @@ export default {
             });
           }
         });
-        this.pageInfo.total = Number(res.data.count);
-      } else if (res && res.code >= 100 && res.code <= 104) {
+        this.pageInfo.total = Number(count ?? "0");
+      } else if (code >= 100 && code <= 104) {
         await this.logout();
       } else {
         this.tableData = [];

+ 7 - 7
src/views/youzan/othgoodsOffline/index.vue

@@ -217,15 +217,15 @@ export default {
       }
       this.loading = true;
       console.log(this.parmValue);
-      const res = await asyncRequest.list(this.parmValue);
-      if (res && res.code === 0 && res.data) {
-        this.tableData = res.data.list;
-
-        this.pageInfo.total = Number(res.data.count);
-      } else if (res && res.code >= 100 && res.code <= 104) {
+      const { code, data, message } = await asyncRequest.list(this.parmValue);
+      if (code === 0) {
+        const { list, count } = data ?? {};
+        this.tableData = list ?? [];
+        this.pageInfo.total = Number(count ?? "0");
+      } else if (code >= 100 && code <= 104) {
         await this.logout();
       } else {
-        this.$message.warning(res.message);
+        this.$message.warning(message);
         this.tableData = [];
         this.pageInfo.total = 0;
       }

+ 16 - 15
src/views/youzan/othgoodsOnline/index.vue

@@ -509,19 +509,19 @@ export default {
   methods: {
     // 获取异常原因下拉列表
     async getresultlist() {
-      const res = await asyncRequest.resultlist({
+      const { code, data, message } = await asyncRequest.resultlist({
         page: 1,
         size: 100,
         type: "8",
         status: "3",
       });
-      if (res && res.code === 0 && res.data) {
-        const { list } = res.data;
+      if (code === 0) {
+        const { list } = data ?? [];
         this.donline_formStOps = list;
-      } else if (res && res.code >= 100 && res.code <= 104) {
+      } else if (code >= 100 && code <= 104) {
         await this.logout();
       } else {
-        this.$message.warning(res.message);
+        this.$message.warning(message);
       }
     },
     // 时间函数
@@ -556,20 +556,20 @@ export default {
         if (valid) {
           this.loading = true;
           const obj = JSON.parse(JSON.stringify(this.donline_form));
-          const res = await asyncRequest.yz_goodoff(obj);
+          const { code, data, message } = await asyncRequest.yz_goodoff(obj);
           this.dialogFormVisible = false;
-          if (res && res.code === 0) {
+          if (code === 0) {
             this.loading = false;
             this.$notify.success({
-              title: res.message,
+              title: message,
               message: "",
             });
             await this.searchList();
-          } else if (res && res.code >= 100 && res.code <= 104) {
+          } else if (code >= 100 && code <= 104) {
             await this.logout();
           } else {
             this.loading = false;
-            this.$message.warning(res.message);
+            this.$message.warning(message);
           }
         } else {
           console.log("error submit!!");
@@ -804,9 +804,10 @@ export default {
       model.plat_code = this.select === "6" ? this.sinput : ""; //平台商品编号
       model.creater = this.select === "7" ? this.sinput : ""; //
       model.company_name = this.select === "9" ? this.sinput : ""; // 部门
-      const res = await asyncRequest.list(model);
-      if (res && res.code === 0 && res.data) {
-        this.tableData = res.data.list;
+      const { code, data, message } = await asyncRequest.list(model);
+      if (code === 0) {
+        const { list, count } = data ?? {};
+        this.tableData = list ?? [];
         this.tableData.forEach((a) => {
           a.cat_name = "";
           let list = a.cat_info || [];
@@ -814,8 +815,8 @@ export default {
             a.cat_name += i == 0 ? b.name : "/" + b.name;
           });
         });
-        this.pageInfo.total = Number(res.data.count);
-      } else if (res && res.code >= 100 && res.code <= 104) {
+        this.pageInfo.total = Number(count ?? "0");
+      } else if (code >= 100 && code <= 104) {
         await this.logout();
       } else {
         this.tableData = [];

+ 3 - 3
src/views/youzan/othsearchSort/index.vue

@@ -441,9 +441,9 @@ export default {
       this.loading = true;
       const { code, data } = await asyncRequest.list(this.parmValue);
       if (code === 0) {
-        const { list, count } = data;
-        this.tableData = list;
-        this.pageInfo.total = count;
+        const { list, count } = data ?? {};
+        this.tableData = list ?? [];
+        this.pageInfo.total = count ?? 0;
       } else if (code >= 100 && code <= 104) {
         await this.logout();
       } else {