Quellcode durchsuchen

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

zhujindu vor 1 Jahr
Ursprung
Commit
ae7669ae25
2 geänderte Dateien mit 88 neuen und 224 gelöschten Zeilen
  1. 64 224
      src/views/deviceOutside/index.vue
  2. 24 0
      src/views/home/index.vue

+ 64 - 224
src/views/deviceOutside/index.vue

@@ -610,18 +610,18 @@ export default {
       }
       this.chainCode = localStorage.getItem('outvchainCode');
       this.storeName = localStorage.getItem('outvstoreName');
-      if (
-        (from.path == '/My/index' && to.path == '/outsidelist/index') ||
-        (from.path == '/home' && to.path == '/outsidelist/index') ||
-        (from.path == '/deviceWithin/index' && to.path == '/outsidelist/index') ||
-        (from.path == '/storemanagement/index' && to.path == '/outsidelist/index')
-      ) {
-        this.tabVal = '1';
-      } else {
-        if (localStorage.getItem('tabVal') != null) {
-          this.tabVal = localStorage.getItem('tabVal');
-        }
-      }
+      // if (
+      //   (from.path == '/My/index' && to.path == '/outsidelist/index') ||
+      //   (from.path == '/home' && to.path == '/outsidelist/index') ||
+      //   (from.path == '/deviceWithin/index' && to.path == '/outsidelist/index') ||
+      //   (from.path == '/storemanagement/index' && to.path == '/outsidelist/index')
+      // ) {
+      //   this.tabVal = '1';
+      // } else {
+      //   if (localStorage.getItem('tabVal') != null) {
+      //     this.tabVal = localStorage.getItem('tabVal');
+      //   }
+      // }
       if (
         (from.path == '/storeDetail' && to.path == '/outsidelist/index') ||
         (from.path == '/storeGroup' && to.path == '/outsidelist/index') ||
@@ -650,6 +650,25 @@ export default {
       this.getMonth();
     },
   },
+  activated() {
+    if (this.$route.query.tabVal != undefined) {
+      this.tabVal = this.$route.query.tabVal;
+    } else {
+      if (localStorage.getItem('tabVal') == null || this.$route.query.info != 'y') {
+        if (this.$route.query.info != undefined) {
+          if (this.$route.query.info.indexOf('y') != -1) {
+            this.tabVal = localStorage.getItem('tabVal');
+          } else {
+            this.tabVal = '1';
+          }
+        } else {
+          this.tabVal = '1';
+        }
+      } else {
+        this.tabVal = localStorage.getItem('tabVal');
+      }
+    }
+  },
   created() {
     this.storeName = localStorage.getItem('outvstoreName');
     this.chainName = localStorage.getItem('outvchainName');
@@ -667,19 +686,19 @@ export default {
     }
     this.chainCode = localStorage.getItem('outvchainCode');
     this.storeName = localStorage.getItem('outvstoreName');
-    if (localStorage.getItem('tabVal') == null || this.$route.query.info != 'y') {
-      if (this.$route.query.info != undefined) {
-        if (this.$route.query.info.indexOf('y') != -1) {
-          this.tabVal = localStorage.getItem('tabVal');
-        } else {
-          this.tabVal = '1';
-        }
-      } else {
-        this.tabVal = '1';
-      }
-    } else {
-      this.tabVal = localStorage.getItem('tabVal');
-    }
+    // if (localStorage.getItem('tabVal') == null || this.$route.query.info != 'y') {
+    //   if (this.$route.query.info != undefined) {
+    //     if (this.$route.query.info.indexOf('y') != -1) {
+    //       this.tabVal = localStorage.getItem('tabVal');
+    //     } else {
+    //       this.tabVal = '1';
+    //     }
+    //   } else {
+    //     this.tabVal = '1';
+    //   }
+    // } else {
+    //   this.tabVal = localStorage.getItem('tabVal');
+    // }
     if (localStorage.getItem('postType') == 'JZ' || localStorage.getItem('postType') == 'GZ') {
       this.mapShows = false;
     } else {
@@ -965,93 +984,6 @@ export default {
             message: error,
           });
         });
