瀏覽代碼

异常拜访问题修改

zhujindu 11 月之前
父節點
當前提交
576b7a90fe
共有 1 個文件被更改,包括 80 次插入175 次删除
  1. 80 175
      src/views/deviceWithin/index.vue

+ 80 - 175
src/views/deviceWithin/index.vue

@@ -44,12 +44,8 @@
         <van-icon class="CalendarIcon" :name="timeico" @click="show = true" />
       </div>
     </div>
-    <div class="lineGrey" v-if="mapShows"></div>
-    <div class="lineGrey" v-if="mapShows"></div>
-    <div class="lineGrey" v-if="mapShows"></div>
-    <div class="lineGrey" v-if="mapShows"></div>
     <!--        主体内容-->
-    <div class="container" style="margin-top: 144px">
+    <div class="container content" style="margin-top: 190px" @touchmove="handleTouch">
       <div class="cellcontent" v-for="(item, index) in list" :key="index">
         <van-cell>
           <div class="card">
@@ -193,15 +189,6 @@
                   </div>
                 </el-popover>
-                <!--              <el-popover-->
-                <!--                  placement="bottom"-->
-                <!--                  width="200"-->
-                <!--                  popper-class="zpover zpover2"-->
-                <!--                  trigger="click"-->
-                <!--                  content="本月未被拜访的信息">-->
-                <!--                <div v-if="item.storeLabels.noVisit" class="visitStoreIco" style="background-color: #fff" slot="reference">-->
-                <!--                  <van-icon :name="visitTimess" size="26" /></div>-->
-                <!--              </el-popover>-->
                 <el-popover
                   placement="bottom"
                   popper-class="zpover zpover1 zpover1sb"
@@ -343,14 +330,7 @@
       <p style="text-align: center; color: #888a8e" v-if="list.length > 0">--已经到底了--</p>
       <br />
       <van-empty description="暂无数据" v-if="list.length == 0" />
-      <!--</van-list>-->
     </div>
-    <br />
-    <br />
-    <br />
-    <br />
-    <br />
-    <br />
     <van-popup v-model="show" position="bottom" :style="{ height: '50%' }">
       <van-datetime-picker
         v-model="currentDate"
@@ -468,7 +448,24 @@ export default {
       this.getUserInPlanList();
     });
   },
