| | |
| | | "path": "pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details", |
| | | "style": { |
| | | "navigationBarTitleText": "提煤单详情", |
| | | "enablePullDownRefresh": false |
| | | "enablePullDownRefresh": true |
| | | } |
| | | }, |
| | | // { |
| | |
| | | orderCode: null, |
| | | orderPlanDetail: {}, |
| | | coalStatus: ['领取', '预约', '签到', '入场', '称皮', '称毛', '离场', '入磅房', '出磅房', '入煤仓', '出煤仓', '放空', '作废', '入场申请', |
| | | '进入场院', '异常审核中' |
| | | '进入场院', '异常审核中', '返回加减吨', '超时', '打印中', '打印中' |
| | | ], |
| | | yyDailyList: [], |
| | | // 领取数量 |
| | |
| | | yyDailyList: {}, |
| | | orderPlanDetail: {}, |
| | | coalStatus: ['领取', '预约', '签到', '入场', '称皮', '称毛', '离场', '入磅房', '出磅房', '入煤仓', '出煤仓', '放空', '作废', '入场申请', |
| | | '进入场院', '异常审核中' |
| | | '进入场院', '异常审核中', '返回加减吨', '超时', '打印中', '打印中' |
| | | ], |
| | | index: '' |
| | | }; |
| | |
| | | faYunDetailobj: {}, |
| | | modalShow: false, |
| | | coalStatus: ['领取', '预约', '签到', '入场', '称皮', '称毛', '离场', '入磅房', '出磅房', '入煤仓', '出煤仓', '放空', '作废', '入场申请', |
| | | '进入场院', '异常审核中' |
| | | '进入场院', '异常审核中', '返回加减吨', '超时', '打印中', '打印中' |
| | | ] |
| | | }; |
| | | }, |
| | |
| | | <view class="bill-of-lading-details"> |
| | | <view class="top-banner" |
| | | style="background: url('https://mx.jzeg.cn:9095/appimg/image/banner/loadingbanner.png') no-repeat;background-size: cover;"> |
| | | <u-notice-bar :text="originInfoNotice" |
| | | v-if="originInfoVisible" |
| | | fontSize='36'></u-notice-bar> |
| | | <view class="top-information"> |
| | | <view class="cutomer-name" |
| | | v-if="orderType == '转入' || orderType == '转出'">煤场:{{ coalDetailsData.toFiledName || '' }}</view> |
| | |
| | | <view class="status-button" |
| | | style="background: url('https://mx.jzeg.cn:9095/appimg/image/banner/statusbutton.png') no-repeat; |
| | | background-size: cover;"> |
| | | {{ coalStatus[coalDetailsData.status] || '' }} |
| | | {{coalStatus[correctStatus]}} |
| | | </view> |
| | | </view> |
| | | <view class="time"> |
| | |
| | | <view class="origin-info_content"> |
| | | <view class="first-line"><combined-title title="原发信息"></combined-title></view> |
| | | <u-form :model="originInfoForm" |
| | | :rules="rules" |
| | | label-position="top" |
| | | label-width="160" |
| | | :label-style="{'marginLeft':'9px'}" |
| | |
| | | plain |
| | | @click="rcsqClick" |
| | | shape="circle" |
| | | :disabled="coalDetailsData.status === 3"></u-button> |
| | | :disabled="correctStatus>= 3"></u-button> |
| | | </view> |
| | | <view class="bottom-button"> |
| | | <u-button text="放空" |
| | |
| | | components: { |
| | | combinedTitle |
| | | }, |
| | | onPullDownRefresh() { |
| | | this.getTakeCoal(); //获取提煤单详情 |
| | | uni.stopPullDownRefresh(); |
| | | }, |
| | | onLoad(value) { |
| | | this.orderPlanId = value.orderPlanId; |
| | | this.yyId = value.yyId; |
| | |
| | | this.getTakeCoal(); //获取提煤单详情 |
| | | } |
| | | this.init(); //获取日志 |
| | | this.getgetService(); //获取客服 |
| | | }, |
| | | onShow() { |
| | | this.coalDayPage(); //获取日志 定时任务 |
| | |
| | | serviecePhone: '' |
| | | }, |
| | | coalStatus: ['领取', '预约', '签到', '入场', '称皮', '称毛', '离场', '入磅房', '出磅房', '入煤仓', '出煤仓', '放空', '作废', '入场申请', |
| | | '进入场院', '异常审核中' |
| | | '进入场院', '异常审核中', '返回加减吨', '超时', '打印中', '打印中' |
| | | ], // 状态 |
| | | weighHouseCode: '', |
| | | // 放空弹窗控制变量 |
| | |
| | | originInfoVisible: false, |
| | | fileList1: [], //图片列表 |
| | | deletable: true, |
| | | rules: { |
| | | contactPicture: { |
| | | type: 'string', |
| | | required: true, |
| | | message: '请上传原发磅单图片', |
| | | trigger: ['blur', 'change'] |
| | | }, |
| | | coalContactHair: { |
| | | type: 'string', |
| | | required: true, |
| | | message: '请输入毛重', |
| | | trigger: ['blur', 'change'] |
| | | }, |
| | | coalContactSkin: { |
| | | type: 'string', |
| | | required: true, |
| | | message: '请输入皮重', |
| | | trigger: ['blur', 'change'] |
| | | } |
| | | }, |
| | | rules: {}, |
| | | timeout: '0', |
| | | wsgShow: false |
| | | |
| | | wsgShow: false, |
| | | timeLineStatus: null, |
| | | originInfoNotice: '填写原发信息后可上磅计量' |
| | | }; |
| | | }, |
| | | watch: { |
| | |
| | | return this.coalDetailsData.hair !== 0 || this.coalDetailsData.skin !== 0; |
| | | }, |
| | | isapproach() { |
| | | return this.currentPageCoalStatus !== 3; |
| | | return this.correctStatus !== 3 |
| | | }, |
| | | coalContactClean() { |
| | | let xx = BigNumber(this.originInfoForm.coalContactHair ? this.originInfoForm.coalContactHair : 0) |
| | |
| | | let minutes = ("0" + currentDate.getMinutes()).slice(-2); |
| | | let formattedDate = year + "-" + month + "-" + date + " " + hours + ":" + minutes; |
| | | return formattedDate |
| | | }, |
| | | correctStatus() { |
| | | return this.currentPageCoalStatus === this.timeLineStatus ? this.currentPageCoalStatus : this |
| | | .timeLineStatus |
| | | } |
| | | }, |
| | | methods: { |
| | |
| | | init() { |
| | | this.$reqGet('coalDayPage', { id: this.orderPlanId, timeout: this.timeout }).then(res => { |
| | | if (res.code == 0) { |
| | | // this.dayRZ = res.data; |
| | | this.timeLineStatus = res.data[0].taskStatus |
| | | this.dayRZ = res.data.map(v => { |
| | | let slicedate = v.taskStatusDes.slice(0, 10); |
| | | if (slicedate == this.currentDate) { |
| | |
| | | uni.setStorageSync('customeropenId', this.serviceInfoObj.openId); |
| | | uni.setStorageSync('customerName', this.serviceInfoObj.openName); |
| | | } |
| | | }); |
| | | }) |
| | | }, |
| | | // 获取提煤单详情 |
| | | getTakeCoal() { |
| | |
| | | // 原发信息回显以及控制是否可修改 |
| | | this.haveInputOrigin = !this.coalDetailsData.skinTwo && this.coalDetailsData.orderType === |
| | | '外购' |
| | | this.deletable = this.isModifyoriginInfo = this.coalDetailsData.status > 3 |
| | | this.deletable = this.coalDetailsData.status > 3 |
| | | this.originInfoForm.coalContactSkin = this.coalDetailsData.skinTwo; |
| | | this.originInfoForm.coalContactHair = this.coalDetailsData.hairTwo; |
| | | this.originInfoForm.contactPicture = this.coalDetailsData.contactPicture |
| | | if (this.coalDetailsData.contactPicture) { |
| | | this.fileList1 = this.coalDetailsData.contactPicture.split(',').map(v => { |
| | | return { |
| | |
| | | } |
| | | } |
| | | }).then(() => { |
| | | this.getgetService(); //获取客服 |
| | | }).then(() => { |
| | | // 判断当前时间是否超出预约时间 |
| | | setTimeout(() => { |
| | | let endTime = this.coalDetailsData.yuYueSection.slice(0, 10) + ' ' + this |
| | |
| | | this.interval = setInterval(() => { |
| | | this.$reqGet('coalDayPage', { id: this.orderPlanId, timeout: this.timeout }).then(res => { |
| | | if (res.code == 0) { |
| | | this.timeLineStatus = res.data[0].taskStatus |
| | | this.dayRZ = res.data.map(v => { |
| | | let slicedate = v.taskStatusDes.slice(0, 10); |
| | | if (slicedate == this.currentDate) { |
| | |
| | | this.weighData.gateCameraId = res.data.lastEquipmentId; |
| | | this.weighData.equipmentCode = res.data.lastEquipmentCode; |
| | | this.weighData.sceneInOut = res.data.sceneInOut; |
| | | let form = { |
| | | sceneId: this.weighData.sceneId, |
| | | gateCameraId: this.weighData.gateCameraId, |
| | | equipmentCode: this.weighData.equipmentCode, |
| | | sceneInOut: this.weighData.sceneInOut, |
| | | } |
| | | uni.setStorageSync('WeighHouseForm', JSON.stringify(form)) |
| | | this.weighHouseCode = res.data.code; |
| | | uni.navigateTo({ |
| | | url: `/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice?takeCoalId=${this.orderPlanId}&sceneId=${ |
| | |
| | | title: '正在打印中,请稍后' |
| | | }) |
| | | this.enterLoading = true |
| | | this.$reqGet('printer', { type: 2, tmId: this.coalDetailsData.id }).then(res => { |
| | | uni.hideLoading() |
| | | this.enterLoading = false |
| | | console.log(res); |
| | | if (res.code === 0) { |
| | | this.$u.toast('打印成功') |
| | | } else { |
| | | this.$u.toast(res.msg ? res.msg : '打印失败') |
| | | } |
| | | }) |
| | | this.$reqGet('printer', { type: 2, tmId: this.coalDetailsData.id, weighingNumber: 1 }).then( |
| | | res => { |
| | | uni.hideLoading() |
| | | this.enterLoading = false |
| | | console.log(res); |
| | | if (res.code === 0) { |
| | | this.$u.toast('打印成功') |
| | | } else { |
| | | this.$u.toast(res.msg ? res.msg : '打印失败') |
| | | } |
| | | }) |
| | | }, |
| | | // 打印出门证 |
| | | printExitPermit() { |
| | | uni.showLoading({ |
| | | title: '正在打印中,请稍后' |
| | | }) |
| | | let form = { |
| | | deptId: this.getWeightHouseObj.deptId, |
| | | tmId: this.getWeightHouseObj.tmId, |
| | | carNo: uni.getStorageSync('carNo'), |
| | | type: 3, |
| | | weighingNumber: 2 |
| | | } |
| | | this.outLoading = true |
| | | this.$reqGet('printer', { type: 3, tmId: this.coalDetailsData.id }).then(res => { |
| | | this.$reqPost('printer', Object.assign(form, JSON.parse(uni.getStorageSync('WeighHouseForm'))), |
| | | 'json').then(res => { |
| | | uni.hideLoading() |
| | | this.outLoading = false |
| | | if (res.code === 0) { |
| | |
| | | this.isfocus2 = false; |
| | | }, |
| | | inputChange() { |
| | | if (Number(this.originInfoForm.coalContactHair) > 0 && Number(this.originInfoForm.coalContactSkin > 0)) { |
| | | if (Number(this.originInfoForm.coalContactHair) > 0 && Number(this.originInfoForm.coalContactSkin > |
| | | 0)) { |
| | | this.isInputOrigin = true; |
| | | } |
| | | }, |
| | |
| | | name: 'file', |
| | | success: res => { |
| | | if (num == 1) { |
| | | this.originInfoForm.contactPicture = JSON.parse(res.data).data.url; |
| | | this.originInfoForm.contactPicture = JSON.parse(res.data) |
| | | .data.url; |
| | | resolve(`${BaseUrl}${JSON.parse(res.data).data.url}`); |
| | | } |
| | | } |
| | |
| | | taskCoalCode: this.coalDetailsData.code, |
| | | carNo: this.coalDetailsData.carNo, |
| | | } |
| | | this.$refs.originInfoRef.validate().then(res => { |
| | | if (this.originInfoForm.coalContactSkin && this.originInfoForm.coalContactHair && this |
| | | .originInfoForm |
| | | .contactPicture) { |
| | | this.$reqPost('appSaveContact', form, 'json').then(res => { |
| | | if (res.code === 0) { |
| | | this.$u.toast('提交成功') |
| | | this.getTakeCoal() |
| | | } else { |
| | | this.isModifyoriginInfo = true |
| | | this.$u.toast(res.msg ? res.msg : '提交失败') |
| | | |
| | | } |
| | | }).then(() => { |
| | | setTimeout(() => { |
| | | this.getTakeCoal() |
| | | }, 1000) |
| | | }) |
| | | }).catch(errors => { |
| | | } else { |
| | | uni.$u.toast('请填写完整原发信息') |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | }; |
| | |
| | | :disabled="addAndSubtractCoalDisabled" |
| | | @click="addAndSubtractCoal" |
| | | class="jiajian" |
| | | v-if="outBuy"></u-button> |
| | | v-if="outBuy||!isSkinWeigh"></u-button> |
| | | </view> |
| | | <view class="four"> |
| | | <view v-show="isConfirmWeighLoading" |
| | | style="color: #ff6363;width: auto;margin: 0 auto;"> |
| | | 超出毛重,磅房人员确认中,请勿离开此页面 |
| | | </view> |
| | | <!-- <view class="four"> |
| | | <u-button type="primary" |
| | | text="刷新" |
| | | @click.stop="RefreshHandle" |
| | | icon="reload" |
| | | throttle-time="800" |
| | | :loading="refreshLoading"></u-button> |
| | | </view> |
| | | </view> --> |
| | | <!-- 放空弹窗 --> |
| | | <view class="evacuationModal"> |
| | | <u-modal :show="evacuationModalShow" |
| | |
| | | title="异常原因" |
| | | :showCancelButton="true" |
| | | @confirm="abnormalConfirm" |
| | | @cancel="abnormalCancel" |
| | | confirmText="提交"> |
| | | <view class="slot-content"> |
| | | <u--form labelPosition="top" |
| | |
| | | </view> |
| | | </u-modal> |
| | | </view> |
| | | <!-- 确认后称重提示弹窗 --> |
| | | <view class=""> |
| | | <u-modal :show="confirmWeighVisiable" |
| | | title="提示" |
| | | :content="confirmWeighContent" |
| | | @confirm="confirmWeighConfirm"></u-modal> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | let socket = null; |
| | | import { webSocketUrl } from '@/api/request.js'; |
| | | import { mapState, mapMutations } from 'vuex'; |
| | | import combinedTitle from '@/components/combined-title/combined-title.vue'; |
| | |
| | | this.changeWeigh('') |
| | | this.realTimeWeigh = 0 |
| | | }, |
| | | onShow() { |
| | | this.timer = setTimeout(() => { |
| | | if (!this.globalweigh) { |
| | | console.log('称重时自动重连'); |
| | | this.socketTask.close(); |
| | | this.changesocketTask(null); |
| | | this.changereconnectNum({ connectNum: 1, isWeigh: true }) |
| | | this.$store.dispatch('websocketInit'); |
| | | } |
| | | }, 3000) |
| | | }, |
| | | onHide() { |
| | | clearTimeout(this.timer) |
| | | }, |
| | | onUnload() { |
| | | clearTimeout(this.timer) |
| | | }, |
| | | components: { |
| | | combinedTitle |
| | | }, |
| | |
| | | coalContactClean: 0, |
| | | coalContactHair: 0, |
| | | coalContactSkin: 0, |
| | | isMerge: 0 //1是 0不是 默认0 是否合卡 |
| | | isMerge: '0', //1是 0不是 默认0 是否合卡 |
| | | isBackground: '0' |
| | | }, |
| | | takeCoalId: null, |
| | | weighHouseCode: '', |
| | |
| | | mergeStateShow: false, //合卡弹窗 |
| | | checkboxValue1: [], |
| | | isExceedOrigin: false, //是否超出原发毛重 |
| | | refreshLoading: false |
| | | refreshLoading: false, |
| | | timer: null |
| | | }; |
| | | }, |
| | | watch: { |
| | |
| | | .orderType == |
| | | '转出') { |
| | | if (this.weighList.skin == 0) { |
| | | this.isSkinWeigh = true |
| | | this.isSkinWeigh = true //称皮没有返回装卸 |
| | | this.outBuy = false //称皮没有返回装卸 |
| | | this.temporaryWeighObj.skin = newV; |
| | | let xx = new BigNumber(this.avgSkin) |
| | | let yy = new BigNumber(newV) |
| | |
| | | this.avgSkin !== 0 |
| | | } else { |
| | | this.isSkinWeigh = false; |
| | | this.outBuy = true; |
| | | this.temporaryWeighObj.hair = newV; |
| | | this.temporaryWeighObj.clean = (this.temporaryWeighObj.hair - this.weighList.skin).toFixed( |
| | | 2); |
| | |
| | | .orderType == '转入') { |
| | | if (this.weighList.hair == 0) { |
| | | this.isSkinWeigh = false; |
| | | this.outBuy = true; |
| | | this.temporaryWeighObj.hair = newV; |
| | | if (this.weighList.orderType == '外购') { |
| | | let xx = new BigNumber(newV) |
| | | let yy = new BigNumber(this.weighList.hairTwo) |
| | | if (xx.minus(yy) > 0.3) { |
| | | this.$u.toast('超出原发信息毛重,请等待管理人员处理') |
| | | this.isExceedOrigin = true |
| | | } |
| | | } |
| | | // if (this.weighList.orderType == '外购') { |
| | | // let xx = new BigNumber(newV) |
| | | // let yy = new BigNumber(this.weighList.hairTwo) |
| | | // if (xx.minus(yy) > 0.3) { |
| | | // this.$u.toast('超出原发信息毛重,请等待管理人员处理') |
| | | // this.isExceedOrigin = true |
| | | // this.saveWeigh() |
| | | // } |
| | | // } |
| | | } else { |
| | | this.isSkinWeigh = true; |
| | | this.isSkinWeigh = true; //称皮没有返回装卸 |
| | | this.outBuy = false //称皮没有返回装卸 |
| | | this.temporaryWeighObj.skin = newV; |
| | | let xx = new BigNumber(this.avgSkin) |
| | | let yy = new BigNumber(newV) |
| | |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | confirmWeighVisiable(v) { |
| | | if (v) { |
| | | uni.hideLoading() |
| | | } |
| | | } |
| | | }, |
| | | computed: { |
| | | ...mapState(['globalweigh', 'globalinfraredStatus', 'globalisconnect', 'globalisUploadimg', 'globalisLogin', |
| | | 'is_open_socket' |
| | | 'is_open_socket', 'socketTask', 'confirmWeighVisiable', 'confirmWeighContent' |
| | | ]), |
| | | coalContactClean() { |
| | | let xx = BigNumber(this.weighData.coalContactHair) |
| | |
| | | }, |
| | | |
| | | methods: { |
| | | ...mapMutations(['changeweighHouseCode', 'changeisLogin', 'changeWeigh']), |
| | | ...mapMutations(['changeweighHouseCode', 'changeisLogin', 'changeWeigh', 'changeconfirmWeighVisiable', |
| | | 'changesocketTask', 'changereconnectNum' |
| | | ]), |
| | | RefreshHandle() { |
| | | if (this.globalisconnect) return this.$u.toast('已连接,无需刷新') |
| | | this.refreshLoading = true |
| | |
| | | // 确认称重接口 |
| | | saveWeigh() { |
| | | this.weighData.coalContactClean = this.coalContactClean; |
| | | console.log(this.weighData); |
| | | this.$reqPost('saveWeigh', this.weighData, 'json') |
| | | .then(res => { |
| | | console.log(res, '称重接口'); |
| | |
| | | }); |
| | | this.isConfirmWeighLoading = false; |
| | | }, 1000); |
| | | } else if (res.code === 3) { |
| | | uni.showLoading({ |
| | | title: '磅房人员确认中', |
| | | }) |
| | | } else { |
| | | this.$u.toast(res.msg ? res.msg : '称重失败,请稍后重试'); |
| | | this.isConfirmWeighLoading = false |
| | |
| | | this.orderSurplusLess = true |
| | | } |
| | | }, |
| | | confirmWeighConfirm() { |
| | | this.changeconfirmWeighVisiable(false) |
| | | this.isConfirmWeighLoading = false |
| | | setTimeout(() => { |
| | | this.$u.toast('即将返回上一页'), |
| | | uni.navigateBack({ |
| | | delta: 1 |
| | | }) |
| | | }, 800) |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | |
| | | xsUserId: '', |
| | | customerId: '', |
| | | isFirstLogin: true, //是否是第一次登录 |
| | | phone: "" |
| | | phone: "", |
| | | isFirstTime: false //是否是登录进入首页,还是别的页面返回 false是登录 true是别的页面 |
| | | }; |
| | | }, |
| | | onShow() { |
| | |
| | | }, |
| | | init() { |
| | | this.qiangDanList(); |
| | | this.getLogOn() |
| | | if (!this.isFirstTime) { |
| | | this.getLogOn() |
| | | } |
| | | }, |
| | | // 司机首页列表 |
| | | qiangDanList() { |
| | |
| | | this.$refs.previewImage.open('https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj1.png') |
| | | }, |
| | | getLogOn() { |
| | | this.isFirstTime = true |
| | | this.$reqGet('getUserEntity').then(res => { |
| | | this.phone = res.data.phone |
| | | }).then(() => { |
| | |
| | | loading: false, |
| | | id: "", |
| | | coalStatus: ['领取', '预约', '签到', '入场', '称皮', '称毛', '离场', '入磅房', '出磅房', '入煤仓', '出煤仓', '放空', '作废', '入场申请', |
| | | '进入场院', '异常审核中', |
| | | '进入场院', '异常审核中', '返回加减吨', '超时', '打印中', '打印中' |
| | | ], // 状态 |
| | | } |
| | | }, |
| | |
| | | this.loading = false; |
| | | if (res.code === 0) { |
| | | this.$u.toast('装卸成功') |
| | | this.init() |
| | | setTimeout(() => { |
| | | this.init() |
| | | }, 1000) |
| | | } else { |
| | | this.$u.toast(res.msg ? res.msg : '装卸失败') |
| | | } |
| | |
| | | <view class="coal-name" |
| | | v-show="coalList.length!==0"> |
| | | <u-checkbox-group v-model="checkedCoal" |
| | | placement="row" |
| | | placement="column" |
| | | @change="checkboxChange" |
| | | size="30"> |
| | | <u-checkbox :customStyle="{marginBottom: '8px',fontSize:'20px'}" |
| | |
| | | checked: false |
| | | } |
| | | }) |
| | | console.log(this.coalList); |
| | | }, |
| | | checkboxChange(e) { |
| | | this.selectedCoal = e |
| | | }, |
| | | formHandle() { |
| | | if (!this.dataForm.firstClass || !this.dataForm.secondClass) return this.$u.toast('请选择煤场或者煤仓') |
| | | if (this.selectedCoal.length === 0) return this.$u.toast('请选择煤种') |
| | | this.$reqPost('updateUser', Object.assign(this.userInfo, { |
| | | responsibilityCoal: this.selectedCoal.join(), |
| | | filedId: this |
| | |
| | | id: '', |
| | | faYunDetailobj: {}, |
| | | coalStatus: ['领取', '预约', '签到', '入场', '称皮', '称毛', '离场', '入磅房', '出磅房', '入煤仓', '出煤仓', '放空', '作废', '入场申请', |
| | | '进入场院', '异常审核中' |
| | | '进入场院', '异常审核中', '打印中', '打印中' |
| | | ] |
| | | }; |
| | | }, |
| | |
| | | } |
| | | } else if (v.startsWith('wsg')) { |
| | | let wsgObj = JSON.parse(v.slice(5)); |
| | | console.log(uni.getStorageSync('carNo'), wsgObj.carNo); |
| | | if (uni.getStorageSync('carNo') === wsgObj.carNo) { |
| | | if (uni.getStorageSync('carNo') === wsgObj.carNo && !wsgObj.peopleWeigh) { |
| | | this.changewsgVisiable(true) |
| | | this.changewsgContent(wsgObj.content) |
| | | } |
| | | if (uni.getStorageSync('carNo') === wsgObj.carNo && wsgObj.peopleWeigh === 2) { |
| | | this.changeconfirmWeighVisiable(true) |
| | | this.changeconfirmWeighContent(wsgObj.content) |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | ...mapMutations(['pushMessage', 'changeWeigh', 'changeinfraredStatus', 'changeisconnect', 'websocketInit', |
| | | 'changewsgVisiable', 'changewsgContent' |
| | | 'changewsgVisiable', 'changewsgContent', 'changeconfirmWeighVisiable', 'changeconfirmWeighContent' |
| | | ]), |
| | | messagePage() { |
| | | uni.navigateTo({ |
| | |
| | | ], |
| | | wsgVisiable: false, //磅房忙碌弹窗控制 |
| | | wsgContent: '', |
| | | globalIsFirstWeighing: 1 //是否是第一次上磅 |
| | | globalIsFirstWeighing: 1, //是否是第一次上磅 |
| | | confirmWeighVisiable: false, //磅房管理确认称重完成提示弹窗 |
| | | confirmWeighContent: '' |
| | | }, |
| | | mutations: { |
| | | lengthchange(state, payload) { |
| | |
| | | changeuserInfo(state, payload) { |
| | | state.globaluserInfo = payload |
| | | }, |
| | | changesocketTask(state, payload) { |
| | | state.socketTask = payload |
| | | }, |
| | | // 改版全局websocket状态 |
| | | changeisconnect(state, payload) { |
| | | state.globalisconnect = payload |
| | |
| | | }, |
| | | // 改变重连次数 |
| | | changereconnectNum(state, payload) { |
| | | if (state.connectNum < 6) { |
| | | state.connectNum += payload |
| | | if (payload.isWeigh) { |
| | | state.connectNum = payload.connectNum |
| | | } else { |
| | | state.connectNum = payload |
| | | if (state.connectNum < 6) { |
| | | state.connectNum += payload.connectNum |
| | | } else { |
| | | state.connectNum = payload.connectNum |
| | | } |
| | | } |
| | | }, |
| | | changeablePrintInduction(state, payload) { |
| | |
| | | }, |
| | | changeglobalIsFirstWeighing(state, payload) { |
| | | state.globalIsFirstWeighing = payload |
| | | }, |
| | | changeconfirmWeighVisiable(state, payload) { |
| | | state.confirmWeighVisiable = payload |
| | | }, |
| | | changeconfirmWeighContent(state, payload) { |
| | | state.confirmWeighContent = payload |
| | | } |
| | | }, |
| | | actions: { |
| | | websocketInit({ state, dispatch, commit }) { |
| | | let wsUrl = `${webSocketUrl}?access_token=${uni.getStorageSync('token')}` |
| | | state.socketTast = uni.connectSocket({ |
| | | state.socketTask = uni.connectSocket({ |
| | | url: wsUrl, |
| | | header: { CLIENT_TOC: 'Y' }, |
| | | success: res => { |
| | |
| | | commit('changeisconnect', false) |
| | | } |
| | | }) |
| | | 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', e)) |
| | | state.socketTask.onOpen(() => dispatch('websocketOnOpen')) |
| | | state.socketTask.onMessage(result => dispatch('websocketOnMessage', result.data)) |
| | | state.socketTask.onClose(e => dispatch('websocketOnClose', e)) |
| | | state.socketTask.onError(e => dispatch('websocketOnError', e)) |
| | | }, |
| | | websocketOnOpen({ state, commit }) { |
| | | console.log('ws打开') |
| | | clearInterval(state.reconnectTimeOut) |
| | | clearInterval(state.globalIntervalId) |
| | | state.globalIntervalId = setInterval(() => { |
| | | state.socketTast.send({ |
| | | state.socketTask.send({ |
| | | data: JSON.stringify({ type: 'ping' }), |
| | | success(e) { |
| | | console.log(e, '发送心跳成功') |
| | |
| | | }, 30000) |
| | | }, |
| | | websocketOnClose({ state, commit, dispatch }, e) { |
| | | if (!state.socketTast) return |
| | | if (!state.socketTask) return |
| | | console.log('ws关闭', e) |
| | | state.socketTast.close(e => { |
| | | state.socketTask.close(e => { |
| | | commit('changeisconnect', false) |
| | | }) |
| | | clearInterval(state.globalIntervalId) |
| | | clearInterval(state.reconnectTimeOut) |
| | | state.socketTast = null |
| | | state.socketTask = null |
| | | commit('changereconnectState', false) |
| | | if (state.connectNum < 6 && state.globalisLogin) { |
| | | console.log(state.connectNum, state.connectNum.connectNum, '链接数'); |
| | | if (state.connectNum < 6 || state.connectNum.connectNum < 6 && state.globalisLogin) { |
| | | uni.showToast({ |
| | | title: `连接失败,正在尝试第${state.connectNum}次连接`, |
| | | title: '连接失败,正在尝试重新连接', |
| | | icon: 'none' |
| | | }) |
| | | commit('changereconnectNum', 1) |
| | | commit('changereconnectNum', { connectNum: 1, isWeigh: false }) |
| | | dispatch('reconnect') |
| | | } else if (state.connectNum >= 6 && state.globalisLogin) { |
| | | commit('changereconnectNum', 1) |
| | | commit('changereconnectNum', { connectNum: 1, isWeigh: false }) |
| | | uni.showToast({ |
| | | title: '网络异常,请稍后重试', |
| | | icon: 'none' |
| | |
| | | console.log('ws报错', e) |
| | | clearInterval(state.globalIntervalId) |
| | | clearInterval(state.reconnectTimeOut) |
| | | state.socketTast = null |
| | | state.socketTask = null |
| | | commit('changereconnectState', false) |
| | | if (state.connectNum < 6 && state.globalisLogin) { |
| | | if (state.connectNum < 6 || state.connectNum.connectNum < 6 && state.globalisLogin) { |
| | | uni.showToast({ |
| | | title: `连接失败,正在尝试第${state.connectNum}次连接`, |
| | | title: '连接失败,正在尝试重新连接', |
| | | icon: 'none' |
| | | }) |
| | | commit('changereconnectNum', 1) |
| | | commit('changereconnectNum', { connectNum: 1, isWeigh: false }) |
| | | dispatch('reconnect') |
| | | } else if (state.connectNum > 6 && state.globalisLogin) { |
| | | commit('changereconnectNum', 1) |
| | | commit('changereconnectNum', { connectNum: 1, isWeigh: false }) |
| | | uni.showToast({ |
| | | title: '网络异常,请稍后重试', |
| | | icon: 'none' |