<template>
|
<view class="overflow" style="padding-bottom:300px">
|
<!-- 顶部 -->
|
<cu-custom bgColor="bg-white" :isBack="true">
|
<block slot="backText"></block>
|
<block slot="content">
|
<span v-if="orderType==24">STO</span>
|
<span v-if="orderType==27">领用单</span>
|
<span v-if="orderType=='' ">DO</span>
|
发货
|
</block>
|
</cu-custom>
|
<!-- 操作人 -->
|
<view class="flex justify-end align-center padding_right30rpx padding_top12rpx">
|
<text class="fontSize12rpx"> 操作人:{{operator}} </text>
|
</view>
|
<!-- 遮挡层 -->
|
<modal-code ref="resmodal" :rescode='rescode' :resmessage='resmessage' />
|
<u-select v-model="containerVisible" :list="containerList" @confirm="containerConfirm"></u-select>
|
<u-select v-model="containerVisibleDo" :list="containerListDo" @confirm="containerConfirmDo"></u-select>
|
<view>
|
<u-form labelPosition="top" :model="warehouse" ref="warehouseRef">
|
<u-row class="border_bottom margin_top10rpx padding10 box200" style="background-color: #fff;">
|
<u-col span="10">
|
<u-form-item label="单号:" prop="DoOrderNo" required style="font-size: 16px;font-weight: bold;padding: 0 0 5px;">
|
<u-input v-model.trim="warehouse.DoOrderNo" placeholder="请录入或扫码"
|
class="width padding_left25rpx"
|
:focus="true"
|
style="margin-left: 15px;font-size: 18px;"
|
@confirm="orderBlurDo" >
|
</u-input>
|
</u-form-item>
|
</u-col>
|
<u-col span="2" @tap="containerFocusDo" >
|
<br/>
|
<span class="fontSize15rpx">选择</span>
|
<u-icon name="arrow-right" size="14" class="fontSize15rpx"></u-icon>
|
</u-col>
|
</u-row>
|
|
<u-row class="border_bottom margin_top10rpx padding10 box200" style="background-color: #fff;">
|
<u-col span="10">
|
<u-form-item label="取货波次号:" prop="OrderNo" required style="font-size: 16px;font-weight: bold;padding: 0 0 5px;">
|
<u-input v-model.trim="warehouse.OrderNo" placeholder="请录入或扫码"
|
class="width padding_left25rpx"
|
:focus="true"
|
style="margin-left: 15px;font-size: 18px;"
|
@confirm="orderBlur" >
|
</u-input>
|
</u-form-item>
|
</u-col>
|
<u-col span="2" @tap="containerFocus" >
|
<br/>
|
<span class="fontSize15rpx">选择</span>
|
<u-icon name="arrow-right" size="14" class="fontSize15rpx"></u-icon>
|
</u-col>
|
</u-row>
|
</u-form>
|
<view scroll-y="true" v-show="singlist.length > 0" class="lineht_sm2">
|
<view :show="item.show" :index="eindex" v-for="(item, eindex) in singlist" :key="eindex" :options="options" class="margin_top10rpx">
|
<view class="item u-border-bottom">
|
<!-- 此层wrap在此为必写的,否则可能会出现标题定位错误 -->
|
<view class="title-wrap">
|
<view :key="eindex+'singlist'" :class="item.cardNum?'bd-ffe6c9':item.edit?'clickactive':''"
|
class="fontSize30rpx width margin_auto background_fff padding10 border_radius relative box_sizing transition">
|
<u-row>
|
<u-col span="12" class="flex" style="align-items: flex-start;">
|
<view style="background-color: #f18202;color: #fff;border-radius: 50%;width: 20px;height: 20px;line-height: 20px;text-align: center;">
|
{{eindex+1}}
|
</view>
|
<view class="color_f18202 padding_left10rpx" style="flex: 1;word-break: break-all;">
|
{{item.materialCode}}({{item.materialName}})
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="12">
|
<view class="text06" >
|
取货波次号:{{item.orderNo}}
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="6">
|
<view class="text06" >
|
分拣总需求数:{{item.quantity}}
|
</view>
|
</u-col>
|
<u-col span="6">
|
<view class="text06" >
|
分拣完成数:{{item.completeQuantity}}
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="12">
|
<view class="text06" >
|
可发货数量:{{item.deliverQuantity}}
|
</view>
|
</u-col>
|
</u-row>
|
</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
|
<view v-show="showImgBtn"
|
class="width fixed bottom140 margin_auto background_fff padding15 border_radius margin_bottom10rpx relative box_sizing transition">
|
<view class="" style="width: 140px;height: 140px;border: 1px dashed #aaaaaa;position: relative;">
|
<image :src="image" mode="" @click="imgClick(image)" style="width: 100%;height: 100%;"></image>
|
</view>
|
<u-icon @click="delimage" name='close-circle-fill' color='red' size='60' v-if="image!==''"
|
style='position: absolute;left:200rpx;top: 20rpx;'>
|
</u-icon>
|
|
<view style="color: #aaaaaa;" v-if="image==''">
|
<view class="fontSize32rpx" @click='upload' style="position: absolute;left: 40px;top: 80px;">
|
<text style='position: absolute;left: 19px; top: -55px;font-size: 60px;'> + </text>
|
<text style='margin-left: 14px;'>选择图片</text>
|
</view>
|
</view>
|
|
</view>
|
<button-modal :issueShow='true' issueTitle="上传图片" subTitle='确认' restTiltle='重置' @reset='rest'
|
@submit='submit' @issue="showImg"/>
|
|
</view>
|
<u-popup v-model="detailshow" border-radius="14" @close="detailshow=false" mode="bottom">
|
<h2 class="text_align_center padding_bottom18 padding15">物料信息</h2>
|
<view class="line flex justify-between">
|
<text class="text-gray">打印张数</text>
|
<text>
|
<u-input v-model.trim="contLabel" placeholder="请输入打印张数"
|
class="width"
|
@focus="contLabel=''"
|
style="font-size: 36rpx;text-align: right;">
|
</u-input>
|
</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">打印发货数量</text>
|
<text>
|
<u-input v-model.trim="ermNum" placeholder="请输入打印发货数量"
|
class="width"
|
@focus="ermNum=''"
|
style="font-size: 36rpx;text-align: right;">
|
</u-input>
|
</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">本次发货数量</text>
|
<text>{{materlist.deliverQuantity}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">物料编号</text>
|
<text>{{materlist.materialCode}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">物料名称</text>
|
<text>{{materlist.materialName}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">批次</text>
|
<text>{{materlist.batchNo}}</text>
|
</view>
|
<view class="margin_top140rpx">
|
<button-modal :cleaningShow='true' allTitle='蓝牙打印' cleaningTitle='斑马打印' @allsubmit="init(1)" @submit='init(2)'/>
|
</view>
|
</u-popup>
|
</view>
|
</template>
|
|
<script>
|
import ButtonModal from '../../components/buttonModal.vue'
|
import ModalCode from '../../components/ModalCode.vue'
|
import {getOutMaterial,addDeliverRecord,getOrderMaterial,getAllOrder ,deletePicture ,getOrderMaterialDo ,getAllOrderDelivery} from '../../api/deliver.js'
|
import { pathToBase64, base64ToPath } from 'image-tools'
|
import {getAttrValue} from '@/utils/tool.js'
|
import {translateapp , translateImg} from '@/utils/compress.js'
|
import printComp from '@/mixins/printDoLabel.js'
|
import printBanma from '@/mixins/printBanma.js'
|
|
export default {
|
mixins: [printComp,printBanma],
|
data() {
|
return {
|
containerVisibleDo: false,
|
containerListDo: [],
|
containerVisible: false,
|
containerList: [],
|
rescode: 0,
|
resmessage: "",
|
singlist: [], //物料详情
|
materlist: {}, //物料详情数据
|
warehouse: {
|
MaterialCode: '',
|
OrderNo: '',
|
DoOrderNo:''
|
},
|
warehouseRules: {
|
OrderNo: [{
|
required: true,
|
message: '取货波次号不能为空',
|
trigger: 'blur'
|
}],
|
MaterialCode: [{
|
required: true,
|
message: '物料编号不能为空',
|
trigger: 'blur'
|
}]
|
},
|
options: [{
|
text: '打印',
|
style: {
|
backgroundColor: '#fc9f35'
|
}
|
}
|
],
|
operator: '',
|
image: '', //当前显示的图片地址
|
action: this.$myHOST + '/delivery/record/uploadImages',
|
fileList: [],
|
detailshow: false,
|
contLabel:1, //打印张数
|
ermNum:'',
|
timer:null,
|
printflag:false,
|
arrPt:[],
|
showImgBtn:false,
|
orderType:''
|
};
|
},
|
components: {
|
ButtonModal,
|
ModalCode
|
},
|
onLoad(option) {
|
if(option.orderType) {
|
this.orderType = option.orderType;
|
}
|
},
|
onReady() {
|
this.$refs.warehouseRef.setRules(this.warehouseRules)
|
},
|
mounted() {
|
this.operator = JSON.parse(uni.getStorageSync('userInfo')).name
|
},
|
methods: {
|
//DO容器选择
|
containerConfirmDo(context){
|
this.warehouse.DoOrderNo = context[0].value
|
this.orderBlurDo()
|
},
|
//DO容器聚焦事件
|
containerFocusDo() {
|
getAllOrderDelivery({
|
'orderType':this.orderType
|
}).then(res => {
|
this.containerListDo = res.data.reduce((curr,item) => {
|
if(item.clientName==null){
|
item.clientName = ''
|
}
|
curr.push({
|
label: item.deliveryNo + '; 时间:' + item.deliveryNoCreateTime + '; 客户:' + item.clientName,
|
value: item.deliveryNo
|
})
|
return curr;
|
},[])
|
this.containerVisibleDo = true;
|
})
|
},
|
// 1 DO单号
|
orderBlurDo(){
|
if(this.warehouse.DoOrderNo == ''){
|
return
|
}
|
this.warehouse.OrderNo = ''
|
this.singlist = []
|
},
|
//容器选择
|
containerConfirm(context){
|
this.warehouse.OrderNo = context[0].value
|
this.orderBlur()
|
},
|
|
//容器聚焦事件
|
containerFocus() {
|
if(this.warehouse.DoOrderNo ==''){
|
this.$u.toast('请选择DO单号')
|
return
|
}
|
console.log("containerFocus")
|
getAllOrder({
|
'OrderNo':this.warehouse.DoOrderNo,
|
'DeliveryNo':this.warehouse.DoOrderNo
|
}).then(res => {
|
this.containerList = res.data.reduce((curr,item) => {
|
curr.push({
|
label: item,
|
value: item
|
})
|
return curr;
|
},[])
|
this.containerVisible = true;
|
})
|
|
},
|
|
|
// 2 取货波次号
|
orderBlur(){
|
if(this.warehouse.DoOrderNo == ''){
|
return
|
}
|
let param = {
|
'OrderNo':this.warehouse.OrderNo,
|
'DeliveryNo':this.warehouse.DoOrderNo,
|
'orderType':this.orderType
|
}
|
// 0214
|
console.log("orderBlur")
|
this.singlist = [];
|
getOrderMaterial(param).then(res => {
|
if(res.code==200){
|
this.singlist = res.data;
|
}
|
|
})
|
},
|
|
|
//物料输入框失焦事件
|
materialBlur() {
|
this.$refs.warehouseRef.validate(vali => {
|
if(vali) {
|
this.getOrderAndMateial()
|
}else {
|
this.rescode = 400
|
this.resmessage = `出库单号和物料编号不能为空`
|
this.$refs.resmodal.show = true
|
}
|
})
|
},
|
//获取信息
|
getOrderAndMateial(){
|
getOutMaterial({
|
...this.warehouse,
|
'orderType':this.orderType
|
}).then(res => {
|
if(res.data.materialCode != null) {
|
this.singlist = [];
|
res.data.thisQuantity = res.data.quantity - res.data.completeQuantity;
|
this.singlist.push(res.data);
|
}else {
|
this.rescode = 400
|
this.resmessage = `当前出库单下找不到该物料${this.warehouse.MaterialCode}`
|
this.$refs.resmodal.show = true
|
}
|
})
|
},
|
//发货数输入
|
changeNum(val) {
|
if(!val.thisQuantity) {
|
this.rescode = 400
|
this.resmessage = '本次发货数不能为空'
|
this.$refs.resmodal.show = true
|
}
|
if(!val.thisQuantity <= 0){
|
this.rescode = 400
|
this.resmessage = '本次发货数不能小于等于0'
|
this.$refs.resmodal.show = true
|
}
|
let num1 = Number(val.quantity - val.completeQuantity).toFixed(3) //必须保留3位小数 -否则会造成剩余物料是小数的时候,无法收货
|
if (Number(val.thisQuantity).toFixed(3) > Number(num1) ) {
|
val.uncollectedQuantity = 0;
|
this.rescode = 400
|
this.resmessage = '本次发货数不能大于总的需求数减去已发货数'
|
this.$refs.resmodal.show = true
|
}
|
},
|
//确认收货
|
submit() {
|
if(this.warehouse.OrderNo == 0) {
|
this.rescode = 400
|
this.resmessage = '取货波次号不能为空'
|
this.$refs.resmodal.show = true
|
return
|
}
|
if(this.singlist.length == 0) {
|
this.rescode = 400
|
this.resmessage = '发货详情不能为空'
|
this.$refs.resmodal.show = true
|
return
|
}
|
if(this.fileList.length<=0){
|
this.rescode = 400
|
this.resmessage = '请上传图片';
|
this.$refs.resmodal.show = true
|
return
|
}
|
this.singlist.forEach((item)=>{
|
item.img = this.fileList[1]
|
})
|
console.log(this.singlist)
|
uni.showModal({
|
title: '提示',
|
content: '是否确认发货?',
|
showCancel: true,
|
cancelColor: '#333333',
|
success: (res => {
|
if (res.confirm) {
|
addDeliverRecord(this.singlist).then((res) => {
|
this.rescode = 200
|
this.resmessage = '发货成功'
|
this.$refs.resmodal.show = true
|
this.rest(1)
|
})
|
|
} else if (res.cancel) {
|
|
}
|
})
|
});
|
|
},
|
//重置
|
rest(parm) {
|
this.warehouse.DoOrderNo ='';
|
this.warehouse.OrderNo = '';
|
this.warehouse.MaterialCode = '';
|
this.singlist = [];
|
if(parm!=1 && this.fileList.length>0){
|
this.delimage()
|
}
|
this.fileList = []
|
this.image = ''
|
},
|
// 上传图片 - 因需要压缩图片 仅支持app上传图片
|
upload() {
|
this.fileList = []
|
uni.chooseImage({
|
sourceType: ["camera", "album"],
|
sizeType: "original",
|
count: 1,
|
success: (res) => {
|
this.image = res.tempFilePaths[0]
|
console.log(res.tempFilePaths)
|
translateapp(res.tempFilePaths[0], 80, imgUrl => {
|
let imgArr = [imgUrl]
|
imgArr.forEach(item => this.fileList.push({
|
uri: item
|
}))
|
console.log(this.fileList)
|
uni.uploadFile({
|
url: this.action,
|
files: this.fileList,
|
fileType: 'image',
|
success: (res) => {
|
if(res.statusCode==200){
|
const result = JSON.parse(res.data)
|
if (result.data == null || result.data == '') {
|
this.image = ''
|
this.fileList = []
|
this.$u.toast('图片上传服务器失败')
|
return
|
}
|
this.fileList.push(result.data)
|
}else{
|
this.$u.toast('图片上传失败')
|
this.fileList = []
|
this.image = ''
|
}
|
}
|
})
|
})
|
}
|
})
|
},
|
delimage() {
|
if(this.fileList.length<=0){
|
return
|
}
|
if(!this.fileList[1]){
|
this.fileList = [];
|
this.image = '';
|
return
|
}
|
deletePicture({
|
'filepath':this.fileList[1]
|
}).then(res => {
|
if(res.code == 200) {
|
this.image = ''
|
this.$u.toast('移除图片成功')
|
this.fileList = []
|
}else {
|
this.rescode = 400
|
this.resmessage = `删除图片失败`
|
this.$refs.resmodal.show = true
|
}
|
})
|
},
|
imgClick(url) {
|
if(this.image!==''){
|
var imgArr = [];
|
imgArr.push(url)
|
//预览图片
|
uni.previewImage({
|
urls: imgArr,
|
current: imgArr[0]
|
});
|
}
|
},
|
//监听原生返回键
|
onBackPress(e) {
|
this.delimage()
|
},
|
//打印
|
init(param) {
|
const arr = ['wareMaterialCode','uncollectedQuantity'];
|
const arrzw = ['物料编号','实际发货数']
|
let isAllow = ''
|
Object.keys(this.materlist).forEach(item => {
|
if(arr.includes(item)) {
|
if(!this.materlist[item]) {
|
isAllow = arr.indexOf(item)
|
// this.rescode = 400
|
// this.resmessage = `${item}为空,不能继续打印`
|
// this.$refs.resmodal.show = true
|
return
|
}
|
}
|
})
|
if(isAllow!=''){
|
this.detailshow = false
|
this.rescode = 400
|
this.resmessage = `${arrzw[isAllow]}为空,不能继续打印`
|
this.$refs.resmodal.show = true
|
return
|
}
|
|
if(!this.contLabel || !this.ermNum){
|
uni.showToast({
|
title: '数量不能为空且大于0',
|
icon: 'none'
|
})
|
return
|
}
|
this.materlist.supplier = this.materlist.supplier || ''
|
this.materlist.deliveryNo = this.warehouse.DoOrderNo || ''
|
this.materlist.completeQuantity = this.ermNum
|
this.arrPt = [this.materlist]
|
if(param==1){
|
this.printComp()
|
}else{
|
this.printBanma(0,2)
|
}
|
|
},
|
showImg(){
|
this.showImgBtn =!this.showImgBtn
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
</style>
|