|
|
|
@ -140,45 +140,63 @@ |
|
|
|
//this.carList //这个页的最终数组 |
|
|
|
//this.lsList //这个页的规格数组 |
|
|
|
console.log(this.carList1) |
|
|
|
for (let i = 0; i < this.carList1.length; i++) { |
|
|
|
if (this.carList.size == 0) { //当前页没有数据 |
|
|
|
if (this.carList.size == 0) { //当前页没有数据 |
|
|
|
for (let i = 0; i < this.carList1.length; i++) { |
|
|
|
console.log("没有数据") |
|
|
|
this.carList.set(this.carList1[i].id, this.carList1[i]) |
|
|
|
this.lsList.set(this.carList1[i].id, this.carList1[i].saleDetailQueryDTO) |
|
|
|
} else { //当前页有数据 |
|
|
|
//商品id是相同的 |
|
|
|
if (that.carList.has(that.carList1[i].id) == true) { |
|
|
|
console.log("商品相同") |
|
|
|
that.lsList.get(that.carList1[i].id).forEach(function(value, key) { |
|
|
|
for (let m = 0; m <= that.carList1[i].saleDetailQueryDTO.length; m++) { |
|
|
|
if (value.name == that.carList1[i].saleDetailQueryDTO[m].name) { |
|
|
|
console.log("规格相同") |
|
|
|
that.lsList.get(that.carList1[i].id)[key].productCount = that.lsList.get(that |
|
|
|
.carList1[i].id)[key].productCount + value.productCount |
|
|
|
|
|
|
|
} else { |
|
|
|
console.log('key', key) |
|
|
|
console.log("规格不同") |
|
|
|
console.log(that.carList1[i].saleDetailQueryDTO[m]) |
|
|
|
if (key + 1 == that.lsList.size) { |
|
|
|
that.lsList.set(that.carList1[i].id, that.carList1[i].saleDetailQueryDTO[ |
|
|
|
m]) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
} else { //当前页有数据 |
|
|
|
for (let i = 0; i < this.carList1.length; i++) { |
|
|
|
for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) { |
|
|
|
if(this.carList.has(this.carList1[i].id) ==true){ //商品相同 |
|
|
|
this.lsList.get(this.carList1[i].id).forEach(function(value, key) { |
|
|
|
if(value.name == that.carList1[i].saleDetailQueryDTO[m].name){ //规格相同,数量相加 |
|
|
|
value.productCount = value.productCount + that.carList1[i].saleDetailQueryDTO[m].productCount |
|
|
|
}else{ //规格不同,直接set |
|
|
|
console.log("规格不同") |
|
|
|
that.lsList.set(that.carList1[i].id,that.carList1[i].saleDetailQueryDTO[m]) |
|
|
|
} |
|
|
|
}) |
|
|
|
}else{ //商品不同 |
|
|
|
this.carList.set(this.carList1[i].id,this.carList1[i]) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// if (that.carList.has(that.carList1[i].id) == true) { |
|
|
|
// console.log("商品相同") |
|
|
|
// that.lsList.forEach(function(value, key) { |
|
|
|
// for (let m = 0; m <= that.carList1[i].saleDetailQueryDTO.length; m++) { |
|
|
|
|
|
|
|
} else { //商品id不同 |
|
|
|
console.log("商品不同") |
|
|
|
this.carList.set(this.carList1[i].id, this.carList1[i]) |
|
|
|
this.lsList.set(this.carList1[i].id, this.carList1[i].saleDetailQueryDTO) |
|
|
|
} |
|
|
|
// if (value.name == that.carList1[i].saleDetailQueryDTO[m].name) { |
|
|
|
// console.log("规格相同") |
|
|
|
// that.lsList.get(that.carList1[i].id)[key].productCount = that.lsList.get(that |
|
|
|
// .carList1[i].id)[key].productCount + value.productCount |
|
|
|
|
|
|
|
// } else { |
|
|
|
// console.log('key', key) |
|
|
|
// console.log("规格不同") |
|
|
|
// console.log(that.carList1[i].saleDetailQueryDTO[m]) |
|
|
|
// if (key + 1 == that.lsList.size) { |
|
|
|
// that.lsList.set(that.carList1[i].id, that.carList1[i].saleDetailQueryDTO[ |
|
|
|
// m]) |
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
// } |
|
|
|
// }) |
|
|
|
|
|
|
|
// } else { //商品id不同 |
|
|
|
// console.log("商品不同") |
|
|
|
// this.carList.set(this.carList1[i].id, this.carList1[i]) |
|
|
|
// this.lsList.set(this.carList1[i].id, this.carList1[i].saleDetailQueryDTO) |
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
console.log('carList1', this.carList1) |
|
|
|
console.log('carList', this.carList) |
|
|
|
console.log('lsList', this.lsList) |
|
|
|
for (let i = 0; i < this.carList.length; i++) { |
|
|
|
@ -241,21 +259,21 @@ |
|
|
|
supplierId: this.khName.id, //供应商id和姓名 |
|
|
|
supplierName: this.khName.consigneeName |
|
|
|
} |
|
|
|
let purchaseDetails = [] |
|
|
|
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 = [] |
|
|
|
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) |
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
// for (let i = 0; i < this.carList.length; i++) { |
|
|
|
// for (let m = 0; m < this.carList[i].saleDetailQueryDTO.length; m++) { |
|
|
|
@ -297,9 +315,9 @@ |
|
|
|
this.$refs.inputDialog.open() |
|
|
|
}, |
|
|
|
//计算价格 |
|
|
|
changePrice(val) { |
|
|
|
let that = this; |
|
|
|
that.shouldPay = 0 |
|
|
|
changePrice(val) { |
|
|
|
let that = this; |
|
|
|
that.shouldPay = 0 |
|
|
|
console.log(that.carList.get(that.index)) |
|
|
|
that.carList.get(that.index).price = val * that.carList.get(that.index).num; |
|
|
|
that.carList.forEach(function(value, key) { |
|
|
|
|