pda_uniapp/pages/work/wms/outboundUnbind.vue

239 lines
4.5 KiB
Vue
Raw Normal View History

<!--托盘信息查询-->
<template>
<view class="container">
<cu-custom :isBack="true">
<block slot="backText"></block>
<block slot="content"> 出库解绑</block>
</cu-custom>
<view class="example">
<uni-forms ref="form" labelWidth="80px">
<uni-forms-item label="货位编号" name="locCode">
<view class="fromItem">
<view class="flex-twice padding-0 radius">
<uni-easyinput v-model="locCode" placeholder="请扫描货位编号" @blur="queryLocInfo" />
</view>
</view>
</uni-forms-item>
<uni-forms-item label="容器编号" name="palletCode">
<view class="fromItem">
<uni-easyinput v-model="palletCode" disabled />
</view>
</uni-forms-item>
</uni-forms>
</view>
<bottomBtn :isSubmit="true" :isWhite="false" position="fixed" :texts="['确认出库解绑']" @onSubmit="handleClear">
</bottomBtn>
</view>
</template>
<script>
import {
qureyPalletInfoByLocCode,
fullCageOut
} from "@/api/wms/project.js"
import {
bottomBtn
} from '@/components/bottomBtn/bottomBtn.vue'
export default {
data() {
return {
locCode: "", // 输入的货位编号
palletCode:"",
rules: {
locCode: {
rules: [{
required: true,
errorMessage: '货位编号不能为空'
}]
}
}
};
},
component: {
bottomBtn
},
onReady() {
this.$refs.form.setRules(this.rules)
},
methods: {
// 查询货位信息
async queryLocInfo() {
if (!this.locCode) return
this.$modal.loading("查询中...")
try {
const {
code,
data
} = await qureyPalletInfoByLocCode({
locCode: this.locCode
})
if (code === 200) {
if (!data) {
this.$modal.msg("该货位未绑定托盘信息")
}else{
this.palletCode = data.palletCode
}
}
} catch (e) {
console.error(e)
} finally {
this.$modal.closeLoading()
}
},
// 显示清空确认对话框
showClearConfirm() {
if (!this.locCode) {
return this.$modal.msg("请先输入货位编号")
}
uni.showModal({
title: '确认清空',
content: `确定要清空货位【${this.locCode}】下的所有托盘吗?`,
confirmText: '确定清空',
confirmColor: '#DD524D',
cancelText: '取消',
success: res => {
if (res.confirm) {
this.handleClear()
}
}
})
},
// 执行清空操作
async handleClear() {
if(!this.locCode){
this.$modal.msgError("请扫码货位编号")
return;
}
if(!this.palletCode){
this.$modal.msgError("当前货位未绑定容器,不用解绑")
return;
}
this.$modal.loading("解绑中...")
try {
const {
code,
msg
} = await fullCageOut({
locCode: this.locCode,
containerCode:this.palletCode
})
if (code === 200) {
this.$modal.msgSuccess("解绑成功")
this.locList = [] // 清空列表
this.locCode = "" // 清空输入
} else {
this.$modal.msgError(msg || "解绑失败")
}
} catch (e) {
console.error(e)
this.$modal.msgError("请求失败")
} finally {
this.$modal.closeLoading()
}
}
}
}
</script>
<style lang="scss">
.container {
background: rgb(242, 243, 245);
height: 100vh;
}
.uni-forms-item {
border-bottom: 1px solid #E5E6EB;
margin-bottom: 0;
padding: 24rpx 0;
}
::v-deep .uni-forms-item__label {
color: #1D2129;
font-size: 28rpx;
font-weight: 400;
}
::v-deep .uni-select {
border: 0px;
}
::v-deep.uni-select__input-placeholder {
font-size: 28rpx;
font-weight: 400;
color: #86909C;
}
.textarea {
background-color: #F2F3F5;
width: 100%;
}
::v-deep.full-width-textarea {
width: 100% !important;
border: unset !important;
}
::v-deep .is-input-border {
border: unset;
}
::v-deep .uni-easyinput__placeholder-class {
font-size: 28rpx;
color: #86909C;
}
::v-deep .uni-input-input {
font-size: 28rpx;
}
::v-deep .uni-select__input-placeholder {
font-size: 28rpx;
color: #86909C;
}
::v-deep .uniui-bottom {
display: none;
}
::v-deep .uniui-top {
display: none;
}
.fromItem {
display: flex;
align-items: center;
}
.example {
padding: 0 24rpx;
background-color: #fff;
width: 702rpx;
border-radius: 24rpx;
margin: 24rpx auto;
}
/* 原有样式保留 */
.cu-form-group .title {
min-width: calc(4em + 15px);
}
page {
background-color: #ffffff;
}
.example {
padding: 15px;
background-color: #fff;
}
.button {
margin: 15px 0;
}
</style>