|
|
@@ -471,7 +471,13 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { addVisitsPosition, mobileReposition, buryingPoint, getDictOption } from '@/api/index';
|
|
|
+import {
|
|
|
+ addVisitsPosition,
|
|
|
+ mobileReposition,
|
|
|
+ buryingPoint,
|
|
|
+ getDictOption,
|
|
|
+ checkVisit,
|
|
|
+} from '@/api/index';
|
|
|
import { getPosition, getTicketFun } from '@/utils/TXApiFun';
|
|
|
import { mapState } from 'vuex';
|
|
|
import store from '@/store';
|
|
|
@@ -804,67 +810,76 @@ export default {
|
|
|
this.toastLoading(0, '加载中...', true);
|
|
|
localStorage.setItem('tabVal', this.tabVal);
|
|
|
localStorage.removeItem('visitId');
|
|
|
- this.buryingPoint({
|
|
|
- systemModel: '计划外',
|
|
|
- buryingPointType: 1,
|
|
|
- buryingPointValue: val.chainName + '(' + val.chainCode + ')',
|
|
|
- buryingPointName: '进店拜访',
|
|
|
- buryingPointPosition: this.tabVal == 1 ? '我的' : '销售部',
|
|
|
- });
|
|
|
- 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);
|
|
|
- // var location = this.CJ02BD(res.latitude, res.longitude);
|
|
|
- if (val.stateString.indexOf('拜访中') != -1) {
|
|
|
- localStorage.setItem('startTime', new Date());
|
|
|
- localStorage.setItem('ORGName', val.deptName);
|
|
|
- localStorage.setItem('chainNameR', val.chainName);
|
|
|
- localStorage.removeItem('visitId'); //删除上次拜访id
|
|
|
- this.toastLoading().clear();
|
|
|
- this.$router.push({
|
|
|
- path: '/visitPage',
|
|
|
- query: {
|
|
|
- typeName2: val.typeName2,
|
|
|
- chainId: val.chainId,
|
|
|
- rdId: val.rdId,
|
|
|
- customerManager: val.customerManager,
|
|
|
- openDate: val.openDate,
|
|
|
- close: val.close,
|
|
|
- freeze: val.freeze,
|
|
|
- lat: TXisBD.lat,
|
|
|
- lon: TXisBD.lon,
|
|
|
- visitId: val.visitId,
|
|
|
- pageType: 'out',
|
|
|
- addressLine: val.addressLine,
|
|
|
- storeCategory: val.storeCategory,
|
|
|
- chainName: val.chainName,
|
|
|
- hisTime: val.hisTime,
|
|
|
- contactName: val.contactName,
|
|
|
- chainCode: val.chainCode,
|
|
|
- tabVal: this.tabVal,
|
|
|
- visitModel: '1',
|
|
|
- latNew: TXisBD.lat,
|
|
|
- lonNew: TXisBD.lon,
|
|
|
- PointSum: '0',
|
|
|
- marklat: resData.latitude,
|
|
|
- marklon: resData.longitude,
|
|
|
- from: 'outPlan',
|
|
|
- },
|
|
|
+ checkVisit({ chainId: val.chainId }).then((res) => {
|
|
|
+ this.buryingPoint({
|
|
|
+ systemModel: '计划外',
|
|
|
+ buryingPointType: 1,
|
|
|
+ buryingPointValue: val.chainName + '(' + val.chainCode + ')',
|
|
|
+ buryingPointName: '进店拜访',
|
|
|
+ buryingPointPosition: this.tabVal == 1 ? '我的' : '销售部',
|
|
|
+ });
|
|
|
+ if (res.code == 200 || val.stateString.indexOf('拜访中') != -1) {
|
|
|
+ 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);
|
|
|
+ // var location = this.CJ02BD(res.latitude, res.longitude);
|
|
|
+ if (val.stateString.indexOf('拜访中') != -1) {
|
|
|
+ localStorage.setItem('startTime', new Date());
|
|
|
+ localStorage.setItem('ORGName', val.deptName);
|
|
|
+ localStorage.setItem('chainNameR', val.chainName);
|
|
|
+ localStorage.removeItem('visitId'); //删除上次拜访id
|
|
|
+ this.toastLoading().clear();
|
|
|
+ this.$router.push({
|
|
|
+ path: '/visitPage',
|
|
|
+ query: {
|
|
|
+ typeName2: val.typeName2,
|
|
|
+ chainId: val.chainId,
|
|
|
+ rdId: val.rdId,
|
|
|
+ customerManager: val.customerManager,
|
|
|
+ openDate: val.openDate,
|
|
|
+ close: val.close,
|
|
|
+ freeze: val.freeze,
|
|
|
+ lat: TXisBD.lat,
|
|
|
+ lon: TXisBD.lon,
|
|
|
+ visitId: val.visitId,
|
|
|
+ pageType: 'out',
|
|
|
+ addressLine: val.addressLine,
|
|
|
+ storeCategory: val.storeCategory,
|
|
|
+ chainName: val.chainName,
|
|
|
+ hisTime: val.hisTime,
|
|
|
+ contactName: val.contactName,
|
|
|
+ chainCode: val.chainCode,
|
|
|
+ tabVal: this.tabVal,
|
|
|
+ visitModel: '1',
|
|
|
+ latNew: TXisBD.lat,
|
|
|
+ lonNew: TXisBD.lon,
|
|
|
+ PointSum: '0',
|
|
|
+ marklat: resData.latitude,
|
|
|
+ marklon: resData.longitude,
|
|
|
+ from: 'outPlan',
|
|
|
+ },
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.checkStoreAddressByStoreCodeFun(val, TXisBD, resData);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ this.toastLoading().clear();
|
|
|
+ this.$dialog.alert({
|
|
|
+ message: error,
|
|
|
+ });
|
|
|
});
|
|
|
- } else {
|
|
|
- this.checkStoreAddressByStoreCodeFun(val, TXisBD, resData);
|
|
|
- }
|
|
|
- })
|
|
|
- .catch((error) => {
|
|
|
+ } else {
|
|
|
this.toastLoading().clear();
|
|
|
this.$dialog.alert({
|
|
|
- message: error,
|
|
|
+ message: res.msg,
|
|
|
});
|
|
|
- });
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
checkStoreAddressByStoreCodeFun(val, location, res) {
|
|
|
checkChainsAddressByChainCode({
|