From 307d2092ac218fb4fe8b4b9857239bab950283c5 Mon Sep 17 00:00:00 2001 From: tianyi <13521030702@163.com> Date: Mon, 11 May 2026 11:52:17 +0800 Subject: [PATCH] 1 --- pages/index/index.vue | 90 +++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/pages/index/index.vue b/pages/index/index.vue index cd7f8d4..05f2485 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -932,45 +932,36 @@ regionId: JSON.parse(uni.getStorageSync('area')).id, geolocation: that.latitude + ',' + that.longitude } - uni.getLocation({ - type: 'gcj02', // 返回国测局坐标,用于微信小程序地图组件 - isHighAccuracy:true, - success: (res) => { - console.log('位置', res) - that.latitude = res.latitude; - that.longitude = res.longitude; - - that.tui.request("/mall/delivery/accept", "POST", data, false, true).then((res) => { - that.loadStatus = 'nomore'; - if (res.code == 200) { - if (!uni.getStorageSync('worker') && res.result != null) { - uni.setStorageSync('worker', res.result) - } - that.deliveryItem.splice(index, 1) - that.tui.toast(res.message); - if (item.workerId != null && item.workerId != undefined && item.workerId != '') { - that.zhipaiCount -= 1 - } else { - if (item.deliveryType == 1) { - that.waimaiCount -= 1 - } else if (item.deliveryType == 2) { - that.kuaidiCount -= 1 - } else if (item.deliveryType == 3) { - that.paotuiCount -= 1 - } - } - that.$forceUpdate(); - } else { - that.tui.toast(res.message); - return; + + that.tui.request("/mall/delivery/accept", "POST", data, false, true).then((res) => { + that.loadStatus = 'nomore'; + if (res.code == 200) { + if (!uni.getStorageSync('worker') && res.result != null) { + uni.setStorageSync('worker', res.result) + } + that.deliveryItem.splice(index, 1) + that.tui.toast(res.message); + if (item.workerId != null && item.workerId != undefined && item.workerId != '') { + that.zhipaiCount -= 1 + } else { + if (item.deliveryType == 1) { + that.waimaiCount -= 1 + } else if (item.deliveryType == 2) { + that.kuaidiCount -= 1 + } else if (item.deliveryType == 3) { + that.paotuiCount -= 1 } - uni.hideLoading(); - }).catch((res) => {}); - }, - fail: (err) => { - console.log('获取位置失败', err); + } + setTimeout(res => { + this.getUserLocation(uni.getStorageSync('worker') ? uni.getStorageSync('worker').workerId : res.result.workerId) + }, 2000) + that.$forceUpdate(); + } else { + that.tui.toast(res.message); + return; } - }); + uni.hideLoading(); + }).catch((res) => {}); }, rejectOrder(item, index) { @@ -1184,9 +1175,23 @@ this.getDelivery(); }, // 获取用户位置 - getUserLocation() { + getUserLocation(id) { 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:id,geolocation:that.latitude + ',' + that.longitude}, false, false,false).then((res) => { + + }).catch((res) => {}); + }, + fail: (err) => { + console.log('获取位置失败', err); + } + }); }, checkTab1(type) { this.checked = type @@ -1275,12 +1280,7 @@ this.indexInit() break; case 1: - let worker = uni.getStorageSync('worker') - if (worker == '' || worker == undefined || worker == null) { - this.tui.toast('您还没有注册兼职') - } else { - that.$refs.deLiveryPage.init() - } + that.$refs.deLiveryPage.init() break; case 2: uni.navigateTo({