|
|
@@ -1,5 +1,4 @@
|
|
|
-import { getGoodsDataApi,getProductDataApi,getPxClassDataApi } from "@/api/product/index";
|
|
|
-import { getGhsProductList } from "@/api/product/index";
|
|
|
+import { getGoodsDataApi,getProductDataApi,getPxClassDataApi,getGhsProductList } from "@/api/product";
|
|
|
import { mapGetters, mapActions } from "vuex";
|
|
|
import { copyObject } from "@/utils/util";
|
|
|
export default {
|
|
|
@@ -7,10 +6,8 @@ export default {
|
|
|
return {
|
|
|
options:'',
|
|
|
pageType: "bill", //选择商品页面类别 用于区分不同功能的数据
|
|
|
-
|
|
|
suitInfo: [], //商品-商品信息
|
|
|
suitClassIndex: 0, //商品-当前商品类别下标
|
|
|
-
|
|
|
productInfo: [], //商品信息
|
|
|
pxClassInfo: [], //培训班开单列表
|
|
|
classIndex: 0, //当前商品类别下标
|
|
|
@@ -18,16 +15,13 @@ export default {
|
|
|
type: "", //库存预警时,固定为waring,其他情况不传或者传空
|
|
|
autoLoad: true, //自动获取商品信息
|
|
|
isLimit: true, //选择数量不能大于库存限制
|
|
|
-
|
|
|
//商品开单
|
|
|
suit_scroll_into_view:"",
|
|
|
suit_top_list:'',
|
|
|
- suitTimeFun:"",
|
|
|
suitFilterProductInfo:'',
|
|
|
//组合开单
|
|
|
scroll_into_view:"",
|
|
|
top_list:'',
|
|
|
- timeFun:"",
|
|
|
filterProductInfo:'',
|
|
|
//当前页面默认使用的单位 0大单位 1小单位
|
|
|
globalUnitType:0
|
|
|
@@ -168,15 +162,7 @@ export default {
|
|
|
let has = false;
|
|
|
if (this.selectList) {
|
|
|
for (const item of this.selectList) {
|
|
|
- const {
|
|
|
- bigCount,
|
|
|
- smallCount,
|
|
|
- bigNum,
|
|
|
- bigUnit,
|
|
|
- smallNum,
|
|
|
- smallUnit,
|
|
|
- ratio
|
|
|
- } = item;
|
|
|
+ const { bigCount, smallCount, bigNum, bigUnit, smallNum, smallUnit, ratio } = item;
|
|
|
const ratioNum = Number(ratio);
|
|
|
if (
|
|
|
Number(bigCount) * ratioNum + Number(smallCount) >
|
|
|
@@ -238,89 +224,53 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
//采购时请求供应商花材
|
|
|
- async initGhsData(id,shopId) {
|
|
|
+ async initGhsData(id,shopId,showAll) {
|
|
|
//extendInfo调用时的扩展参数,如shopId
|
|
|
try {
|
|
|
- let params = {
|
|
|
- py: this.py,
|
|
|
- id:id,
|
|
|
- shopId:shopId
|
|
|
- };
|
|
|
- let directList = [];
|
|
|
+ let params = { py: this.py, id:id, shopId:shopId, showAll:showAll }
|
|
|
const { data } = await getGhsProductList(params);
|
|
|
- data.forEach(element => {
|
|
|
- element.child &&
|
|
|
- element.child.forEach(child => {
|
|
|
-
|
|
|
- //价格如果有改动,记忆的花材价格需要改掉 shish 20210811
|
|
|
- directList[child.id] = child
|
|
|
-
|
|
|
- child.classId = element.classId;
|
|
|
- child.className = element.className;
|
|
|
- });
|
|
|
- });
|
|
|
this.productInfo = data;
|
|
|
-
|
|
|
- if(this.pageType == 'cg' && !this.$util.isEmpty(this.option.id)){
|
|
|
- if(uni.getStorageSync('selectList'+this.pageType+'_ghs_'+this.option.id)){
|
|
|
- let currentInfo = uni.getStorageSync('selectList'+this.pageType+'_ghs_'+this.option.id)
|
|
|
- if(!this.$util.isEmpty(currentInfo)){
|
|
|
- currentInfo.forEach((currentItem,currentIndex,currentArray)=>{
|
|
|
- let currentId = currentItem.id
|
|
|
- if(directList[currentId]){
|
|
|
- //价格如果有改动,记忆花材的价格需要更新 shish 20210811
|
|
|
- currentArray[currentIndex].bigPrice = directList[currentId].bigPrice
|
|
|
- currentArray[currentIndex].smallPrice = directList[currentId].smallPrice
|
|
|
- }
|
|
|
- })
|
|
|
- this.setSelectInfoByType({ type: this.pageType, info: currentInfo })
|
|
|
- }else{
|
|
|
- //临时解决方案
|
|
|
- this.resetSelectInfoByType(this.pageType);
|
|
|
- }
|
|
|
+ if(this.pageType == 'cg' || this.pageType == 'bookCg'){
|
|
|
+ let targetId = this.option.id ? this.option.id : 0
|
|
|
+ let currentInfo = uni.getStorageSync('selectList'+this.pageType+'_ghs_'+targetId)
|
|
|
+ if(!this.$util.isEmpty(currentInfo)){
|
|
|
+ this.setSelectInfoByType({ type: this.pageType, info: currentInfo })
|
|
|
}else{
|
|
|
//临时解决方案
|
|
|
this.resetSelectInfoByType(this.pageType);
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
this.classIndex = 0;
|
|
|
this.scroll_into_view = 'class_0';
|
|
|
this.scrollPushList();
|
|
|
} catch (error) {
|
|
|
+ uni.hideLoading()
|
|
|
} finally {
|
|
|
- uni.hideLoading();
|
|
|
+ uni.hideLoading()
|
|
|
}
|
|
|
},
|
|
|
async initData(extendInfo) {
|
|
|
//extendInfo调用时的扩展参数 如 shopId
|
|
|
- try {
|
|
|
- let params = {
|
|
|
- py: this.py,
|
|
|
- type: this.type
|
|
|
- };
|
|
|
- if (extendInfo) {
|
|
|
- params = { ...params, ...extendInfo };
|
|
|
- }
|
|
|
- const { data } = await getProductDataApi(params);
|
|
|
- data.forEach(element => {
|
|
|
- element.child &&
|
|
|
- element.child.forEach(child => {
|
|
|
- child.classId = element.classId;
|
|
|
- child.className = element.className;
|
|
|
- });
|
|
|
+ let params = {
|
|
|
+ py: this.py,
|
|
|
+ type: this.type
|
|
|
+ };
|
|
|
+ if (extendInfo) {
|
|
|
+ params = { ...params, ...extendInfo };
|
|
|
+ }
|
|
|
+ const { data } = await getProductDataApi(params);
|
|
|
+ data.forEach(element => {
|
|
|
+ element.child &&
|
|
|
+ element.child.forEach(child => {
|
|
|
+ child.classId = element.classId;
|
|
|
+ child.className = element.className;
|
|
|
});
|
|
|
- this.productInfo = data;
|
|
|
- this.classIndex = 0;
|
|
|
- this.scrollPushList();
|
|
|
- } catch (error) {
|
|
|
- } finally {
|
|
|
- uni.hideLoading();
|
|
|
- }
|
|
|
+ });
|
|
|
+ this.productInfo = data;
|
|
|
+ this.classIndex = 0;
|
|
|
+ this.scrollPushList();
|
|
|
},
|
|
|
- /**
|
|
|
- * 滚动或切换分类 获取更多数据
|
|
|
- * **/
|
|
|
+ //滚动或切换分类 获取更多数据
|
|
|
scrollPushList(){
|
|
|
let list = copyObject(this.productInfo);
|
|
|
let classList = [];
|
|
|
@@ -332,55 +282,19 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
this.filterProductInfo = classList
|
|
|
- return
|
|
|
- if(this.$util.isEmpty(this.filterProductInfo)){ //第一次进入无数据
|
|
|
- let classList = [];
|
|
|
- list.forEach(ele=>{
|
|
|
- classList = [...classList,{child:[],classId:ele.classId,className:ele.className}]
|
|
|
- })
|
|
|
- classList[this.classIndex].child = list[this.classIndex].child;
|
|
|
- this.filterProductInfo = classList;
|
|
|
- let classIndex = 1;
|
|
|
- this.timeFun = setInterval(()=>{
|
|
|
- if(classIndex<this.filterProductInfo.length){
|
|
|
- classList[classIndex].child = list[classIndex].child;
|
|
|
- this.filterProductInfo = classList;
|
|
|
- classIndex++
|
|
|
- }else{
|
|
|
- clearInterval(this.timeFun)
|
|
|
- }
|
|
|
- },600)
|
|
|
- }else{//获取更多数据
|
|
|
- if(this.$util.isEmpty(this.filterProductInfo[this.classIndex].child)){
|
|
|
- this.filterProductInfo[this.classIndex].child = list[this.classIndex].child;
|
|
|
- }
|
|
|
- if(this.classIndex+1<this.filterProductInfo.length-1){
|
|
|
- if(this.$util.isEmpty(this.filterProductInfo[this.classIndex+1].child)){
|
|
|
- this.filterProductInfo[this.classIndex+1].child = list[this.classIndex+1].child;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
},
|
|
|
- /**
|
|
|
- * 滚动商品监听
|
|
|
- * **/
|
|
|
+ //滚动商品监听
|
|
|
scroll_detail(options){
|
|
|
//options 为滚动信息。 options.detail.scrollTop 值为相对于scroll-view。
|
|
|
if(!uni.getStorageSync("resolve")){
|
|
|
this.get_node_details(options);
|
|
|
};
|
|
|
},
|
|
|
- /**
|
|
|
- * 获取商品节点信息
|
|
|
- * **/
|
|
|
+ //获取商品节点信息
|
|
|
get_node_details(options){
|
|
|
const query = uni.createSelectorQuery().in(this); //获得实力
|
|
|
//获取多个节点方式
|
|
|
query.selectAll(".selectAll").boundingClientRect(data=>{
|
|
|
- // console.log(data); //得到class类名为 selectAll的数组集合
|
|
|
this.top_list = data.map(item=>{
|
|
|
return Math.ceil(item.top);
|
|
|
});
|
|
|
@@ -414,9 +328,9 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
scroll_bottom(){
|
|
|
- this.classIndex = this.filterProductInfo.length-1
|
|
|
- this.filterProductInfo[this.classIndex].isActive = true;
|
|
|
- this.filterProductInfo[this.classIndex-1].isActive = true;
|
|
|
+ this.classIndex = this.filterProductInfo.length-1
|
|
|
+ this.filterProductInfo[this.classIndex].isActive = true;
|
|
|
+ this.filterProductInfo[this.classIndex-1].isActive = true;
|
|
|
},
|
|
|
//获取当前选中商品总价
|
|
|
getSelectItemPrice(item) {
|
|
|
@@ -428,9 +342,7 @@ export default {
|
|
|
price = Math.round(sum * 100) / 100;
|
|
|
return price;
|
|
|
},
|
|
|
- /**
|
|
|
- * 商品-请求商品数据
|
|
|
- */
|
|
|
+ //商品-请求商品数据
|
|
|
async initGoodsData(extendInfo) {
|
|
|
//extendInfo调用时的扩展参数 如 shopId
|
|
|
try {
|
|
|
@@ -457,9 +369,7 @@ export default {
|
|
|
uni.hideLoading();
|
|
|
}
|
|
|
},
|
|
|
- /**
|
|
|
- * 商品-滚动或切换分类 获取更多数据
|
|
|
- * **/
|
|
|
+ //商品-滚动或切换分类 获取更多数据
|
|
|
suitScrollPushList(){
|
|
|
let list = copyObject(this.suitInfo);
|
|
|
let classList = [];
|
|
|
@@ -471,41 +381,8 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
this.suitFilterProductInfo = classList
|
|
|
- return
|
|
|
- if(this.$util.isEmpty(this.suitFilterProductInfo)){ //第一次进入无数据
|
|
|
- let classList = [];
|
|
|
- list.forEach(ele=>{
|
|
|
- classList = [...classList,{child:[],classId:ele.classId,className:ele.className}]
|
|
|
- })
|
|
|
- classList[this.suitClassIndex].child = list[this.suitClassIndex].child;
|
|
|
- this.suitFilterProductInfo = classList;
|
|
|
- let classIndex = 1;
|
|
|
- this.suitTimeFun = setInterval(()=>{
|
|
|
- if(classIndex<this.suitFilterProductInfo.length){
|
|
|
- classList[classIndex].child = list[classIndex].child;
|
|
|
- this.suitFilterProductInfo = classList;
|
|
|
- classIndex++
|
|
|
- }else{
|
|
|
- clearInterval(this.suitTimeFun)
|
|
|
- }
|
|
|
- },600)
|
|
|
- }else{//获取更多数据
|
|
|
- if(this.$util.isEmpty(this.suitFilterProductInfo[this.suitClassIndex].child)){
|
|
|
- this.suitFilterProductInfo[this.suitClassIndex].child = list[this.suitClassIndex].child;
|
|
|
- }
|
|
|
- if(this.suitClassIndex+1<this.suitFilterProductInfo.length-1){
|
|
|
- if(this.$util.isEmpty(this.suitFilterProductInfo[this.suitClassIndex+1].child)){
|
|
|
- this.suitFilterProductInfo[this.suitClassIndex+1].child = list[this.suitClassIndex+1].child;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
},
|
|
|
- /**
|
|
|
- * 获取当前选中商品总价
|
|
|
- */
|
|
|
+ //获取当前选中商品总价
|
|
|
getSelectGoodsPrice(item) {
|
|
|
let price = 0;
|
|
|
|
|
|
@@ -516,9 +393,7 @@ export default {
|
|
|
}
|
|
|
return price;
|
|
|
},
|
|
|
- /**
|
|
|
- * 通过id获取当前选中的商品信息
|
|
|
- */
|
|
|
+ //通过id获取当前选中的商品信息
|
|
|
getSelectItemById(id, classId) {
|
|
|
let info = {
|
|
|
bigCount: 0, //扎数
|
|
|
@@ -542,9 +417,7 @@ export default {
|
|
|
}
|
|
|
return info;
|
|
|
},
|
|
|
- /**
|
|
|
- * 通过id获取当前选中的商品类别信息 左边菜单角标 当前选中该类别商品多少件
|
|
|
- */
|
|
|
+ //通过id获取当前选中的商品类别信息 左边菜单角标 当前选中该类别商品多少件
|
|
|
getSelectClassById(classId) {
|
|
|
let info = {
|
|
|
bigCount: 0, //扎数
|
|
|
@@ -730,9 +603,7 @@ export default {
|
|
|
//记忆已经选择的花材
|
|
|
this.rememberProduct()
|
|
|
},
|
|
|
- /**
|
|
|
- * 通过id获取当前选中的商品类别信息 左边菜单角标 当前选中该类别商品多少件
|
|
|
- */
|
|
|
+ //通过id获取当前选中的商品类别信息 左边菜单角标 当前选中该类别商品多少件
|
|
|
getSuitSelectClassById(classId) {
|
|
|
let info = {
|
|
|
bigCount: 0, //扎数
|
|
|
@@ -757,10 +628,7 @@ export default {
|
|
|
}
|
|
|
return info;
|
|
|
},
|
|
|
-
|
|
|
- /**
|
|
|
- * 多风格-添加商品
|
|
|
- */
|
|
|
+ //多风格-添加商品
|
|
|
addGoodsEvent(item) {
|
|
|
console.log(item,'itemitem')
|
|
|
const list = this.selectList;
|
|
|
@@ -801,9 +669,7 @@ export default {
|
|
|
this.setSelectInfoByType({ type: this.pageType, info: list });
|
|
|
// this.$forceUpdate();
|
|
|
},
|
|
|
- /**
|
|
|
- * 多风格-添加商品
|
|
|
- */
|
|
|
+ //多风格-添加商品
|
|
|
addGoods(item) {
|
|
|
const list = this.selectList;
|
|
|
let has = false;
|
|
|
@@ -841,9 +707,7 @@ export default {
|
|
|
this.setSelectInfoByType({ type: this.pageType, info: list });
|
|
|
// this.$forceUpdate();
|
|
|
},
|
|
|
- /**
|
|
|
- * 多风格-减去商品
|
|
|
- */
|
|
|
+ //多风格-减去商品
|
|
|
delGoodsEvent(item) {
|
|
|
const list = this.selectList;
|
|
|
for (let index = 0; index < list.length; index++) {
|
|
|
@@ -861,9 +725,7 @@ export default {
|
|
|
}
|
|
|
this.setSelectInfoByType({ type: this.pageType, info: list });
|
|
|
},
|
|
|
- /**
|
|
|
- * 更新商品
|
|
|
- */
|
|
|
+ //更新商品
|
|
|
updateItemEvent(item) {
|
|
|
const list = this.selectList;
|
|
|
|
|
|
@@ -898,26 +760,32 @@ export default {
|
|
|
this.rememberProduct()
|
|
|
|
|
|
},
|
|
|
- /**
|
|
|
- * 切换左侧商品类别
|
|
|
- */
|
|
|
+ //切换左侧商品类别
|
|
|
swichClass(cur) {
|
|
|
- // clearInterval(this.timeFun)
|
|
|
- console.log(cur,'---',this.filterProductInfo)
|
|
|
this.classIndex = cur;
|
|
|
this.filterProductInfo[cur].isActive = true;
|
|
|
- if(cur==this.filterProductInfo.length-1){
|
|
|
- this.filterProductInfo[cur-1].isActive = true;
|
|
|
+ if(cur == this.filterProductInfo.length-1){
|
|
|
+ if(this.filterProductInfo[cur-1]){
|
|
|
+ this.filterProductInfo[cur-1].isActive = true
|
|
|
+ }
|
|
|
}
|
|
|
- if(cur!=0&&cur!=this.filterProductInfo.length-2){
|
|
|
- this.filterProductInfo[cur-1].isActive = true;
|
|
|
- this.filterProductInfo[cur+1].isActive = true;
|
|
|
- if(this.filterProductInfo[cur+1].child.length<5&&cur<this.filterProductInfo.length-3){
|
|
|
- this.filterProductInfo[cur+2].isActive = true;
|
|
|
+ if(cur !=0 && cur != this.filterProductInfo.length-2){
|
|
|
+ if(this.filterProductInfo[cur-1]){
|
|
|
+ this.filterProductInfo[cur-1].isActive = true
|
|
|
+ }
|
|
|
+ if(this.filterProductInfo[cur+1]){
|
|
|
+ this.filterProductInfo[cur+1].isActive = true
|
|
|
+ }
|
|
|
+ if(this.filterProductInfo[cur+1] && this.filterProductInfo[cur+1].child.length < 5 && cur < this.filterProductInfo.length-3){
|
|
|
+ if(this.filterProductInfo[cur+2]){
|
|
|
+ this.filterProductInfo[cur+2].isActive = true
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
this.scroll_into_view = '';
|
|
|
- this.$nextTick(()=>{this.scroll_into_view = 'class_'+cur;})
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ this.scroll_into_view = 'class_'+cur
|
|
|
+ })
|
|
|
// this.scrollPushList();
|
|
|
//解决最后一个 ***来回*** 问题 (由于点击左侧导航,右侧锚点位置信息变化,此时滚动事件也随之滚动。)
|
|
|
uni.setStorageSync("resolve","last");
|
|
|
@@ -925,14 +793,8 @@ export default {
|
|
|
uni.removeStorageSync("resolve")
|
|
|
},400);
|
|
|
},
|
|
|
-
|
|
|
- /**
|
|
|
- * 商品(多风格)-切换左侧商品类别
|
|
|
- */
|
|
|
+ //商品(多风格)-切换左侧商品类别
|
|
|
suitSwichClass(cur) {
|
|
|
-
|
|
|
-
|
|
|
- // clearInterval(this.suitTimeFun)
|
|
|
this.suitClassIndex = cur;
|
|
|
this.suitFilterProductInfo[cur].isActive = true;
|
|
|
if(cur==this.suitFilterProductInfo.length-1){
|
|
|
@@ -952,18 +814,14 @@ export default {
|
|
|
uni.removeStorageSync("resolve")
|
|
|
},400);
|
|
|
},
|
|
|
- /**
|
|
|
- * 滚动商品监听
|
|
|
- * **/
|
|
|
+ //滚动商品监听
|
|
|
suit_scroll_detail(options){
|
|
|
//options 为滚动信息。 options.detail.scrollTop 值为相对于scroll-view。
|
|
|
if(!uni.getStorageSync("resolve")){
|
|
|
this.suit_get_node_details(options);
|
|
|
};
|
|
|
},
|
|
|
- /**
|
|
|
- * 获取商品节点信息
|
|
|
- * **/
|
|
|
+ //获取商品节点信息
|
|
|
suit_get_node_details(options){
|
|
|
const query = uni.createSelectorQuery().in(this); //获得实力
|
|
|
//获取多个节点方式
|
|
|
@@ -1002,13 +860,10 @@ export default {
|
|
|
this.suitFilterProductInfo[this.suitClassIndex].isActive = true;
|
|
|
// this.suitScrollPushList();
|
|
|
},
|
|
|
- /**
|
|
|
- * 搜索对应花材
|
|
|
- */
|
|
|
+ //搜索对应花材
|
|
|
suitSearchFn() {
|
|
|
let list = copyObject(this.suitFilterProductInfo);
|
|
|
if(!this.$util.isEmpty(this.py)){
|
|
|
- clearInterval(this.suitTimeFun)
|
|
|
let commonChildList = [];
|
|
|
list.forEach(ele => {
|
|
|
//过滤常用
|
|
|
@@ -1050,7 +905,6 @@ export default {
|
|
|
searchFn() {
|
|
|
let list = copyObject(this.productInfo);
|
|
|
if(!this.$util.isEmpty(this.py)){
|
|
|
-
|
|
|
//大于等于2个字符才开始搜索 shish 20210622
|
|
|
if(this.py.length <=1){
|
|
|
return
|
|
|
@@ -1059,47 +913,71 @@ export default {
|
|
|
if(this.py.toLocaleLowerCase().indexOf('fs') == 0 && this.py.length <= 2){
|
|
|
return
|
|
|
}
|
|
|
+ if(this.py.indexOf('粉色') == 0 && this.py.length <= 2){
|
|
|
+ return
|
|
|
+ }
|
|
|
if(this.py.toLocaleLowerCase().indexOf('hs') == 0 && this.py.length <= 2){
|
|
|
return
|
|
|
}
|
|
|
+ if(this.py.indexOf('红色') == 0 && this.py.length <= 2){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(this.py.indexOf('黄色') == 0 && this.py.length <= 2){
|
|
|
+ return
|
|
|
+ }
|
|
|
if(this.py.toLocaleLowerCase().indexOf('zs') == 0 && this.py.length <= 2){
|
|
|
return
|
|
|
}
|
|
|
+ if(this.py.indexOf('紫色') == 0 && this.py.length <= 2){
|
|
|
+ return
|
|
|
+ }
|
|
|
if(this.py.toLocaleLowerCase().indexOf('ls') == 0 && this.py.length <= 2){
|
|
|
return
|
|
|
}
|
|
|
+ if(this.py.indexOf('绿色') == 0 && this.py.length <= 2){
|
|
|
+ return
|
|
|
+ }
|
|
|
if(this.py.toLocaleLowerCase().indexOf('bs') == 0 && this.py.length <= 2){
|
|
|
return
|
|
|
}
|
|
|
- clearInterval(this.timeFun)
|
|
|
+ if(this.py.indexOf('白色') == 0 && this.py.length <= 2){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(this.py.toLocaleLowerCase().indexOf('cs') == 0 && this.py.length <= 2){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(this.py.indexOf('橙色') == 0 && this.py.length <= 2){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(this.py.indexOf('银色') == 0 && this.py.length <= 2){
|
|
|
+ return
|
|
|
+ }
|
|
|
let commonChildList = [];
|
|
|
list.forEach(ele => {
|
|
|
- //过滤常用
|
|
|
- if(ele.classId != -2){
|
|
|
- if (!this.$util.isEmpty(ele.child)) {
|
|
|
- ele.child.forEach(obj => {
|
|
|
- //模糊搜索 shish 20210622
|
|
|
- let hasName = obj.itemName && obj.itemName.indexOf(this.py) >= 0;
|
|
|
+ if (!this.$util.isEmpty(ele.child)) {
|
|
|
+ ele.child.forEach(obj => {
|
|
|
+ let hasName = obj.itemName && obj.itemName.indexOf(this.py) >= 0;
|
|
|
+ let hasPy = false
|
|
|
+ if(hasName == false){
|
|
|
let elePy = (obj.py && obj.py.toLocaleUpperCase()) || "";
|
|
|
- let hasPy = elePy.indexOf(this.py.toLocaleUpperCase()) >= 0;
|
|
|
- if (hasName || hasPy) {
|
|
|
- if(this.$util.isEmpty(commonChildList)){
|
|
|
- commonChildList = [...commonChildList,{classId: ele.classId, className: ele.className,isActive:true,child:[obj]}];
|
|
|
- }else{
|
|
|
- commonChildList.forEach(res => {
|
|
|
- if(res.classId==ele.classId){
|
|
|
- res.child.push(obj)
|
|
|
- }else{
|
|
|
- commonChildList.push({classId: ele.classId, className: ele.className,isActive:true,child:[obj]});
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
+ hasPy = elePy.indexOf(this.py.toLocaleUpperCase()) >= 0;
|
|
|
+ }
|
|
|
+ if (hasName || hasPy) {
|
|
|
+ if(this.$util.isEmpty(commonChildList)){
|
|
|
+ commonChildList = [...commonChildList,{classId: ele.classId, className: ele.className,isActive:true,child:[obj]}];
|
|
|
+ }else{
|
|
|
+ commonChildList.forEach(res => {
|
|
|
+ if(res.classId==ele.classId){
|
|
|
+ res.child.push(obj)
|
|
|
+ }else{
|
|
|
+ commonChildList.push({classId: ele.classId, className: ele.className,isActive:true,child:[obj]});
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
list = this.$util.unique(commonChildList)
|
|
|
this.filterProductInfo = list;
|
|
|
this.classIndex = 0;
|