|
|
@@ -75,25 +75,32 @@ export default {
|
|
|
suitFilterProductInfo() {
|
|
|
let list = copyObject(this.suitInfo);
|
|
|
if (this.py) {
|
|
|
- let commonList = list.find(ele => {
|
|
|
+ let commonChildList = [];
|
|
|
+ list.forEach(ele => {
|
|
|
//在常用中过滤
|
|
|
- return ele.classId != -2;
|
|
|
- });
|
|
|
- if (commonList) {
|
|
|
- let commonChildList = [];
|
|
|
- if (!this.$util.isEmpty(commonList.child)) {
|
|
|
- commonList.child.forEach(ele => {
|
|
|
- let hasName = ele.goodsName && ele.goodsName.indexOf(this.py) >= 0;
|
|
|
- let elePy = (ele.py && ele.py.toLocaleUpperCase()) || "";
|
|
|
- let hasPy = elePy.indexOf(this.py.toLocaleUpperCase()) >= 0;
|
|
|
- if (hasName || hasPy) {
|
|
|
- commonChildList.push(ele);
|
|
|
- }
|
|
|
- });
|
|
|
+ if(ele.classId != -2){
|
|
|
+ ele.child.forEach(obj => {
|
|
|
+ let hasName = obj.goodsName && obj.goodsName.indexOf(this.py) >= 0;
|
|
|
+ let elePy = (obj.py && obj.py.toLocaleUpperCase()) || "";
|
|
|
+ let hasPy = elePy.indexOf(this.py.toLocaleUpperCase()) >= 0;
|
|
|
+ if (hasName || hasPy) {
|
|
|
+ if(commonChildList==''){
|
|
|
+ commonChildList = [...commonChildList,{classId: ele.classId, className: ele.className,child:[obj]}];
|
|
|
+ }else{
|
|
|
+ commonChildList.forEach(res => {
|
|
|
+ if(res.classId==ele.classId){
|
|
|
+ res.child.push(obj)
|
|
|
+ }else{
|
|
|
+ commonChildList = [...commonChildList,{classId: ele.classId, className: ele.className,child:[obj]}];
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
- commonList.child = commonChildList;
|
|
|
- list = [commonList];
|
|
|
- }
|
|
|
+ });
|
|
|
+ list = commonChildList
|
|
|
+ this.suitClassIndex = 0;
|
|
|
}
|
|
|
return list;
|
|
|
},
|
|
|
@@ -387,38 +394,32 @@ export default {
|
|
|
const element = list[index];
|
|
|
if (element.id == item.id && element.classId == item.classId) {
|
|
|
has = true;
|
|
|
- if(this.offVerifyRepertory){//去除库存验证
|
|
|
- if(this.isSmallCount){
|
|
|
- list[index] = { ...element, smallCount: ++element.smallCount };
|
|
|
- }else{
|
|
|
- list[index] = { ...element, bigCount: ++element.bigCount };
|
|
|
- }
|
|
|
- }else {
|
|
|
- if (this.isLimit) {
|
|
|
- if (element.bigCount < item.bigNum) {
|
|
|
- if(!this.isSmallCount){
|
|
|
- list[index] = { ...element, bigCount: ++element.bigCount };
|
|
|
- }
|
|
|
- }else{this.$msg("库存不足");}
|
|
|
- if(element.smallCount < item.smallNum) {
|
|
|
- if(this.isSmallCount){
|
|
|
- list[index] = { ...element, smallCount: ++element.smallCount };
|
|
|
- }
|
|
|
- }else{this.$msg("库存不足");}
|
|
|
- }
|
|
|
-
|
|
|
- if (this.isLimit) {
|
|
|
- const {bigCount, smallCount} = list[index];
|
|
|
- //超过库存时 设置为库存最大值
|
|
|
- const ratio = Number(item.ratio);
|
|
|
- if (
|
|
|
- Number(bigCount) * ratio + Number(smallCount) >
|
|
|
- Number(item.bigNum) * ratio + Number(item.smallNum)
|
|
|
- ) {
|
|
|
- list[index].bigCount = Number(item.bigNum);
|
|
|
- list[index].smallCount = Number(item.smallNum);
|
|
|
- this.$msg("库存不足");
|
|
|
- }
|
|
|
+ // if(this.offVerifyRepertory){//去除库存验证
|
|
|
+ // if(this.isSmallCount){
|
|
|
+ // list[index] = { ...element, smallCount: ++element.smallCount };
|
|
|
+ // }else{
|
|
|
+ // list[index] = { ...element, bigCount: ++element.bigCount };
|
|
|
+ // }
|
|
|
+ // }else {
|
|
|
+ //
|
|
|
+ // }
|
|
|
+ if(!this.isSmallCount){
|
|
|
+ list[index] = { ...element, bigCount: ++element.bigCount };
|
|
|
+ }
|
|
|
+ if(this.isSmallCount){
|
|
|
+ list[index] = { ...element, smallCount: ++element.smallCount };
|
|
|
+ }
|
|
|
+ if (this.isLimit) {
|
|
|
+ const {bigCount, smallCount} = list[index];
|
|
|
+ //超过库存时 设置为库存最大值
|
|
|
+ const ratio = Number(item.ratio);
|
|
|
+ if (
|
|
|
+ Number(bigCount) * ratio + Number(smallCount) >
|
|
|
+ Number(item.bigNum) * ratio + Number(item.smallNum)
|
|
|
+ ) {
|
|
|
+ list[index].bigCount = Number(item.bigNum);
|
|
|
+ list[index].smallCount = Number(item.smallNum);
|
|
|
+ this.$msg("库存不足");
|
|
|
}
|
|
|
}
|
|
|
break;
|