wangfukang 1 day ago
parent
commit
442ed986e3
  1. 69
      utils/goodsList1.js

69
utils/goodsList1.js

@ -334,6 +334,13 @@ export default {
}
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
}
@ -346,7 +353,7 @@ export default {
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) {
@ -410,7 +417,7 @@ export default {
}
})
} else {
} else if (!useLastBuyPrice) {
this.carList.forEach(function(value, key) {
if (value.isChangePrice == undefined) {
value.isChangePrice = false
@ -534,6 +541,9 @@ export default {
}
// 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) {
@ -893,6 +903,7 @@ export default {
},
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) {
@ -900,8 +911,8 @@ export default {
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,
@ -945,11 +956,11 @@ export default {
}
}
}
if (!cusPrice && (Number(obj.discountAmount) != Number(obj.wholesalePrice) && Number(obj
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
if (!cusReturnPrice && lockCustomPrice && obj.returnPrice != undefined && (Number(obj.discountAmount) != Number(obj
.wholesalePrice) && Number(obj.discountAmount) != Number(obj.lsprice))) {
obj.isChangeReturnPrice = true
}
@ -1142,8 +1153,8 @@ export default {
}
})
} 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,
@ -1188,11 +1199,11 @@ export default {
}
}
}
if (!cusPrice && (Number(obj.discountAmount) != Number(obj.wholesalePrice) && Number(obj
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(
if (!cusReturnPrice && lockCustomPrice && (Number(obj.discountAmount) != Number(obj.wholesalePrice) && Number(
obj.discountAmount) != Number(obj.lsprice))) {
obj.isChangeReturnPrice = true
}
@ -12030,10 +12041,16 @@ export default {
//计算总金额和总数量
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 != '散客') {
@ -12074,21 +12091,25 @@ export default {
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