diff --git a/components/tab-bar/delivery.vue b/components/tab-bar/delivery.vue index 64b8f5c..ad293ae 100644 --- a/components/tab-bar/delivery.vue +++ b/components/tab-bar/delivery.vue @@ -390,6 +390,39 @@ this.getDelivery() this.$forceUpdate() }, + // 获取用户位置 + getUserLocation() { + let that = this; + uni.getLocation({ + type: 'gcj02', // 返回国测局坐标,用于微信小程序地图组件 + success: (res) => { + console.log('位置', res) + this.latitude = res.latitude; + this.longitude = res.longitude; + + 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); + } + }); + }, onReachPage(){ console.log("11111") if (this.searchForm.pageNum >= this.totalPages) return; @@ -635,7 +668,7 @@ let that = this that.tui.request(url, "POST", {deliveryId:item.id,workerId:item.workerId}, false, true).then((res) => { if (res.code == 200) { - + that.getUserLocation() if(status == 2 || status == 3){ that.pageData.splice(index, 1) }else{