|
|
@@ -199,8 +199,7 @@ export default {
|
|
|
},
|
|
|
//滚动或切换分类 获取更多数据
|
|
|
scrollPushList(){
|
|
|
-
|
|
|
- //涉及记住花材的代码和流程,请全项目搜索关键词remember_item
|
|
|
+ //涉及记住花材的代码和流程,请全项目搜索关键词 remember_item
|
|
|
//将已选的花材按classId_productId键名组合
|
|
|
let selectListData = []
|
|
|
if(!this.$util.isEmpty(this.selectList)){
|
|
|
@@ -242,7 +241,7 @@ export default {
|
|
|
},
|
|
|
//搜索对应花材
|
|
|
searchFn() {
|
|
|
- let list = this.globalItemList
|
|
|
+ const list = this.globalItemList
|
|
|
if(this.$util.isEmpty(this.py)){
|
|
|
this.globalClassItemList = '';
|
|
|
this.classIndex = 0;
|
|
|
@@ -256,25 +255,25 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
//红色粉色花材太多,搜索时会卡住,所以设置输入第三个字母时才搜索
|
|
|
- if(this.py.indexOf('fs') == 0 && this.py.length <= 2){
|
|
|
- return
|
|
|
- }
|
|
|
- if(this.py.indexOf('hs') == 0 && this.py.length <= 2){
|
|
|
- return
|
|
|
- }
|
|
|
- if(this.py.indexOf('zs') == 0 && this.py.length <= 2){
|
|
|
- return
|
|
|
- }
|
|
|
- if(this.py.indexOf('ls') == 0 && this.py.length <= 2){
|
|
|
- return
|
|
|
- }
|
|
|
- if(this.py.indexOf('bs') == 0 && this.py.length <= 2){
|
|
|
- return
|
|
|
- }
|
|
|
- if(this.py.indexOf('yj') == 0 && this.py.length <= 2){
|
|
|
- return
|
|
|
- }
|
|
|
- //涉及记住花材的代码和流程,请全项目搜索关键词remember_item
|
|
|
+ // if(this.py.indexOf('fs') == 0 && this.py.length <= 2){
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // if(this.py.indexOf('hs') == 0 && this.py.length <= 2){
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // if(this.py.indexOf('zs') == 0 && this.py.length <= 2){
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // if(this.py.indexOf('ls') == 0 && this.py.length <= 2){
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // if(this.py.indexOf('bs') == 0 && this.py.length <= 2){
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // if(this.py.indexOf('yj') == 0 && this.py.length <= 2){
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ //涉及记住花材的代码和流程,请全项目搜索关键词 remember_item
|
|
|
//将已选的花材按productId键名组合
|
|
|
let selectListData = []
|
|
|
if(!this.$util.isEmpty(this.selectList)){
|
|
|
@@ -283,13 +282,16 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- let filterItemData = [];
|
|
|
- list.forEach(currentItem => {
|
|
|
-
|
|
|
+ const queryUpper = this.py.toLocaleUpperCase()
|
|
|
+ const groupsMap = {}
|
|
|
+ const items = Object.values(list || {})
|
|
|
+ for (let idx = 0; idx < items.length; idx++) {
|
|
|
+ const currentItem = items[idx]
|
|
|
+ if(!currentItem){ continue }
|
|
|
//组合已记忆已选择的花材
|
|
|
- let currentPId = currentItem.id
|
|
|
- let selectProduct = selectListData[currentPId] || []
|
|
|
- if(!this.$util.isEmpty(selectProduct)){
|
|
|
+ const currentPId = currentItem.id
|
|
|
+ const selectProduct = selectListData[currentPId] || null
|
|
|
+ if(selectProduct){
|
|
|
currentItem.bigCount = selectProduct.bigCount || 0
|
|
|
currentItem.userPrice = selectProduct.userPrice || 0
|
|
|
currentItem.smallCount = selectProduct.smallCount || 0
|
|
|
@@ -298,25 +300,22 @@ export default {
|
|
|
currentItem.userPrice = 0
|
|
|
currentItem.smallCount = 0
|
|
|
}
|
|
|
- let elePy = (currentItem.py && currentItem.py.toLocaleUpperCase()) || "";
|
|
|
- let hasPy = elePy.indexOf(this.py.toLocaleUpperCase()) >= 0;
|
|
|
- if (hasPy) {
|
|
|
- if(this.$util.isEmpty(filterItemData)){
|
|
|
- filterItemData = [{classId: currentItem.classId, className: currentItem.className,isActive:true,child:[currentItem]}]
|
|
|
- }else{
|
|
|
- filterItemData.forEach(res => {
|
|
|
- if(res.classId==currentItem.classId){
|
|
|
- res.child.push(currentItem)
|
|
|
- }else{
|
|
|
- filterItemData.push({classId: currentItem.classId, className: currentItem.className,isActive:true,child:[currentItem]})
|
|
|
- }
|
|
|
- })
|
|
|
+
|
|
|
+ // 预计算并复用 py 大写
|
|
|
+ if(currentItem._pyUpper === undefined){
|
|
|
+ currentItem._pyUpper = (currentItem.py && currentItem.py.toLocaleUpperCase()) || ""
|
|
|
+ }
|
|
|
+ const hasPy = currentItem._pyUpper.indexOf(queryUpper) >= 0
|
|
|
+ if(hasPy){
|
|
|
+ const cid = currentItem.classId
|
|
|
+ if(!groupsMap[cid]){
|
|
|
+ groupsMap[cid] = {classId: cid, className: currentItem.className, isActive: true, child: []}
|
|
|
}
|
|
|
+ groupsMap[cid].child.push(currentItem)
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- })
|
|
|
-
|
|
|
- let searchList = this.$util.unique(filterItemData)
|
|
|
+ const searchList = Object.values(groupsMap)
|
|
|
this.globalClassItemList = searchList;
|
|
|
this.classIndex = 0;
|
|
|
this.scroll_into_view = 'class_'+0;
|
|
|
@@ -489,7 +488,7 @@ export default {
|
|
|
this.customData = {};
|
|
|
},
|
|
|
itemNumPriceRefresh(){
|
|
|
- //涉及记住花材的代码和流程,请全项目搜索关键词remember_item
|
|
|
+ //涉及记住花材的代码和流程,请全项目搜索关键词 remember_item
|
|
|
//将已选的花材按classId_productId键名组合
|
|
|
let selectListData = []
|
|
|
if(!this.$util.isEmpty(this.selectList)){
|