<template>
|
<view class="overflow">
|
<cu-custom bgColor="bg-white" :isBack="true">
|
<block slot="backText">
|
</block>
|
<block slot="content">旧件收货</block>
|
</cu-custom>
|
<view class="flex justify-end align-center padding_right30rpx padding_top12rpx">
|
<text class="fontSize12rpx"> 操作人:{{operator}} </text>
|
</view>
|
<view class="text-bold width fontSize32rpx" style="padding: 10rpx 10rpx;background-color: #d6d6d6;">
|
<view class="flex justify-between align-center">
|
<text class="width23 padding10">收货单号</text>
|
<text>{{putCode}}</text>
|
</view>
|
</view>
|
<modal-code ref="resmodal" :rescode='rescode' :resmessage='resmessage' />
|
<view class="" v-if="renameFocus">
|
<u-form labelPosition="top" :model="warehouse" ref="warehouseRef">
|
<u-row class="border_bottom margin_top10rpx padding10" style="background-color: #fff;">
|
<u-col span="10">
|
<u-form-item label="物料编号:" prop="warehouseCode" required
|
style="font-size: 16px;font-weight: bold;padding: 0 0 10rpx;">
|
<input v-model="warehouse.warehouseCode" @focus="focu=true" placeholder="请录入或扫码"
|
@blur="getMaterialDetails" class="width padding_left25rpx"
|
style="font-weight: bolder;margin-left: 30rpx;">
|
</input>
|
<u-icon v-if="warehouse.warehouseCode && focu" @click="warehouse.warehouseCode=''"
|
name="close-circle-fill" color="#848484"></u-icon>
|
</u-form-item>
|
</u-col>
|
<u-col span="2">
|
<u-icon class="iconfont icon-saoma fontSize60rpx"></u-icon>
|
</u-col>
|
</u-row>
|
</u-form>
|
<scroll-view scroll-y="true">
|
<u-swipe-action :show="item.show" :index="eindex" v-for="(item, eindex) in singlist" :key="eindex"
|
@click="longpress" @open="open" @close='close' :options="options">
|
<view class="item u-border-bottom">
|
<!-- 此层wrap在此为必写的,否则可能会出现标题定位错误 -->
|
<view class="title-wrap">
|
<view :key="eindex+'singlist'" :class="item.cardNum?'bd-ffe6c9':item.edit?'clickactive':''"
|
class="fontSize32rpx width margin_auto background_fff padding15 border_radius margin_bottom10rpx relative box_sizing transition">
|
<u-row>
|
<u-col span="12" class="flex">
|
<view class="flex justify-center align-center"
|
style="background-color: #f18202;color: #fff;border-radius: 50vh;width: 20px;height: 20px;">
|
{{eindex+1}}
|
</view>
|
<view class="color_f18202 padding_left10rpx">
|
{{item.code}}
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="12">
|
<view class="" style="padding: 10rpx 0 10rpx 45rpx;color: #808080;">
|
名称:{{item.name}}
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="6">
|
<input disabled="" class="border_bottom_f18202 width45 fontSize32rpx text-left"
|
style="margin:10rpx 0 10rpx 45rpx;" v-model="item.unit" placeholder="单位" />
|
</u-col>
|
<u-col span="5">
|
<input
|
class="border_bottom_f18202 width text-left fontSize32rpx padding_left10rpx"
|
v-model="item.quantity" type="number" @focus='dc(item)'
|
@blur="changeNum(item)" placeholder="请输入收货数量" />
|
</u-col>
|
</u-row>
|
</view>
|
</view>
|
</view>
|
</u-swipe-action>
|
</scroll-view>
|
<u-popup v-model="detailshow" border-radius="14" @close="detailshow=false" mode="bottom">
|
<view class="pop">
|
<h2 class="text_align_center padding_bottom18 padding15">物料信息</h2>
|
<view class="line flex justify-between">
|
<text class="text-gray">物料编号</text>
|
<text>{{materlist.code}}</text>
|
</view>
|
|
<view class="line flex justify-between">
|
<text class="text-gray">物料大类</text>
|
<text>{{materlist.category}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">物料小类</text>
|
<text>{{materlist.wareMaterialTypeName}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">物料规格</text>
|
<text>{{materlist.specificationModel}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">长(mm)</text>
|
<text>{{materlist.long}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">宽(mm)</text>
|
<text>{{materlist.width}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">高(mm)</text>
|
<text>{{materlist.high}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">重量(kg)</text>
|
<text>{{materlist.weight}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">条码</text>
|
<text>{{materlist.barCode}}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">单位</text>
|
<text>{{materlist.unit}}</text>
|
</view>
|
<!-- <view class="line flex justify-between">
|
<text class="text-gray">送货数量</text>
|
<text>{{materlist.quantity}}</text>
|
</view> -->
|
</view>
|
<view class="margin_top140rpx">
|
<button-modal :subShow='true' garmenTitle='打印' @submit='print' @reset='rest' />
|
</view>
|
</u-popup>
|
<button-modal :empTytowerShow='true' cleaningTitle="重置" garmenTitle='下一步' @submit='next' @reset='rest' />
|
</view>
|
<view class="" v-else>
|
<scroll-view scroll-y="true" style="height: 440rpx;">
|
<!-- <view class="margin_top10rpx overflow_auto" style="height:calc(100% - 20rpx)"> -->
|
<view v-for="(item,eindex) in arr" :key="eindex" style="background-color: #fff;">
|
<u-row class="padding15">
|
<u-col span="6" class="flex">
|
<view class="flex justify-center align-center "
|
style="background-color: #f18202;color: #fff;border-radius: 50vh;width: 20px;height: 20px;">
|
{{eindex+1}}
|
</view>
|
<view class="padding_left10rpx color_f18202">
|
{{item.code}}
|
</view>
|
</u-col>
|
<u-col span="6" class="color_f18202" style="text-align: right;">
|
收货数量:{{item.quantity}}
|
</u-col>
|
</u-row>
|
<u-row class="padding15">
|
<u-col span="6" class="flex">
|
<view class="padding_left45rpx">
|
名称:{{item.name}}
|
</view>
|
</u-col>
|
<u-col span="6" class="" style="text-align: right;">
|
单位:{{item.unit}}
|
</u-col>
|
</u-row>
|
</view>
|
<!-- </view> -->
|
</scroll-view>
|
<view class="fontSize32rpx background_fff padding15">
|
<u-row>
|
<u-col span="6" class="text-gray">
|
本次收货总数量
|
</u-col>
|
<u-col span="6" class="font_weight_bold color_f18202" style="text-align: right;">
|
{{QuantityTotal}}
|
</u-col>
|
</u-row>
|
</view>
|
<!-- <view
|
class="width fixed bottom140 margin_auto background_fff padding15 border_radius margin_bottom10rpx relative box_sizing transition">
|
<u-upload :action="action" upload-text="送货单照片" :file-list="fileList1" @on-success="successPic"
|
@on-remove="remove">
|
</u-upload>
|
</view> -->
|
<view
|
class="width fixed bottom140 margin_auto background_fff padding15 border_radius margin_bottom10rpx relative box_sizing transition">
|
<view class="" style="width: 250rpx;height: 250rpx;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 class="" style="color: #aaaaaa;" v-if="image==''">
|
<u-icon name="plus" @click='upload' size='48' style='position: absolute;left: 120rpx;top: 100rpx;'>
|
</u-icon>
|
<text class="fontSize32rpx" style="position: absolute;left: 85rpx;top: 160rpx;">选择图片</text>
|
</view>
|
</view>
|
<button-modal :empTytowerShow='true' cleaningTitle="重置" garmenTitle='收货完成' @submit='submit'
|
@reset='reset' />
|
</view>
|
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import ButtonModal from '../../../components/buttonModal.vue'
|
import ModalCode from '../../../components/ModalCode.vue'
|
// import {
|
// getMaterial
|
// } from '../../../api/takeMaterial/order.js'
|
import {
|
getOrderNo,
|
getMaterialDetails
|
} from '../../../api/putIn/artificial.js'
|
import {
|
addConfirmReceipt
|
} from '../../../api/takeMaterial/order.js'
|
import {
|
getDate
|
} from '../../../utils/dateTime.js'
|
export default {
|
data() {
|
return {
|
renameFocus: true,
|
detailshow: false,
|
rescode: 0,
|
resmessage: "",
|
focu: false,
|
putCode: '',
|
fileList: [],
|
fileList1: [],
|
flag: true,
|
action: this.$myHOST + '/sysFileInfo/uploadImages',
|
image: '',
|
base: '',
|
singlist: [
|
// {
|
// id: 0,
|
// deliverDate: 1,
|
// WareMaterialCode: 930112020,
|
// name: 3,
|
// describe: 4,
|
// Category: '零件',
|
// MaterialTypeId: '主轴',
|
// MaterialTypeName: '水平仪',
|
// SpecificationModel: 'EM5BG 5X4P-16BK',
|
// Long: 9,
|
// Width: 10,
|
// High: 11,
|
// Weight: 12,
|
// PurchaseNo: 5530000622,
|
// BarCode: 920102,
|
// Quantity: 15,
|
// Company: 'EA',
|
// basicExpressInfoCode: 17,
|
// BasicExpressInfoName: 'xxxxx',
|
// DeliveryQuantity: 19,
|
// GoodsQuantity: 20,
|
// deliveryNo: 21,
|
// UncollectedQuantity: ''
|
// },
|
], //物料详情
|
arr: [],
|
materlist: {}, //物料详情数据
|
warehouse: {
|
warehouseCode: ''
|
},
|
warehouseRules: {
|
warehouseCode: [{
|
required: true,
|
message: '物料编号不能为空',
|
trigger: 'blur'
|
}]
|
},
|
options: [{
|
text: '详情',
|
style: {
|
backgroundColor: '#fc9f35'
|
}
|
},
|
{
|
text: '删除',
|
style: {
|
backgroundColor: '#fc4b4b'
|
}
|
}
|
],
|
operator: '',
|
QuantityTotal: '', //应收货总数
|
Datetime: getDate(),
|
};
|
},
|
components: {
|
ButtonModal,
|
ModalCode
|
},
|
onReady() {
|
this.$refs.warehouseRef.setRules(this.warehouseRules)
|
},
|
mounted() {
|
this.operator = JSON.parse(uni.getStorageSync('userInfo')).name
|
this.getOrderNo()
|
},
|
methods: {
|
//入库单号
|
getOrderNo() {
|
getOrderNo().then((res) => {
|
if (res.code == 200) {
|
this.putCode = res.data
|
} else {
|
this.$refs.resmodal.show = true
|
}
|
})
|
},
|
//物料查询
|
getMaterialDetails() {
|
this.$refs.warehouseRef.validate(valid => {
|
if (valid) {
|
setTimeout(() => {
|
this.focu = false
|
if (this.warehouse.warehouseCode !== '') {
|
let params = {
|
BarCode: this.warehouse.warehouseCode
|
}
|
getMaterialDetails(params).then((res) => {
|
if (res.code == 200) {
|
// this.singlist=res.data
|
res.data.forEach(item => {
|
this.singlist.push(item)
|
})
|
let deWeightThree = (val) => {
|
let map = new Map()
|
for (let item of val) {
|
if (!map.has(item.code && item.barNo)) {
|
map.set(item.code && item.barNo, item)
|
} else {
|
uni.showModal({
|
title: '提示',
|
content: '请勿重复扫描',
|
showCancel: false
|
})
|
}
|
}
|
return [...map.values()]
|
}
|
this.singlist = deWeightThree(this.singlist)
|
} else {
|
this.resmessage = res.message
|
this.rescode = res.code
|
this.$refs.resmodal.show = true
|
}
|
})
|
}
|
|
}, 200)
|
}
|
})
|
},
|
//删除详情
|
longpress(index, eindex) {
|
if (eindex == 1) {
|
this.singlist.splice(index, 1)
|
} else {
|
this.materlist = this.singlist[index]
|
this.detailshow = true
|
}
|
|
},
|
open(index) {
|
// 先将正在被操作的swipeAction标记为打开状态,否则由于props的特性限制,
|
// 原本为'false',再次设置为'false'会无效
|
this.singlist[index].cardNum = true;
|
this.singlist[index].show = true;
|
this.singlist.map((val, idx) => {
|
if (index != idx) this.singlist[idx].show = false;
|
})
|
this.$forceUpdate()
|
},
|
close(index) {
|
this.singlist[index].show = false;
|
this.singlist[index].cardNum = false;
|
this.$forceUpdate()
|
},
|
//编辑状态样式
|
dc(e) {
|
e.cardNum = true
|
this.$forceUpdate()
|
},
|
//改变组盘数量
|
changeNum(val) {
|
val.cardNum = false
|
if (val.quantity && val.quantity > 0) {
|
val.edit = true
|
this.$forceUpdate()
|
} else {
|
val.edit = false
|
this.$forceUpdate()
|
}
|
|
},
|
// successPic(data, index, lists, name) {
|
// // console.log(data)
|
// this.fileList.push(data.data)
|
// },
|
// //删除图片
|
// remove(index, lists, name) {
|
// this.fileList.splice(index, 1)
|
// },
|
upload() {
|
uni.chooseImage({
|
sourceType: ["camera", "album"],
|
sizeType: "original",
|
count: 1,
|
success: (res) => {
|
pathToBase64(res.tempFilePaths[0]).then(base64 => {
|
this.image = res.tempFilePaths[0]
|
uni.uploadFile({
|
url: this.action,
|
filePath: res.tempFilePaths[0],
|
formData: {
|
'images': JSON.stringify(base64)
|
},
|
success: (res) => {
|
var str = JSON.parse(res.data)
|
}
|
})
|
})
|
}
|
})
|
},
|
delimage() {
|
this.image = ''
|
this.$u.toast('移除成功')
|
},
|
imgClick(url) {
|
if (this.image !== '') {
|
var imgArr = [];
|
imgArr.push(url)
|
//预览图片
|
uni.previewImage({
|
urls: imgArr,
|
current: imgArr[0]
|
});
|
}
|
},
|
//确认
|
next() {
|
this.$refs.warehouseRef.validate(valid => {
|
if (valid) {
|
this.arr = this.singlist.filter(item => item.edit)
|
if (this.arr.length == 0) {
|
uni.showModal({
|
title: '提示',
|
content: '未填写组盘数量',
|
showCancel: false
|
})
|
return
|
}
|
this.renameFocus = false
|
this.QuantityTotal = this.arr.reduce((prev, next) => {
|
return Number(prev) + Number(next.quantity)
|
}, 0)
|
}
|
});
|
},
|
submit() {
|
let criterionReceivingMaterions = []
|
this.arr.forEach(item => {
|
criterionReceivingMaterions.push({
|
wareMaterialCode: item.code,
|
quantity: item.quantity,
|
barCode: item.barCode
|
})
|
})
|
let params = {
|
createdTime: this.Datetime,
|
updatedTime: this.Datetime,
|
createdUserId: JSON.parse(uni.getStorageSync('userInfo')).id,
|
createdUserName: JSON.parse(uni.getStorageSync('userInfo')).name,
|
updatedUserId: JSON.parse(uni.getStorageSync('userInfo')).id,
|
updatedUserName: JSON.parse(uni.getStorageSync('userInfo')).name,
|
deliveryNo: this.putCode,
|
images: this.fileList.toString(),
|
type: '旧件',
|
criterionReceivingMaterions
|
}
|
addConfirmReceipt(params).then((res) => {
|
this.rescode = res.code
|
this.resmessage = res.message
|
this.$refs.resmodal.show = true
|
if (res.code == 200) {
|
this.renameFocus = true
|
this.singlist = []
|
this.getOrderNo()
|
this.warehouse.warehouseCode = ''
|
}
|
})
|
},
|
//清楚选中
|
rest() {
|
this.singlist.forEach(item => {
|
item.quantity = ''
|
item.edit = false
|
})
|
},
|
reset() {
|
// this.fileList=[]
|
// this.fileList1=[]
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
|
</style>
|