tianyi 1 month 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 : ''
//
this.getUserLocation();
// this.getUserLocation();
this.getUserOrders();
// WebSocket
this.getDeliveryLocation();
@ -700,6 +700,7 @@
let that = this
this.tui.request("/mall/delivery/accept", "POST",data, false, true).then((res) => {
that.loadStatus = 'nomore';
that.getUserLocation();
if (res.code == 200) {
if(!uni.getStorageSync('worker') && res.result != null){
uni.setStorageSync('worker',res.result)
@ -918,22 +919,31 @@
},
//
getUserLocation() {
let that = this;
uni.getLocation({
type: 'gcj02', //
success: (res) => {
console.log('位置', res)
this.latitude = res.latitude;
this.longitude = res.longitude;
//
this.markers.push({
id: 0,
latitude: res.latitude,
longitude: res.longitude,
title: '我的位置',
iconPath: '/static/images/tabbar/fabu1.png', //
width: 30,
height: 30
});
that.tui.request("/worker/admin/edit", "POST", {
workerId:uni.getStorageSync('worker').workerId,
region:JSON.parse(uni.getStorageSync('area')).id,
geolocation:this.latitude + ',' + this.longitude
}, false, false).then((res) => {
}).catch((res) => {})
// //
// this.markers.push({
// id: 0,
// latitude: res.latitude,
// longitude: res.longitude,
// title: '',
// iconPath: '/static/images/tabbar/fabu1.png', //
// width: 30,
// height: 30
// });
},
fail: (err) => {
console.log('获取位置失败', err);

Loading…
Cancel
Save