Procházet zdrojové kódy

首页增加提示类tab,B类指标页优化,我的-增加业务员日常工作统计

zhujindu před 1 rokem
rodič
revize
d67161f8a2

+ 1 - 0
src/views/home/hintTabPage/visitPage.vue

@@ -73,6 +73,7 @@ export default {
           // 进入我的-我的客户(storemanagementlist)
           // 1:未完工;2:未结案
           let storeStatus = list.rightTable.indexOf('未完工') != -1 ? '1' : '2';
+          localStorage.setItem('storeStatus', storeStatus);
           this.$router.push({ path: '/storemanagementlist', query: { storeStatus: storeStatus } });
         }
       } else {

+ 33 - 35
src/views/storeManagement/index.vue

@@ -410,6 +410,18 @@ export default {
       this.getstoreCoverPosition();
       this.getStreetQuery();
       this.getMonth();
+      let storeStatus = localStorage.getItem('storeStatus');
+      // 1:未完工;2:未结案
+      if (storeStatus) {
+        if (storeStatus == 2) {
+          this.statusOption = [
+            { text: '已结案', value: 1, selectFlag: false },
+            { text: '已提交', value: 2, selectFlag: true },
+            { text: '未提交', value: 3, selectFlag: true },
+          ];
+        }
+        this.setOption();
+      }
       this.onSearch();
       if (localStorage.getItem('postType') == 'JZ' || localStorage.getItem('postType') == 'GZ') {
         this.mapShows = false;
@@ -418,44 +430,21 @@ export default {
       }
     }
   },
-  created() {
-    this.initStoreStatus();
-  },
   watch: {
     $route: {
       handler(to, from) {
-        this.$nextTick(() => {
-          console.log(from);
-          if (to.path == '/storemanagement/index' && from.path == '/My/index') {
-            this.tabVal = '1';
-          }
-          if (to.path == '/storemanagement/index' && from.path == '/home') {
-            this.initStoreStatus();
-          }
-        });
+        // if (to.path == '/storemanagement/index' && from.path == '/My/index') {
+        //   this.tabVal = '1';
+        // }
+        if (from.path == '/storemanagement/index') {
+          // 离开当前页面时
+          localStorage.removeItem('storeStatus');
+        }
       },
       // immediate: true,
     },
   },
   methods: {
-    initStoreStatus() {
-      this.storeStatus = this.$route.query.storeStatus; //首页-提示类-建店跳转过来的状态
-      if (this.storeStatus != undefined) {
-        // 1:未完工;2:未结案
-        if (this.storeStatus == 2) {
-          // 筛选项确认
-          this.$nextTick(() => {
-            this.statusOption = [
-              { text: '已结案', value: 1, selectFlag: false },
-              { text: '已提交', value: 2, selectFlag: true },
-              { text: '未提交', value: 3, selectFlag: true },
-            ];
-            this.pageNum = 1;
-            this.onConfirm();
-          });
-        }
-      }
-    },
     initSelect() {
       this.activatedTitles = [];
       this.activatedValues = [];
@@ -815,13 +804,13 @@ export default {
         this.disabled = false;
         if (res.code == 200) {
           this.loading = false;
-          console.log(this.list);
           this.list = this.list.concat(res.rows);
           if (this.list.length >= res.total) {
             this.finished = true;
           } else {
             this.finished = false;
           }
+          console.log(this.list);
           this.pageNum = this.pageNum + 1;
           // this.list = res.rows
         } else {
@@ -873,7 +862,13 @@ export default {
     },
     onClickLeft() {
       localStorage.setItem('tabVal', '1');
-      this.$router.push('/My/index');
+      let storeStatus = localStorage.getItem('storeStatus');
+      if (storeStatus) {
+        localStorage.removeItem('storeStatus');
+        this.$router.go(-1);
+      } else {
+        this.$router.push('/My/index');
+      }
     },
     onSearch() {
       window.scrollTo(0, 0);
@@ -918,6 +913,12 @@ export default {
     },
     // 筛选项确认
     onConfirm() {
+      this.setOption();
+      this.$refs.dropdownItem.toggle();
+      this.pageNum = 1;
+      this.getUserMyStoreList();
+    },
+    setOption() {
       let titles = [];
       let values = [];
       this.statusOption.forEach((val) => {
@@ -931,9 +932,6 @@ export default {
       this.dropdownTitle = this.activatedTitles.length
         ? this.activatedTitles.join(',')
         : '门店状态';
-      this.$refs.dropdownItem.toggle();
-      this.pageNum = 1;
-      this.getUserMyStoreList();
     },
   },
 };