-      // let loading1 = this.$toast.loading({
-      //   duration: 0,
-      //   message: '加载中...',
-      //   forbidClick: true,
-      // });
-      // let url = window.location.href;
-      // let wx = this.wx;
-      // var that = this;
-      // let qiyeData;
-      // const instance = axios.create();
-      // instance.defaults.headers.common['userId'] = localStorage.getItem('loginName');
-      // instance
-      //   .get(process.env.VUE_APP_BASE_API + 'mobile/wx/ticket', {
-      //     params: {
-      //       url: url,
-      //     },
-      //   })
-      //   .then((response) => {
-      //     if (response.status == 200) {
-      //       this.cont = 5;
-      //       var flat = true;
-      //       var times = setInterval(() => {
-      //         this.cont--;
-      //         if (this.cont == '0') {
-      //           if (flat) {
-      //             loading1.clear();
-      //             clearInterval(times);
-      //             that.$dialog.alert({
-      //               message: '定位失败,请开启企微定位权限',
-      //             });
-      //           } else {
-      //             clearInterval(times);
-      //           }
-      //         }
-      //       }, 1000);
-      //       qiyeData = response.data.data;
-      //       wx.config({
-      //         beta: true, // 必须这么写,否则wx.invoke调用形式的jsapi会有问题
-      //         debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
-      //         appId: qiyeData.appId, // 必填,企业微信的corpID
-      //         timestamp: qiyeData.timestamp, // 必填,生成签名的时间戳
-      //         nonceStr: qiyeData.nonceStr, // 必填,生成签名的随机串
-      //         signature: qiyeData.signature, // 必填,签名,见 附录-JS-SDK使用权限签名算法
-      //         jsApiList: ['ready', 'getLocation'], // 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
-      //       });
-      //       wx.ready(function () {
-      //         wx.getLocation({
-      //           type: 'gcj02',
-      //           success: function (res) {
-      //             flat = false;
-      //             loading1.clear();
-      //             var name = '我的';
-      //             if (that.tabVal != 1) {
-      //               name = '销售部';
-      //             }
-      //             that.buryingPoint({
-      //               systemModel: '计划外',
-      //               buryingPointType: 3,
-      //               buryingPointValue: name,
-      //               buryingPointName: '计划外',
-      //               buryingPointPosition: '进入地图',
-      //             });
-      //             that.$router.push({
-      //               path: '/rangeStore',
-      //               query: {
-      //                 lat: '',
-      //                 lon: '',
-      //                 tabVal: that.tabVal,
-      //               },
-      //             });
-      //           },
-      //           fail: function () {
-      //             loading1.clear();
-      //             that.$dialog.alert({
-      //               message: 'GPS未开启',
-      //             });
-      //           },
-      //         });
-      //       });
-      //       wx.error(function (res) {
-      //         loading1.clear();
-      //         that.$dialog.alert({
-      //           message: '定位失败,请开启企微定位权限',
-      //         });
-      //       });
-      //     }
-      //   });
     },
     //取消搜索
     cancelSearch() {
@@ -1091,7 +1023,7 @@ export default {
         message: '加载中...',
         forbidClick: true,
       });
