qingyiay
2023-08-01 99a5ffe50a0441dbd09f9b9af027f8941f33b3ac
称重增加异常功能
3个文件已修改
236 ■■■■ 已修改文件
api/globalApi.js 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue 212 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/driver-page/driver-index/driver-index.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/globalApi.js
@@ -383,13 +383,27 @@
        method: 'GET'
    },
    /**
     * @description  */
     * @description 选择煤种 */
    getAccordingCoalNameAll: {
        url: '/wrzs/tmtaskcoal/getAccordingCoalNameAll',
        method: 'GET'
    },
    /**
     * @description 确认卸货 */
    confirmLoadAndUnload: {
        url: '/wrzs/tmtaskcoal/confirmLoadAndUnload',
        method: 'POST'
    },
    /**
     * @description 皮重异常 */
    getAvgSkin: {
        url: '/wrzs/tmtaskcoal/getAvgSkin',
        method: 'GET'
    },
    /**
     * @description 皮重异常原因填写 */
    tmAbnormalTextAdd: {
        url: '/wrzs/tmtaskcoal/tmAbnormalTextAdd',
        method: 'POST'
    }
}
pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue
@@ -5,8 +5,8 @@
        background-size: cover;">
            <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="">
@@ -183,7 +183,29 @@
                class="jiajian"
                v-if="outBuy"></u-button>
        </view>
        <!-- <view class="four" v-if="weighList.orderType !== '外购'">如您需要调整装载货品吨数,请点击返回加减吨</view> -->
        <view style="width: 200rpx;margin: auto;position: relative;"
            v-if="historyBtn"><u-button type="primary"
                text="显示历史皮重"
                @click.stop="displayHistory"></u-button></view>
        <Transition name="slide-fade">
            <view class="history-skin"
                v-if="historyShow">
                <view class="history-skin_item"
                    v-for="item in tmTaskCoalList">
                    <view class="createTime">
                        日期:{{item.createTime.slice(0,10)}}
                    </view>
                    <view class="skin">
                        <view class="">
                            皮重:
                        </view>
                        <view class="">
                            {{item.skin}}
                        </view>
                    </view>
                </view>
            </view>
        </Transition>
        <!-- 放空弹窗 -->
        <view class="evacuationModal">
            <u-modal :show="evacuationModalShow"
@@ -192,6 +214,29 @@
                :showCancelButton="true"
                @confirm="evacuationConfirm"
                @cancel="evacuationCancel"></u-modal>
        </view>
        <!-- 称重异常弹窗 -->
        <view class="">
            <u-modal :show="abnormalModalShow"
                title="异常原因"
                :showCancelButton="true"
                @confirm="abnormalConfirm"
                @cancel="abnormalCancel"
                confirmText="提交">
                <view class="slot-content">
                    <u--form labelPosition="top">
                        <u-form-item>
                            <u-textarea v-model="abnormalContent"
                                confirmType="done"
                                placeholder="请输入异常原因"
                                height='140'
                                count
                                border="surround"
                                autoHeight></u-textarea>
                        </u-form-item>
                    </u--form>
                </view>
            </u-modal>
        </view>
    </view>
