This commit is contained in:
linfso 2024-05-21 13:45:55 +08:00
parent 5cb9431f33
commit 00958d0444

View File

@ -190,8 +190,11 @@
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="寄件公司" prop="sender.company">
<el-input v-model="form.sender.company" placeholder="" />
<el-form-item label="寄件公司" prop="sender.company"
:rules="form.paymentType != 2 ? rules.sender.company : []"
>
<el-input
v-model="form.sender.company" placeholder="" />
</el-form-item>
</el-col>
<el-col :span="24">
@ -252,7 +255,9 @@
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="收件公司" prop="reciever.company">
<el-form-item label="收件公司" prop="reciever.company"
:rules="form.paymentType != 4 ? rules.reciever.company : []"
>
<el-input v-model="form.reciever.company" placeholder="" />
</el-form-item>
</el-col>
@ -318,7 +323,7 @@
</el-col>
<el-col :span="12">
<el-form-item label="总件数" prop="parcelQty" label-width="70px">
<el-input v-model="form.parcelQty" style="text-align: right;" @blur="handleGenGoods" @keyup.enter.native="handleGenGoods" placeholder="" />
<el-input v-model="form.parcelQty" style="text-align: right;" @blur="handleInitGenGoods" @keyup.enter.native="handleInitGenGoods" placeholder="" />
</el-form-item>
</el-col>
<el-col :span="12">
@ -380,7 +385,7 @@
</el-table-column>
<el-table-column prop="cargoQty" label="件数" align="center" width="60">
<template slot-scope="scope">
<el-input v-model="scope.row.cargoQty" size="mini" placeholder=""></el-input>
<el-input v-model="scope.row.cargoQty" @blur="(val)=>handleCargoQtyChange(val,scope.row)" @keyup.enter.native="(val)=>handleCargoQtyChange(val,scope.row)" size="mini" placeholder=""></el-input>
</template>
</el-table-column>
@ -393,9 +398,26 @@
<el-table-column label="操作" align="left" min-width="50">
<template slot-scope="scope">
<!-- <span style="cursor: pointer;font-size: 21px;color: #6e6e6e;" title="删除"
@click="()=>{deleteGoodsItem(scope.row);event.stopPropagation()}"
>
<i class="el-icon-delete" />
</span>
<span style="cursor: pointer;font-size: 21px;color: #6e6e6e;" title="复制"
@click="()=>{copyGoodsItem(scope.row);event.stopPropagation()}"
>
<i class="el-icon-copy-document" />
</span> -->
<span class="icon iconfont"
style="cursor: pointer;font-size: 21px;color: #6e6e6e;"
@click="()=>deleteGoodsItem(scope.row)">&#xe7ae;</span>
@click="()=>deleteGoodsItem(scope.row,scope.$index)">&#xe7ae;</span>
<span class="icon iconfont"
style="cursor: pointer;font-size: 21px;color: #6e6e6e;"
@click="()=>copyGoodsItem(scope.row,scope.$index)">&#xe620;</span>
</template>
</el-table-column>
@ -644,10 +666,6 @@
</el-form-item>
</el-col>
</el-row>
</el-col>
@ -824,6 +842,9 @@ data() {
province: [
{ required: true, message: "省不能为空", trigger: ["blur",'change'] }
],
company: [
{ required: true, message: "发件公司不能为空", trigger: ["blur",'change'] }
],
// city: [
// { required: true, message: "市不能为空", trigger: "blur" }
// ],
@ -847,6 +868,10 @@ data() {
province: [
{ required: true, message: "寄件省不能为空", trigger: ["blur",'change'] }
],
company: [
{ required: true, message: "发件公司不能为空", trigger: ["blur",'change'] }
],
// city: [
// { required: true, message: "寄件市不能为空", trigger: "blur" }
// ],
@ -1180,20 +1205,7 @@ methods: {
})
},
deleteGoodsItem(row){
this.$confirm('确定删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let newList = this.form.cargoList.filter(item => item.goodsName !== row.goodsName);
this.form.cargoList=newList;
this.handleCalcQty();
this.handleCalcVolume();
}).catch(() => {
})
},
lpadZero(val,len) {
return (new Array(len + 1).join('0') + val).slice(-len);
},
@ -1203,10 +1215,10 @@ methods: {
for(let i=1;i<=this.form.parcelQty;i++){
let subBillCode = this.form.billCode+""+this.lpadZero(i,4);
billSubCodeStr=billSubCodeStr+subBillCode+","
console.log(billSubCodeStr);
// console.log(billSubCodeStr);
}
// let billSubCodeStr = this.form.billCode+"["+this.lpadZero(1,3)+"-"+this.lpadZero(this.form.parcelQty,3)+"]";
console.log(billSubCodeStr);
// console.log(billSubCodeStr);
this.form.billCodeSub=billSubCodeStr;
}else{
this.form.billCodeSub=null;
@ -1254,7 +1266,7 @@ methods: {
this.isNeedSave=true;
this.form.printTypeCheckList=[1,5],
this.handleGenGoods();
this.handleInitGenGoods();
}
@ -1464,7 +1476,7 @@ methods: {
let totalVolume=0.0;
if(row!=null){
let volume=parseFloat(row.length)*parseFloat(row.width)*parseFloat(row.height);
row.volume=parseFloat((volume/1000000).toFixed(5));
row.volume=parseFloat((volume/1000000).toFixed(5))*parseFloat(row.cargoQty);
}
this.form.cargoList.forEach(item=>{
@ -1473,21 +1485,7 @@ methods: {
this.form.totalVolume = parseFloat(totalVolume.toFixed(5));
},
handleCalcQty(val,row){
let totalCargoQty=0;
let goodsInfo='';
this.form.cargoList.forEach(item=>{
totalCargoQty=totalCargoQty+parseInt(item.cargoQty);
goodsInfo=goodsInfo+item.goodsName+"x"+item.cargoQty+",";
});
this.form.parcelQty = totalCargoQty;
this.handleGenSubbill();
},
handleCalcFeeItem(val,row){
if(row!=null){
@ -1608,53 +1606,21 @@ methods: {
this.form.goodsInfo = selNameStr;
},
handleGenGoods(){
handleInitGenGoods(){
if(this.form.parcelQty>0){
let currentParcelQty = 0;
this.form.cargoList.forEach(item=>{
currentParcelQty = currentParcelQty+parseInt(item.cargoQty);
});
// 新件数大于
if(this.form.parcelQty>=this.form.cargoList.length){
console.log()
let len=this.form.parcelQty-this.form.cargoList.length;
for(let i=0;i<len;i++){
if(this.form.parcelQty>currentParcelQty){
let len=this.form.parcelQty-currentParcelQty;
if(this.form.parcelQty>20){
let cargo={
"goodsCode": "",
"goodsName": "",
"cargoQty": 1,
"length": 0,
"width": 0,
"height": 0,
"volume": 0,
}
this.form.cargoList.push(cargo);
}
}
else{
let newList=[];
for(let i=0;i<this.form.parcelQty;i++){
newList.push(this.form.cargoList[i])
}
this.form.cargoList=newList;
}
}else{
this.form.cargoList=[];
}
},
onGoodsChange_old(goodsName){
if(goodsName&& goodsName!='') {
// 旧map
let nameOldMap = new Map();
if(this.form.cargoList!=null&& this.form.cargoList.length>0){
this.form.cargoList.forEach(item=>{
nameOldMap[item.goodsName]=item;
});
}
if(!(goodsName in nameOldMap)){
let cargo={
"goodsCode": goodsName,
"goodsName": goodsName,
"cargoQty": 1,
"goodsCode": "",
"goodsName": "",
"cargoQty": len,
"length": 0,
"width": 0,
"height": 0,
@ -1662,10 +1628,81 @@ methods: {
}
this.form.cargoList.push(cargo);
}
this.handleCalcQty();
this.handleCalcVolume();
else{
for(let i=0;i<len;i++){
let cargo={
"goodsCode": "",
"goodsName": "",
"cargoQty": 1,
"length": 0,
"width": 0,
"height": 0,
"volume": 0,
}
this.form.cargoList.push(cargo);
}
}
}
else{
let newList=[];
let incQty=0;
let zeroItem=null;
for(let i=0;i<this.form.cargoList.length;i++){
let item=this.form.cargoList[i];
// 忽略未填写体积的数据
if(item.length==0&&item.width==0&&item.height==0){
zeroItem=item;
zeroItem.cargoQty=1;
continue;
}
if((incQty+parseInt(item.cargoQty))<this.form.parcelQty){
incQty = incQty+parseInt(item.cargoQty);
newList.push(item)
}else{
item.cargoQty=this.form.parcelQty-incQty;
newList.push(item)
incQty = incQty+parseInt(item.cargoQty);
break;
}
}
// 补足数量
let bzLen=this.form.parcelQty-incQty;
for(let i=0;i<bzLen;i++){
let newItem=Object.assign({},zeroItem);
newList.push(newItem);
}
this.form.cargoList=newList;
}
}else{
this.form.cargoList=[];
}
},
handleCargoQtyChange(){
this.handleInitGenGoods();
this.handleCalcVolume();
},
deleteGoodsItem(row,index){
this.$confirm('确定删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
// let newList = this.form.cargoList.filter(item => item.goodsName !== row.goodsName);
// this.form.cargoList=newList;
console.log(index);
this.form.cargoList.splice(index,1)
this.handleCalcVolume();
}).catch(() => {
})
},
copyGoodsItem(row,index){
let newItem = Object.assign({},row);
newItem.cargoQty=1;
this.form.cargoList.splice(index+1, 0, newItem);
// this.form.cargoList.push(newItem);
handleCargoQtyChange();
},
showLocalTime(){