From 05273ace3da665cb10c36ca0dac4413a8284302a Mon Sep 17 00:00:00 2001 From: qingyiay <2386314947@qq.com> Date: 星期三, 17 五月 2023 18:10:36 +0800 Subject: [PATCH] 增加部分限制,增加新功能 --- pages/driver-page/driver-index/bill-of-lading-details/punchTheClock/punchTheClock.vue | 79 +++++++++++++++++++++------------------ 1 files changed, 42 insertions(+), 37 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..ac4ef2e 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,14 +5,14 @@ <view class="punchTheClock_container"> <view class="punchTheClock_btn" @click="arrive"> <view> - <p>绛惧埌/鎵撳崱</p> + <p>{{ coalStatus == 2 ? '宸茬鍒�' : '绛惧埌/鎵撳崱' }}</p> <p>{{ nowTime }}</p> </view> </view> - <view class="punchTheClock_text"> + <!-- <view class="punchTheClock_text"> <u-icon name="map" color="#51e30d" size="30"></u-icon> <text>鏈繘鍏ョ熆鍦哄尯鍩�</text> - </view> + </view> --> </view> </view> </template> @@ -21,53 +21,54 @@ import { todayDate } from '@/utils/util.js'; export default { onLoad(params) { - if (params.orderPlanId) { - this.punchTheClockObj.id = params.orderPlanId; - } + this.punchTheClockObj.tmcoa = params.tmId.toString(); + this.coalStatus = params.coalStatus; }, data() { return { nowTime: '', + coalStatus: 0, punchTheClockObj: { - latitude: null, - longitude: null, - id: null + tmcoa: null, + latA: null, + latB: null } }; }, 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.latB = res.latitude; + that.punchTheClockObj.latA = res.longitude; } }); }, @@ -78,7 +79,8 @@ }, // 绛惧埌 arrive() { - if (this.punchTheClockObj.latitude && this.punchTheClockObj.longitude) { + if (this.punchTheClockObj.latA && this.punchTheClockObj.latB) { + console.log(this.punchTheClockObj); this.$reqPost('arrive', this.punchTheClockObj, 'params').then(res => { console.log(res, '绛惧埌'); if (res.code == 0) { @@ -92,7 +94,7 @@ ); }); } else { - this.$u.toast(res.data ? res.data : '绛惧埌澶辫触'); + this.$u.toast(res.msg ? res.msg : '绛惧埌澶辫触'); } }); } else { @@ -120,6 +122,9 @@ display: flex; justify-content: center; align-items: center; + p { + text-align: center; + } } .punchTheClock_text { display: flex; -- Gitblit v1.9.1