Files

538 lines
15 KiB
Vue
Executable File

<template>
<!-- 当前任务 -->
<view class="pickPage" style="">
<opsoft-dialog-notice
:dialogNoticeShow="showDialog"
:dialogNoticeType="dialogNoticeType"
:dialogNoticeTitle="dialogNoticeTitle"
:dialogNoticeContent="dialogNoticeContent"
@dialogNoticeConfirmClick="dialogNoticeConfirmClick"
>
</opsoft-dialog-notice>
<view class="nav">
<view class="nav-left">
<view v-for="(item, index) in navInfo">
{{ item }}
<span
v-if="index !== navInfo.length - 1"
style="display: inline-block; margin: 0 2px"
>
&#12288;&gt;
</span>
</view>
</view>
<view class="nav-back" @click="turnBack">返回</view>
</view>
<view class="content">
<view class="scan">
<view class="scan-left">拣货单号: {{ currentNo }}</view>
<view class="scan-right">
是否播种: {{ ifSeed ? " 是" : "否" }}
</view>
</view>
<view class="currentTask">
<view class="currentTask-top">拣货任务详情</view>
</view>
<view class="taskTable">
<z-table
class="baseTable"
:tableData="baseTableData"
:columns="baseColumns"
titleTextAlign="center"
textAlign="center"
emptyText="设置了showLoading=false才会看到我"
@onClick="rowClick($event)"
/>
</view>
<view class="pickButton" @click="startPick">开始拣货</view>
</view>
<view class="opsoft-card-dialog card-shadow" v-show="dialogShow">
<view class="opsoft-card-title">
<view class="text">请扫描拣货容器号</view>
<view class="icon" @click="dialogShow = false">x</view>
</view>
<view class="opsoft-card-content">
<view class="box">
<!-- {{ pickDockerNo ? pickDockerNo : '请扫描拣货容器号'}} -->
<input
type="text"
v-model="pickDockerNo"
@confirm="confirmEvent"
placeholder="请扫描拣货容器号"
/>
<image
src="../../../static/img/scan-blue.png"
class="img"
@click="scanEvent"
></image>
</view>
</view>
<view class="opsoft-card-footer">
<view class="button" @click="noDocker">不使用容器</view>
<view class="button" @click="useDocker">确认</view>
</view>
</view>
</view>
</template>
<script>
import opsoftDialogNotice from '@/components/opsoft-dialog-notice/opsoft-dialog-notice.vue';
import errorStrUntil from '@/common/errorStrUntil.js';
export default {
props: {
// type: {
// // 1: 销售; 2: 生产
// type: Number,
// default: 1
// }
},
data() {
return {
dialogNoticeContent:'',
dialogNoticeTitle:'',
dialogNoticeType:'',
showDialog:false,
navInfo: ["拣货平台", "销售拣货", "当前任务"],
baseTableData: [
{
key1: "123",
key2: "123",
key3: "123",
key4: "123",
key5: "123",
key6: "123",
key7: "123",
},
],
baseColumns: [
{
title: "序号",
key: "INDEX",
width: 100,
formatNum: false,
listenerClick: true,
},
{
title: "订单编号",
key: "FSRCBILLNO",
width: 200,
formatNum: false,
listenerClick: true,
},
{
title: "产品代码",
key: "FMATERIALNUMBER",
width: 250,
formatNum: false,
listenerClick: true,
},
{
title: "产品名称",
key: "FMATERIALNAME",
width: 250,
formatNum: false,
listenerClick: true,
},
{
title: "规格型号",
key: "FSPECIFICATION",
width: 200,
formatNum: false,
listenerClick: true,
},
{
title: "拣货数量",
key: "FQTY",
width: 150,
formatNum: false,
listenerClick: true,
},
{
title: "拣货单位",
key: "FUNITNAME",
width: 150,
formatNum: false,
listenerClick: true,
},
],
currentNo: "", // 拣货单号 ORY0323000001
ifSeed: true, // 是否播种
dialogShow: false, // 显示弹窗
// 扫描 拣货容器号
pickDockerNo: "",
// 容器内码
dockerId: "",
companyId: "", // 组织id
type: 1, // 1: 销售, 2: 生产,
ifpickDockerConfirm: false
}
},
onLoad(e) {
// console.log("页面参数", e);
this.currentNo = e.no;
this.ifSeed = e.ifSeed === "1"; // 1 是播种
this.companyId = e.companyId;
this.type = Number(e.type)
this.navInfo[1] = this.type === 1 ? '销售拣货' : '生产拣货'
this.ifpickDockerConfirm = false;
if (this.currentNo) {
// 从上一个页面传过来的 信息,
// 在mounted 里从缓存里拿
// this.getTaskDetail();
}
},
created() {
this.ifpickDockerConfirm = false;
this.baseTableData = this.$store.state.currentPickArr;
this.baseTableData.forEach((item,index) => {
// 序号处理
item.INDEX = index+1;
})
// console.log('mounted', this.baseTableData)
},
mounted() {
this.ifpickDockerConfirm = false;
},
components: {
opsoftDialogNotice
},
methods: {
dialogNoticeConfirmClick(){
this.showDialog = false;
},
dialogNoticeProps(err,type){
err = errorStrUntil.handle(err);
this.showDialog = true;
this.dialogNoticeType = 'error';
this.dialogNoticeTitle = '异常提示';
if(type=='success'){
this.dialogNoticeType = 'success';
this.dialogNoticeTitle = '执行成功';
}
this.dialogNoticeContent = err;
},
rowClick(row) {
// console.log(row)
},
turnBack() {
// uni.navigateBack()
if (this.type === 1) {
uni.navigateTo({
url: `STK_PICKTAST`, // no docker number
})
} else {
uni.navigateTo({
url: `/pages/views/STK_PICKTAST_MO/STK_PICKTAST_MO`, // no docker number
})
}
},
startPick() {
this.dialogShow = true
},
// 不使用容器
noDocker() {
this.dialogShow = false
this.pickDockerNo = "";
// 是否分拨 影响分拣完的提示信息
let ifSeed = this.ifSeed === '是' ? '1' : '0';
if (this.type===1) {
uni.navigateTo({
url: `STK_SellPicking?companyId=${this.companyId}&ifSeed=${ifSeed}&type=${this.type}`, // no docker number
})
} else {
// 生产
uni.navigateTo({
url: `/pages/views/STK_PICKTAST/STK_SellPicking?companyId=${this.companyId}&ifSeed=${ifSeed}&type=${this.type}`, // no docker number
})
}
},
// 使用容器
useDocker() {
// 判断拣货容器号有值 且已经触发扫描或者回车
if (this.pickDockerNo && this.ifpickDockerConfirm) {
let no = this.pickDockerNo
this.dialogShow = false;
this.pickDockerNo = "";
let ifSeed = this.ifSeed === '是' ? '1' : '0';
if (this.type === 1) {
uni.navigateTo({
url: `STK_SellPicking?dockerNo=${no}&companyId=${this.companyId}&dockerId=${this.dockerId}&ifSeed=${ifSeed}&type=${this.type}`, // docker number
})
} else {
uni.navigateTo({
url: `/pages/views/STK_PICKTAST/STK_SellPicking?dockerNo=${no}&companyId=${this.companyId}&dockerId=${this.dockerId}&ifSeed=${ifSeed}&type=${this.type}`, // docker number
})
}
} else if (this.pickDockerNo && this.ifpickDockerConfirm === false) {
uni.showToast({
title: "填完容器号后请回车",
icon: "none",
// duration: 2000
})
}else {
uni.showToast({
title: "请扫描拣货容器号",
icon: "none",
// duration: 2000
})
}
},
// 容器扫描
scanEvent() {
uni.scanCode({
success: (res) => {
this.pickDockerNo = res.result;
this.confirmEvent()
}
})
},
// 容器回车
confirmEvent() {
if (!this.pickDockerNo) {
uni.showToast({
title: "请扫描拣货容器号",
icon: "none",
})
this.ifpickDockerConfirm = false;
return
}
uni.showLoading({
title: "加载中",
mask: true
})
// https://www.tapd.cn/36031001/markdown_wikis/show/#1136031001001000916
this.$request.get('/PickInventory/GetContainerInfo', {
params: {
companyId: this.companyId,
containerNo: this.pickDockerNo,
}
}).then((res) => {
uni.hideLoading()
uni.showToast({
title: '容器扫描成功!',
icon: 'none',
})
this.dockerId = res.TaskContainer.FINTERID // 暂时只需要容器内码
this.ifpickDockerConfirm = true;
// return Promise.resolve()
// return new Promise((resolve)=>{ resolve()})
}).catch(err => {
this.ifpickDockerConfirm = false;
uni.hideLoading();
this.dialogNoticeProps(err,'error')
})
},
},
watch:{
pickDockerNo() {
this.ifpickDockerConfirm = false;
console.log('watch change')
}
}
}
</script>
<style scoped lang="scss">
$pagePadding: 20px;
$primaryColor: #4662ff; // 按钮颜色
.pickPage {
background-color: #f2f2f2;
height: 100%;
display: flex;
flex-direction: column;
}
.nav {
display: flex;
justify-content: space-between;
align-items: center;
height: 60rpx;
padding: 0 $pagePadding;
background-color: #fff;
.nav-left {
display: flex;
}
.nav-back {
color: #02a7f0;
}
}
.content {
margin: 0 $pagePadding;
flex: 1;
position: relative;
}
.scan {
display: flex;
justify-content: space-around;
align-items: center;
height: 80rpx;
width: 100%;
margin-top: 30rpx;
margin-bottom: 30rpx;
.scan-left {
// font-size: 18px;
// font-weight: 600;
flex-grow: 0;
margin-right: 20rpx;
}
.scan-right {
// font-size: 16px;
// flex-grow: 1;
}
.scan-input {
// width: 100%;
padding-left: 34rpx;
height: 80rpx;
border: 1px solid #fff;
border-radius: 34rpx;
background-color: #fff;
}
}
.currentTask-top {
background-color: #fff;
height: 40px;
line-height: 40px;
padding-left: 10px;
font-weight: 600;
border-radius: 4px;
}
.taskTable {
margin-top: 8rpx;
margin-bottom: 8rpx;
// height:100%;
// max-height: 600px;
background-color: #fff;
position: relative;
.baseTable {
// position: absolute;
// bottom: 10px;
// :deep(.z-table-container-row)
.z-table-container-row {
background-color: red !important;
}
.z-table-container-row .z-table-container-col {
color: red;
}
}
}
.pickButton {
position: absolute;
height: 100rpx;
width: 60%;
left: 50%;
transform: translateX(-50%);
bottom: 30px;
border: 1px solid #fff;
border-radius: 16rpx;
text-align: center;
line-height: 100rpx;
background-color: $primaryColor;
color: #fff;
}
.opsoft-card-dialog {
position: fixed;
margin: auto auto;
width: 550rpx;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
min-height: 200px;
background-color: #fff;
border-radius: 16px;
/* width: 434.78rpx; */
display: flex;
flex-direction: column;
justify-content: space-between;
.opsoft-card-title {
text-align: left;
padding: 0 30rpx;
height: 72.46rpx;
// line-height: 72.46rpx;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid #d7d7d7;
.text {
font-size: 32.61rpx;
}
}
.opsoft-card-content {
margin: 10px;
font-size: 25.36rpx;
.box {
border: 1px solid #d7d7d7;
text-align: center;
height: 150rpx;
line-height: 150rpx;
// color: #d7d7d7;
display: flex;
justify-content: center;
align-items: center;
.img {
width: 60rpx;
height: 60rpx;
}
}
}
.opsoft-card-footer {
display: flex;
// flex: 1;
justify-content: space-around;
margin-bottom: 15rpx;
.button {
// width: 50%;
padding: 0 15rpx;
text-align: center;
height: 72.46rpx;
line-height: 66.23rpx;
border-radius: 0;
background-color: $primaryColor;
color: #fff;
border-radius: 15rpx;
// border: 0.5px solid rgba(235, 237, 240, 1);
font-family: 思源黑体;
}
}
}
.card-shadow {
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.12);
}
</style>