From 1fdf41cc692eb7b208fe647259d4295164280a41 Mon Sep 17 00:00:00 2001 From: qingyiay <2386314947@qq.com> Date: 星期五, 21 四月 2023 14:12:09 +0800 Subject: [PATCH] 修改历史提煤单 --- pages/driver-page/driver-index/bill-of-lading-details/punchTheClock/punchTheClock.vue | 90 +++++++++++++++++++++++++++++++++++++-------- 1 files changed, 74 insertions(+), 16 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 843f75a..008c53a 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 @@ -3,9 +3,9 @@ <view class="punchTheClock"> <!-- 鎵撳崱鎸夐挳 --> <view class="punchTheClock_container"> - <view class="punchTheClock_btn"> - <view class=""> - <p>绛惧埌/鎵撳崱</p> + <view class="punchTheClock_btn" @click="arrive"> + <view> + <p>{{ coalStatus == 2 ? '宸茬鍒�' : '绛惧埌/鎵撳崱' }}</p> <p>{{ nowTime }}</p> </view> </view> @@ -20,31 +20,86 @@ <script> import { todayDate } from '@/utils/util.js'; export default { - onLoad(params){ - if(params.orderPlanId){ - this.orderPlanId = params.orderPlanId - } + onLoad(params) { + this.punchTheClockObj.tmcoa = params.tmId.toString(); + this.coalStatus = params.coalStatus; }, data() { return { nowTime: '', - orderPlanId:null + coalStatus: 0, + punchTheClockObj: { + tmcoa: null, + latA: null, + latB: null + } }; }, onShow() { - this.todayDate(); + 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, '鑾峰彇浣嶇疆', that); + that.punchTheClockObj.latB = res.latitude; + that.punchTheClockObj.latA = res.longitude; + } + }); + }, todayDate() { setInterval(() => { this.nowTime = todayDate('hms'); }, 1000); }, // 绛惧埌 - arrive(){ - this.$reqPost('arrive', { id: this.orderPlanId }, 'params').then(res => { - console.log(res, '绛惧埌'); - }); + arrive() { + 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) { + this.$u.toast('绛惧埌鎴愬姛'); + setTimeout(() => { + uni.navigateBack( + { + delta: 1 + }, + 500 + ); + }); + } else { + this.$u.toast(res.msg ? res.msg : '绛惧埌澶辫触'); + } + }); + } else { + this.$u.toast('鏆傝幏鍙栦笉鍒板埌褰撳墠浣嶇疆'); + } } } }; @@ -67,14 +122,17 @@ display: flex; justify-content: center; align-items: center; + p { + text-align: center; + } } .punchTheClock_text { - display:flex; + display: flex; justify-content: center; margin-top: vww(20); color: #b8b8b8; - .text{ - margin-left:vww(5); + .text { + margin-left: vww(5); } } } -- Gitblit v1.9.1