|
|
|
@ -32,14 +32,14 @@ |
|
|
|
<img :src="value[1].productPicture" alt="" |
|
|
|
style="width: 140rpx;height: 140rpx;margin: 30rpx 0 0 30rpx;"> |
|
|
|
<view class="shop-productName"> |
|
|
|
<view style="color:#FF5809;">品名:{{value[1].productName}}</view> |
|
|
|
<view>货号:{{value[1].productSn}}</view> |
|
|
|
<view>总价:{{value[1].price}} 数量:{{value[1].productCount}}</view> |
|
|
|
<view style="color:#FF5809;">品名:{{value[1].productName}} ({{value[1].productSn}})</view> |
|
|
|
<view>单价:{{value[1].purchasePrice || 0}} 数量:{{value[1].productCount}}</view> |
|
|
|
<view>总价:{{value[1].price}}</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
<view class="shop-type"> |
|
|
|
<view class="shop-collapse" v-for="(values,keys) in Array.from(value[1].stockLogList)" :key="key"> |
|
|
|
<view class="shop-collapse" v-for="(values,keys) in Array.from(value[1].stockLogList)" :key="keys"> |
|
|
|
<view @tap.stop="delShopSpec(value[0],values[0])"> |
|
|
|
<uni-icons color="red" type="minus" size="26"></uni-icons> |
|
|
|
</view> |
|
|
|
@ -64,13 +64,13 @@ |
|
|
|
<view class="content-list" v-if='storageType==0'> |
|
|
|
<view class="list-name">应付金额</view> |
|
|
|
<view class="list-val"> |
|
|
|
<input type="text" v-model="shouldPay"> |
|
|
|
<input type="text" placeholder="请输入应付金额" v-model="shouldPay"> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="content-list" v-if='storageType==0'> |
|
|
|
<view class="list-name">已付金额</view> |
|
|
|
<view class="list-val"> |
|
|
|
<input type="text" v-model="alreadyPay" @blur="changePay"> |
|
|
|
<input type="text" placeholder="请输入已付金额" v-model="alreadyPay" @blur="changePay"> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="content-list" v-if='storageType==0'> |
|
|
|
@ -183,11 +183,11 @@ |
|
|
|
khName: [], |
|
|
|
carList: new Map(), |
|
|
|
remark: '', |
|
|
|
otherPay: 0, |
|
|
|
otherPay: '', |
|
|
|
noPay: 0, |
|
|
|
alreadyPay: 0, |
|
|
|
alreadyPay: '', |
|
|
|
realAmount: 0, |
|
|
|
shouldPay: 0, |
|
|
|
shouldPay: '', |
|
|
|
totalAmount: 0, |
|
|
|
index: '', |
|
|
|
index1: '', |
|
|
|
@ -214,13 +214,12 @@ |
|
|
|
onShow() { |
|
|
|
let that = this; |
|
|
|
this.khName = JSON.parse(JSON.stringify(this.khName)) || '' |
|
|
|
this.totalAmount = 0; |
|
|
|
if (this.carList.size == 0) { //当前页没有数据 |
|
|
|
for (let i = 0; i < this.carList1.length; i++) { |
|
|
|
let obj = { |
|
|
|
purchasePrice: "", //进货价 |
|
|
|
price: 0, |
|
|
|
productCount: this.carList1[i].num, |
|
|
|
productCount: 0, |
|
|
|
productId: this.carList1[i].id, |
|
|
|
productName: this.carList1[i].productName, |
|
|
|
productPicture: this.carList1[i].productPicture, |
|
|
|
@ -230,7 +229,8 @@ |
|
|
|
} |
|
|
|
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) |
|
|
|
.saleDetailQueryDTO[m].productCount) |
|
|
|
obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount |
|
|
|
} |
|
|
|
this.carList.set(this.carList1[i].id, obj) |
|
|
|
} |
|
|
|
@ -244,17 +244,21 @@ |
|
|
|
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) |
|
|
|
.saleDetailQueryDTO[m].productCount) |
|
|
|
|
|
|
|
} else { //规格不同 |
|
|
|
this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[ |
|
|
|
m].attributeList, this.carList1[i].saleDetailQueryDTO[m].productCount) |
|
|
|
} |
|
|
|
m].attributeList, this.carList1[i].saleDetailQueryDTO[m].productCount) |
|
|
|
|
|
|
|
} |
|
|
|
this.carList.get(this.carList1[i].id).productCount += this.carList1[i].saleDetailQueryDTO[ |
|
|
|
m].productCount |
|
|
|
} |
|
|
|
} else { //商品不同 |
|
|
|
let obj = { |
|
|
|
purchasePrice: "", //进货价 |
|
|
|
price: 0, |
|
|
|
productCount: this.carList1[i].num, |
|
|
|
productCount: 0, |
|
|
|
productId: this.carList1[i].id, |
|
|
|
productName: this.carList1[i].productName, |
|
|
|
productPicture: this.carList1[i].productPicture, |
|
|
|
@ -266,18 +270,17 @@ |
|
|
|
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 |
|
|
|
obj.name = this.carList1[i].saleDetailQueryDTO[m].name |
|
|
|
obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount |
|
|
|
} |
|
|
|
this.carList.set(this.carList1[i].id, obj) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
this.carList.get(this.carList1[i].id).price = this.carList.get(this.carList1[i].id).purchasePrice * this.carList.get(this.carList1[i].id).productCount; |
|
|
|
} |
|
|
|
this.carList1 = [] |
|
|
|
} |
|
|
|
this.carList.forEach(function(value, key) { |
|
|
|
that.totalAmount += value.productCount |
|
|
|
}) |
|
|
|
this.noPay = this.shouldPay |
|
|
|
|
|
|
|
this.getAllPrice() |
|
|
|
}, |
|
|
|
onLoad() { |
|
|
|
this.storageType = uni.getStorageSync('type') |
|
|
|
@ -446,13 +449,12 @@ |
|
|
|
this.goodsDetail.attributeList[i].value[m].isChecked = false |
|
|
|
} |
|
|
|
} |
|
|
|
this.totalAmount = 0; |
|
|
|
if (this.carList.size == 0) { //当前页没有数据 |
|
|
|
for (let i = 0; i < carList1.length; i++) { |
|
|
|
let obj = { |
|
|
|
purchasePrice: "", //进货价 |
|
|
|
price: 0, |
|
|
|
productCount: carList1[i].num, |
|
|
|
productCount: 0, |
|
|
|
productId: carList1[i].id, |
|
|
|
productName: carList1[i].productName, |
|
|
|
productPicture: carList1[i].productPicture, |
|
|
|
@ -462,7 +464,8 @@ |
|
|
|
} |
|
|
|
for (let m = 0; m < carList1[i].saleDetailQueryDTO.length; m++) { |
|
|
|
obj.stockLogList.set(carList1[i].saleDetailQueryDTO[m].attributeList, carList1[i] |
|
|
|
.saleDetailQueryDTO[m].productCount) |
|
|
|
.saleDetailQueryDTO[m].productCount) |
|
|
|
obj.productCount += carList1[i].saleDetailQueryDTO[m].productCount |
|
|
|
} |
|
|
|
this.carList.set(carList1[i].id, obj) |
|
|
|
} |
|
|
|
@ -478,18 +481,22 @@ |
|
|
|
.saleDetailQueryDTO[ |
|
|
|
m].attributeList, this.carList.get(carList1[i].id).stockLogList.get( |
|
|
|
carList1[i].saleDetailQueryDTO[m].attributeList) + carList1[i] |
|
|
|
.saleDetailQueryDTO[m].productCount) |
|
|
|
.saleDetailQueryDTO[m].productCount) |
|
|
|
this.carList.get(carList1[i].id).productCount += carList1[i].saleDetailQueryDTO[ |
|
|
|
m].productCount |
|
|
|
} else { //规格不同 |
|
|
|
this.carList.get(carList1[i].id).stockLogList.set(carList1[i] |
|
|
|
.saleDetailQueryDTO[ |
|
|
|
m].attributeList, carList1[i].saleDetailQueryDTO[m].productCount) |
|
|
|
m].attributeList, carList1[i].saleDetailQueryDTO[m].productCount) |
|
|
|
this.carList.get(carList1[i].id).productCount += carList1[i].saleDetailQueryDTO[ |
|
|
|
m].productCount |
|
|
|
} |
|
|
|
} |
|
|
|
} else { //商品不同 |
|
|
|
let obj = { |
|
|
|
purchasePrice: "", //进货价 |
|
|
|
price: 0, |
|
|
|
productCount: carList1[i].num, |
|
|
|
productCount: 0, |
|
|
|
productId: carList1[i].id, |
|
|
|
productName: carList1[i].productName, |
|
|
|
productPicture: carList1[i].productPicture, |
|
|
|
@ -501,17 +508,15 @@ |
|
|
|
for (let m = 0; m < carList1[i].saleDetailQueryDTO.length; m++) { |
|
|
|
obj.stockLogList.set(carList1[i].saleDetailQueryDTO[m].attributeList, carList1[i] |
|
|
|
.saleDetailQueryDTO[m].productCount) |
|
|
|
obj.name = carList1[i].saleDetailQueryDTO[m].name |
|
|
|
obj.name = carList1[i].saleDetailQueryDTO[m].name |
|
|
|
obj.productCount += carList1[i].saleDetailQueryDTO[m].productCount |
|
|
|
} |
|
|
|
this.carList.set(carList1[i].id, obj) |
|
|
|
} |
|
|
|
} |
|
|
|
carList1 = [] |
|
|
|
} |
|
|
|
this.carList.forEach(function(value, key) { |
|
|
|
that.totalAmount += value.productCount |
|
|
|
}) |
|
|
|
this.noPay = this.shouldPay |
|
|
|
this.getAllPrice() |
|
|
|
this.$refs.shopPopup.close() |
|
|
|
|
|
|
|
}, |
|
|
|
@ -536,6 +541,7 @@ |
|
|
|
if(that.carList.has(id) == true){ |
|
|
|
that.carList.delete(id) |
|
|
|
} |
|
|
|
that.getAllPrice() |
|
|
|
that.$forceUpdate() |
|
|
|
} |
|
|
|
} |
|
|
|
@ -550,10 +556,15 @@ |
|
|
|
content: "确定删除此条商品吗?", |
|
|
|
success: function(res) { |
|
|
|
if(res.confirm){ |
|
|
|
console.log(that.carList.get(id)) |
|
|
|
that.carList.get(id).productCount -= that.carList.get(id).stockLogList.get(name); |
|
|
|
that.carList.get(id).stockLogList.delete(name) |
|
|
|
that.carList.get(id).price = that.carList.get(id).productCount * that.carList.get(id).purchasePrice |
|
|
|
if(that.carList.get(id).stockLogList.size == 0){ |
|
|
|
that.carList.delete(id) |
|
|
|
} |
|
|
|
|
|
|
|
that.getAllPrice() |
|
|
|
} |
|
|
|
that.$forceUpdate() |
|
|
|
} |
|
|
|
@ -578,11 +589,12 @@ |
|
|
|
} |
|
|
|
let that = this; |
|
|
|
let purchase = { |
|
|
|
alreadyPay: this.alreadyPay, //已付金额 |
|
|
|
noPay: this.noPay, //欠款 |
|
|
|
alreadyPay: this.alreadyPay == ''?0:this.alreadyPay, //已付金额 |
|
|
|
noPay: this.noPay == ''?0:this.noPay, //欠款 |
|
|
|
shouldPay: this.shouldPay, //应付金额 |
|
|
|
totalAmount: this.totalAmount, //总数量 |
|
|
|
remark: this.remark, |
|
|
|
remark: this.remark, |
|
|
|
otherPay:this.otherPay == ''?0:this.otherPay, |
|
|
|
supplierId: this.khName.id, //供应商id和姓名 |
|
|
|
supplierName: this.khName.consigneeName |
|
|
|
} |
|
|
|
@ -620,18 +632,28 @@ |
|
|
|
//编辑每一个的单价 |
|
|
|
clickCollapse(index) { |
|
|
|
this.index = index |
|
|
|
this.$refs.inputDialog.val = '' |
|
|
|
this.$refs.inputClose.val = '' |
|
|
|
this.$refs.inputDialog.open() |
|
|
|
}, |
|
|
|
//计算价格 |
|
|
|
changePrice(val) { |
|
|
|
let that = this; |
|
|
|
that.shouldPay = 0 |
|
|
|
that.carList.get(that.index).purchasePrice = val |
|
|
|
that.carList.get(that.index).price = val * that.carList.get(that.index).productCount; |
|
|
|
that.carList.forEach(function(value, key) { |
|
|
|
that.shouldPay += value.price |
|
|
|
}) |
|
|
|
this.getAllPrice() |
|
|
|
|
|
|
|
}, |
|
|
|
//计算总金额和总数量 |
|
|
|
getAllPrice(){ |
|
|
|
let that = this; |
|
|
|
this.shouldPay = 0 |
|
|
|
this.totalAmount = 0 |
|
|
|
this.carList.forEach(function(value, key) { |
|
|
|
that.shouldPay = that.shouldPay + value.price |
|
|
|
that.totalAmount = that.totalAmount + value.productCount |
|
|
|
}) |
|
|
|
this.alreadyPay = this.shouldPay |
|
|
|
that.noPay = this.shouldPay - this.alreadyPay |
|
|
|
}, |
|
|
|
//修改已选规格的数量 |
|
|
|
GoodsNumChange(e,index,index1){ |
|
|
|
@ -639,17 +661,12 @@ |
|
|
|
let that = this; |
|
|
|
this.carList.get(index).stockLogList.set(index1,e) |
|
|
|
this.carList.get(index).productCount = 0 |
|
|
|
this.shouldPay = 0 |
|
|
|
this.totalAmount = 0 |
|
|
|
this.carList.get(index).stockLogList.forEach(function(value, key) { |
|
|
|
console.log(that.carList.get(index)) |
|
|
|
that.carList.get(index).productCount = that.carList.get(index).productCount + value |
|
|
|
that.carList.get(index).price = that.carList.get(index).productCount * that.carList.get(index).purchasePrice |
|
|
|
}) |
|
|
|
this.carList.forEach(function(value, key) { |
|
|
|
that.shouldPay = that.shouldPay + value.price |
|
|
|
that.totalAmount = that.totalAmount+ value.productCount |
|
|
|
}) |
|
|
|
this.getAllPrice(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|