From 6a232ec3d1d75af66b5afb475895d585a494cbaf Mon Sep 17 00:00:00 2001 From: yangan <yangan0921@163.com> Date: 星期六, 29 六月 2024 16:24:35 +0800 Subject: [PATCH] feat:小程序修改问题若干 --- pages/driver-page/driver-index/bill-of-lading-details/punchTheClock/punchTheClock.vue | 254 ++++++++++++++++++++++++++++---------------------- 1 files changed, 140 insertions(+), 114 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 4c20882..36693d6 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,139 +3,165 @@ <view class="punchTheClock"> <!-- 鎵撳崱鎸夐挳 --> <view class="punchTheClock_container"> - <view class="punchTheClock_btn" @click="arrive"> + <view class="punchTheClock_btn" + @click="arrive"> <view> <p>{{ coalStatus == 2 ? '宸茬鍒�' : '绛惧埌/鎵撳崱' }}</p> <p>{{ nowTime }}</p> </view> - </view> - <view class="punchTheClock_text"> - <u-icon name="map" color="#51e30d" size="30"></u-icon> - <text>鏈繘鍏ョ熆鍦哄尯鍩�</text> </view> </view> </view> </template> <script> -import { todayDate } from '@/utils/util.js'; -export default { - onLoad(params) { - if (params.orderPlanId && params.coalStatus) { - this.punchTheClockObj.id = params.orderPlanId; - this.coalStatus = params.coalStatus; - } - }, - data() { - return { - nowTime: '', - coalStatus: 0, - punchTheClockObj: { - latitude: null, - longitude: null, - id: null - } - }; - }, - onShow() { - 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: '鎺堟潈鎴愬姛锛�' - }); - } - }); - } + import { todayDate } from '@/utils/util.js'; + export default { + data() { + return { + nowTime: '', + coalStatus: 0, + punchTheClockObj: { + tmcoa: null, + latA: null, + latB: null }, - fail() { - console.log('鑾峰彇澶辫触'); - } - }); + timeout: '2', //'1' 鏄秴鏃� '2' 鏄湭瓒呮椂 + entranceApplyParams: { + takeCoalId: '', + filedId: '', + deptId: '', + sendDate: '', + yyId: '' + }, + yuYueSection: '', //棰勭害鏃堕棿娈� + }; }, - getFuzzyLocation() { - let that = this; - wx.getFuzzyLocation({ - type: 'wgs84', - success(res) { - console.log(res, '鑾峰彇浣嶇疆', that); - that.punchTheClockObj.latitude = res.latitude; - that.punchTheClockObj.longitude = res.longitude; - } - }); + onLoad(params) { + this.punchTheClockObj.tmcoa = params.tmId; + this.coalStatus = params.coalStatus; + this.entranceApplyParams.takeCoalId = params.orderPlanId + this.entranceApplyParams.filedId = params.filedId + this.entranceApplyParams.deptId = params.deptId + this.entranceApplyParams.yyId = params.yyId + this.entranceApplyParams.sendDate = params.sendDate + this.yuYueSection = params.yuYueSection + this.getSetting(); //鑾峰彇鎺堟潈 + this.getFuzzyLocation(); //鑾峰彇浣嶇疆 + this.todayDate(); //褰撳墠鏃堕棿 }, - todayDate() { - setInterval(() => { - this.nowTime = todayDate('hms'); - }, 1000); - }, - // 绛惧埌 - arrive() { - if (this.punchTheClockObj.latitude && this.punchTheClockObj.longitude) { - 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.data ? res.data : '绛惧埌澶辫触'); + methods: { + getSetting() { + // 鑾峰彇鏉冮檺淇℃伅 + wx.getSetting({ + success(res) { + if (!res.authSetting['scope.userFuzzyLocation']) { + wx.authorize({ + scope: 'scope.userFuzzyLocation', + success(res) { + uni.showToast({ + title: '鎺堟潈鎴愬姛锛�' + }); + } + }); + } + }, + fail() { + console.log('鑾峰彇澶辫触'); } }); - } else { - this.$u.toast('鏆傝幏鍙栦笉鍒板埌褰撳墠浣嶇疆'); - } + }, + 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() { + 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) { + setTimeout(() => { + uni.redirectTo({ + url: `/pages/driver-page/appointment/appointment?type=鍏ュ満鐢宠&yyId=${this.entranceApplyParams.yyId}&yuYueSection=${this.yuYueSection}&takeCoalId=${this.entranceApplyParams.takeCoalId}&deptId=${this.entranceApplyParams.deptId}&filedId=${this.entranceApplyParams.filedId}&sendDate=${this.entranceApplyParams.sendDate}` + }) + }, 1000); + } else { + this.$u.toast(res.msg ? res.msg : '绛惧埌澶辫触'); + } + }); + } else { + this.$u.toast('鏆傝幏鍙栦笉鍒板埌褰撳墠浣嶇疆'); + } + }, + // entranceApply() { + // if (this.coalStatus !== 2) { + // this.$u.toast('璇峰厛绛惧埌') + // return + // } + // if (this.timeout === '2') { + // this.$u.toast('鏈秴鍑洪绾︽椂闂�,鏃犻渶鏇存崲'); + // return + // } + // uni.navigateTo({ + // url: `/pages/driver-page/appointment/appointment?type=鍏ュ満鐢宠&takeCoalId=${this.entranceApplyParams.takeCoalId}&yyId=${this.entranceApplyParams.yyId}&filedId=${this.entranceApplyParams.filedId}&deptId=${ + // this.entranceApplyParams.deptId + // }&sendDate=${this.entranceApplyParams.sendDate}&yuYueSection=${this.yuYueSection}` + // }); + // } } - } -}; + }; </script> -<style lang="scss" scoped> -.punchTheClock { - height: 100vh; - display: flex; - justify-content: center; - align-items: center; - .punchTheClock_container { - .punchTheClock_btn { - width: vww(240); - height: vww(240); - color: #ffffff; - font-size: vww(20); - border-radius: 50%; - background-color: #36d4e5; - display: flex; - justify-content: center; - align-items: center; - p{ - text-align: center; +<style lang="scss" + scoped> + .punchTheClock { + height: 100vh; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + + .punchTheClock_container { + .punchTheClock_btn { + width: vww(240); + height: vww(240); + color: #ffffff; + font-size: vww(20); + border-radius: 50%; + background-color: #36d4e5; + display: flex; + justify-content: center; + align-items: center; + + p { + text-align: center; + } } - } - .punchTheClock_text { - display: flex; - justify-content: center; - margin-top: vww(20); - color: #b8b8b8; - .text { - margin-left: vww(5); + + .punchTheClock_text { + display: flex; + justify-content: center; + margin-top: vww(20); + color: #b8b8b8; + + .text { + margin-left: vww(5); + } } } } -} -</style> +</style> \ No newline at end of file -- Gitblit v1.9.1