货无忧
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

546 lines
12 KiB

2 years ago
<template>
<u-navbar title="下架扫描" bgColor='#D3832A' leftIconColor='#ffffff' titleStyle='color:#ffffff' placeholder
:autoBack="true" leftIconSize='35'></u-navbar>
<image mode="widthFix" class="bgimg" src="/pagesHome/static/bgby.png"></image>
<!-- <view class="scanqcview">
<image src="/pagesHome/static/scanqc.png"></image>
<view>请直接扫描库位码</view>
</view> -->
<view class="viewbx" v-if="pageType=='1'">
<view class="vwtybx1">
<view>
<view>
<image src="/pagesHome/static/tuoicon.png"></image>
<view>托盘码</view>
</view>
<view>
<input placeholder="扫码或输入托盘码" v-model="trayCode"/>
</view>
</view>
<!-- <view>
<view>
<image src="/pagesHome/static/topicons.png"></image>
<view>托盘编号</view>
</view>
<view>
汇通龙泉001
</view>
</view> -->
<view>
<view>
<image src="/pagesHome/static/kuicon.png"></image>
<view>库位码</view>
</view>
<view>
汇通龙泉001
</view>
</view>
</view>
<!-- <view class="numvie">
<view>数量</view>
<view>20</view>
</view> -->
</view>
<view class="tbchec">
<view :class="!isallcheck?'':'xz'" @click="allquanxuan">
<image :src="!isallcheck?'/pagesHome/static/downnocheck.png':'/pagesHome/static/downcheck.png'"></image>
<view>全选</view>
</view>
<!-- <view>
<image src="/pagesHome/static/downnocheck.png"></image>
<view>全选</view>
</view> -->
</view>
<scroll-view scroll-y="true" class="scvorder" :style="{'--height':pageType=='1'?'50vh':'65vh'}">
<view class="itembox" v-for="(item,index) in datalist">
<view class="topon1" @click="checkite(item)">
<view>
<image :src="checkdatalist.indexOf(item)==-1?'/pagesHome/static/downnocheck.png':'/pagesHome/static/downcheck.png'"></image>
<view>{{index+1}}</view>
</view>
</view>
<view class="topon2" v-if="item?.associationId">
<image src="/pagesHome/static/checi.png"></image>
<view>订单号{{item?.associationId}}</view>
</view>
<view class="topon2" v-if="item?.associationValue">
<image src="/pagesHome/static/checi.png"></image>
<view>包装号{{item?.associationValue}}</view>
</view>
<view class="topon2" v-if="item?.orderCode">
<image src="/pagesHome/static/checi.png"></image>
<view>订单号{{item?.orderCode}}</view>
</view>
<view class="topon2" v-if="item?.orderPackageCode">
<image src="/pagesHome/static/checi.png"></image>
<view>包装号{{item?.orderPackageCode}}</view>
</view>
<view class="topon2" v-if="item?.trayCode">
<image src="/pagesHome/static/checi.png"></image>
<view>托盘码{{item?.trayCode}}</view>
</view>
</view>
</scroll-view>
<view class="butys">
<view class="qut">取消</view>
<view class="conf" @click="downs">确认下架</view>
</view>
</template>
<script lang="ts" setup>
import {
warehouseUpdownTypedownScanPackage,
warehouseUpdownTypeupShelfScanAllocation,
warehouseUpdownTypedownPackage,
warehouseUpdownTypeupShelfScanGoods,
warehouseUpdownTypedownTrayCode,
warehouseUpdownTypedownZeroOrder,
warehouseUpdownTypedownStock,
} from '@/api/user.js'
import {
onLoad,
onShow,
onHide,
onUnload
} from '@dcloudio/uni-app'
import { reactive, toRefs, watchEffect } from "vue";
const details=reactive({
scantype:1,
mergeTray:'',
newmergeTray:'',
scancode:'',
pageType:1,
datalist:[],
checkdatalist:[],
isallcheck:false,
resdata:{} as any,
trayCode:'',
})
onLoad((op) => {
// details.upshelfScanType = op.type
details.pageType=op.type
// details.scancode = '23072506670-2'
details.scancode = '1687644549722112002'
// details.scancode = 'HT20230800001'
scandata()
// setTimeout(()=>{
// details.scancode='23072506670-2'
// scandata()
// },4500)
uni.$on('scancodedate', function (code) {
if (code) {
// console.log(code);
details.scancode = code
scandata()
}
})
})
watchEffect(()=>{
if(details.datalist.length==details.checkdatalist.length){
details.isallcheck=true
}else{
details.isallcheck=false
}
})
async function scandata(){
// let res=await
let res=null
let data=null;
switch (Number(details.pageType)){
case 1:
data={
upshelfScanType:'4',
code:details.scancode
}
res=await warehouseUpdownTypeupShelfScanGoods(data)
if(res.code==200){
details.datalist=details.datalist.concat(res.data)
details.checkdatalist=details.checkdatalist.concat(res.data)
details.trayCode=details.scancode
}else {
uni.showToast({
title:res.msg,
icon:'none'
})
}
break;
case 2:
data={
allocationId:details.scancode
}
res=await warehouseUpdownTypeupShelfScanAllocation(data)
if(res.code==200){
details.datalist=details.datalist.concat(res.data.list)
details.checkdatalist=details.checkdatalist.concat(res.data.list)
details.resdata=res.data
}else {
uni.showToast({
title:res.msg,
icon:'none'
})
}
break;
case 3:
data={
orderPackageCode:details.scancode
}
res=await warehouseUpdownTypedownScanPackage(data)
if(res.code==200){
details.datalist=details.datalist.concat([res.data])
details.checkdatalist=details.checkdatalist.concat([res.data])
}else {
uni.showToast({
title:res.msg,
icon:'none'
})
}
break;
case 4:
break;
case 5:
break;
}
}
async function downs(){
let res=null
let data=null;
let list=[]
switch (Number(details.pageType)){
case 1:
data={
trayCode:details.trayCode
}
res=await warehouseUpdownTypedownTrayCode(data)
break;
case 2:
data={
allocationId:details.resdata.allocationId
}
res=await warehouseUpdownTypeupShelfScanAllocation(data)
break;
case 3:
list=[]
details.checkdatalist.map(item=>{
list.push({
orderPackageCode:item.associationValue
})
})
data={
upShelfPackageList:list,
}
res=await warehouseUpdownTypedownPackage(data)
break;
case 4:
data={
allocationId:details.resdata.allocationId
}
res=await warehouseUpdownTypedownStock(data)
break;
case 5:
list=[]
data={
upShelfZeroOrderList:details.resdata.allocationId
}
res=await warehouseUpdownTypedownZeroOrder(data)
break;
}
if(res.code==200){
uni.showToast({
title:'下架成功',
icon:'none'
})
}else {
uni.showToast({
title:res.msg,
icon:'none'
})
}
}
function checkite(item){
if(details.checkdatalist.indexOf(item)==-1){
details.checkdatalist.push(item)
}else{
details.checkdatalist.splice(details.checkdatalist.indexOf(item),1)
}
}
function allquanxuan(){
if(details.datalist.length==details.checkdatalist.length){
details.checkdatalist=[]
}else{
details.datalist.map(item=>{
if(details.checkdatalist.indexOf(item)==-1){
details.checkdatalist.push(item)
}
})
}
}
const {
trayCode,
isallcheck,
checkdatalist,
pageType,
datalist
}=toRefs(details)
</script>
<style lang="scss">
.butys{
display: flex;
align-items: center;
margin-top: 20upx;
justify-content: space-around;
>.conf{
width: 320upx;
height: 100upx;
border-radius: 20upx;
display: flex;
align-items: center;
justify-content: center;
font-size: 32upx;
font-weight: 400;
color: #FFFFFF;
background-color: #D3832A;
}
>.qut{
width: 320upx;
height: 100upx;
border-radius: 20upx;
display: flex;
align-items: center;
justify-content: center;
font-size: 32upx;
font-weight: 400;
color: #5A6875;
background-color: #FFFFFF;
}
}
.scvorder{
width: 100%;
margin-top: 20upx;
height: var(--height);
.itembox{
width: 686upx;
border-radius: 20upx;
padding: 0 20upx;
box-sizing: border-box;
background-color: #ffffff;
margin: auto;
margin-bottom: 20upx;
.topon1:nth-last-child(1){
border-bottom: 4upx solid #EEEEEE00 !important;
}
>.topon1{
display: flex;
align-items: center;
justify-content: space-between;
padding: 20upx 10upx;
box-sizing: border-box;
border-bottom: 4upx solid #EEEEEE;
&:nth-last-child(1){
border-bottom: 4upx solid #EEEEEE00 !important;
}
>view:nth-of-type(1){
display: flex;
align-items: center;
>image{
width: 48upx;
height: 48upx;
margin-right: 30upx;
}
>view{
width: 50rpx;
height: 50rpx;
background: #178AF220;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 28upx;
font-weight: 500;
color: #178AF2;
}
}
>view:nth-of-type(2){
display: flex;
align-items: center;
>view{
width: 136upx;
height: 64upx;
border-radius: 8upx;
display: flex;
align-items: center;
justify-content: center;
font-size: 28rpx;
font-weight: 400;
color: #90A0AF;
background-color: #F5F5F6;
margin-right: 20upx;
&:nth-last-child(1){
margin-right: 0upx;
}
}
.xzc{
background-color: #178AF2 !important;
color: #ffffff !important;
}
.xze{
background-color: #F8544B !important;
color: #ffffff !important;
}
>image{
width: 64upx;
height: 64upx;
}
}
}
>.topon2{
display: flex;
align-items: center;
justify-content: flex-start;
padding: 20upx 10upx;
box-sizing: border-box;
border-bottom: 4upx solid #EEEEEE;
>image{
width: 64upx;
height: 64upx;
margin-right: 20upx;
}
>view{
font-size: 28upx;
font-weight: 400;
color: #020B18;
}
}
}
}
.tbchec{
width: 686rpx;
height: 80rpx;
padding: 16upx 36upx;
box-sizing: border-box;
margin: auto;
margin-top: 20upx;
display: flex;
align-items: center;
justify-content: flex-start;
position: relative;
background-color: #ffffff;
border-radius: 20upx;
.xz{
color: #D3832A !important;
}
>view{
display: flex;
align-items: center;
justify-content: center;
font-size: 28rpx;
font-weight: 400;
color: #90A0AF;
>image{
width: 48upx;
height: 48upx;
margin-right: 16upx;
}
}
}
.viewbx{
width: 686upx;
// height: 356upx;
background: #FFFFFF;
border-radius: 20upx;
position: relative;
padding: 10upx 20upx;
box-sizing: border-box;
margin: auto;
margin-top: 40upx;
.numvie{
display: flex;
align-items: center;
font-size: 28upx;
font-weight: 400;
color: #020B18;
padding: 30upx 0;
>view:nth-of-type(1){
width: 200upx;
display: flex;
align-items: center;
justify-content: center;
}
>view:nth-of-type(2){
}
}
.vwtybx1{
display: flex;
flex-direction: column;
align-items: flex-start;
padding: 20upx 0;
box-sizing: border-box;
// border-bottom: 4upx solid #EEEEEE;
// &:nth-last-child(1){
// border-bottom: none;
// }
>view{
display: flex;
align-items: center;
margin-bottom: 20upx;
&:nth-last-child(1){
margin-bottom: 0upx;
}
>view:nth-of-type(1){
display: flex;
align-items: center;
width: 200upx;
font-size: 28upx;
font-weight: 400;
color: #020B18;
>image{
width: 48upx;
height: 48upx;
margin-right: 15upx;
}
}
>view:nth-of-type(2){
font-size: 28upx;
font-weight: 400;
color: #020B18;
>input{
flex: 1;
}
}
}
}
}
.bgimg {
position: absolute;
left: 0;
top: 0;
width: 100%;
}
.scanqcview {
display: flex;
align-items: center;
justify-content: center;
position: relative;
margin-top: 10upx;
>image {
width: 72upx;
height: 72upx;
margin-right: 16upx;
}
>view {
font-size: 32upx;
font-weight: 400;
color: #FFFFFF;
}
}
</style>