From 55533cb7a39359b808b9f4791bb57de14826a692 Mon Sep 17 00:00:00 2001 From: tianyi <13521030702@163.com> Date: Mon, 11 May 2026 11:52:09 +0800 Subject: [PATCH] 1 --- components/tab-bar/delivery.vue | 73 ++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 32 deletions(-) diff --git a/components/tab-bar/delivery.vue b/components/tab-bar/delivery.vue index cbf4232..5af387c 100644 --- a/components/tab-bar/delivery.vue +++ b/components/tab-bar/delivery.vue @@ -380,6 +380,10 @@ }, methods: { init() { + let worker = uni.getStorageSync('worker') + if (worker == '' || worker == undefined || worker == null) { + this.tui.toast('您还没有注册兼职') + } console.log("配送初始化") this.menuButtonInfo = uni.getMenuButtonBoundingClientRect() this.isOnLine = uni.getStorageSync('worker').isOnLine @@ -389,13 +393,29 @@ if(uni.getStorageSync('worker')){ this.searchForm.workerId = uni.getStorageSync('worker').workerId } - this.getDelivery() this.$forceUpdate() + this.getDelivery() + }, // 获取用户位置 - getUserLocation() { + getUserLocation(item) { let that = this; - + uni.getLocation({ + type: 'gcj02', + isHighAccuracy:true, + success: (res) => { + console.log('位置', res) + that.latitude = res.latitude; + that.longitude = res.longitude; + + that.tui.request('/worker/admin/editLocation', "POST", {workerId:item.workerId,geolocation:that.latitude + ',' + that.longitude}, false, false,false).then((res) => { + + }).catch((res) => {}); + }, + fail: (err) => { + console.log('获取位置失败', err); + } + }); }, onReachPage(){ console.log("11111") @@ -641,36 +661,25 @@ url = "/mall/delivery/arriveShop" } let that = this - uni.getLocation({ - type: 'gcj02', // 返回国测局坐标,用于微信小程序地图组件 - isHighAccuracy:true, - success: (res) => { - console.log('位置', res) - that.latitude = res.latitude; - that.longitude = res.longitude; - - that.tui.request(url, "POST", {regionId:regionId,deliveryId:item.id,workerId:item.workerId,geolocation:that.latitude + ',' + that.longitude}, false, true).then((res) => { - if (res.code == 200) { - if(status == 2 || status == 3){ - that.pageData.splice(index, 1) - }else{ - that.pageData[index].arriveTime = "qq" - } - that.tui.toast(res.message,200); - /* that.searchForm.pageNum = 1 - that.getDelivery() */ - that.$forceUpdate(); - } else { - that.tui.toast(res.message,200); - return; - } - uni.hideLoading(); - }).catch((res) => {}); - }, - fail: (err) => { - console.log('获取位置失败', err); + + this.getUserLocation(item) + that.tui.request(url, "POST", {regionId:regionId,deliveryId:item.id,workerId:item.workerId}, false, true).then((res) => { + if (res.code == 200) { + if(status == 2 || status == 3){ + that.pageData.splice(index, 1) + }else{ + that.pageData[index].arriveTime = "qq" + } + that.tui.toast(res.message,200); + /* that.searchForm.pageNum = 1 + that.getDelivery() */ + that.$forceUpdate(); + } else { + that.tui.toast(res.message,200); + return; } - }); + uni.hideLoading(); + }).catch((res) => {}); }, checkTab1(type) { this.tab1Checked = type