From eb9ae89c3e9f66fe5d0f39092a41e5c09bd86fc6 Mon Sep 17 00:00:00 2001 From: 付延余 <f-yanyu@outlook.com> Date: 星期五, 24 三月 2023 13:40:02 +0800 Subject: [PATCH] 获取司机定位微信接口签到,货代首页列表详情 --- pages/driver-page/driver-index/bill-of-lading-details/punchTheClock/punchTheClock.vue | 62 +++++++++++++++++-------------- 1 files changed, 34 insertions(+), 28 deletions(-) diff --git a/pages/driver-page/driver-index/bill-of-lading-details/punchTheClock/punchTheClock.vue b/pages/driver-page/driver-index/bill-of-lading-details/punchTheClock/punchTheClock.vue index 38d397c..4c20882 100644 --- a/pages/driver-page/driver-index/bill-of-lading-details/punchTheClock/punchTheClock.vue +++ b/pages/driver-page/driver-index/bill-of-lading-details/punchTheClock/punchTheClock.vue @@ -5,7 +5,7 @@ <view class="punchTheClock_container"> <view class="punchTheClock_btn" @click="arrive"> <view> - <p>绛惧埌/鎵撳崱</p> + <p>{{ coalStatus == 2 ? '宸茬鍒�' : '绛惧埌/鎵撳崱' }}</p> <p>{{ nowTime }}</p> </view> </view> @@ -21,13 +21,15 @@ import { todayDate } from '@/utils/util.js'; export default { onLoad(params) { - if (params.orderPlanId) { + if (params.orderPlanId && params.coalStatus) { this.punchTheClockObj.id = params.orderPlanId; + this.coalStatus = params.coalStatus; } }, data() { return { nowTime: '', + coalStatus: 0, punchTheClockObj: { latitude: null, longitude: null, @@ -36,38 +38,39 @@ }; }, onShow() { - this.todayDate(); - // 鑾峰彇鏉冮檺淇℃伅 - wx.getSetting({ - success(res) { - if (!res.authSetting['scope.userFuzzyLocation']) { - wx.authorize({ - scope: 'scope.userFuzzyLocation', - success(res) { - console.log(res); - if (res.errMsg == 'authorize:ok') { - // 鑾峰彇浣嶇疆淇℃伅 - this.getFuzzyLocation(); - } - } - }); - } else { - this.getFuzzyLocation(); - } - }, - fail() { - console.log('鑾峰彇澶辫触'); - } - }); + this.getSetting(); //鑾峰彇鎺堟潈 + this.getFuzzyLocation(); //鑾峰彇浣嶇疆 + this.todayDate(); //褰撳墠鏃堕棿 }, methods: { + getSetting() { + // 鑾峰彇鏉冮檺淇℃伅 + wx.getSetting({ + success(res) { + if (!res.authSetting['scope.userFuzzyLocation']) { + wx.authorize({ + scope: 'scope.userFuzzyLocation', + success(res) { + uni.showToast({ + title: '鎺堟潈鎴愬姛锛�' + }); + } + }); + } + }, + fail() { + console.log('鑾峰彇澶辫触'); + } + }); + }, getFuzzyLocation() { + let that = this; wx.getFuzzyLocation({ type: 'wgs84', success(res) { - console.log(res, '鑾峰彇浣嶇疆'); - this.punchTheClockObj.latitude = res.latitude; - this.punchTheClockObj.longitude = res.longitude; + console.log(res, '鑾峰彇浣嶇疆', that); + that.punchTheClockObj.latitude = res.latitude; + that.punchTheClockObj.longitude = res.longitude; } }); }, @@ -120,6 +123,9 @@ display: flex; justify-content: center; align-items: center; + p{ + text-align: center; + } } .punchTheClock_text { display: flex; -- Gitblit v1.9.1