|
|
@@ -487,6 +487,7 @@ import bfxx from '@/assets/bfxx.png';
|
|
|
import xmgj from '@/assets/xmgj.png';
|
|
|
import { getOrderUrlByStoreId } from '@/api/inventory';
|
|
|
import { checkStoreAddressByStoreCode } from '@/api/visitstore';
|
|
|
+import { getPosition, getMapPoi, getkeywordPoi, getTicketFun } from '@/utils/TXApiFun';
|
|
|
export default {
|
|
|
name: 'outsidelist',
|
|
|
components: { tabBar, mapmarker },
|
|
|
@@ -1106,113 +1107,129 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
positionFn(val) {
|
|
|
- // 本地开发 test 环境时 时跳过获取定位功能
|
|
|
- if (process.env.NODE_ENV === 'test') {
|
|
|
- this.lat = 34.62188103091605;
|
|
|
- this.lon = 112.45364302095416;
|
|
|
- localStorage.setItem('lat', this.lat);
|
|
|
- localStorage.setItem('lon', this.lon);
|
|
|
- if (this.tabVal == 1) {
|
|
|
- this.getUserOutPlaListFun();
|
|
|
+ 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) {
|
|
|
+ this.getUserOutPlaListFun();
|
|
|
+ } else {
|
|
|
+ this.getUserOrgStoreList();
|
|
|
+ }
|
|
|
} else {
|
|
|
- this.getUserOrgStoreList();
|
|
|
+ this.getUserOutPlaListFun();
|
|
|
}
|
|
|
- return;
|
|
|
- }
|
|
|
- var that = this;
|
|
|
- let url = window.location.href;
|
|
|
- let wx = this.wx;
|
|
|
- let loadingmap = this.$toast.loading({
|
|
|
- duration: 0,
|
|
|
- message: '定位中...',
|
|
|
- forbidClick: true,
|
|
|
});
|
|
|
- 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) => {
|
|
|
- console.log('url=' + url);
|
|
|
- loadingmap.clear();
|
|
|
- if (response.status == 200) {
|
|
|
- this.cont = 5;
|
|
|
- var flat = true;
|
|
|
- var times = setInterval(() => {
|
|
|
- this.cont--;
|
|
|
- if (this.cont == '0') {
|
|
|
- if (flat) {
|
|
|
- clearInterval(times);
|
|
|
- if (val == 1) {
|
|
|
- that.$dialog.alert({
|
|
|
- message: '定位失败,请开启企微定位权限',
|
|
|
- });
|
|
|
- }
|
|
|
- loadingmap.clear();
|
|
|
- } 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;
|
|
|
- loadingmap.clear();
|
|
|
- console.log('处理前');
|
|
|
- console.log(res.latitude, res.longitude);
|
|
|
- var location = that.CJ02BD(res.latitude, res.longitude);
|
|
|
- console.log('处理后');
|
|
|
- console.log(location);
|
|
|
- that.lat = location.lat;
|
|
|
- that.lon = location.lon;
|
|
|
- localStorage.setItem('lat', location.lat);
|
|
|
- localStorage.setItem('lon', location.lon);
|
|
|
- if (val == 1) {
|
|
|
- if (that.tabVal == 1) {
|
|
|
- that.getUserOutPlaListFun();
|
|
|
- } else {
|
|
|
- that.getUserOrgStoreList();
|
|
|
- }
|
|
|
- } else {
|
|
|
- that.getUserOutPlaListFun();
|
|
|
- }
|
|
|
- },
|
|
|
- fail: function () {
|
|
|
- loadingmap.clear();
|
|
|
- if (val == 1) {
|
|
|
- that.$dialog.alert({
|
|
|
- message: 'GPS未开启',
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
- });
|
|
|
- });
|
|
|
- wx.error(function (res) {
|
|
|
- loadingmap.clear();
|
|
|
- if (val == 1) {
|
|
|
- that.$dialog.alert({
|
|
|
- message: '定位失败,请开启企微定位权限',
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
+ // // 本地开发 test 环境时 时跳过获取定位功能
|
|
|
+ // if (process.env.NODE_ENV === 'test') {
|
|
|
+ // this.lat = 34.62188103091605;
|
|
|
+ // this.lon = 112.45364302095416;
|
|
|
+ // localStorage.setItem('lat', this.lat);
|
|
|
+ // localStorage.setItem('lon', this.lon);
|
|
|
+ // if (this.tabVal == 1) {
|
|
|
+ // this.getUserOutPlaListFun();
|
|
|
+ // } else {
|
|
|
+ // this.getUserOrgStoreList();
|
|
|
+ // }
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // var that = this;
|
|
|
+ // let url = window.location.href;
|
|
|
+ // let wx = this.wx;
|
|
|
+ // let loadingmap = this.$toast.loading({
|
|
|
+ // duration: 0,
|
|
|
+ // message: '定位中...',
|
|
|
+ // forbidClick: true,
|
|
|
+ // });
|
|
|
+ // 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) => {
|
|
|
+ // console.log('url=' + url);
|
|
|
+ // loadingmap.clear();
|
|
|
+ // if (response.status == 200) {
|
|
|
+ // this.cont = 5;
|
|
|
+ // var flat = true;
|
|
|
+ // var times = setInterval(() => {
|
|
|
+ // this.cont--;
|
|
|
+ // if (this.cont == '0') {
|
|
|
+ // if (flat) {
|
|
|
+ // clearInterval(times);
|
|
|
+ // if (val == 1) {
|
|
|
+ // that.$dialog.alert({
|
|
|
+ // message: '定位失败,请开启企微定位权限',
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // loadingmap.clear();
|
|
|
+ // } 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;
|
|
|
+ // loadingmap.clear();
|
|
|
+ // console.log('处理前');
|
|
|
+ // console.log(res.latitude, res.longitude);
|
|
|
+ // var location = that.CJ02BD(res.latitude, res.longitude);
|
|
|
+ // console.log('处理后');
|
|
|
+ // console.log(location);
|
|
|
+ // that.lat = location.lat;
|
|
|
+ // that.lon = location.lon;
|
|
|
+ // localStorage.setItem('lat', location.lat);
|
|
|
+ // localStorage.setItem('lon', location.lon);
|
|
|
+ // if (val == 1) {
|
|
|
+ // if (that.tabVal == 1) {
|
|
|
+ // that.getUserOutPlaListFun();
|
|
|
+ // } else {
|
|
|
+ // that.getUserOrgStoreList();
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // that.getUserOutPlaListFun();
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // fail: function () {
|
|
|
+ // loadingmap.clear();
|
|
|
+ // if (val == 1) {
|
|
|
+ // that.$dialog.alert({
|
|
|
+ // message: 'GPS未开启',
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // });
|
|
|
+ // });
|
|
|
+ // wx.error(function (res) {
|
|
|
+ // loadingmap.clear();
|
|
|
+ // if (val == 1) {
|
|
|
+ // that.$dialog.alert({
|
|
|
+ // message: '定位失败,请开启企微定位权限',
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // });
|
|
|
},
|
|
|
getUserOutPlaListFun() {
|
|
|
this.storeType = localStorage.getItem('storeType');
|
|
|
@@ -1436,35 +1453,44 @@ export default {
|
|
|
},
|
|
|
});
|
|
|
} else {
|
|
|
- // 本地开发 test 环境时 跳过获取定位功能
|
|
|
- if (process.env.NODE_ENV === 'test') {
|
|
|
- let res = {
|
|
|
- latitude: 34.615684509277344,
|
|
|
- longitude: 112.4474105834961,
|
|
|
- };
|
|
|
- this.lat = res.latitude;
|
|
|
- this.lon = res.longitude;
|
|
|
+ getPosition().thrn((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, location, res);
|
|
|
- } else {
|
|
|
- let loading1 = this.$toast.loading({
|
|
|
- duration: 0,
|
|
|
- message: '加载中...',
|
|
|
- forbidClick: true,
|
|
|
- });
|
|
|
- this.getLocationFun()
|
|
|
- .then((resData) => {
|
|
|
- loading1.clear();
|
|
|
- let { location, res } = resData;
|
|
|
- this.checkStoreAddressByStoreCodeFun(val, location, res);
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- console.log(err);
|
|
|
- loading1.clear();
|
|
|
- });
|
|
|
- }
|
|
|
+ // var location = this.CJ02BD(res.latitude, res.longitude);
|
|
|
+ this.checkStoreAddressByStoreCodeFun(val, TXisBD, resData);
|
|
|
+ });
|
|
|
+ // // 本地开发 test 环境时 跳过获取定位功能
|
|
|
+ // if (process.env.NODE_ENV === 'test') {
|
|
|
+ // let res = {
|
|
|
+ // latitude: 34.615684509277344,
|
|
|
+ // longitude: 112.4474105834961,
|
|
|
+ // };
|
|
|
+ // this.lat = res.latitude;
|
|
|
+ // this.lon = res.longitude;
|
|
|
+ // localStorage.setItem('lat', this.lat);
|
|
|
+ // localStorage.setItem('lon', this.lon);
|
|
|
+ // var location = this.CJ02BD(res.latitude, res.longitude);
|
|
|
+ // this.checkStoreAddressByStoreCodeFun(val, location, res);
|
|
|
+ // } else {
|
|
|
+ // let loading1 = this.$toast.loading({
|
|
|
+ // duration: 0,
|
|
|
+ // message: '加载中...',
|
|
|
+ // forbidClick: true,
|
|
|
+ // });
|
|
|
+ // this.getLocationFun()
|
|
|
+ // .then((resData) => {
|
|
|
+ // loading1.clear();
|
|
|
+ // let { location, res } = resData;
|
|
|
+ // this.checkStoreAddressByStoreCodeFun(val, location, res);
|
|
|
+ // })
|
|
|
+ // .catch((err) => {
|
|
|
+ // console.log(err);
|
|
|
+ // loading1.clear();
|
|
|
+ // });
|
|
|
+ // }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -2299,22 +2325,25 @@ export default {
|
|
|
},
|
|
|
// 滚动条与底部距离小于 offset 时触发 初始化会触发
|
|
|
onLoad() {
|
|
|
- var postType = localStorage.getItem('postType');
|
|
|
- if (postType == 'GZ') {
|
|
|
- this.typeShow = false;
|
|
|
- } else {
|
|
|
- this.typeShow = true;
|
|
|
- }
|
|
|
- if (this.lon == '' && this.tabVal != 1) {
|
|
|
- this.positionFn(1);
|
|
|
- } else {
|
|
|
- if (this.tabVal == 1) {
|
|
|
- this.positionFn();
|
|
|
- // this.getUserOutPlaListFun();
|
|
|
+ // 授权
|
|
|
+ getTicketFun().then(() => {
|
|
|
+ var postType = localStorage.getItem('postType');
|
|
|
+ if (postType == 'GZ') {
|
|
|
+ this.typeShow = false;
|
|
|
} else {
|
|
|
- this.getUserOrgStoreList();
|
|
|
+ this.typeShow = true;
|
|
|
}
|
|
|
- }
|
|
|
+ if (this.lon == '' && this.tabVal != 1) {
|
|
|
+ this.positionFn(1);
|
|
|
+ } else {
|
|
|
+ if (this.tabVal == 1) {
|
|
|
+ this.positionFn();
|
|
|
+ // this.getUserOutPlaListFun();
|
|
|
+ } else {
|
|
|
+ this.getUserOrgStoreList();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
},
|
|
|
};
|