|
|
@@ -538,6 +538,7 @@ export default {
|
|
|
},
|
|
|
// 进入拜访
|
|
|
storeVisit(val) {
|
|
|
+ this.toastLoading(0, '加载中...', true);
|
|
|
localStorage.setItem('tabVal', this.tabVal);
|
|
|
localStorage.removeItem('visitId');
|
|
|
this.buryingPoint({
|
|
|
@@ -551,6 +552,7 @@ export default {
|
|
|
localStorage.setItem('startTime', new Date());
|
|
|
localStorage.setItem('ORGName', val.deptName);
|
|
|
localStorage.setItem('chainNameR', val.chainName);
|
|
|
+ this.toastLoading().clear();
|
|
|
this.$router.push({
|
|
|
path: '/visitPage',
|
|
|
query: {
|
|
|
@@ -593,6 +595,7 @@ export default {
|
|
|
this.checkStoreAddressByStoreCodeFun(val, TXisBD, resData);
|
|
|
})
|
|
|
.catch((error) => {
|
|
|
+ this.toastLoading().clear();
|
|
|
this.$dialog.alert({
|
|
|
message: error,
|
|
|
});
|
|
|
@@ -604,80 +607,85 @@ export default {
|
|
|
chainCode: val.chainCode,
|
|
|
lon: location.lon,
|
|
|
lat: location.lat,
|
|
|
- }).then((response) => {
|
|
|
- if (val.lat == '' || val.lat == null) {
|
|
|
- this.lat = location.lat;
|
|
|
- this.lon = location.lon;
|
|
|
- }
|
|
|
- let PointSumval = this.twoPointSum(
|
|
|
- location.lat,
|
|
|
- location.lon,
|
|
|
- location.lat,
|
|
|
- location.lon
|
|
|
- ).toFixed(2);
|
|
|
- // 直接进入拜访 不校验经纬度
|
|
|
- // localStorage.setItem('startTime', new Date());
|
|
|
- // localStorage.setItem('ORGName', val.deptName);
|
|
|
- // localStorage.setItem('chainNameR', val.chainName);
|
|
|
- // this.toSuishenbangOutstoreVisit(res, val, location, PointSumval);
|
|
|
- // return;
|
|
|
- // 门店校验 地址不通过
|
|
|
- if (response.code != 200) {
|
|
|
- // updateAddress : ,1:同城AB+金牌,去修改地址;2:非金牌店铺,非同城店铺偏差过大不允许拜访,可以重置定位;0非金牌店铺,非同城店铺 位置信息不存在 可以继续拜访
|
|
|
- if (response.data.updateAddress == 0) {
|
|
|
- // 非金牌店铺,非同城店铺 位置信息不存在 可以继续拜访
|
|
|
- this.$dialog
|
|
|
- .confirm({
|
|
|
- confirmButtonText: '确定拜访',
|
|
|
- cancelButtonText: '取消拜访',
|
|
|
- title: '系统提示',
|
|
|
- message:
|
|
|
- '该客户没有经纬度,此次拜访会保存定位点作为客户经纬度,下次拜访时判断是否偏差过大。',
|
|
|
- closeOnClickOverlay: true,
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- this.toSuishenbangOutstoreVisit(res, val, location, PointSumval);
|
|
|
- });
|
|
|
- } else if (response.data.updateAddress == 1) {
|
|
|
- // 同城AB+金牌,去修改地址
|
|
|
- // addressUpdateTimesOver: true=已经达到最大次数,不让修改; false=没有达到可以修改
|
|
|
- if (!response.data.addressUpdateTimesOver) {
|
|
|
+ })
|
|
|
+ .then((response) => {
|
|
|
+ this.toastLoading().clear();
|
|
|
+ if (val.lat == '' || val.lat == null) {
|
|
|
+ this.lat = location.lat;
|
|
|
+ this.lon = location.lon;
|
|
|
+ }
|
|
|
+ let PointSumval = this.twoPointSum(
|
|
|
+ location.lat,
|
|
|
+ location.lon,
|
|
|
+ location.lat,
|
|
|
+ location.lon
|
|
|
+ ).toFixed(2);
|
|
|
+ // 直接进入拜访 不校验经纬度
|
|
|
+ // localStorage.setItem('startTime', new Date());
|
|
|
+ // localStorage.setItem('ORGName', val.deptName);
|
|
|
+ // localStorage.setItem('chainNameR', val.chainName);
|
|
|
+ // this.toSuishenbangOutstoreVisit(res, val, location, PointSumval);
|
|
|
+ // return;
|
|
|
+ // 门店校验 地址不通过
|
|
|
+ if (response.code != 200) {
|
|
|
+ // updateAddress : ,1:同城AB+金牌,去修改地址;2:非金牌店铺,非同城店铺偏差过大不允许拜访,可以重置定位;0非金牌店铺,非同城店铺 位置信息不存在 可以继续拜访
|
|
|
+ if (response.data.updateAddress == 0) {
|
|
|
+ // 非金牌店铺,非同城店铺 位置信息不存在 可以继续拜访
|
|
|
this.$dialog
|
|
|
.confirm({
|
|
|
+ confirmButtonText: '确定拜访',
|
|
|
+ cancelButtonText: '取消拜访',
|
|
|
title: '系统提示',
|
|
|
- message: response.msg + '请立即修改后再拜访',
|
|
|
- messageAlign: 'left',
|
|
|
- confirmButtonText: '立即修改',
|
|
|
- cancelButtonText: '取消',
|
|
|
+ message:
|
|
|
+ '该客户没有经纬度,此次拜访会保存定位点作为客户经纬度,下次拜访时判断是否偏差过大。',
|
|
|
+ closeOnClickOverlay: true,
|
|
|
})
|
|
|
.then(() => {
|
|
|
- this.$router.push({
|
|
|
- path: '/storeDetail',
|
|
|
- query: {
|
|
|
- id: val.chainId,
|
|
|
- type: 'address',
|
|
|
- storeAddressId: val.storeAddressId,
|
|
|
- },
|
|
|
+ this.toSuishenbangOutstoreVisit(res, val, location, PointSumval);
|
|
|
+ });
|
|
|
+ } else if (response.data.updateAddress == 1) {
|
|
|
+ // 同城AB+金牌,去修改地址
|
|
|
+ // addressUpdateTimesOver: true=已经达到最大次数,不让修改; false=没有达到可以修改
|
|
|
+ if (!response.data.addressUpdateTimesOver) {
|
|
|
+ this.$dialog
|
|
|
+ .confirm({
|
|
|
+ title: '系统提示',
|
|
|
+ message: response.msg + '请立即修改后再拜访',
|
|
|
+ messageAlign: 'left',
|
|
|
+ confirmButtonText: '立即修改',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.$router.push({
|
|
|
+ path: '/storeDetail',
|
|
|
+ query: {
|
|
|
+ id: val.chainId,
|
|
|
+ type: 'address',
|
|
|
+ storeAddressId: val.storeAddressId,
|
|
|
+ },
|
|
|
+ });
|
|
|
});
|
|
|
+ } else {
|
|
|
+ this.$dialog.confirm({
|
|
|
+ title: '系统提示',
|
|
|
+ message: '已经达到最大修改次数',
|
|
|
+ messageAlign: 'left',
|
|
|
+ confirmButtonText: '确定',
|
|
|
});
|
|
|
- } else {
|
|
|
- this.$dialog.confirm({
|
|
|
- title: '系统提示',
|
|
|
- message: '已经达到最大修改次数',
|
|
|
- messageAlign: 'left',
|
|
|
- confirmButtonText: '确定',
|
|
|
- });
|
|
|
+ }
|
|
|
+ } else if (response.data.updateAddress == 2) {
|
|
|
+ // 1.非金牌店铺,非同城店铺 位置偏差过大 重置经纬度
|
|
|
+ this.resetCoord(res, val, location, PointSumval);
|
|
|
+ return;
|
|
|
}
|
|
|
- } else if (response.data.updateAddress == 2) {
|
|
|
- // 1.非金牌店铺,非同城店铺 位置偏差过大 重置经纬度
|
|
|
- this.resetCoord(res, val, location, PointSumval);
|
|
|
- return;
|
|
|
+ } else {
|
|
|
+ // 门店编码校验门店地址通过 进入拜访
|
|
|
+ this.toSuishenbangOutstoreVisit(res, val, location, PointSumval);
|
|
|
}
|
|
|
- } else {
|
|
|
- // 门店编码校验门店地址通过 进入拜访
|
|
|
- this.toSuishenbangOutstoreVisit(res, val, location, PointSumval);
|
|
|
- }
|
|
|
- });
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.toastLoading().clear();
|
|
|
+ });
|
|
|
},
|
|
|
// 重置经纬度
|
|
|
resetCoord(res, val, location, PointSumval) {
|