-      getUserOrgStoreList({
+      let params = {
         lat: that.lat,
         lon: that.lon,
         chainCode: this.chainCode,
@@ -1101,7 +1033,15 @@ export default {
         pageSize: this.pageSize,
         storeName: this.storeName.trim(),
         genDate: this.genDate,
-      }).then((res) => {
+      };
+      console.log('abnormalTsjStoreIds=' + this.$route.query.abnormalTsjStoreIds);
+      // 如果是从首页-扫码异常门店列表跳转过来
+      if (this.$route.query.abnormalTsjStoreIds) {
+        params.storeIds = this.$route.query.abnormalTsjStoreIds;
+      }
+      getUserOrgStoreList(params).then((res) => {
+        delete this.$route.query.abnormalTsjStoreIds;
+        console.log('abnormalTsjStoreIds=' + this.$route.query.abnormalTsjStoreIds);
         this.disabled = false;
         if (res.code == 200) {
           loading2.clear();
@@ -1155,113 +1095,6 @@ export default {
             message: error,
           });
         });
-      // // 本地开发 test 环境时 时跳过获取定位功能
-      // if (process.env.NODE_ENV === 'test') {
-      //   this.lat = 34.62188103091605;
-      //   this.lon = 112.45364302095416;
-      //   localStorage.setItem('lat', this.lat);
-      //   localStorage.setItem('lon', this.lon);
-      //   if (this.tabVal == 1) {
-      //     this.getUserOutPlaListFun();
-      //   } else {
-      //     this.getUserOrgStoreList();
-      //   }
-      //   return;
-      // }
-      // var that = this;
-      // let url = window.location.href;
-      // let wx = this.wx;
-      // let loadingmap = this.$toast.loading({
-      //   duration: 0,
-      //   message: '定位中...',
-      //   forbidClick: true,
-      // });
-      // let qiyeData;
-      // const instance = axios.create();
-      // instance.defaults.headers.common['userId'] = localStorage.getItem('loginName');
-      // instance
-      //   .get(process.env.VUE_APP_BASE_API + 'mobile/wx/ticket', {
-      //     params: {
-      //       url: url,
-      //     },
-      //   })
-      //   .then((response) => {
-      //     console.log('url=' + url);
-      //     loadingmap.clear();
-      //     if (response.status == 200) {
-      //       this.cont = 5;
-      //       var flat = true;
-      //       var times = setInterval(() => {
-      //         this.cont--;
-      //         if (this.cont == '0') {
-      //           if (flat) {
-      //             clearInterval(times);
-      //             if (val == 1) {
-      //               that.$dialog.alert({
-      //                 message: '定位失败,请开启企微定位权限',
-      //               });
-      //             }
-      //             loadingmap.clear();
-      //           } else {
-      //             clearInterval(times);
-      //           }
-      //         }
-      //       }, 1000);
-      //       qiyeData = response.data.data;
-      //       wx.config({
-      //         beta: true, // 必须这么写,否则wx.invoke调用形式的jsapi会有问题
-      //         debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
-      //         appId: qiyeData.appId, // 必填,企业微信的corpID
-      //         timestamp: qiyeData.timestamp, // 必填,生成签名的时间戳
-      //         nonceStr: qiyeData.nonceStr, // 必填,生成签名的随机串
-      //         signature: qiyeData.signature, // 必填,签名,见 附录-JS-SDK使用权限签名算法
-      //         jsApiList: ['ready', 'getLocation'], // 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
-      //       });
-      //       wx.ready(function () {
-      //         wx.getLocation({
-      //           type: 'gcj02',
-      //           success: function (res) {
-      //             flat = false;
-      //             loadingmap.clear();
-      //             console.log('处理前');
-      //             console.log(res.latitude, res.longitude);
-      //             var location = that.CJ02BD(res.latitude, res.longitude);
-      //             console.log('处理后');
-      //             console.log(location);
-      //             that.lat = location.lat;
-      //             that.lon = location.lon;
-      //             localStorage.setItem('lat', location.lat);
-      //             localStorage.setItem('lon', location.lon);
-      //             if (val == 1) {
-      //               if (that.tabVal == 1) {
-      //                 that.getUserOutPlaListFun();
-      //               } else {
-      //                 that.getUserOrgStoreList();
-      //               }
-      //             } else {
-      //               that.getUserOutPlaListFun();
-      //             }
-      //           },
-      //           fail: function () {
-      //             loadingmap.clear();
-      //             if (val == 1) {
-      //               that.$dialog.alert({
-      //                 message: 'GPS未开启',
-      //               });
-      //             }
-      //           },
-      //         });
-      //       });
-      //       wx.error(function (res) {
-      //         loadingmap.clear();
-      //         if (val == 1) {
-      //           that.$dialog.alert({
-      //             message: '定位失败,请开启企微定位权限',
-      //           });
-      //         }
-      //       });
-      //     }
-      //   });
     },
     getUserOutPlaListFun() {
       this.storeType = localStorage.getItem('storeType');
@@ -1277,7 +1110,7 @@ export default {
         this.list = [];
         this.refreshing = false;
       }
-      getUserOutPlaList({
+      let params = {
         lat: that.lat,
         lon: that.lon,
         chainCode: this.chainCode,
@@ -1287,7 +1120,15 @@ export default {
         pageSize: this.pageSize,
         storeName: this.storeName.trim(),
         genDate: this.genDate,
-      }).then((res) => {
+      };
+      console.log('abnormalTsjStoreIds=' + this.$route.query.abnormalTsjStoreIds);
+      // 如果是从首页-扫码异常门店列表跳转过来
+      if (this.$route.query.abnormalTsjStoreIds) {
+        params.storeIds = this.$route.query.abnormalTsjStoreIds;
+      }
+      getUserOutPlaList(params).then((res) => {
+        delete this.$route.query.abnormalTsjStoreIds;
+        console.log('abnormalTsjStoreIds=' + this.$route.query.abnormalTsjStoreIds);
         this.disabled = false;
         if (res.code == 200) {
           loading3.clear();
@@ -2347,7 +2188,6 @@ export default {
         } else {
           if (this.tabVal == 1) {
             this.positionFn();
-            // this.getUserOutPlaListFun();
           } else {
             this.getUserOrgStoreList();
           }

+ 24 - 0
src/views/home/index.vue

@@ -1202,6 +1202,19 @@
       </van-cell>
       <div class="lineGrey"></div>
     </div>
+    <!-- 扫码异常门店 -->
+    <div
+      class="contentborder"
+      v-if="(powerGrade == 1 || powerGrade == 2) && reportInfoData.abnormalTsjCount > 0">
+      <van-cell class="homeTitle" title="扫码异常门店" @click="clickAbnormalStore">
+        <template #title
+          ><span class="custom-title">扫码异常门店&nbsp;&nbsp;</span>
+          <van-tag type="danger">{{ reportInfoData.abnormalTsjCount }}</van-tag>
+        </template>
+        <template #right-icon><van-icon class="homeCellIcon" name="arrow" size="16" /> </template>
+      </van-cell>
+      <div class="lineGrey"></div>
+    </div>
     <div class="contentborder">
       <van-button
         v-if="powerGrade == 3 && showButton"
@@ -1547,6 +1560,17 @@ export default {
       this.$router.go(-1);
       // window.location.href = process.env.VUE_APP_SSB_LINK + "/homeIndex"
     },
+    // 跳转异常门店列表
+    clickAbnormalStore() {
+      // localStorage.setItem('abnormalTsjStoreIds', this.reportInfoData.abnormalTsjStoreIds); //查询ids
+      this.$router.push({
+        path: '/outsidelist/index',
+        query: {
+          tabVal: this.reportInfoData.powerGrade == 2 ? 0 : 1, // 跳转页面的tabval
+          abnormalTsjStoreIds: this.reportInfoData.abnormalTsjStoreIds,
+        },
+      });
+    },
   },
 };
 </script>