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 != '') { 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) { if (this.oldCustomId != this.khName.id) {
isTrue = true isTrue = true
} }
@ -346,7 +353,7 @@ export default {
this.zhiqianqiankuan = this.khName.noEarn 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) { this.carList.forEach(function(value, key) {
if (value.productId != '' && value.productId != null) { if (value.productId != '' && value.productId != null) {
if (value.isChangePrice == undefined) { if (value.isChangePrice == undefined) {
@ -410,7 +417,7 @@ export default {
} }
}) })
} else { } else if (!useLastBuyPrice) {
this.carList.forEach(function(value, key) { this.carList.forEach(function(value, key) {
if (value.isChangePrice == undefined) { if (value.isChangePrice == undefined) {
value.isChangePrice = false value.isChangePrice = false
@ -534,6 +541,9 @@ export default {
} }
// const uuid = generateUUID(); // const uuid = generateUUID();
this.handleData(isTrue) 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: { filters: {
sliceMsg(val) { sliceMsg(val) {
@ -893,6 +903,7 @@ export default {
}, },
handleData(isTrue) { handleData(isTrue) {
let that = this; 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++) { for (let i = 0; i < this.carList1.length; i++) {
if (this.carList1[i].discount != 10 && this.carList1[i].discount != undefined) { if (this.carList1[i].discount != 10 && this.carList1[i].discount != undefined) {
@ -900,8 +911,8 @@ export default {
this.discountCurrent = "0" this.discountCurrent = "0"
} }
if (this.carList1[i].saleDetailQueryDTO) { if (this.carList1[i].saleDetailQueryDTO) {
let isChangePrice = false let isChangePrice = this.carList1[i].isChangePrice == true
let isChangeReturnPrice = false let isChangeReturnPrice = this.carList1[i].isChangeReturnPrice == true
if (this.carList.size == 0) { //当前页没有数据 if (this.carList.size == 0) { //当前页没有数据
let obj = { let obj = {
attrId: this.carList1[i].attrId, 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))) { .discountAmount) != Number(obj.lsprice))) {
obj.isChangePrice = true 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))) { .wholesalePrice) && Number(obj.discountAmount) != Number(obj.lsprice))) {
obj.isChangeReturnPrice = true obj.isChangeReturnPrice = true
} }
@ -1142,8 +1153,8 @@ export default {
} }
}) })
} else { //商品不同 } else { //商品不同
let isChangePrice = false let isChangePrice = this.carList1[i].isChangePrice == true
let isChangeReturnPrice = false let isChangeReturnPrice = this.carList1[i].isChangeReturnPrice == true
let obj = { let obj = {
attrId: this.carList1[i].attrId, 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))) { .discountAmount) != Number(obj.lsprice))) {
obj.isChangePrice = true 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.discountAmount) != Number(obj.lsprice))) {
obj.isChangeReturnPrice = true obj.isChangeReturnPrice = true
} }
@ -12030,10 +12041,16 @@ export default {
//计算总金额和总数量 //计算总金额和总数量
async getAllPrice(price, type) { async getAllPrice(price, type) {
let that = this let that = this
let productIds = '' let idList = []
this.carList.forEach(function(value, key) { this.carList.forEach(function(value) {
productIds += key + ',' 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() await this.reloadPrices()
this.$nextTick(() => { this.$nextTick(() => {
if (this.oldCustomId != this.khName.id && this.khName.name != '散客') { if (this.oldCustomId != this.khName.id && this.khName.name != '散客') {
@ -12074,21 +12091,25 @@ export default {
userId: this.khName.id, userId: this.khName.id,
productIds: productIds productIds: productIds
}, false, true).then((res1) => { }, false, true).then((res1) => {
if (requestSeq !== that.lastBuyPriceSeq || !that.khName || that.khName.id !== requestCustomerId) {
return
}
if (res1.code == 200) { if (res1.code == 200) {
if (res1.result != null && res1.result.length > 0) { if (res1.result != null && res1.result.length > 0) {
for (let i = 0; i < res1.result.length; i++) { for (let i = 0; i < res1.result.length; i++) {
if (!this.carList.get(res1.result[i].productId).isChangePrice) { let lastRow = res1.result[i]
this.carList.get(res1.result[i].productId).discountAmount = let goods = that.carList.get(lastRow.productId)
res1.result[i].discountAmount if (!goods || lastRow.discountAmount === null || lastRow.discountAmount === undefined || lastRow.discountAmount === '') {
this.carList.get(res1.result[i].productId).price = Number( continue
Number(res1.result[i].discountAmount * this.carList }
.get(res1.result[i].productId).productCount) let lastPrice = Number(lastRow.discountAmount)
.toFixed(2)) 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) if (!goods.isChangeReturnPrice) {
.isChangeReturnPrice) { goods.returnPrice = lastPrice
this.carList.get(res1.result[i].productId).returnPrice =
res1.result[i].discountAmount
} }
} }
this.$nextTick(() => { this.$nextTick(() => {

Loading…
Cancel
Save