|
|
@@ -1,5 +1,6 @@
|
|
|
import { getProductDataApi } from "@/api/product/index";
|
|
|
import { mapGetters, mapActions } from "vuex";
|
|
|
+import { copyObject } from "@/utils/util";
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -26,6 +27,31 @@ export default {
|
|
|
onUnload() {},
|
|
|
computed: {
|
|
|
...mapGetters(["getSelectInfo"]),
|
|
|
+ filterProductInfo() {
|
|
|
+ let list = copyObject(this.productInfo);
|
|
|
+ if (this.py) {
|
|
|
+ let commonList = list.find(ele => {
|
|
|
+ //在常用中过滤
|
|
|
+ return ele.classId == -2;
|
|
|
+ });
|
|
|
+ if (commonList) {
|
|
|
+ let commonChildList = [];
|
|
|
+ if (!this.$util.isEmpty(commonList.child)) {
|
|
|
+ commonList.child.forEach(ele => {
|
|
|
+ let hasName = ele.itemName && ele.itemName.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);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ commonList.child = commonChildList;
|
|
|
+ list = [commonList];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ },
|
|
|
/**
|
|
|
* 当前页面选中的商品列表
|
|
|
*/
|
|
|
@@ -37,6 +63,7 @@ export default {
|
|
|
if (curClass) {
|
|
|
return `class_${curClass.classId}`;
|
|
|
}
|
|
|
+
|
|
|
return "";
|
|
|
},
|
|
|
//选择商品总价
|
|
|
@@ -57,6 +84,7 @@ export default {
|
|
|
},
|
|
|
//选择商品总数
|
|
|
allCount() {
|
|
|
+ console.log(444444, this.selectList);
|
|
|
return this.selectList.length;
|
|
|
},
|
|
|
/**
|
|
|
@@ -204,15 +232,16 @@ export default {
|
|
|
const element = list[index];
|
|
|
if (element.id == item.id && element.classId == item.classId) {
|
|
|
has = true;
|
|
|
- if (this.isLimit) {
|
|
|
- if (element.bigCount < item.bigNum) {
|
|
|
- list[index] = { ...element, bigCount: ++element.bigCount };
|
|
|
- } else if (element.smallCount < item.smallNum) {
|
|
|
- list[index] = { ...element, smallCount: ++element.smallCount };
|
|
|
- }
|
|
|
- } else {
|
|
|
- list[index] = { ...element, bigCount: ++element.bigCount };
|
|
|
- }
|
|
|
+ // if (this.isLimit) {
|
|
|
+ // if (element.bigCount < item.bigNum) {
|
|
|
+ // list[index] = { ...element, bigCount: ++element.bigCount };
|
|
|
+ // }
|
|
|
+ // else if (element.smallCount < item.smallNum) {
|
|
|
+ // list[index] = { ...element, smallCount: ++element.smallCount };
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ list[index] = { ...element, bigCount: ++element.bigCount };
|
|
|
+ // }
|
|
|
|
|
|
if (this.isLimit) {
|
|
|
const { bigCount, smallCount } = list[index];
|
|
|
@@ -270,7 +299,7 @@ export default {
|
|
|
if (element.bigCount > 0) {
|
|
|
list[index] = { ...element, bigCount: --element.bigCount };
|
|
|
} else if (element.smallCount > 0) {
|
|
|
- list[index] = { ...element, smallCount: --element.smallCount };
|
|
|
+ list[index] = { ...element, smallCount: 0 };
|
|
|
}
|
|
|
|
|
|
if (this.isLimit) {
|
|
|
@@ -285,6 +314,9 @@ export default {
|
|
|
list[index].smallCount = Number(item.smallNum);
|
|
|
}
|
|
|
}
|
|
|
+ if (element.bigCount == 0 && element.smallCount == 0) {
|
|
|
+ list.splice(index, 1);
|
|
|
+ }
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
@@ -373,6 +405,10 @@ export default {
|
|
|
} else {
|
|
|
this.classIndex = cur;
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 搜索对应花材
|
|
|
+ */
|
|
|
+ searchFn() {}
|
|
|
}
|
|
|
};
|