+  mounted() {
+    // 解决iOS 上拉边界下拉出现白色空白
+    let node = document.getElementsByClassName('deviceWithin')[0];
+    node.addEventListener(
+      'touchmove',
+      (e) => {
+        if (e._isScroller) return;
+        e.preventDefault();
+      },
+      {
+        passive: false,
+      }
+    );
+  },
   methods: {
+    handleTouch(e) {
+      e._isScroller = true;
+    },
     linkapp(val) {
       var poind = this.gcj02BD(val.lat, val.lon);
       let url = window.location.href;
@@ -1283,162 +1280,58 @@ export default {
             localStorage.setItem('ORGName', val.deptName);
             localStorage.setItem('chainNameR', val.storeName);
           } else {
-            if (this.flag) {
-              this.flag = false;
-              this.timer = null;
-              this.timer = setTimeout(() => {
-                this.flag = true;
-              }, 2000);
-              let loading1 = this.$toast.loading({
-                duration: 0,
-                message: '定位中...',
-                forbidClick: true,
-              });
-              let url = window.location.href;
-              let that = this;
-              let wx = this.wx;
-              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,
+            getPosition()
+              .then((res) => {
+                let { TXisBD, resData } = res;
+                this.lat = TXisBD.lat;
+                this.lon = TXisBD.lon;
+                localStorage.setItem('lat', this.lat);
+                localStorage.setItem('lon', this.lon);
+                console.log('异常拜访=' + this.lat);
+                console.log('异常拜访=' + this.lon);
+                let PointSum = this.twoPointSum(
+                  TXisBD.lat,
+                  TXisBD.lon,
+                  TXisBD.lat,
+                  TXisBD.lon
+                ).toFixed(2);
+                this.$router.push({
+                  path: '/abnormalVisit',
+                  query: {
+                    storeId: val.storeId,
+                    rdId: val.rdId,
+                    lat: this.lat,
+                    lon: this.lon,
+                    visitModel: localStorage.getItem('postType') != 'GZ' ? '5' : '3',
+                    visitId: val.visitId,
+                    genDate: val.genDate,
+                    storeCode: val.storeCode,
+                    latNew: location.lat,
+                    lonNew: location.lon,
+                    PointSum: PointSum,
+                    marklat: resData.latitude,
+                    marklon: resData.longitude,
                   },
-                })
-                .then((response) => {
-                  if (response.status == 200) {
-                    this.cont = 3;
-                    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 location = that.CJ02BD(res.latitude, res.longitude);
-                          if (val.lat == '' || val.lat == null) {
-                            that.lat = location.lat;
-                            that.lon = location.lon;
-                          }
-                          let PointSum = that
-                            .twoPointSum(that.lat, that.lon, location.lat, location.lon)
-                            .toFixed(2);
-                          if (PointSum > 500 && localStorage.getItem('postType') != 'GZ') {
-                            that.$dialog
-                              .confirm({
-                                confirmButtonText: '确定',
-                                cancelButtonText: '取消',
-                                title: '系统提示',
-                                message: '定位距离偏差大',
-                                closeOnClickOverlay: true,
-                              })
-                              .then(() => {
-                                that.dialogms = false;
-                                that.$router.push({
-                                  path: '/abnormalVisit',
-                                  query: {
-                                    storeId: val.storeId,
-                                    rdId: val.rdId,
-                                    lat: that.lat,
-                                    lon: that.lon,
-                                    visitModel: '5',
-                                    visitId: val.visitId,
-                                    genDate: val.genDate,
-                                    storeCode: val.storeCode,
-                                    latNew: location.lat,
-                                    lonNew: location.lon,
-                                    PointSum: PointSum,
-                                    marklat: res.latitude,
-                                    marklon: res.longitude,
-                                  },
-                                });
-                                localStorage.setItem('startTime', new Date());
-                                localStorage.setItem('ORGName', val.deptName);
-                                localStorage.setItem('chainNameR', val.storeName);
-                              });
-                          } else {
-                            that.$router.push({
-                              path: '/abnormalVisit',
-                              query: {
-                                storeId: val.storeId,
-                                rdId: val.rdId,
-                                lat: that.lat,
-                                lon: that.lon,
-                                visitModel: '3',
-                                visitId: val.visitId,
-                                genDate: val.genDate,
-                                storeCode: val.storeCode,
-                                latNew: location.lat,
-                                lonNew: location.lon,
-                                PointSum: PointSum,
-                                marklat: res.latitude,
-                                marklon: res.longitude,
-                              },
-                            });
-                            localStorage.setItem('startTime', new Date());
-                            localStorage.setItem('ORGName', val.deptName);
-                            localStorage.setItem('chainNameR', val.storeName);
-                          }
-                          addVisitsPosition({
-                            storeId: val.storeId,
-                            visitsId: '',
-                            lon: res.longitude,
-                            lat: res.latitude,
-                            sourceLon: location.lon,
-                            sourceLat: location.lat,
-                            positionDesc: '',
-                            accuracy: res.accuracy,
-                          });
-                        },
-                        fail: function () {
-                          loading1.clear();
-                          that.$dialog
-                            .alert({
-                              message: 'GPS未开启',
-                            })
-                            .then(() => {
-                              // that.abnormalVisit(val)
-                            });
-                        },
-                      });
-                    });
-                    wx.error(function (res) {
-                      loading1.clear();
-                      that.$dialog.alert({
-                        message: '定位失败,请开启企微定位权限',
-                      });
-                    });
-                  } else {
-                    loading1.clear();
-                    this.$toast.fail(dataList.msg);
-                  }
                 });
-            }
+                localStorage.setItem('startTime', new Date());
+                localStorage.setItem('ORGName', val.deptName);
+                localStorage.setItem('chainNameR', val.storeName);
+                addVisitsPosition({
+                  storeId: val.storeId,
+                  visitsId: '',
+                  lon: resData.longitude,
+                  lat: resData.latitude,
+                  sourceLon: location.lon,
+                  sourceLat: location.lat,
+                  positionDesc: '',
+                  accuracy: resData.accuracy,
+                });
+              })
+              .catch((error) => {
+                this.$dialog.alert({
+                  message: error,
+                });
+              });
           }
         } else {
           this.$dialog.alert({
@@ -1670,6 +1563,18 @@ export default {
   font-weight: 600;
 }
 .deviceWithin {
+  height: 100%;
+  width: 100%;
+  display: flex;
+  flex-direction: column;
+  overflow: hidden;
+  .content {
+    flex: 1;
+    overflow-y: auto;
+  }
+  .tabBar {
+    height: 50px;
+  }
   .TCFXListItem {
     display: inline-block;
     border: 1px solid #ccc;