Browse Source

入库

master
tianyi@bogon 3 years ago
parent
commit
8c102e5de2
  1. 81
      pages/inventory/addinventory.vue

81
pages/inventory/addinventory.vue

@ -40,12 +40,14 @@
</view> </view>
<view class="shop-type"> <view class="shop-type">
<view class="shop-collapse" v-for="(values,keys) in Array.from(value[1].stockLogList)"> <view class="shop-collapse" v-for="(values,keys) in Array.from(value[1].stockLogList)">
<text>{{values[0]}}</text> <text>{{values[0] | sliceMsg}}</text>
<!-- <text style="color: red;">单价:¥{{item.price}}</text> --> <!-- <text style="color: red;">单价:¥{{item.price}}</text> -->
<text>数量:{{values[1]}}</text> <text>数量:{{values[1]}}</text>
</view> </view>
<view class="" style="position: absolute;top:0;right:0;" @tap="clickCollapse(value[0])"> <view
采购价 style="position: absolute;top: 130rpx;right: 40rpx;color: blue;text-decoration: underline;"
@tap="clickCollapse(value[0])">
维护采购价
</view> </view>
</view> </view>
</view> </view>
@ -132,6 +134,21 @@
index1: '' index1: ''
} }
}, },
filters: {
sliceMsg(val) {
var name = ''
if (typeof(val) == 'string') {
let newObj = JSON.parse(val)
for (let as in newObj) {
for (var i = 0; i < newObj[as].length; i++) {
console.log(newObj[as])
name += newObj[as] + '/'
}
}
}
return name;
}
},
onShow() { onShow() {
let that = this; let that = this;
this.khName = JSON.parse(JSON.stringify(this.khName)) || '' this.khName = JSON.parse(JSON.stringify(this.khName)) || ''
@ -143,17 +160,18 @@
for (let i = 0; i < this.carList1.length; i++) { for (let i = 0; i < this.carList1.length; i++) {
let obj = { let obj = {
purchasePrice: this.carList1[i].price, //进货价 purchasePrice: this.carList1[i].price, //进货价
price:0, price: 0,
productCount: this.carList1[i].num, productCount: this.carList1[i].num,
productId: this.carList1[i].id, productId: this.carList1[i].id,
productName: this.carList1[i].productName, productName: this.carList1[i].productName,
productPicture: this.carList1[i].productPicture, productPicture: this.carList1[i].productPicture,
productSn:this.carList1[i].productSn, productSn: this.carList1[i].productSn,
stockLogList: new Map(), stockLogList: new Map(),
stockLogList1:[] stockLogList1: []
} }
for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) { for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) {
obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList,this.carList1[i].saleDetailQueryDTO[m].productCount) obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, this.carList1[i]
.saleDetailQueryDTO[m].productCount)
} }
console.log("没有数据") console.log("没有数据")
this.carList.set(this.carList1[i].id, obj) this.carList.set(this.carList1[i].id, obj)
@ -163,33 +181,39 @@
this.carList1 = [] this.carList1 = []
} else { //当前页有数据 } else { //当前页有数据
for (let i = 0; i < this.carList1.length; i++) { for (let i = 0; i < this.carList1.length; i++) {
if(this.carList.has(this.carList1[i].id) == true){ //商品相同 if (this.carList.has(this.carList1[i].id) == true) { //商品相同
for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) { 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){ //规格相同 if (this.carList.get(this.carList1[i].id).stockLogList.has(this.carList1[i].saleDetailQueryDTO[
m].attributeList) == true) { //规格相同
console.log("规格相同") 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) this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[
}else{ //规格不同 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("规格不同") console.log("规格不同")
this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList,this.carList1[i].saleDetailQueryDTO[m].productCount) this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[
m].attributeList, this.carList1[i].saleDetailQueryDTO[m].productCount)
} }
} }
}else{//商品不同 } else { //商品不同
let obj = { let obj = {
purchasePrice: this.carList1[i].price, //进货价 purchasePrice: this.carList1[i].price, //进货价
price:0, price: 0,
productCount: this.carList1[i].num, productCount: this.carList1[i].num,
productId: this.carList1[i].id, productId: this.carList1[i].id,
productName: this.carList1[i].productName, productName: this.carList1[i].productName,
productPicture: this.carList1[i].productPicture, productPicture: this.carList1[i].productPicture,
stockLogList: new Map(), stockLogList: new Map(),
stockLogList1:[], stockLogList1: [],
name:'' name: ''
} }
for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) { for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) {
obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList,this.carList1[i].saleDetailQueryDTO[m].productCount) obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, this.carList1[i]
.saleDetailQueryDTO[m].productCount)
obj.name = this.carList1[i].saleDetailQueryDTO[m].name obj.name = this.carList1[i].saleDetailQueryDTO[m].name
} }
this.carList.set(this.carList1[i].id,obj) this.carList.set(this.carList1[i].id, obj)
} }
} }
@ -199,10 +223,9 @@
console.log('carList1', this.carList1) console.log('carList1', this.carList1)
console.log('carList', this.carList) console.log('carList', this.carList)
console.log('lsList', this.lsList) console.log('lsList', this.lsList)
for (let i = 0; i < this.carList.length; i++) { this.carList.forEach(function(value, key) {
this.totalAmount += this.carList[i].num that.totalAmount += value.productCount
this.shouldPay += this.carList[i].price })
}
this.noPay = this.shouldPay this.noPay = this.shouldPay
}, },
onLoad() { onLoad() {
@ -273,14 +296,14 @@
// purchaseDetails.push(obj) // purchaseDetails.push(obj)
// } // }
let purchaseDetails = []; let purchaseDetails = [];
this.carList.forEach(function(value, key){ this.carList.forEach(function(value, key) {
console.log(value.stockLogList) console.log(value.stockLogList)
value.stockLogList.forEach(function(values, keys){ value.stockLogList.forEach(function(values, keys) {
let obj={ let obj = {
productCount:values, productCount: values,
attributeList:keys attributeList: keys
} }
value.stockLogList1.push(obj) value.stockLogList1.push(obj)
}) })
console.log(value) console.log(value)
purchaseDetails.push(value) purchaseDetails.push(value)

Loading…
Cancel
Save