</template>
@@ -271,39 +316,57 @@
                isfocus1: false,
                isfocus2: false,
                // 外购第一次称毛重不需要加减吨
                outBuy: true
                outBuy: true,
                // 皮重异常相关
                abnormalContent: '',
                avgSkin: null, // 平均皮重
                tmTaskCoalList: [],
                abnormalModalShow: false,
                historyBtn: false,
                historyShow: false
            };
        },
        watch: {
            realTimeWeigh(newV, oldV) {
                if (this.weighList.orderType == '外销' || this.weighList.orderType == '内销' || this.weighList.orderType ==
                    '转出') {
                    if (this.weighList.skin == 0) {
                        // this.temporaryWeighObj.skin = this.realTimeWeigh;
                        this.temporaryWeighObj.skin = newV;
                    } else {
                        // this.temporaryWeighObj.hair = this.realTimeWeigh;
                        this.temporaryWeighObj.hair = newV;
                        this.temporaryWeighObj.clean = (this.temporaryWeighObj.hair - this.weighList.skin).toFixed(2);
                        this.isweigh = this.temporaryWeighObj.clean > this.weighList.orderSurplus || this.temporaryWeighObj
                            .clean < 0;
                    }
                } else if (this.weighList.orderType == '外购' || this.weighList.orderType == '内购' || this.weighList
                    .orderType == '转入') {
                    if (this.weighList.hair == 0) {
                        this.temporaryWeighObj.hair = newV;
                    } else {
                        this.temporaryWeighObj.skin = newV;
                        this.temporaryWeighObj.clean = (this.weighList.hair - this.temporaryWeighObj.skin).toFixed(2);
                        this.isweigh = this.temporaryWeighObj.clean > this.weighList.orderSurplus || this.temporaryWeighObj
                            .clean < 0;
                    }
                }
            },
            // 监听重量变化
            globalweigh(newV) {
                this.weighData.weigh = this.realTimeWeigh = newV;
                console.log(this.realTimeWeigh, '真实重量改变了');
            globalweigh: {
                deep: true,
                handler: function(newV) {
                    this.weighData.weigh = this.realTimeWeigh = newV;
                    if (this.weighList.orderType == '外销' || this.weighList.orderType == '内销' || this.weighList
                        .orderType ==
                        '转出') {
                        if (this.weighList.skin == 0) {
                            this.getAverageSkin()
                            this.temporaryWeighObj.skin = newV;
                            if (this.avgSkin < newV) {
                                this.abnormalModalShow = true
                                this.historyBtn = true
                            }
                        } else {
                            this.temporaryWeighObj.hair = newV;
                            this.temporaryWeighObj.clean = (this.temporaryWeighObj.hair - this.weighList.skin).toFixed(
                                2);
                            this.isweigh = this.temporaryWeighObj.clean > this.weighList.orderSurplus || this
                                .temporaryWeighObj
                                .clean < 0;
                        }
                    } else if (this.weighList.orderType == '外购' || this.weighList.orderType == '内购' || this.weighList
                        .orderType == '转入') {
                        if (this.weighList.hair == 0) {
                            this.temporaryWeighObj.hair = newV;
                        } else {
                            this.temporaryWeighObj.skin = newV;
                            this.temporaryWeighObj.clean = (this.weighList.hair - this.temporaryWeighObj.skin).toFixed(
                                2);
                            this.isweigh = this.temporaryWeighObj.clean > this.weighList.orderSurplus || this
                                .temporaryWeighObj
                                .clean < 0;
                        }
                    }
                }
            }
        },
        onShow() {
@@ -346,10 +409,14 @@
        methods: {
            ...mapMutations(['changeweighHouseCode', 'changeisLogin']),
            init() {
                uni.showLoading({
                    title: "加载中"
                })
                // 获取称重信息
                this.$reqGet('weighList', { id: this.takeCoalId }).then(res => {
                    console.log(res, '获取称重信息');
                    if (res.code == 0) {
                        uni.hideLoading()
                        this.weighList = res.data;
                        this.weighData.deptId = res.data.deptId;
                        this.weighData.tmId = res.data.id;
@@ -370,6 +437,9 @@
                        } else {
                            this.isInputOrigin = true;
                        }
                    } else {
                        uni.hideLoading()
                        this.$u.toast('加载失败')
                    }
                });
            },
@@ -478,6 +548,46 @@
                if (this.weighData.coalContactHair > 0 && this.weighData.coalContactSkin > 0) {
                    this.isInputOrigin = true;
                }
            },
            getAverageSkin() {
                uni.showLoading({
                    title: "加载中"
                })
                this.$reqGet('getAvgSkin').then(res => {
                    if (res.code === 0) {
                        uni.hideLoading()
                        this.avgSkin = res.data.avgSkin
                        this.tmTaskCoalList = res.data.tmTaskCoalList
                    } else {
                        uni.hideLoading()
                        this.$u.toast('加载失败')
                    }
                })
            },
            abnormalCancel() {
                this.abnormalModalShow = false
            },
            abnormalConfirm() {
                uni.showLoading({
                    title: "提交中"
                })
                this.$reqPost('tmAbnormalTextAdd', { tmId: this.weighData.tmId, abnormalText: this.abnormalContent },
                    'params').then(
                    res => {
                        if (res.code == 0) {
                            uni.hideLoading()
                            this.$u.toast('提交成功')
                            this.abnormalModalShow = false
                        } else {
                            uni.hideLoading()
                            this.$u.toast('提交失败')
                            this.abnormalModalShow = true
                        }
                    })
            },
            displayHistory() {
                this.historyShow = true
            }
        }
    };
@@ -493,9 +603,14 @@
    ::v-deep.weighingDevice {
        width: 100%;
        height: 100vh;
        height: 100%;
        display: flex;
        flex-direction: column;
        .slot-content {
            width: 96%;
            border: 1rpx solid rgb(220, 223, 230);
        }
        .one {
            // flex: 3;
@@ -716,6 +831,41 @@
            margin-top: vww(5);
            text-align: center;
        }
        .slide-fade-enter-active {
            transition: all 0.3s ease-out;
        }
        .history-skin {
            width: 96%;
            height: vww(300);
            margin: vww(50) auto;
            margin-top: vww(10);
            background: #ffffff;
            box-shadow: 0rpx 0rpx 14rpx 0rpx rgba(73, 120, 240, 0.14), 0rpx 7rpx 45rpx 0rpx rgba(73, 120, 240, 0.12);
            border-radius: 20rpx;
            overflow: scroll;
            color: #000;
            .history-skin_item {
                width: 80%;
                height: vww(30);
                @include flex;
                margin: vww(10) auto;
                .createTime {
                    color: rgb(60, 156, 255);
                }
                .skin {
                    color: #f81414;
                    @include flex;
                    width: 180rpx;
                    height: vww(30);
                }
            }
        }
    }
    .secondary-confirmation__main {
pages/driver-page/driver-index/driver-index.vue
@@ -292,13 +292,13 @@
            // 抢单按钮
            qiangDanBtn(value) {
                if (value.tmcCount == '0') {
                    this.qiangDan(value.orderPlanId, value.fleetId, value.customerId === null ? '0' : value.customerId,
                        value.xsUserId === null ? '0' : value.xsUserId);
                    this.qiangDan(value.orderPlanId, value.fleetId, value.customerId === '' ? '0' : value.customerId,
                        value.xsUserId === '' ? '0' : value.xsUserId);
                } else {
                    this.qiangDanOrderPlanId = value.orderPlanId;
                    this.fleetId = value.fleetId;
                    this.customerId = value.customerId === null ? '0' : value.customerId;
                    this.xsUserId = value.xsUserId === null ? '0' : value.xsUserId;
                    this.customerId = value.customerId === '' ? '0' : value.customerId;
                    this.xsUserId = value.xsUserId === '' ? '0' : value.xsUserId;
                    this.qiangDanShow = true;
                    this.qiangDanContent = `已抢${value.tmcCount}单,确定抢单?`;
                }