浏览代码

首页增加“扫码异常门店”入口

zhujindu 1 年之前
父节点
当前提交
66dfdf96ac
共有 3 个文件被更改,包括 29 次插入14 次删除
  1. 11 0
      src/App.vue
  2. 17 13
      src/views/deviceOutside/index.vue
  3. 1 1
      src/views/home/index.vue

+ 11 - 0
src/App.vue

@@ -9,6 +9,8 @@ import watermark from 'watermark-dom';
 export default {
   name: 'App',
   created() {
+    // 初始化数据
+    this.initData();
     // 当前设备:PC/mobile
     let isDevice = window.navigator.userAgent.match(
       /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
@@ -40,5 +42,14 @@ export default {
       }
     }, 1000);
   },
+  methods: {
+    initData() {
+      // 重置扫码异常门店状态
+      // 期望:从首页扫码异常门店入口进入 计划外列表后只执行一次扫码异常门店数据的请求
+      // 结果:因为是路由跳转携带参数,当前页面跳转其他页面在跳回相当于刷新当前页面,会再次请求扫码异常门店数据
+      // 所以添加状态作为区分
+      localStorage.setItem('abnormalTsjStoreIds', '');
+    },
+  },
 };
 </script>

+ 17 - 13
src/views/deviceOutside/index.vue

@@ -580,6 +580,7 @@ export default {
       lon: '',
       timeData: '',
       customerVisits: true,
+      abnormalTsjStoreIds: null,
     };
   },
   watch: {
@@ -651,8 +652,17 @@ export default {
     },
   },
   activated() {
-    if (this.$route.query.tabVal != undefined) {
+    debugger;
+    console.log('abnormalTsjStoreIds=' + this.$route.query.abnormalTsjStoreIds);
+    // 如果是从首页-扫码异常门店列表跳转过来
+    if (
+      this.$route.query.tabVal != undefined &&
+      this.$route.query.abnormalTsjStoreIds &&
+      localStorage.getItem('abnormalTsjStoreIds') == ''
+    ) {
+      this.abnormalTsjStoreIds = this.$route.query.abnormalTsjStoreIds;
       this.tabVal = this.$route.query.tabVal;
+      localStorage.setItem('abnormalTsjStoreIds', '扫码异常门店');
     } else {
       if (localStorage.getItem('tabVal') == null || this.$route.query.info != 'y') {
         if (this.$route.query.info != undefined) {
@@ -1034,14 +1044,11 @@ export default {
         storeName: this.storeName.trim(),
         genDate: this.genDate,
       };
-      console.log('abnormalTsjStoreIds=' + this.$route.query.abnormalTsjStoreIds);
-      // 如果是从首页-扫码异常门店列表跳转过来
-      if (this.$route.query.abnormalTsjStoreIds) {
-        params.storeIds = this.$route.query.abnormalTsjStoreIds;
+      if (this.abnormalTsjStoreIds) {
+        params.storeIds = this.abnormalTsjStoreIds;
       }
       getUserOrgStoreList(params).then((res) => {
-        delete this.$route.query.abnormalTsjStoreIds;
-        console.log('abnormalTsjStoreIds=' + this.$route.query.abnormalTsjStoreIds);
+        this.abnormalTsjStoreIds = null;
         this.disabled = false;
         if (res.code == 200) {
           loading2.clear();
@@ -1121,14 +1128,11 @@ export default {
         storeName: this.storeName.trim(),
         genDate: this.genDate,
       };
-      console.log('abnormalTsjStoreIds=' + this.$route.query.abnormalTsjStoreIds);
-      // 如果是从首页-扫码异常门店列表跳转过来
-      if (this.$route.query.abnormalTsjStoreIds) {
-        params.storeIds = this.$route.query.abnormalTsjStoreIds;
+      if (this.abnormalTsjStoreIds) {
+        params.storeIds = this.abnormalTsjStoreIds;
       }
       getUserOutPlaList(params).then((res) => {
-        delete this.$route.query.abnormalTsjStoreIds;
-        console.log('abnormalTsjStoreIds=' + this.$route.query.abnormalTsjStoreIds);
+        this.abnormalTsjStoreIds = null;
         this.disabled = false;
         if (res.code == 200) {
           loading3.clear();

+ 1 - 1
src/views/home/index.vue

@@ -1562,7 +1562,7 @@ export default {
     },
     // 跳转异常门店列表
     clickAbnormalStore() {
-      // localStorage.setItem('abnormalTsjStoreIds', this.reportInfoData.abnormalTsjStoreIds); //查询ids
+      localStorage.setItem('abnormalTsjStoreIds', '');
       this.$router.push({
         path: '/outsidelist/index',
         query: {