Browse Source

入库

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

171
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)) || ''
@ -140,69 +157,75 @@
//this.lsList //这个页的规格数组 //this.lsList //这个页的规格数组
console.log(this.carList1) console.log(this.carList1)
if (this.carList.size == 0) { //当前页没有数据 if (this.carList.size == 0) { //当前页没有数据
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)
console.log(this.carList) console.log(this.carList)
// this.lsList.set(this.carList1[i].id, obj) // this.lsList.set(this.carList1[i].id, obj)
} }
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[
console.log("规格相同") m].attributeList) == true) { //规格相同
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) console.log("规格相同")
}else{ //规格不同 this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[
console.log("规格不同") m].attributeList, this.carList.get(this.carList1[i].id).stockLogList.get(this
this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList,this.carList1[i].saleDetailQueryDTO[m].productCount) .carList1[i].saleDetailQueryDTO[m].attributeList) + this.carList1[i]
} .saleDetailQueryDTO[m].productCount)
} } else { //规格不同
}else{//商品不同 console.log("规格不同")
let obj = { this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[
purchasePrice: this.carList1[i].price, //进货价 m].attributeList, this.carList1[i].saleDetailQueryDTO[m].productCount)
price:0, }
productCount: this.carList1[i].num, }
productId: this.carList1[i].id, } else { //商品不同
productName: this.carList1[i].productName, let obj = {
productPicture: this.carList1[i].productPicture, purchasePrice: this.carList1[i].price, //进货价
stockLogList: new Map(), price: 0,
stockLogList1:[], productCount: this.carList1[i].num,
name:'' productId: this.carList1[i].id,
} productName: this.carList1[i].productName,
for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) { productPicture: this.carList1[i].productPicture,
obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList,this.carList1[i].saleDetailQueryDTO[m].productCount) stockLogList: new Map(),
obj.name = this.carList1[i].saleDetailQueryDTO[m].name stockLogList1: [],
} name: ''
this.carList.set(this.carList1[i].id,obj) }
} 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.name = this.carList1[i].saleDetailQueryDTO[m].name
}
this.carList.set(this.carList1[i].id, obj)
}
}
this.carList1 = [] this.carList1 = []
} }
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() {
@ -271,21 +294,21 @@
// } // }
// 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)
}) })
console.log(purchaseDetails) console.log(purchaseDetails)
this.tui.request("/app/stock/putInOfProduct", "post", { this.tui.request("/app/stock/putInOfProduct", "post", {
purchase: purchase, purchase: purchase,
@ -308,7 +331,7 @@
}) })
}, },
//编辑每一个的单价 //编辑每一个的单价
clickCollapse(index) { clickCollapse(index) {
console.log(index) console.log(index)
this.index = index this.index = index
this.$refs.inputDialog.open() this.$refs.inputDialog.open()
@ -317,7 +340,7 @@
changePrice(val) { changePrice(val) {
let that = this; let that = this;
that.shouldPay = 0 that.shouldPay = 0
that.carList.get(that.index).purchasePrice = val that.carList.get(that.index).purchasePrice = val
that.carList.get(that.index).price = val * that.carList.get(that.index).productCount; that.carList.get(that.index).price = val * that.carList.get(that.index).productCount;
that.carList.forEach(function(value, key) { that.carList.forEach(function(value, key) {
that.shouldPay += value.price that.shouldPay += value.price
@ -348,7 +371,7 @@
.content { .content {
border-top: 1px solid #eee; border-top: 1px solid #eee;
overflow-y: scroll; overflow-y: scroll;
max-height: 100vh; max-height: 100vh;
margin-bottom: 100rpx; margin-bottom: 100rpx;
} }
@ -422,7 +445,7 @@
.shop-box { .shop-box {
width: 95%; width: 95%;
margin: 0 auto; margin: 0 auto;
position: relative; position: relative;
} }

Loading…
Cancel
Save