|
|
|
@ -147,9 +147,7 @@ |
|
|
|
onShow() { |
|
|
|
let that = this; |
|
|
|
this.khName = JSON.parse(JSON.stringify(this.khName)) || '' |
|
|
|
//this.carList1 //上个页回来的 |
|
|
|
//this.carList //这个页的最终数组 |
|
|
|
console.log(this.carList1) |
|
|
|
this.totalAmount = 0; |
|
|
|
if (this.carList.size == 0) { //当前页没有数据 |
|
|
|
for (let i = 0; i < this.carList1.length; i++) { |
|
|
|
let obj = { |
|
|
|
@ -167,9 +165,7 @@ |
|
|
|
obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, this.carList1[i] |
|
|
|
.saleDetailQueryDTO[m].productCount) |
|
|
|
} |
|
|
|
console.log("没有数据") |
|
|
|
this.carList.set(this.carList1[i].id, obj) |
|
|
|
console.log(this.carList) |
|
|
|
} |
|
|
|
this.carList1 = [] |
|
|
|
} else { //当前页有数据 |
|
|
|
@ -178,13 +174,11 @@ |
|
|
|
for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) { |
|
|
|
if (this.carList.get(this.carList1[i].id).stockLogList.has(this.carList1[i].saleDetailQueryDTO[ |
|
|
|
m].attributeList) == true) { //规格相同 |
|
|
|
console.log("规格相同") |
|
|
|
this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[ |
|
|
|
m].attributeList, this.carList.get(this.carList1[i].id).stockLogList.get(this |
|
|
|
.carList1[i].saleDetailQueryDTO[m].attributeList) + this.carList1[i] |
|
|
|
.saleDetailQueryDTO[m].productCount) |
|
|
|
} else { //规格不同 |
|
|
|
console.log("规格不同") |
|
|
|
this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[ |
|
|
|
m].attributeList, this.carList1[i].saleDetailQueryDTO[m].productCount) |
|
|
|
} |
|
|
|
@ -208,13 +202,9 @@ |
|
|
|
} |
|
|
|
this.carList.set(this.carList1[i].id, obj) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
this.carList1 = [] |
|
|
|
|
|
|
|
} |
|
|
|
console.log('carList1', this.carList1) |
|
|
|
console.log('carList', this.carList) |
|
|
|
this.carList.forEach(function(value, key) { |
|
|
|
that.totalAmount += value.productCount |
|
|
|
}) |
|
|
|
@ -256,8 +246,6 @@ |
|
|
|
}) |
|
|
|
}, |
|
|
|
inventorySubmit() { |
|
|
|
console.log(this.khName) |
|
|
|
console.log(Array.from(this.carList)[1]) |
|
|
|
if (this.khName == '' || this.carList == '') { |
|
|
|
uni.showToast({ |
|
|
|
title: "信息填写完成后入库!", |
|
|
|
@ -274,22 +262,8 @@ |
|
|
|
supplierId: this.khName.id, //供应商id和姓名 |
|
|
|
supplierName: this.khName.consigneeName |
|
|
|
} |
|
|
|
// that.carList.forEach(function(value, key) { |
|
|
|
// for (let i = 0; i < value.saleDetailQueryDTO.length; i++) { |
|
|
|
// let obj = { |
|
|
|
// purchasePrice: value.price, //进货价 |
|
|
|
// productCount: value.num, |
|
|
|
// productId: key, |
|
|
|
// productName: value.productName, |
|
|
|
// productPicture: value.productPicture, |
|
|
|
// stockLogList: value.saleDetailQueryDTO |
|
|
|
|
|
|
|
// } |
|
|
|
// purchaseDetails.push(obj) |
|
|
|
// } |
|
|
|
let purchaseDetails = []; |
|
|
|
this.carList.forEach(function(value, key) { |
|
|
|
console.log(value.stockLogList) |
|
|
|
value.stockLogList.forEach(function(values, keys) { |
|
|
|
let obj = { |
|
|
|
productCount: values, |
|
|
|
@ -297,11 +271,8 @@ |
|
|
|
} |
|
|
|
value.stockLogList1.push(obj) |
|
|
|
}) |
|
|
|
console.log(value) |
|
|
|
purchaseDetails.push(value) |
|
|
|
}) |
|
|
|
|
|
|
|
console.log(purchaseDetails) |
|
|
|
this.tui.request("/app/stock/putInOfProduct", "post", { |
|
|
|
purchase: purchase, |
|
|
|
purchaseDetails: purchaseDetails |
|
|
|
@ -324,8 +295,8 @@ |
|
|
|
}, |
|
|
|
//编辑每一个的单价 |
|
|
|
clickCollapse(index) { |
|
|
|
console.log(index) |
|
|
|
this.index = index |
|
|
|
this.index = index |
|
|
|
this.$refs.inputDialog.val = '' |
|
|
|
this.$refs.inputDialog.open() |
|
|
|
}, |
|
|
|
//计算价格 |
|
|
|
|