New file |
| | |
| | | <template> |
| | | <!-- 称重历史--> |
| | | <view class="weigh-history" |
| | | v-if="list.length!==0"> |
| | | <view class="block-main"> |
| | | <view class="weigh-item" |
| | | v-for='item in list' |
| | | :key="item.id"> |
| | | <view class="weigh-time"> |
| | | <u-tag :text="item.createTime.slice(-8,-3)" |
| | | plain></u-tag> |
| | | </view> |
| | | <view class="item-block"> |
| | | <view class="item"> |
| | | <view class="concrete" |
| | | :style="{ backgroundImage: `url(${onlineurl}/appimg/image/banner/skin.png)`, backgroundSize: 'cover', backgroundRepeat: 'no-repeat' }"> |
| | | 皮</view> |
| | | <view class="num">{{ item.skin ||'' }}</view> |
| | | </view> |
| | | <view class="item"> |
| | | <view class="concrete" |
| | | :style="{ backgroundImage: `url(${onlineurl}/appimg/image/banner/hair.png)`, backgroundSize: 'cover', backgroundRepeat: 'no-repeat' }"> |
| | | 毛</view> |
| | | <view class="num">{{ item.hair ||''}}</view> |
| | | </view> |
| | | <view class="item"> |
| | | <view class="concrete" |
| | | :style="{ backgroundImage: `url(${onlineurl}/appimg/image/banner/clean.png)`, backgroundSize: 'cover', backgroundRepeat: 'no-repeat' }"> |
| | | 净</view> |
| | | <view class="num">{{ item.clean||'' }}</view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | import { onlineurl } from '@/api/request.js' |
| | | export default { |
| | | name: "weighItem", |
| | | props: { |
| | | list: { |
| | | type: Array, |
| | | default: () => [] |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | onlineurl, |
| | | }; |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" |
| | | scoped> |
| | | .weigh-history { |
| | | width: 690rpx; |
| | | height: 100%; |
| | | min-height: 420rpx; |
| | | margin: vww(20) auto; |
| | | background: #ffffff; |
| | | box-shadow: 4rpx 6rpx 51rpx 0rpx rgba(73, 120, 240, 0.11); |
| | | border-radius: 20rpx; |
| | | position: relative; |
| | | font-size: 30rpx; |
| | | font-weight: 300; |
| | | color: #303030; |
| | | overflow: hidden; |
| | | |
| | | .block-main { |
| | | display: grid; |
| | | grid-template-columns: auto; |
| | | grid-template-rows: repeat(auto-fit, minmax(40rpx, 1fr)); |
| | | gap: auto 5rpx; |
| | | width: 94%; |
| | | height: 100%; |
| | | min-height: 380rpx; |
| | | margin: vww(18) vww(7) vww(11) vww(17); |
| | | gap: 10rpx 20rpx; |
| | | |
| | | .weigh-item { |
| | | width: 100%; |
| | | height: vww(80); |
| | | @include flex; |
| | | flex-direction: column; |
| | | justify-content: space-around; |
| | | align-items: flex-start; |
| | | |
| | | .item-block { |
| | | width: 100%; |
| | | height: vww(36); |
| | | @include flex; |
| | | justify-content: space-around; |
| | | |
| | | .item { |
| | | min-width: vww(50); |
| | | height: vww(45); |
| | | font-size: 21rpx; |
| | | font-weight: 400; |
| | | color: #ffffff; |
| | | text-align: center; |
| | | line-height: vww(30); |
| | | @include flex; |
| | | |
| | | .concrete { |
| | | width: vww(36); |
| | | height: vww(36); |
| | | } |
| | | |
| | | .num { |
| | | font-size: 40rpx; |
| | | font-weight: 300; |
| | | color: #303030; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </style> |
| | |
| | | |
| | | <script> |
| | | import { onlineurl } from '@/api/request.js' |
| | | import card from '@/components/card/card.vue'; |
| | | import combinedTitle from '@/components/combined-title/combined-title.vue'; |
| | | import { customerId } from '@/utils/status'; |
| | | export default { |
| | |
| | | } |
| | | }, |
| | | components: { |
| | | card, |
| | | combinedTitle |
| | | }, |
| | | watch: { |
| | |
| | | </view> |
| | | <view class="main-banner"> |
| | | <view class="empty-pointer" |
| | | v-if="!yyDailyList">暂无更多数据</view> |
| | | v-if="yyDailyList.length===0">暂无更多数据</view> |
| | | <view class="main-block"> |
| | | <view class="main-container"> |
| | | <view class="main-container_content" |
| | |
| | | <view class="second-line"> |
| | | <view class="line-content"> |
| | | <view class="line-content_text">净重</view> |
| | | <view class="line-content_num">{{ item.clean.toFixed(2) || 0 }}</view> |
| | | <view class="line-content_num">{{ item.clean?item.clean.toFixed(2):'' || '' }} |
| | | </view> |
| | | </view> |
| | | <view class="line-content"> |
| | | <view class="line-content_text">余量</view> |
| | |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view class="weigh-history" |
| | | v-if="showWeigh.length!==0"> |
| | | <view class="block-main"> |
| | | <view class="weigh-item" |
| | | v-for='item in showWeigh' |
| | | :key="item.id"> |
| | | <view class="weigh-time"> |
| | | <u-tag :text="item.createTime.slice(-8,-3)" |
| | | plain></u-tag> |
| | | </view> |
| | | <view class="item-block"> |
| | | <view class="item"> |
| | | <view class="concrete" |
| | | :style="{ backgroundImage: `url(${onlineurl}/appimg/image/banner/skin.png)`, backgroundSize: 'cover', backgroundRepeat: 'no-repeat' }"> |
| | | 皮</view> |
| | | <view class="num">{{ item.skin }}</view> |
| | | </view> |
| | | <view class="item"> |
| | | <view class="concrete" |
| | | :style="{ backgroundImage: `url(${onlineurl}/appimg/image/banner/hair.png)`, backgroundSize: 'cover', backgroundRepeat: 'no-repeat' }"> |
| | | 毛</view> |
| | | <view class="num">{{ item.hair }}</view> |
| | | </view> |
| | | <view class="item"> |
| | | <view class="concrete" |
| | | :style="{ backgroundImage: `url(${onlineurl}/appimg/image/banner/clean.png)`, backgroundSize: 'cover', backgroundRepeat: 'no-repeat' }"> |
| | | 净</view> |
| | | <view class="num">{{ item.clean }}</view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <weigh-item :list="showWeigh"></weigh-item> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | import combinedTitle from '@/components/combined-title/combined-title.vue'; |
| | | import weighItem from '@/components/weighItem.vue' |
| | | import { onlineurl } from '@/api/request.js' |
| | | export default { |
| | | components: { |
| | | combinedTitle |
| | | combinedTitle, |
| | | weighItem |
| | | }, |
| | | onLoad(params) { |
| | | this.id = params.id; |
| | |
| | | </view> |
| | | |
| | | <!-- 称重历史--> |
| | | <view class="weigh-history" |
| | | v-if="showWeigh.length!==0"> |
| | | <view class="block-main"> |
| | | <view class="weigh-item" |
| | | v-for='item in showWeigh' |
| | | :key="item.id"> |
| | | <view class="weigh-time"> |
| | | <u-tag :text="item.createTime.slice(-8,-3)" |
| | | plain></u-tag> |
| | | </view> |
| | | <view class="item-block"> |
| | | <view class="item"> |
| | | <view class="concrete" |
| | | :style="{ backgroundImage: `url(${onlineurl}/appimg/image/banner/skin.png)`, backgroundSize: 'cover', backgroundRepeat: 'no-repeat' }"> |
| | | 皮</view> |
| | | <view class="num">{{ item.skin }}</view> |
| | | </view> |
| | | <view class="item"> |
| | | <view class="concrete" |
| | | :style="{ backgroundImage: `url(${onlineurl}/appimg/image/banner/hair.png)`, backgroundSize: 'cover', backgroundRepeat: 'no-repeat' }"> |
| | | 毛</view> |
| | | <view class="num">{{ item.hair }}</view> |
| | | </view> |
| | | <view class="item"> |
| | | <view class="concrete" |
| | | :style="{ backgroundImage: `url(${onlineurl}/appimg/image/banner/clean.png)`, backgroundSize: 'cover', backgroundRepeat: 'no-repeat' }"> |
| | | 净</view> |
| | | <view class="num">{{ item.clean }}</view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <weigh-item :list="showWeigh"></weigh-item> |
| | | <!-- 时间线 --> |
| | | <view class="timeLine"> |
| | | <u-steps :current="dayRZ.length - 1" |
| | |
| | | import { onlineurl } from '@/api/request.js' |
| | | import { webSocketUrl } from '@/api/request.js'; |
| | | import { mapState, mapMutations } from 'vuex'; |
| | | import weighItem from '@/components/weighItem.vue' |
| | | export default { |
| | | components: { |
| | | weighItem |
| | | }, |
| | | onLoad(value) { |
| | | this.orderPlanId = value.orderPlanId; |
| | | this.yyId = value.yyId; |
| | |
| | | <template> |
| | | <view class="main"> |
| | | <view style="position: relative;top: -120px;"> |
| | | <view> |
| | | <u-empty mode="data" |
| | | icon="http://cdn.uviewui.com/uview/empty/data.png" |
| | | textSize="30" |
| | | iconSize="1000" |
| | | v-if="!orderPlanData"></u-empty> |
| | | v-if="orderPlanData.length===0"></u-empty> |
| | | </view> |
| | | <view class="collection-form"> |
| | | <view class="collection-form-item" |
| | |
| | | this.showWeigh = this.coalDetailsData.tmTaskCoalItems ? this.coalDetailsData |
| | | .tmTaskCoalItems : [], |
| | | this.showWeigh.forEach(v => { |
| | | v.discount = null |
| | | if (!v.discount) { |
| | | v.discount = '' |
| | | } |
| | | }) |
| | | uni.hideLoading() |
| | | } else { |
| | |
| | | :style="{ backgroundImage: `url(${onlineurl}/appimg/image/banner/weighbanner.png)`, backgroundSize: 'cover', backgroundRepeat: 'no-repeat' }"> |
| | | <view class="top"> |
| | | <view class="top_left"> |
| | | <text>{{ realTimeWeigh }}</text> |
| | | <!-- <text>{{ globalweigh }}</text> --> |
| | | <!-- <text>{{ realTimeWeigh }}</text> --> |
| | | <text>{{ globalweigh }}</text> |
| | | </view> |
| | | <view class="top_right"> |
| | | <view class=""> |
| | |
| | | </view> |
| | | </view> |
| | | <!-- 称重历史--> |
| | | <transition name="weighHistory"> |
| | | <view class="weigh-history" |
| | | v-if="weighHistory.length!==0"> |
| | | <view class="block-main"> |
| | | <view class="weigh-item" |
| | | v-for='item in weighHistory' |
| | | :key="item.id"> |
| | | <view class="weigh-time"> |
| | | <u-tag :text="item.createTime.slice(-8,-3)" |
| | | plain></u-tag> |
| | | </view> |
| | | <view class="item-block"> |
| | | <view class="item"> |
| | | <view class="concrete" |
| | | :style="{ backgroundImage: `url(${onlineurl}/appimg/image/banner/skin.png)`, backgroundSize: 'cover', backgroundRepeat: 'no-repeat' }"> |
| | | 皮</view> |
| | | <view class="num">{{ item.skin }}</view> |
| | | </view> |
| | | <view class="item"> |
| | | <view class="concrete" |
| | | :style="{ backgroundImage: `url(${onlineurl}/appimg/image/banner/hair.png)`, backgroundSize: 'cover', backgroundRepeat: 'no-repeat' }"> |
| | | 毛</view> |
| | | <view class="num">{{ item.hair }}</view> |
| | | </view> |
| | | <view class="item"> |
| | | <view class="concrete" |
| | | :style="{ backgroundImage: `url(${onlineurl}/appimg/image/banner/clean.png)`, backgroundSize: 'cover', backgroundRepeat: 'no-repeat' }"> |
| | | 净</view> |
| | | <view class="num">{{ item.clean }}</view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </transition> |
| | | <weigh-item :list="weighHistory"></weigh-item> |
| | | <view class="three"> |
| | | <!-- 放空 --> |
| | | <u-button type="primary" |
| | |
| | | @click="UnloadingAgainHandle" |
| | | :loading="UnloadingAgainLoading" |
| | | loadingText="确认" |
| | | :disabled="isweigh||realTimeWeigh == 0" |
| | | v-if='canUnload'></u-button> |
| | | </view> |
| | | <!-- 放空弹窗 --> |
| | |
| | | import { webSocketUrl, onlineurl } from '@/api/request.js'; |
| | | import { mapState, mapMutations } from 'vuex'; |
| | | import combinedTitle from '@/components/combined-title/combined-title.vue'; |
| | | import weighItem from '@/components/weighItem.vue' |
| | | export default { |
| | | onLoad(params) { |
| | | this.takeCoalId = params.takeCoalId; |
| | |
| | | this.weighData.overTmWaixiao = 1 |
| | | } |
| | | this.changeweighHouseCode(params.weighHouseCode); |
| | | this.changeWeigh(0) |
| | | }, |
| | | components: { |
| | | combinedTitle |
| | | combinedTitle, |
| | | weighItem |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | } |
| | | }, |
| | | // 监听重量变化 |
| | | globalweigh(newV) { |
| | | this.weighData.weigh = this.realTimeWeigh = newV; |
| | | console.log(this.realTimeWeigh, '真实重量改变了'); |
| | | globalweigh: { |
| | | handler: function(newV) { |
| | | this.weighData.weigh = this.realTimeWeigh = newV; |
| | | console.log(this.realTimeWeigh, '真实重量改变了'); |
| | | }, |
| | | deep: true |
| | | } |
| | | }, |
| | | onShow() { |
| | | this.init(); |
| | | this.changeisLogin(true) |
| | | this.realTimeWeigh = 0 |
| | | // this.realTimeWeigh = 0 |
| | | }, |
| | | computed: { |
| | | ...mapState(['globalweigh', 'globalinfraredStatus']), |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | ...mapMutations(['changeweighHouseCode', 'changeisLogin']), |
| | | ...mapMutations(['changeweighHouseCode', 'changeisLogin', 'changeWeigh']), |
| | | init() { |
| | | uni.showLoading({ |
| | | title: '加载中' |
| | |
| | | socketTask: null, |
| | | websocketData: null, // 存放从后端接收到的websocket数据 |
| | | globalIntervalId: null, |
| | | is_open_socket: false, //避免重复连接 |
| | | connectNum: 1, //重连次数, |
| | | reconnectTimeOut: null |
| | | }, |
| | | mutations: { |
| | | lengthchange(state, payload) { |
| | |
| | | // 设置底部栏 |
| | | setUserTabbar(state, roleType) { |
| | | state.roleType = roleType |
| | | if (roleType == 1) { |
| | | if (roleType === 1) { |
| | | state.userTabbar = userRoleTabbar.first |
| | | uni.setStorageSync('userTabbar', state.userTabbar) |
| | | } else if (roleType == 2 || roleType == 3) { |
| | | } else if (roleType === 2 || roleType === 3) { |
| | | state.userTabbar = userRoleTabbar.second |
| | | uni.setStorageSync('userTabbar', state.userTabbar) |
| | | } else if (roleType == 4) { |
| | | } else if (roleType === 4) { |
| | | state.userTabbar = userRoleTabbar.three |
| | | uni.setStorageSync('userTabbar', state.userTabbar) |
| | | } |
| | |
| | | }, |
| | | setWebsocketData(state, data) { |
| | | state.websocketData = data |
| | | } |
| | | }, |
| | | // 改变重连状态 |
| | | changereconnectState(state, payload) { |
| | | state.is_open_socket = payload |
| | | }, |
| | | // 改变重连次数 |
| | | changereconnectNum(state, payload) { |
| | | state.connectNum = payload |
| | | }, |
| | | }, |
| | | actions: { |
| | | websocketInit({ state, dispatch, commit }) { |
| | |
| | | state.socketTast = uni.connectSocket({ |
| | | url: wsUrl, |
| | | header: { CLIENT_TOC: 'Y' }, |
| | | complete: res => { |
| | | console.log(res, 'socket结果') |
| | | success: res => { |
| | | console.log(res, 'socketSuccess') |
| | | if (res.errMsg === 'connectSocket:ok') { |
| | | commit('changeisconnect', true) |
| | | commit('changereconnectState', true) |
| | | } |
| | | }, |
| | | fail: res => { |
| | | console.log(res, 'socketFail') |
| | | console.log('ws失败'); |
| | | commit('changereconnectState', false) |
| | | dispatch('reconnect') |
| | | } |
| | | |
| | | }) |
| | | state.socketTast.onOpen(() => dispatch('websocketOnOpen')) |
| | | state.socketTast.onMessage(result => dispatch('websocketOnMessage', result.data)) |
| | | state.socketTast.onClose(e => dispatch('websocketOnClose', e)) |
| | | state.socketTast.onError(e => dispatch('websocketOnError')) |
| | | state.socketTast.onError(e => dispatch('websocketOnError', e)) |
| | | }, |
| | | websocketOnOpen({ state, commit }) { |
| | | console.log('onOpen') |
| | | console.log('ws打开') |
| | | clearInterval(state.reconnectTimeOut) |
| | | clearInterval(state.globalIntervalId) |
| | | state.globalIntervalId = setInterval(() => { |
| | | state.socketTast.send({ |
| | | data: JSON.stringify({ type: 'ping' }), |
| | |
| | | }) |
| | | }, 30000) |
| | | }, |
| | | websocketOnClose({ state, commit }) { |
| | | websocketOnClose({ state, commit, dispatch }, e) { |
| | | if (!state.socketTast) return |
| | | console.log('ws关闭', e) |
| | | state.socketTast.close(e => { |
| | | commit('changeisconnect', false) |
| | | }) |
| | | console.log('ws关闭') |
| | | clearInterval(state.globalIntervalId) |
| | | clearInterval(state.reconnectTimeOut) |
| | | state.socketTast = null |
| | | commit('changereconnectState', false) |
| | | if (state.connectNum < 6) { |
| | | dispatch('reconnect') |
| | | } else { |
| | | commit('changereconnectNum', 1) |
| | | } |
| | | |
| | | }, |
| | | websocketOnError(e) { |
| | | console.log('socket报错', e) |
| | | websocketOnError({ state, commit, dispatch }, e) { |
| | | // 如果重连状态为false则不进行重连,为true才会 |
| | | console.log('ws报错', e) |
| | | clearInterval(state.globalIntervalId) |
| | | clearInterval(state.reconnectTimeOut) |
| | | state.socketTast = null |
| | | commit('changereconnectState', false) |
| | | if (state.connectNum < 6) { |
| | | uni.showToast({ |
| | | title: `连接失败,正尝试第${state.connectNum}次连接`, |
| | | icon: 'none' |
| | | }) |
| | | let num = 1; |
| | | num++; |
| | | commit('changereconnectNum', num) |
| | | dispatch('reconnect') |
| | | } else { |
| | | commit('changereconnectNum', 1) |
| | | } |
| | | }, |
| | | // 接收数据 |
| | | websocketOnMessage({ state, commit }, result) { |
| | | commit('setWebsocketData', result) |
| | | }, |
| | | // 重新连接 |
| | | reconnect({ state, commit, dispatch }) { |
| | | console.log(state.is_open_socket, '重新连接socket状态'); |
| | | clearInterval(state.globalIntervalId) |
| | | if (!state.is_open_socket) { |
| | | state.reconnectTimeOut = setInterval(() => { |
| | | dispatch('websocketInit') |
| | | }, 5000) |
| | | } |
| | | } |
| | | } |
| | | }) |