|
@@ -236,8 +236,8 @@
|
|
|
width="60%"
|
|
|
:close-on-click-modal="false"
|
|
|
:destroy-on-close="true"
|
|
|
- :modal-append-to-body='false'
|
|
|
:close-on-press-escape="false"
|
|
|
+ top="10vh"
|
|
|
v-dialog-drag>
|
|
|
<procurement-detail
|
|
|
@closeFun="!procurementDialog"
|
|
@@ -287,6 +287,7 @@ export default {
|
|
|
return {
|
|
|
form: {},
|
|
|
disabled: false,
|
|
|
+ skip:false,
|
|
|
receiptDisable:false,
|
|
|
customerContact: customerContact,
|
|
|
contactsForm: {},
|
|
@@ -480,37 +481,31 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
if(this.detailData.params){
|
|
|
+ this.skip = true
|
|
|
detailListData(this.detailData.params.id).then(res =>{
|
|
|
- const orderNoList = [];
|
|
|
- res.data.data.itemsVOList.forEach((item,index) =>{
|
|
|
- this.detailData.params.orderItemIds.forEach((e,i) =>{
|
|
|
- if(e == index){
|
|
|
- item.srcId = item.id;
|
|
|
- item.orgOrderNo = res.data.data.orgOrderNo;
|
|
|
- item.contractNumber = res.data.data.orderNo;
|
|
|
- orderNoList.push(item.contractNumber)
|
|
|
- if(item.actualQuantity !== 0){ //如果收过货
|
|
|
- item.actualQuantity = _.subtract(item.orderQuantity, item.actualQuantity); //收货件数 = 采购件数 - 已收件数
|
|
|
- }else{
|
|
|
- item.actualQuantity = item.orderQuantity;
|
|
|
- }
|
|
|
- item.contractAmount = item.amount;
|
|
|
- //如果件数 和 码单重量不为 0 或空 算出一件的重量 并记录每一行的
|
|
|
- if(item.orderQuantity && item.orderQuantity!= "0"
|
|
|
- && item.billWeight && item.billWeight!= "0"
|
|
|
- && item.invoiceWeight && item.invoiceWeight!= "0"){
|
|
|
- this.singleton[index]={
|
|
|
- BQ : _.divide(item.billWeight, item.orderQuantity),
|
|
|
- IQ : _.divide(item.invoiceWeight, item.orderQuantity)
|
|
|
- }
|
|
|
- }
|
|
|
- delete item.id
|
|
|
- this.$refs.crudContact.rowCellAdd(item);
|
|
|
- this.$refs.crudContact.rowCell(item,this.contactsData.length - 1)
|
|
|
- }
|
|
|
- })
|
|
|
+ const orderNoList = []; //合同号数据
|
|
|
+ this.detailData.params.orderItemIds.forEach((e,i) =>{
|
|
|
+ const item = res.data.data.itemsVOList[e];
|
|
|
+ item.srcId = item.id;
|
|
|
+ item.orgOrderNo = res.data.data.orgOrderNo;
|
|
|
+ item.contractNumber = res.data.data.orderNo;
|
|
|
+ orderNoList.push(item.contractNumber)
|
|
|
+ if(item.actualQuantity !== 0){ //如果收过货
|
|
|
+ item.actualQuantity = _.subtract(item.orderQuantity, item.actualQuantity); //收货件数 = 采购件数 - 已收件数
|
|
|
+ }else{
|
|
|
+ item.actualQuantity = item.orderQuantity;
|
|
|
+ }
|
|
|
+ item.contractAmount = item.amount;
|
|
|
+ //码单重量 除以 数量 每个的码单重量
|
|
|
+ item.singleton = {
|
|
|
+ BQ : _.divide(item.billWeight, item.orderQuantity),
|
|
|
+ IQ : _.divide(item.invoiceWeight, item.orderQuantity)
|
|
|
+ }
|
|
|
+ delete item.id
|
|
|
+ this.$refs.crudContact.rowCellAdd(item);
|
|
|
+ this.$refs.crudContact.rowCell(item,this.contactsData.length - 1)
|
|
|
})
|
|
|
- this.$set(this.form,'orderNo', Array.from(new Set(orderNoList)).join(","))
|
|
|
+ this.$set(this.form,'orderNo', Array.from(new Set(orderNoList)).join(",")) // 数组去重逗号隔开 那合同总
|
|
|
this.$set(this.form,'saleman',res.data.data.salesName)
|
|
|
this.$set(this.form,'corpId',res.data.data.corpsName[0].id)
|
|
|
this.$set(this.form,'orgOrderNo', res.data.data.orgOrderNo)
|
|
@@ -535,7 +530,7 @@ export default {
|
|
|
storageId:this.form.storageId,
|
|
|
}
|
|
|
selectGoodsNum(params).then(res =>{
|
|
|
- this.$set(this.contactsData[row.$index],"kuCun",res.data.data)
|
|
|
+ this.$set(this.contactsData[row.$index],"inventoryNumber",res.data.data)
|
|
|
})
|
|
|
}
|
|
|
},
|
|
@@ -548,29 +543,29 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
actualQuantityChange(row){
|
|
|
- if(row.orderQuantity && row.orderQuantity!= "0"
|
|
|
- && row.billWeight && row.billWeight!= "0"
|
|
|
- && row.invoiceWeight && row.invoiceWeight!= "0"){
|
|
|
- row.billWeight = _.multiply(this.singleton[row.$index].BQ,row.actualQuantity)
|
|
|
- row.invoiceWeight = _.multiply(this.singleton[row.$index].IQ,row.actualQuantity)
|
|
|
+ if(row.singleton){
|
|
|
+ const _sing = row.singleton
|
|
|
+ if( _sing.BQ !== 0){ //如果有值并且不为空 计算码单与发票
|
|
|
+ row.billWeight = _.multiply(_sing.BQ,row.actualQuantity)
|
|
|
+ }
|
|
|
+ if( _sing.IQ !== 0){
|
|
|
+ row.invoiceWeight = _.multiply(_sing.IQ,row.actualQuantity)
|
|
|
+ this.invoiceWeightChange(row) //发票改变合同
|
|
|
+ }
|
|
|
this.totalChange()
|
|
|
- this.priceChange(row)
|
|
|
- this.invoiceWeightChange(row)
|
|
|
}
|
|
|
},
|
|
|
//合计
|
|
|
totalChange(){
|
|
|
let invoiceList = this.contactsData.map(item => {
|
|
|
- if(!item.invoiceWeight){
|
|
|
- item.invoiceWeight = 0
|
|
|
- }
|
|
|
- return parseFloat(item.invoiceWeight);
|
|
|
+ if(item.invoiceWeight){
|
|
|
+ return parseFloat(item.invoiceWeight);
|
|
|
+ }else return 0
|
|
|
});
|
|
|
let billList = this.contactsData.map(item => {
|
|
|
- if(!item.billWeight){
|
|
|
- item.billWeight = 0
|
|
|
- }
|
|
|
- return parseFloat(item.billWeight);
|
|
|
+ if(item.billWeight){
|
|
|
+ return parseFloat(item.billWeight);
|
|
|
+ }else return 0
|
|
|
});
|
|
|
this.$set(this.form,"invoiceWeight",invoiceList.reduce((n,m) => n + m))
|
|
|
this.$set(this.form,"billWeight",billList.reduce((n,m) => n + m))
|
|
@@ -750,21 +745,14 @@ export default {
|
|
|
item.contractNumber = item.orderNo;
|
|
|
item.contractAmount = item.amount;
|
|
|
item.actualQuantity = item.orderQuantity;
|
|
|
+ item.singleton = {
|
|
|
+ BQ : _.divide(item.billWeight, item.orderQuantity),
|
|
|
+ IQ : _.divide(item.invoiceWeight, item.orderQuantity)
|
|
|
+ }
|
|
|
this.$refs.crudContact.rowCellAdd(item);
|
|
|
this.selectInventory(item)
|
|
|
})
|
|
|
|
|
|
- this.contactsData.forEach((item,index)=>{
|
|
|
- if(item.orderQuantity && item.orderQuantity!= "0"
|
|
|
- && item.billWeight && item.billWeight!= "0"
|
|
|
- && item.invoiceWeight && item.invoiceWeight!= "0"){
|
|
|
- this.singleton[index]={
|
|
|
- BQ : _.divide(item.billWeight, item.orderQuantity),
|
|
|
- IQ : _.divide(item.invoiceWeight, item.orderQuantity)
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
this.totalChange()
|
|
|
this.sumOrderNo(); //合并合同号
|
|
|
this.procurementDialog = false;
|