From 0becab45282781f281ad5aa04202b83039ab275e Mon Sep 17 00:00:00 2001
From: qingyiay <2386314947@qq.com>
Date: 星期五, 14 四月 2023 17:42:08 +0800
Subject: [PATCH] 增加发运统计页面,修改websocket,增加消息推送
---
pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue | 57 +++++++++++++++------------------------------------------
1 files changed, 15 insertions(+), 42 deletions(-)
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 cc668fc..c5bc631 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
@@ -3,7 +3,7 @@
<view class="bangDanMessage">
<view class="">
<text>瀹㈡埛锛歿{ coalDetailsData.customerName || '' }}</text>
- <text>鐭垮巶锛歿{ coalDetailsData.deptName || '' }}</text>
+ <text>鐭垮満锛歿{ coalDetailsData.deptName || '' }}</text>
</view>
<view class="">
<text>鐨噸锛歿{ coalDetailsData.skin || '' }}</text>
@@ -11,7 +11,7 @@
<text>鍑�閲嶏細{{ coalDetailsData.clean || '' }}</text>
</view>
<view class="">
- <text>纾呭崟绫诲瀷锛歿{ coalDetailsData.orderTye || '' }}</text>
+ <text>纾呭崟绫诲瀷锛歿{ coalDetailsData.orderType || '' }}</text>
<text>鐘舵�侊細{{ coalStatus[coalDetailsData.status] }}</text>
</view>
<view class="">
@@ -48,8 +48,8 @@
</template>
<script>
-let socket = null;
import { webSocketUrl } from '@/api/request.js';
+import { mapState, mapMutations } from 'vuex';
export default {
onLoad(value) {
if (value.orderPlanId && value.yyId) {
@@ -108,6 +108,7 @@
this.init();
},
computed: {
+ ...mapState(['globalweigh', 'globalinfraredStatus']),
name() {
return uni.getStorageSync('name');
},
@@ -255,54 +256,26 @@
}
});
},
- /**
- * 鍒濆鍖� weoSocket
- */
- initWebSocket() {
- let wsUrl = `${webSocketUrl}?access_token=${uni.getStorageSync('token')}`;
- socket = uni.connectSocket({
- url: wsUrl,
- header: {
- CLIENT_TOC: 'Y'
- },
- complete: res => {
- console.log(res, 'socket缁撴灉');
- }
- });
- socket.onOpen(() => {
- console.log('onOpen');
- });
- // 鑾峰彇鏈嶅姟鍣ㄤ紶鏉ョ殑鏁版嵁锛屽仛鐩稿簲澶勭悊
- socket.onMessage(res => {
- console.log('socketWeigh', res);
- let nowWeighObj = JSON.parse(res.data.slice(7));
- if (nowWeighObj.eqCode == this.weighHouseCode) {
- if (nowWeighObj.eqInfraredStatus) {
- this.weighData.weigh = nowWeighObj.weigh;
- } else {
- this.weighData.weigh = nowWeighObj.weigh;
- }
- }
- });
- socket.onClose(() => {
- console.log('webSocketClose');
- this.$u.toast('纾呮埧鎺ュ彛缁堢');
- });
- socket.onError(err => {
- console.log('socket鎶ラ敊', err);
- this.$u.toast('纾呮埧鎺ュ彛鏆傛椂涓嶈兘浣跨敤锛岃閲嶆柊杩涘叆璇ラ〉闈紝閲嶈瘯锛侊紒');
- });
- },
// 鏀剧┖
evacuation() {
this.evacuationModalShow = true;
},
// 鏀剧┖寮圭獥纭
evacuationConfirm() {
+ this.weighData = {
+ ...this.weighData,
+ weigh: this.globalweigh
+ };
let mix = Object.assign(this.weighData, this.getWeightHouseObj);
this.$reqPost('getOneEvacuation', mix, 'json').then(res => {
console.log(res, '绗竴娆℃斁绌�');
- this.evacuationModalShow = false;
+ if (res.code == 0) {
+ this.$u.toast('鎿嶄綔鎴愬姛');
+ this.evacuationModalShow = false;
+ } else {
+ this.$u.toast('鎿嶄綔澶辫触锛岃绋嶅悗閲嶈瘯');
+ this.evacuationModalShow = false;
+ }
});
},
// 鏀剧┖寮圭獥鍙栨秷
--
Gitblit v1.9.1