wangfukang 15 hours ago
parent
commit
1951ac67b2
  1. 63
      package2/inventory/goodsList1HENG.vue

63
package2/inventory/goodsList1HENG.vue

@ -1626,6 +1626,13 @@
}
if (this.khName != '') {
let useLastBuyPrice = this.shopId == '1838094297858183168' || this.shopId == '1811579958284390400' || this.shopId == '1818888277105709056'
if (useLastBuyPrice && this.oldCustomId && this.oldCustomId != this.khName.id) {
this.carList.forEach(function(value) {
value.isChangePrice = false
value.isChangeReturnPrice = false
})
}
if(this.oldCustomId != this.khName.id){
isTrue = true
}
@ -1638,7 +1645,7 @@
this.zhiqianqiankuan = this.khName.noEarn
}
if(this.khName.categoryId != null && this.khName.categoryId != ''){
if(!useLastBuyPrice && this.khName.categoryId != null && this.khName.categoryId != ''){
this.carList.forEach(function(value, key) {
if(value.productId != '' && value.productId != null){
if(value.isChangePrice == undefined){
@ -1692,7 +1699,7 @@
}
})
}else{
}else if(!useLastBuyPrice){
this.carList.forEach(function(value, key) {
if(value.isChangePrice == undefined){
value.isChangePrice = false
@ -1804,6 +1811,9 @@
}
// const uuid = generateUUID();
this.handleData(isTrue)
if ((this.shopId == '1838094297858183168' || this.shopId == '1811579958284390400' || this.shopId == '1818888277105709056') && !isTrue && this.khName && this.khName.name != '散客' && this.carList && this.carList.size > 0) {
this.getAllPrice()
}
},
filters: {
sliceMsg(val) {
@ -2166,6 +2176,7 @@
},
handleData(isTrue) {
let that = this;
let lockCustomPrice = !(this.shopId == '1838094297858183168' || this.shopId == '1811579958284390400' || this.shopId == '1818888277105709056') || uni.getStorageSync('hangOrder')
for (let i = 0; i < this.carList1.length; i++) {
if(this.carList1[i].discount != 10 && this.carList1[i].discount != undefined){
@ -2173,8 +2184,8 @@
this.discountCurrent = "0"
}
if (this.carList1[i].saleDetailQueryDTO) {
let isChangePrice = false
let isChangeReturnPrice = false
let isChangePrice = this.carList1[i].isChangePrice == true
let isChangeReturnPrice = this.carList1[i].isChangeReturnPrice == true
if (this.carList.size == 0) { //当前页没有数据
let obj = {
attrId: this.carList1[i].attrId,
@ -2217,10 +2228,10 @@
}
}
}
if(!cusPrice && (Number(obj.discountAmount) != Number(obj.wholesalePrice) && Number(obj.discountAmount) != Number(obj.lsprice))){
if(!cusPrice && lockCustomPrice && (Number(obj.discountAmount) != Number(obj.wholesalePrice) && Number(obj.discountAmount) != Number(obj.lsprice))){
obj.isChangePrice = true
}
if(!cusReturnPrice && obj.returnPrice != undefined && (Number(obj.discountAmount) != Number(obj.wholesalePrice) && Number(obj.discountAmount) != Number(obj.lsprice))){
if(!cusReturnPrice && lockCustomPrice && obj.returnPrice != undefined && (Number(obj.discountAmount) != Number(obj.wholesalePrice) && Number(obj.discountAmount) != Number(obj.lsprice))){
obj.isChangeReturnPrice = true
}
if(this.khName.categoryId != null && this.khName.categoryId != ''){
@ -2398,8 +2409,8 @@
}
})
} else { //商品不同
let isChangePrice = false
let isChangeReturnPrice = false
let isChangePrice = this.carList1[i].isChangePrice == true
let isChangeReturnPrice = this.carList1[i].isChangeReturnPrice == true
let obj = {
attrId: this.carList1[i].attrId,
@ -2442,10 +2453,10 @@
}
}
}
if(!cusPrice && (Number(obj.discountAmount) != Number(obj.wholesalePrice) && Number(obj.discountAmount) != Number(obj.lsprice))){
if(!cusPrice && lockCustomPrice && (Number(obj.discountAmount) != Number(obj.wholesalePrice) && Number(obj.discountAmount) != Number(obj.lsprice))){
obj.isChangePrice = true
}
if(!cusReturnPrice && (Number(obj.discountAmount) != Number(obj.wholesalePrice) && Number(obj.discountAmount) != Number(obj.lsprice))){
if(!cusReturnPrice && lockCustomPrice && (Number(obj.discountAmount) != Number(obj.wholesalePrice) && Number(obj.discountAmount) != Number(obj.lsprice))){
obj.isChangeReturnPrice = true
}
if(this.khName.categoryId != null && this.khName.categoryId != ''){
@ -12430,10 +12441,16 @@
//计算总金额和总数量
async getAllPrice(price, type) {
let that = this
let productIds = ''
this.carList.forEach(function(value, key) {
productIds += key + ','
let idList = []
this.carList.forEach(function(value) {
if (value && value.productId) {
idList.push(value.productId)
}
})
let productIds = idList.join(',')
let requestCustomerId = this.khName ? this.khName.id : ''
let requestSeq = (this.lastBuyPriceSeq || 0) + 1
this.lastBuyPriceSeq = requestSeq
await this.reloadPrices()
this.$nextTick(() => {
if(this.oldCustomId != this.khName.id && this.khName.name != '散客'){
@ -12472,15 +12489,25 @@
userId: this.khName.id,
productIds: productIds
}, false, true).then((res1) => {
if (requestSeq !== that.lastBuyPriceSeq || !that.khName || that.khName.id !== requestCustomerId) {
return
}
if (res1.code == 200) {
if(res1.result != null && res1.result.length > 0){
for(let i = 0; i < res1.result.length;i++){
if(!this.carList.get(res1.result[i].productId).isChangePrice){
this.carList.get(res1.result[i].productId).discountAmount = res1.result[i].discountAmount
this.carList.get(res1.result[i].productId).price = Number(Number(res1.result[i].discountAmount * this.carList.get(res1.result[i].productId).productCount).toFixed(2))
let lastRow = res1.result[i]
let goods = that.carList.get(lastRow.productId)
if (!goods || lastRow.discountAmount === null || lastRow.discountAmount === undefined || lastRow.discountAmount === '') {
continue
}
let lastPrice = Number(lastRow.discountAmount)
if(!goods.isChangePrice){
goods.discountAmount = lastPrice
goods.unitPrice = lastPrice
goods.price = Number((lastPrice * Number(goods.productCount)).toFixed(2))
}
if(!this.carList.get(res1.result[i].productId).isChangeReturnPrice){
this.carList.get(res1.result[i].productId).returnPrice = res1.result[i].discountAmount
if(!goods.isChangeReturnPrice){
goods.returnPrice = lastPrice
}
}
this.$nextTick(() => {

Loading…
Cancel
Save