From d36eb757af8867278125c6999fcaa5bdb902151c Mon Sep 17 00:00:00 2001 From: 付延余 <f-yanyu@outlook.com> Date: 星期二, 21 三月 2023 17:38:45 +0800 Subject: [PATCH] 司机称重页面,签到页面 --- api/publicInterface.js | 2 pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue | 42 ++++++++- pages/login/userPassword.vue | 3 pages/driver-page/appointment/appointment.vue | 4 api/globalApi.js | 8 + pages/driver-page/driver-index/bill-of-lading-details/punchTheClock/punchTheClock.vue | 72 ++++++++++++++---- utils/util.js | 13 ++ api/request.js | 4 pages.json | 18 ++-- pages/customer-page/customer-index/customer-index.vue | 1 pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue | 69 ++++++++++++----- 11 files changed, 172 insertions(+), 64 deletions(-) diff --git a/api/globalApi.js b/api/globalApi.js index 4dbc45f..eb8bea4 100644 --- a/api/globalApi.js +++ b/api/globalApi.js @@ -126,7 +126,6 @@ method: "GET" }, - // 鐢ㄦ埛 // 鑾峰彇鐢ㄦ埛淇℃伅 getUserEntity: { @@ -235,10 +234,15 @@ url: "/wrzs/userOperation/weighList", method: 'GET' }, + // 鑾峰彇鎵�鍦ㄧ鎴� + getWeighHouse:{ + url:"/wrzs/jccoalweighhouse/getWeighHouse", + method:'GET' + }, // 鎻愮叅鍗曟棩蹇楁煡璇� coalDayPage: { - url: "/wrzs/tmtaskcoallog/page", + url: "/wrzs/tmtaskcoallog/getTmId", method: 'GET' } } diff --git a/api/publicInterface.js b/api/publicInterface.js index 1e0c7bd..92997f9 100644 --- a/api/publicInterface.js +++ b/api/publicInterface.js @@ -4,7 +4,7 @@ // const BaseUrl = "http://192.168.3.159:9999/"; import {BaseUrl as wrBaseUrl} from '@/api/request.js' // const BaseUrl = "http://192.168.0.120:9999" -const BaseUrl = "http://192.168.0.130:9999" +const BaseUrl = "http://192.168.3.130:9999" // 鐧诲綍 // function apiLogin({ diff --git a/api/request.js b/api/request.js index 31b67e2..6b7e1b8 100644 --- a/api/request.js +++ b/api/request.js @@ -80,8 +80,8 @@ // const BaseUrl = "http://192.168.0.120:9997" // const webSocketUrl = "ws://192.168.0.120:9997/wrzs/ws/info" -const BaseUrl = "http://192.168.0.130:9997"; -const webSocketUrl = "ws://192.168.0.130:9997/wrzs/ws/info" +const BaseUrl = "http://192.168.3.130:9997"; +const webSocketUrl = "ws://192.168.3.130:9997/wrzs/ws/info" // 璇锋眰鎷︽埅 const fetch = (url, opt) => { diff --git a/pages.json b/pages.json index 576bbbe..da8e598 100644 --- a/pages.json +++ b/pages.json @@ -147,17 +147,15 @@ "enablePullDownRefresh": false } + }, { + "path": "pages/driver-page/driver-index/bill-of-lading-details/punchTheClock/punchTheClock", + "style": { + "navigationBarTitleText": "鐭垮満绛惧埌", + "enablePullDownRefresh": false + } + } - ,{ - "path" : "pages/driver-page/driver-index/bill-of-lading-details/punchTheClock/punchTheClock", - "style" : - { - "navigationBarTitleText": "", - "enablePullDownRefresh": false - } - - } - ], + ], "tabBar": { // "color": "#999794", // "selectedColor": "#007AFF", diff --git a/pages/customer-page/customer-index/customer-index.vue b/pages/customer-page/customer-index/customer-index.vue index 3fb5769..c70f52a 100644 --- a/pages/customer-page/customer-index/customer-index.vue +++ b/pages/customer-page/customer-index/customer-index.vue @@ -61,7 +61,6 @@ <script> import card from '@/components/card/card.vue'; import { customerId } from '@/utils/status'; -import { todayDate } from '@/utils/util.js'; export default { components: { card diff --git a/pages/driver-page/appointment/appointment.vue b/pages/driver-page/appointment/appointment.vue index 71c7c3e..272b15c 100644 --- a/pages/driver-page/appointment/appointment.vue +++ b/pages/driver-page/appointment/appointment.vue @@ -22,7 +22,6 @@ <script> import combinedTitle from '@/components/combined-title/combined-title.vue'; -import { BigNumber } from 'bignumber.js'; export default { components: { combinedTitle @@ -95,6 +94,9 @@ this.$reqPost('yuYue', { takeCoalId: this.yuYuePostParams.takeCoalId, yuYueId: this.yuYuePostParams.yuYueId }, 'params').then(res => { if (res.code == 0) { this.$u.toast('棰勭害鎴愬姛锛�'); + uni.navigateBack({ + delta: 1 + }) } else { this.$u.toast(res.data ? res.data : '棰勭害澶辫触'); } diff --git a/pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue b/pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue index 27b78fa..42ae87c 100644 --- a/pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue +++ b/pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue @@ -11,7 +11,7 @@ <u-button text="鏀剧┖" type="primary" plain></u-button> <u-button text="鍛煎彨瀹㈡湇" type="primary" plain></u-button> </view> - <view class="utils_chil"><u-button text="灞曠ず鎻愮叅鍗�" @click="showCaolPickUpBill" type="primary" ></u-button></view> + <view class="utils_chil"><u-button text="灞曠ず鎻愮叅鍗�" @click="showCaolPickUpBill" type="primary"></u-button></view> <view class="utils_chil"><u-button text="涓婄璁¢噺" @click="cengZhongClick" type="primary"></u-button></view> </view> </view> @@ -30,29 +30,52 @@ return { orderPlanId: null, yyId: null, - dayRZ: [] + dayRZ: [], + coalDetailsData: {}, // 鎻愮叅鍗曡鎯� + getWeightHouseObj: { + // 鑾峰彇鎵�鍦ㄧ鎴� + deptId: '', + filedId: '', + tmId: '', + tmCode: '', + carNo: '' + } }; }, onShow() { this.init(); }, - computed:{ - userName(){ - return uni.getStorageSync('username') + computed: { + userName() { + return uni.getStorageSync('username'); }, - openid(){ - return uni.getStorageSync('openid') + openid() { + return uni.getStorageSync('openid'); } }, methods: { init() { this.coalDayPage(); + this.getTakeCoal(); + }, + // 鑾峰彇鎻愮叅鍗曡鎯� + getTakeCoal() { + this.$reqGet('getTakeCoal', { takeCoalId: this.orderPlanId }).then(res => { + if (res.code == 0) { + this.coalDetailsData = res.data[0]; + this.getWeightHouseObj.deptId = this.coalDetailsData.deptId; + this.getWeightHouseObj.filedId = this.coalDetailsData.filedId; + this.getWeightHouseObj.tmId = this.coalDetailsData.id; + this.getWeightHouseObj.tmCode = this.coalDetailsData.code; + this.getWeightHouseObj.carNo = this.coalDetailsData.carNo; + } + }); }, // 鏃ュ織鏌ヨ coalDayPage() { - this.$reqGet('coalDayPage').then(res => { + this.$reqGet('coalDayPage', { id: this.orderPlanId }).then(res => { if (res.code == 0) { - this.dayRZ = res.data.records; + this.dayRZ = res.data; } }); }, @@ -64,8 +87,8 @@ }, // 绛惧埌 arriveClick() { - this.$reqPost('arrive', { id: this.orderPlanId }, 'params').then(res => { - console.log(res, '绛惧埌'); + uni.navigateTo({ + url: `/pages/driver-page/driver-index/bill-of-lading-details/punchTheClock/punchTheClock?orderPlanId=${this.orderPlanId}` }); }, // 鍏ュ満鐢宠 @@ -75,9 +98,9 @@ }); }, // 鍛煎彨瀹㈡湇 - callCustomerService(){ + callCustomerService() { wx.join1v1Chat({ - caller: { nickname:this.userName , openid: this.openid }, + caller: { nickname: this.userName, openid: this.openid }, listener: { nickname: '瀹㈡湇', openid: 'orutI5YT0yEvARVngdsTmBpisWmw' }, // 杩欓噷鐨刼penid鏄痜yy鐨勶紝鍏呭綋鍥哄畾鐨勫鏈峯penid backgroundType: 2, roomType: 'voice' @@ -85,13 +108,17 @@ }, // 绉伴噸 cengZhongClick() { - uni.navigateTo({ - url:`/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice?takeCoalId=${this.orderPlanId}` - }) + this.$reqGet('getWeighHouse', this.getWeightHouseObj).then(res => { + console.log(res, '鑾峰彇纾呮埧'); + if(res.code == 0){ + uni.navigateTo({ + url: `/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice?takeCoalId=${this.orderPlanId}&sceneId=${res.data.id}&gateCameraId=${res.data.gateCameraId}&gateCameraCode=${res.data.gateCameraCode}&weighCode=${res.data.weighCode}` + }); + }else{ + this.$u.toast('鏈湪纾呮埧锛岃鍓嶅線纾呮埧鍚庡啀璇曪紒锛�') + } + }); } - /** - * @desc 绛夊緟鍙栫叅鍗曟帴鍙� - * */ } }; </script> @@ -127,8 +154,8 @@ padding: vww(20); box-sizing: border-box; overflow-y: overlay; //琛屼负涓� auto 鐩稿悓锛屼絾鏄粴鍔ㄦ潯缁樺埗鍦ㄥ唴瀹逛箣涓婏紝鑰屼笉鏄崰鎹┖闂淬�� - .u-text{ - margin-bottom: vww(5)!important; + .u-text { + margin-bottom: vww(5) !important; } } .utilsBox { 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 6da7f10..843f75a 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,40 +3,80 @@ <view class="punchTheClock"> <!-- 鎵撳崱鎸夐挳 --> <view class="punchTheClock_container"> - <view class="punchTheClock_btn">绛惧埌/鎵撳崱</view> - <view class="punchTheClock_text"><text>鏈繘鍏ヨ�冨嫟鍖哄煙</text></view> + <view class="punchTheClock_btn"> + <view class=""> + <p>绛惧埌/鎵撳崱</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 { - data() { - return {}; + onLoad(params){ + if(params.orderPlanId){ + this.orderPlanId = params.orderPlanId + } }, - methods: {} + data() { + return { + nowTime: '', + orderPlanId:null + }; + }, + onShow() { + this.todayDate(); + }, + methods: { + todayDate() { + setInterval(() => { + this.nowTime = todayDate('hms'); + }, 1000); + }, + // 绛惧埌 + arrive(){ + this.$reqPost('arrive', { id: this.orderPlanId }, 'params').then(res => { + console.log(res, '绛惧埌'); + }); + } + } }; </script> <style lang="scss" scoped> -.punchTheClock{ - display:flex; +.punchTheClock { + height: 100vh; + display: flex; justify-content: center; align-items: center; - .punchTheClock_container{ - .punchTheClock_btn{ - width:vww(240); - height:vww(240); + .punchTheClock_container { + .punchTheClock_btn { + width: vww(240); + height: vww(240); + color: #ffffff; + font-size: vww(20); border-radius: 50%; - background-color: #ffd63e; - display:flex; + background-color: #36d4e5; + display: flex; justify-content: center; align-items: center; } - .punchTheClock_text{ - + .punchTheClock_text { + display:flex; + justify-content: center; + margin-top: vww(20); + color: #b8b8b8; + .text{ + margin-left:vww(5); + } } } - } </style> diff --git a/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue b/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue index 11f6dac..d27cf67 100644 --- a/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue +++ b/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue @@ -2,7 +2,9 @@ <view class="weighingDevice"> <view class="one"> <view class="top"> - <view class="top_left"><text>41.5</text></view> + <view class="top_left"> + <text>{{ realTimeWeigh }}</text> + </view> <view class="top_right"> <view class=""> 绉伴噸: @@ -42,12 +44,28 @@ import { webSocketUrl } from '@/api/request.js'; export default { onLoad(params) { - console.log('绉伴噸椤甸潰', params); this.takeCoalId = params.takeCoalId; + this.weighData.sceneId = params.sceneId; + this.weighData.gateCameraId = params.gateCameraId; + this.weighData.equipmentCode = params.gateCameraCode; + this.weighCode = params.weighCode; }, data() { return { + weighData: { + //纭绉伴噸鎺ュ彛鍙傛暟 + deptId: '', + tmId: '', + sceneId: '', + carNo: '', + gateCameraId: '', + equipmentCode: '', + weigh: '', + tmCode: '' + }, takeCoalId: null, + weighCode: '', + realTimeWeigh: '', weighList: {}, webSocket: null // webSocket瀹炰緥 // lockReconnect: false, // 閲嶈繛閿侊紝閬垮厤澶氭閲嶈繛 @@ -78,6 +96,10 @@ console.log(res, '鑾峰彇绉伴噸淇℃伅'); if (res.code == 0) { this.weighList = res.data; + this.weighData.deptId = res.data.deptId; + this.weighData.tmId = res.data.id; + this.weighData.carNo = res.data.carNo; + this.weighData.tmCode = res.data.code; } }); }, @@ -85,16 +107,17 @@ * @纭绉伴噸绛夊緟鍚庣鎻愪緵瀹炴椂绉伴噸鎺ュ彛锛岃幏鍙栫毊閲嶏紝姣涢噸 */ confirmWeigh() { - // this.$reqPost('saveWeigh',{id:this.takeCoalId,skin:'',hair:''}).then(res=>{ - // console.log(res,"纭绉伴噸"); - // }) + console.log('纭绉伴噸', this.weighData); + this.$reqPost('saveWeigh',this.weighData,'json').then(res=>{ + console.log(res,"纭绉伴噸"); + }) }, /** * 鍒濆鍖� weoSocket */ initWebSocket() { // let wsUrl = `wss://192.168.0.120:9997/wrzs/ws/info?access_token=${this.token}`; - let wsUrl = `${webSocketUrl}?access_token=c954c7f5-f34b-453e-8c9d-e291747b401f`; + let wsUrl = `${webSocketUrl}?access_token=${uni.getStorageSync('token')}`; socket = uni.connectSocket({ url: wsUrl, header: { @@ -108,7 +131,12 @@ console.log('onOpen'); }); socket.onMessage(res => { - console.log(res, '鏈嶅姟鍣ㄨ繑鍥炵殑鏁版嵁'); + console.log('socketWeigh', res); + let nowWeigh = JSON.parse(res.data.slice(7)).weigh; + // if (nowWeigh.eqCode == this.weighCode) { + // this.weighData.weigh = this.realTimeWeigh = nowWeigh; + // } + this.weighData.weigh = this.realTimeWeigh = nowWeigh; }); // 鑾峰彇鏈嶅姟鍣ㄤ紶鏉ョ殑鏁版嵁锛屽仛鐩稿簲澶勭悊 socket.onClose(() => { console.log('close'); diff --git a/pages/login/userPassword.vue b/pages/login/userPassword.vue index 2fa9899..4b8b3fd 100644 --- a/pages/login/userPassword.vue +++ b/pages/login/userPassword.vue @@ -43,8 +43,9 @@ }, data() { return { - username: 'appuser',// 瀹㈡埛 + // username: '12222222222',// 瀹㈡埛 // username: '18805080506',// 鐜嬫锛堝徃鏈猴級 + username: '13333333332',// driver password: '123456', remember: true, baseUrl: '' diff --git a/utils/util.js b/utils/util.js index f5e9768..f9b67d7 100644 --- a/utils/util.js +++ b/utils/util.js @@ -1,7 +1,16 @@ -export function todayDate(){ +export function todayDate(arg){ let date = new Date() let year = date.getFullYear() let month = date.getMonth() + 1; let day = date.getDate() - return year + '-' + month + '-' + day + let hour = date.getHours() + let minutes = date.getMinutes() + let seconds = date.getSeconds() + console.log(arg,'鏃堕棿'); + if(arg == 'hms'){ + hour = hour < 10 ? '0' + hour : hour + minutes = minutes < 10 ? '0' + minutes : minutes + seconds = seconds < 10 ? '0' + seconds : seconds + return hour+':'+minutes+':' + seconds + } } \ No newline at end of file -- Gitblit v1.9.1