tianyi 6 months ago
parent
commit
2c1b2e0eea
  1. 32
      pages/index/index.vue

32
pages/index/index.vue

@ -628,7 +628,7 @@
} }
that.searchForm.workerId = uni.getStorageSync('worker') ? uni.getStorageSync('worker').workerId : '' that.searchForm.workerId = uni.getStorageSync('worker') ? uni.getStorageSync('worker').workerId : ''
// 获取用户当前位置 // 获取用户当前位置
this.getUserLocation(); // this.getUserLocation();
this.getUserOrders(); this.getUserOrders();
// 建立WebSocket连接或定时请求获取配送员位置 // 建立WebSocket连接或定时请求获取配送员位置
this.getDeliveryLocation(); this.getDeliveryLocation();
@ -700,6 +700,7 @@
let that = this let that = this
this.tui.request("/mall/delivery/accept", "POST",data, false, true).then((res) => { this.tui.request("/mall/delivery/accept", "POST",data, false, true).then((res) => {
that.loadStatus = 'nomore'; that.loadStatus = 'nomore';
that.getUserLocation();
if (res.code == 200) { if (res.code == 200) {
if(!uni.getStorageSync('worker') && res.result != null){ if(!uni.getStorageSync('worker') && res.result != null){
uni.setStorageSync('worker',res.result) uni.setStorageSync('worker',res.result)
@ -918,22 +919,31 @@
}, },
// 获取用户位置 // 获取用户位置
getUserLocation() { getUserLocation() {
let that = this;
uni.getLocation({ uni.getLocation({
type: 'gcj02', // 返回国测局坐标,用于微信小程序地图组件 type: 'gcj02', // 返回国测局坐标,用于微信小程序地图组件
success: (res) => { success: (res) => {
console.log('位置', res) console.log('位置', res)
this.latitude = res.latitude; this.latitude = res.latitude;
this.longitude = res.longitude; this.longitude = res.longitude;
// 将用户位置添加到标记点
this.markers.push({ that.tui.request("/worker/admin/edit", "POST", {
id: 0, workerId:uni.getStorageSync('worker').workerId,
latitude: res.latitude, region:JSON.parse(uni.getStorageSync('area')).id,
longitude: res.longitude, geolocation:this.latitude + ',' + this.longitude
title: '我的位置', }, false, false).then((res) => {
iconPath: '/static/images/tabbar/fabu1.png', // 用户位置图标
width: 30, }).catch((res) => {})
height: 30 // // 将用户位置添加到标记点
}); // this.markers.push({
// id: 0,
// latitude: res.latitude,
// longitude: res.longitude,
// title: '我的位置',
// iconPath: '/static/images/tabbar/fabu1.png', // 用户位置图标
// width: 30,
// height: 30
// });
}, },
fail: (err) => { fail: (err) => {
console.log('获取位置失败', err); console.log('获取位置失败', err);

Loading…
Cancel
Save