Browse Source

no message

zhujindu 5 months ago
parent
commit
eecdd24968
1 changed files with 24 additions and 14 deletions
  1. 24 14
      src/views/home/noVisit.vue

+ 24 - 14
src/views/home/noVisit.vue

@@ -41,7 +41,7 @@
   </div>
 </template>
 <script>
-import { addVisitsPosition, mobileReposition } from '@/api/index';
+import { addVisitsPosition, mobileReposition, checkVisit } from '@/api/index';
 import { chainNoVisitList } from '@/api/visitapi';
 import { checkChainsAddressByChainCode } from '@/api/agentList';
 import { getPosition, getTicketFun } from '@/utils/TXApiFun';
@@ -103,22 +103,32 @@ export default {
       this.clickIsFlage = false;
       this.toastLoading(0, '加载中...', true);
       this.activatStoreVal = val;
-      // 拜访时重新获取定位
-      getPosition()
-        .then((res) => {
-          let { TXisBD, resData } = res;
-          this.TXisBD = TXisBD;
-          this.TXPiont = resData;
-          localStorage.setItem('lat', TXisBD.lat);
-          localStorage.setItem('lon', TXisBD.lon);
-          this.checkStoreAddressByStoreCodeFun();
-        })
-        .catch((error) => {
+      checkVisit({ chainId: val.chainId }).then((res) => {
+        if (res.code == 200 || (val.stateString && val.stateString.indexOf('拜访中') != -1)) {
+          // 拜访时重新获取定位
+          getPosition()
+            .then((res) => {
+              let { TXisBD, resData } = res;
+              this.TXisBD = TXisBD;
+              this.TXPiont = resData;
+              localStorage.setItem('lat', TXisBD.lat);
+              localStorage.setItem('lon', TXisBD.lon);
+              this.checkStoreAddressByStoreCodeFun();
+            })
+            .catch((error) => {
+              this.clickIsFlage = true;
+              this.$dialog.alert({
+                message: error,
+              });
+            });
+        } else {
           this.clickIsFlage = true;
+          this.toastLoading().clear();
           this.$dialog.alert({
-            message: error,
+            message: res.msg,
           });
-        });
+        }
+      });
     },
     checkStoreAddressByStoreCodeFun() {
       this.toastLoading(0, '加载中...', true);