|
|
|
@ -1557,56 +1557,57 @@ |
|
|
|
console.log(this.khName) |
|
|
|
console.log(this.carList) |
|
|
|
|
|
|
|
if(this.khName.categoryId != null){ |
|
|
|
|
|
|
|
if(this.khName.categoryId != null && this.khName.categoryId != ''){ |
|
|
|
this.carList.forEach(function(value, key) { |
|
|
|
if(value.isChangePrice == undefined){ |
|
|
|
value.isChangePrice = false |
|
|
|
} |
|
|
|
if(value.isChangeReturnPrice == undefined){ |
|
|
|
value.isChangeReturnPrice = false |
|
|
|
} |
|
|
|
if(value.customerCategoryList != null){ |
|
|
|
let truePrice = 0 |
|
|
|
let ischeckCustom = false |
|
|
|
let ischeckCustomPrice = false |
|
|
|
for(let i=0;i<value.customerCategoryList.length;i++){ |
|
|
|
if(Number(value.unitPrice) == Number(value.customerCategoryList[i].categoryPrice)){ |
|
|
|
ischeckCustom = true |
|
|
|
if(value.productId != '' && value.productId != null){ |
|
|
|
if(value.isChangePrice == undefined){ |
|
|
|
value.isChangePrice = false |
|
|
|
} |
|
|
|
if(value.isChangeReturnPrice == undefined){ |
|
|
|
value.isChangeReturnPrice = false |
|
|
|
} |
|
|
|
if(value.customerCategoryList != null){ |
|
|
|
let truePrice = 0 |
|
|
|
let ischeckCustom = false |
|
|
|
let ischeckCustomPrice = false |
|
|
|
for(let i=0;i<value.customerCategoryList.length;i++){ |
|
|
|
if(Number(value.unitPrice) == Number(value.customerCategoryList[i].categoryPrice)){ |
|
|
|
ischeckCustom = true |
|
|
|
} |
|
|
|
if(that.khName.categoryId == value.customerCategoryList[i].categoryId && value.customerCategoryList[i].categoryPrice != ''){ |
|
|
|
truePrice = value.customerCategoryList[i].categoryPrice |
|
|
|
ischeckCustomPrice = true |
|
|
|
} |
|
|
|
/* if(that.khName.categoryId == value.customerCategoryList[i].categoryId && value.customerCategoryList[i].categoryPrice == ''){ |
|
|
|
uni.showToast({title:value.productSn+'商品没有维护"'+value.customerCategoryList[i].categoryName+'"价格',mask:true,duration:2000}); |
|
|
|
} */ |
|
|
|
} |
|
|
|
if(that.khName.categoryId == value.customerCategoryList[i].categoryId && value.customerCategoryList[i].categoryPrice != ''){ |
|
|
|
truePrice = value.customerCategoryList[i].categoryPrice |
|
|
|
ischeckCustomPrice = true |
|
|
|
if(ischeckCustomPrice && (Number(value.unitPrice) == Number(value.wholesalePrice) || Number(value.unitPrice) == Number(value.lsprice) || ischeckCustom) && !value.isChangePrice && !uni.getStorageSync('hangOrder')){ |
|
|
|
value.unitPrice = truePrice |
|
|
|
value.discountAmount = truePrice |
|
|
|
} |
|
|
|
if(ischeckCustomPrice == false && !value.isChangePrice && !uni.getStorageSync('hangOrder')){ |
|
|
|
value.unitPrice = value.wholesalePrice |
|
|
|
value.discountAmount = value.wholesalePrice |
|
|
|
} |
|
|
|
if(ischeckCustomPrice && (Number(value.returnPrice) == Number(value.wholesalePrice) || Number(value.unitPrice) == Number(value.lsprice) || ischeckCustom) && !value.isChangeReturnPrice && !uni.getStorageSync('hangOrder')){ |
|
|
|
value.returnPrice = truePrice |
|
|
|
} |
|
|
|
if(ischeckCustomPrice == false && !value.isChangeReturnPrice && !uni.getStorageSync('hangOrder')){ |
|
|
|
value.returnPrice = value.wholesalePrice |
|
|
|
} |
|
|
|
/* if(that.khName.categoryId == value.customerCategoryList[i].categoryId && value.customerCategoryList[i].categoryPrice == ''){ |
|
|
|
uni.showToast({title:value.productSn+'商品没有维护"'+value.customerCategoryList[i].categoryName+'"价格',mask:true,duration:2000}); |
|
|
|
} */ |
|
|
|
} |
|
|
|
if(ischeckCustomPrice && (Number(value.unitPrice) == Number(value.wholesalePrice) || Number(value.unitPrice) == Number(value.lsprice) || ischeckCustom) && !value.isChangePrice && !uni.getStorageSync('hangOrder')){ |
|
|
|
value.unitPrice = truePrice |
|
|
|
value.discountAmount = truePrice |
|
|
|
} |
|
|
|
if(ischeckCustomPrice == false && !value.isChangePrice && !uni.getStorageSync('hangOrder')){ |
|
|
|
value.unitPrice = value.wholesalePrice |
|
|
|
value.discountAmount = value.wholesalePrice |
|
|
|
} |
|
|
|
if(ischeckCustomPrice && (Number(value.returnPrice) == Number(value.wholesalePrice) || Number(value.unitPrice) == Number(value.lsprice) || ischeckCustom) && !value.isChangeReturnPrice && !uni.getStorageSync('hangOrder')){ |
|
|
|
value.returnPrice = truePrice |
|
|
|
} |
|
|
|
if(ischeckCustomPrice == false && !value.isChangeReturnPrice && !uni.getStorageSync('hangOrder')){ |
|
|
|
value.returnPrice = value.wholesalePrice |
|
|
|
} |
|
|
|
}else{ |
|
|
|
if(!value.isChangeReturnPrice){ |
|
|
|
value.returnPrice = value.wholesalePrice |
|
|
|
} |
|
|
|
if(!value.isChangePrice){ |
|
|
|
value.discountAmount = value.wholesalePrice |
|
|
|
value.unitPrice = value.wholesalePrice |
|
|
|
}else{ |
|
|
|
value.discountAmount = value.unitPrice |
|
|
|
if(!value.isChangeReturnPrice){ |
|
|
|
value.returnPrice = value.wholesalePrice |
|
|
|
} |
|
|
|
if(!value.isChangePrice){ |
|
|
|
value.discountAmount = value.wholesalePrice |
|
|
|
value.unitPrice = value.wholesalePrice |
|
|
|
}else{ |
|
|
|
value.discountAmount = value.unitPrice |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
@ -4371,6 +4372,10 @@ |
|
|
|
} |
|
|
|
}, 100 * i) |
|
|
|
} else { //精准搜索 |
|
|
|
if (convertedStr[i].indexOf('数量') == -1 && convertedStr[i].indexOf('名称') == -1 && convertedStr[i].indexOf( |
|
|
|
'单价') == -1 && convertedStr[i].indexOf('批发价') == -1 && convertedStr[i].indexOf(',') == -1) { |
|
|
|
convertedStr[i] = convertedStr[i] + ',' |
|
|
|
} |
|
|
|
let voiceData = this.extractInfo(convertedStr[i] + '。') |
|
|
|
if (voiceData.productSn) { |
|
|
|
voiceData.productSn = voiceData.productSn.replace(/[沟勾钩]/g, 'J'); |
|
|
|
@ -6971,6 +6976,7 @@ |
|
|
|
} |
|
|
|
|
|
|
|
} catch (e) { |
|
|
|
let id = this.oneGoodsId |
|
|
|
if (this.getMsg.indexOf('色,') != -1) { |
|
|
|
this.getMsg = this.getMsg.replace(/色,/g, '色') |
|
|
|
} |
|
|
|
@ -6983,6 +6989,15 @@ |
|
|
|
if (this.getMsg.indexOf('件') != -1) { |
|
|
|
this.getMsg = this.getMsg.replace(/件/g, '件,') |
|
|
|
} |
|
|
|
|
|
|
|
if(this.carList.get(id).isFirst == undefined){ |
|
|
|
this.carList.get(id).isFirst = false |
|
|
|
}else{ |
|
|
|
if (this.getMsg.startsWith("货号")) { |
|
|
|
this.getMsg = this.getMsg.replace(/货号/g, '') |
|
|
|
} |
|
|
|
this.getMsg = '请返回以下规格:'+this.getMsg |
|
|
|
} |
|
|
|
await this.tui.request("/purchaseOcrPicture/callWithMessageOfPurchase", "POST", { |
|
|
|
customerId:this.khName.id, |
|
|
|
questionMsg: this.getMsg |
|
|
|
@ -6992,7 +7007,7 @@ |
|
|
|
this.voiceText1 = '' |
|
|
|
this.$refs.popup.close() |
|
|
|
let purchaseDetails = res.result.data.purchaseDetails |
|
|
|
let id = this.oneGoodsId |
|
|
|
|
|
|
|
if (purchaseDetails.length > 0) { |
|
|
|
// this.carList.get(id).productCount = 0 |
|
|
|
// this.carList.get(id).returnCount = 0 |
|
|
|
@ -7190,6 +7205,7 @@ |
|
|
|
}) |
|
|
|
} |
|
|
|
} else { |
|
|
|
let id = this.oneGoodsId |
|
|
|
if (this.getMsg.indexOf('色,') != -1) { |
|
|
|
this.getMsg = this.getMsg.replace(/色,/g, '色') |
|
|
|
} |
|
|
|
@ -7202,16 +7218,25 @@ |
|
|
|
if (this.getMsg.indexOf('件') != -1) { |
|
|
|
this.getMsg = this.getMsg.replace(/件/g, '件,') |
|
|
|
} |
|
|
|
|
|
|
|
if(this.carList.get(id).isFirst == undefined){ |
|
|
|
this.carList.get(id).isFirst = false |
|
|
|
}else{ |
|
|
|
if (this.getMsg.startsWith("货号")) { |
|
|
|
this.getMsg = this.getMsg.replace(/货号/g, '') |
|
|
|
} |
|
|
|
this.getMsg = '请返回以下规格:'+this.getMsg |
|
|
|
} |
|
|
|
await this.tui.request("/purchaseOcrPicture/callWithMessageOfPurchase", "POST", { |
|
|
|
customerId:this.khName.id, |
|
|
|
questionMsg: this.getMsg |
|
|
|
}, false, true).then((res) => { |
|
|
|
if (res.code == 200) { |
|
|
|
|
|
|
|
this.voiceText = '' |
|
|
|
this.voiceText1 = '' |
|
|
|
this.$refs.popup.close() |
|
|
|
let purchaseDetails = res.result.data.purchaseDetails |
|
|
|
let id = this.oneGoodsId |
|
|
|
if (purchaseDetails.length > 0) { |
|
|
|
if (this.carList.get(id).productName == '') { |
|
|
|
this.carList.get(id).productName = purchaseDetails[0].productName |
|
|
|
@ -7236,7 +7261,7 @@ |
|
|
|
if (isTrue == false && this.carList.get(id).productSn == '') { |
|
|
|
this.carList.get(id).productSn = purchaseDetails[0].productSn |
|
|
|
} |
|
|
|
if (isTrue == false) { |
|
|
|
if (isTrue == false && this.carList.get(id).isFirst == undefined) { |
|
|
|
if (purchaseDetails[0].productId) { |
|
|
|
|
|
|
|
this.carList.get(id).id = purchaseDetails[0].productId |
|
|
|
@ -7324,57 +7349,61 @@ |
|
|
|
this.carList = specMap |
|
|
|
}) |
|
|
|
this.$nextTick(() => { |
|
|
|
for (let i = 0; i < purchaseDetails[0].stockLogList1.length; i++) { |
|
|
|
purchaseDetails[0].stockLogList1[i].name = this.sliceMsg( |
|
|
|
purchaseDetails[0].stockLogList1[i].attributeList) |
|
|
|
if (this.carList.get(id).stockLogList.size == 0) { |
|
|
|
this.carList.get(id).stockLogList.set(purchaseDetails[0] |
|
|
|
.stockLogList1[i].attributeList, purchaseDetails[0] |
|
|
|
.stockLogList1[i]) |
|
|
|
} else { |
|
|
|
|
|
|
|
if (this.carList.get(id).stockLogList.has(purchaseDetails[ |
|
|
|
0].stockLogList1[i].attributeList) == true) { |
|
|
|
this.carList.get(id).stockLogList.get(purchaseDetails[ |
|
|
|
0].stockLogList1[i].attributeList) |
|
|
|
.productCount += |
|
|
|
purchaseDetails[0].stockLogList1[i] |
|
|
|
.productCount ? |
|
|
|
Number(purchaseDetails[0].stockLogList1[i] |
|
|
|
.productCount):0 |
|
|
|
this.carList.get(id).stockLogList.get(purchaseDetails[ |
|
|
|
0].stockLogList1[i].attributeList).productNum = purchaseDetails[ |
|
|
|
0].stockLogList1[i].stockCount |
|
|
|
for(let j = 0; j < purchaseDetails.length; j++){ |
|
|
|
for (let i = 0; i < purchaseDetails[j].stockLogList1.length; i++) { |
|
|
|
purchaseDetails[j].stockLogList1[i].name = this.sliceMsg( |
|
|
|
purchaseDetails[j].stockLogList1[i].attributeList) |
|
|
|
if (this.carList.get(id).stockLogList.size == 0) { |
|
|
|
this.carList.get(id).stockLogList.set(purchaseDetails[j] |
|
|
|
.stockLogList1[i].attributeList, purchaseDetails[j] |
|
|
|
.stockLogList1[i]) |
|
|
|
} else { |
|
|
|
this.carList.get(id).stockLogList.set(purchaseDetails[ |
|
|
|
0].stockLogList1[i].attributeList, |
|
|
|
purchaseDetails[0].stockLogList1[i]) |
|
|
|
this.carList.get(id).stockLogList.get( |
|
|
|
purchaseDetails[0].stockLogList1[i] |
|
|
|
.attributeList).productNum = this.carList.get(id).stockLogList.get( |
|
|
|
purchaseDetails[0].stockLogList1[i] |
|
|
|
.attributeList).stockCount |
|
|
|
|
|
|
|
if (this.carList.get(id).stockLogList.has(purchaseDetails[ |
|
|
|
0].stockLogList1[i].attributeList) == true) { |
|
|
|
this.carList.get(id).stockLogList.get(purchaseDetails[ |
|
|
|
0].stockLogList1[i].attributeList) |
|
|
|
.productCount += |
|
|
|
purchaseDetails[j].stockLogList1[i] |
|
|
|
.productCount ? |
|
|
|
Number(purchaseDetails[j].stockLogList1[i] |
|
|
|
.productCount):0 |
|
|
|
this.carList.get(id).stockLogList.get(purchaseDetails[ |
|
|
|
0].stockLogList1[i].attributeList).productNum = purchaseDetails[ |
|
|
|
0].stockLogList1[i].stockCount |
|
|
|
} else { |
|
|
|
this.carList.get(id).stockLogList.set(purchaseDetails[ |
|
|
|
0].stockLogList1[i].attributeList, |
|
|
|
purchaseDetails[j].stockLogList1[i]) |
|
|
|
this.carList.get(id).stockLogList.get( |
|
|
|
purchaseDetails[j].stockLogList1[i] |
|
|
|
.attributeList).productNum = this.carList.get(id).stockLogList.get( |
|
|
|
purchaseDetails[j].stockLogList1[i] |
|
|
|
.attributeList).stockCount |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if(purchaseDetails[j].stockLogList1[i].productCount > 0){ |
|
|
|
this.carList.get(id).productCount += Number( |
|
|
|
purchaseDetails[j].stockLogList1[i].productCount) |
|
|
|
}else{ |
|
|
|
this.carList.get(id).returnCount += Math.abs(purchaseDetails[j].stockLogList1[i].productCount) |
|
|
|
} |
|
|
|
} |
|
|
|
if(purchaseDetails[0].stockLogList1[i].productCount > 0){ |
|
|
|
this.carList.get(id).productCount += Number( |
|
|
|
purchaseDetails[0].stockLogList1[i].productCount) |
|
|
|
}else{ |
|
|
|
this.carList.get(id).returnCount += Math.abs(purchaseDetails[0].stockLogList1[i].productCount) |
|
|
|
} |
|
|
|
if (this.carList.get(id).stockLogList.get( |
|
|
|
'{"颜色":"均色","尺码":"均码"}')) { |
|
|
|
if (this.carList.get(id).stockLogList.get( |
|
|
|
'{"颜色":"均色","尺码":"均码"}').productCount == 1 && this.carList.get( |
|
|
|
id) |
|
|
|
.stockLogList.size> 1&& |
|
|
|
purchaseDetails[0].stockLogList1.length > 0) { |
|
|
|
this.carList.get(id).stockLogList.delete( |
|
|
|
'{"颜色":"均色","尺码":"均码"}') |
|
|
|
'{"颜色":"均色","尺码":"均码"}')) { |
|
|
|
if (this.carList.get(id).stockLogList.get( |
|
|
|
'{"颜色":"均色","尺码":"均码"}').productCount == 1 && this.carList.get( |
|
|
|
id) |
|
|
|
.stockLogList.size> 1&& |
|
|
|
purchaseDetails[j].stockLogList1.length > 0) { |
|
|
|
this.carList.get(id).stockLogList.delete( |
|
|
|
'{"颜色":"均色","尺码":"均码"}') |
|
|
|
this.carList.get(id).productCount-=1 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.carList.get(id).price = Number(this.carList.get(id).productCount) * |
|
|
|
this.carList.get(id).discountAmount |
|
|
|
}) |
|
|
|
@ -8499,7 +8528,7 @@ |
|
|
|
this.getMsg = this.getMsg.replace(/货号/g, '') |
|
|
|
} |
|
|
|
this.tui.request("/app/sale/buyAi", "POST", { |
|
|
|
aiMsg: "请返回以下规格:"+this.getMsg, |
|
|
|
aiMsg: "请返回以下规格"+this.getMsg, |
|
|
|
productId: this.oneGoodsId |
|
|
|
}, false, true).then((res) => { |
|
|
|
if (res.code == 200) { |
|
|
|
@ -8571,7 +8600,7 @@ |
|
|
|
this.getMsg = this.getMsg.replace(/货号/g, '') |
|
|
|
} |
|
|
|
this.tui.request("/app/sale/buyAi", "POST", { |
|
|
|
aiMsg: "请返回以下规格:"+this.getMsg, |
|
|
|
aiMsg: "请返回以下规格"+this.getMsg, |
|
|
|
productId: this.oneGoodsId |
|
|
|
}, false, true).then((res) => { |
|
|
|
if (res.code == 200) { |
|
|
|
@ -8664,9 +8693,11 @@ |
|
|
|
if (shopId == uni.getStorageSync('shopId').substring('10','12')) { |
|
|
|
that.productId = base.decode(res.result.split(',')[0]) |
|
|
|
that.toggle('bottom', base.decode(res.result.split(',')[0])); |
|
|
|
setTimeout(res => { |
|
|
|
that.scanCodeAdd() |
|
|
|
}, 1100) |
|
|
|
if(that.attrBuilt != null && that.attrBuilt != ''){ |
|
|
|
setTimeout(res => { |
|
|
|
that.scanCodeAdd() |
|
|
|
}, 1100) |
|
|
|
} |
|
|
|
} else { |
|
|
|
setTimeout(res => { |
|
|
|
that.tui.toast('您的店铺中暂无该商品!') |
|
|
|
@ -11998,7 +12029,7 @@ |
|
|
|
} |
|
|
|
}).catch((res) => {}) |
|
|
|
} |
|
|
|
if((this.shopId == '1838094297858183168' || this.shopId == '1811579958284390400' || this.shopId == '1818888277105709056') && this.khName.name != '散客'){ |
|
|
|
if((this.shopId == '1838094297858183168' || this.shopId == '1811579958284390400' || this.shopId == '1818888277105709056') && this.khName.name != '散客' && productIds != ''){ |
|
|
|
|
|
|
|
this.tui.request("/app/product/getByUserIdAndProductIds", "POST", { |
|
|
|
userId: this.khName.id, |
|
|
|
|