|
|
@@ -938,99 +938,120 @@ export default {
|
|
|
// 范围
|
|
|
rangeStoreFn() {
|
|
|
localStorage.setItem('tabVal', this.tabVal);
|
|
|
- let loading1 = this.$toast.loading({
|
|
|
- duration: 0,
|
|
|
- message: '加载中...',
|
|
|
- forbidClick: true,
|
|
|
- });
|
|
|
- let url = window.location.href;
|
|
|
- let wx = this.wx;
|
|
|
- var that = this;
|
|
|
- // that.$router.push({path: "/rangeStore", query: {
|
|
|
- // lon:"112.45359397440227",
|
|
|
- // lat:"34.62171814576471",
|
|
|
- // tabVal:that.tabVal
|
|
|
- // }
|
|
|
- // })
|
|
|
- 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 } = res;
|
|
|
+ this.lat = TXisBD.lat;
|
|
|
+ this.lon = TXisBD.lon;
|
|
|
+ let name = this.tabVal != 1 ? '销售部' : '我的';
|
|
|
+ this.buryingPoint({
|
|
|
+ systemModel: '计划外',
|
|
|
+ buryingPointType: 3,
|
|
|
+ buryingPointValue: name,
|
|
|
+ buryingPointName: '计划外',
|
|
|
+ buryingPointPosition: '进入地图',
|
|
|
+ });
|
|
|
+ this.$router.push({
|
|
|
+ path: '/rangeStore',
|
|
|
+ query: {
|
|
|
+ lat: '',
|
|
|
+ lon: '',
|
|
|
+ tabVal: this.tabVal,
|
|
|
+ },
|
|
|
+ });
|
|
|
})
|
|
|
- .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: '定位失败,请开启企微定位权限',
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
+ .catch((error) => {
|
|
|
+ this.$dialog.alert({
|
|
|
+ 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() {
|
|
|
@@ -1114,22 +1135,40 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
positionFn(val) {
|
|
|
- getPosition().then((res) => {
|
|
|
- let { TXisBD } = res;
|
|
|
- this.lat = TXisBD.lat;
|
|
|
- this.lon = TXisBD.lon;
|
|
|
- localStorage.setItem('lat', TXisBD.lat);
|
|
|
- localStorage.setItem('lon', TXisBD.lon);
|
|
|
- if (val == 1) {
|
|
|
- if (this.tabVal == 1) {
|
|
|
+ getPosition()
|
|
|
+ .then((res) => {
|
|
|
+ let { TXisBD } = res;
|
|
|
+ this.lat = TXisBD.lat;
|
|
|
+ this.lon = TXisBD.lon;
|
|
|
+ if (val == 1) {
|
|
|
+ if (this.tabVal == 1) {
|
|
|
+ this.getUserOutPlaListFun();
|
|
|
+ } else {
|
|
|
+ this.getUserOrgStoreList();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
this.getUserOutPlaListFun();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ // PC端没有定位权限依然可以访问
|
|
|
+ let isMobile = localStorage.getItem('isMobile');
|
|
|
+ if (!isMobile) {
|
|
|
+ this.$dialog.alert({
|
|
|
+ message: error,
|
|
|
+ });
|
|
|
} else {
|
|
|
- this.getUserOrgStoreList();
|
|
|
+ if (val == 1) {
|
|
|
+ if (this.tabVal == 1) {
|
|
|
+ this.getUserOutPlaListFun();
|
|
|
+ } else {
|
|
|
+ this.getUserOrgStoreList();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.getUserOutPlaListFun();
|
|
|
+ }
|
|
|
}
|
|
|
- } else {
|
|
|
- this.getUserOutPlaListFun();
|
|
|
- }
|
|
|
- });
|
|
|
+ });
|
|
|
// // 本地开发 test 环境时 时跳过获取定位功能
|
|
|
// if (process.env.NODE_ENV === 'test') {
|
|
|
// this.lat = 34.62188103091605;
|
|
|
@@ -1460,15 +1499,21 @@ export default {
|
|
|
},
|
|
|
});
|
|
|
} else {
|
|
|
- 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);
|
|
|
- this.checkStoreAddressByStoreCodeFun(val, TXisBD, resData);
|
|
|
- });
|
|
|
+ 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);
|
|
|
+ this.checkStoreAddressByStoreCodeFun(val, TXisBD, resData);
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ this.$dialog.alert({
|
|
|
+ message: error,
|
|
|
+ });
|
|
|
+ });
|
|
|
// // 本地开发 test 环境时 跳过获取定位功能
|
|
|
// if (process.env.NODE_ENV === 'test') {
|
|
|
// let res = {
|