This commit is contained in:
ylj20011123 2026-01-22 18:19:32 +08:00
parent e330a8fef4
commit 3b44d72f79
59 changed files with 168 additions and 76 deletions

View File

@ -1423,24 +1423,64 @@ export default {
}); });
} }
// thisAllType thisAllType // thisAllType thisAllType
// let COMMODITYLISTList = [] // let COMMODITYLISTList = []
console.log('thisAllTypethisAllTypethisAllType', JSON.parse(JSON.stringify(thisAllType)));
console.log('listlistlist', JSON.parse(JSON.stringify(list)));
if (thisAllType && thisAllType.length > 0) { if (thisAllType && thisAllType.length > 0) {
// id id
let haveFindTypeShop = []
// id
let showShopInSmallType = []
thisAllType.forEach((item) => { thisAllType.forEach((item) => {
if (list && list.length > 0) { if (list && list.length > 0) {
list.forEach((subItem) => { list.forEach((subItem) => {
if (item.UserdefinedType_Id === subItem.USERDEFINEDTYPE_ID) { if (item.UserdefinedType_Id === subItem.USERDEFINEDTYPE_ID) {
haveFindTypeShop.push(item.UserdefinedType_Id)
item.COMMODITYLIST = subItem.COMMODITYLIST; item.COMMODITYLIST = subItem.COMMODITYLIST;
// if (subItem.COMMODITYLIST && subItem.COMMODITYLIST.length > 0) { // id
// subItem.COMMODITYLIST.forEach((thirdItem) => { if (subItem.COMMODITYLIST && subItem.COMMODITYLIST.length > 0) {
// COMMODITYLISTList.push(thirdItem.COMMODITY_NAME) subItem.COMMODITYLIST.forEach((thirdItem) => {
// }) // COMMODITYLISTList.push(thirdItem.COMMODITY_NAME)
// } showShopInSmallType.push(thirdItem.COMMODITY_ID)
})
}
} }
}); });
} }
}); });
//
let noFindTypeShopList = []
list.forEach((item) => {
if (haveFindTypeShop.indexOf(item.USERDEFINEDTYPE_ID) === -1) {
if (item.COMMODITYLIST && item.COMMODITYLIST.length > 0) {
item.COMMODITYLIST.forEach((subItem) => {
noFindTypeShopList.push(subItem)
})
}
}
})
//
//
// console.log('id', showShopInSmallType);
noFindTypeShopList = noFindTypeShopList.filter(item => showShopInSmallType.indexOf(item.COMMODITY_ID) === -1)
// console.log('noFindTypeShopListnoFindTypeShopListnoFindTypeShopList', noFindTypeShopList);
thisAllType.forEach((item) => {
if (item.UserdefinedType_Name === '全部') {
item.COMMODITYLIST = noFindTypeShopList
}
})
} }
let leftIndex = -1; let leftIndex = -1;
@ -1480,6 +1520,9 @@ export default {
// //
let shopList = []; let shopList = [];
console.log('thisAllTypethisAllTypethisAllType', JSON.parse(JSON.stringify(thisAllType)));
if (thisAllType && thisAllType.length > 0) { if (thisAllType && thisAllType.length > 0) {
// //
let thisTypeAllShop = []; let thisTypeAllShop = [];
@ -1505,7 +1548,12 @@ export default {
} }
}); });
thisAllType[0].COMMODITYLIST = thisTypeAllShop; //
if (thisAllType[0].COMMODITYLIST && thisAllType[0].COMMODITYLIST.length > 0) {
thisAllType[0].COMMODITYLIST = thisAllType[0].COMMODITYLIST.concat(thisTypeAllShop);
} else {
thisAllType[0].COMMODITYLIST = thisTypeAllShop;
}
if ( if (
leftIndex !== -1 && leftIndex !== -1 &&

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
{ {
"component": true, "usingComponents": {},
"usingComponents": {} "component": true
} }

View File

@ -1,4 +1,4 @@
{ {
"usingComponents": {}, "component": true,
"component": true "usingComponents": {}
} }

View File

@ -1241,7 +1241,7 @@ var _default = {
}), (0, _defineProperty2.default)(_methods, "handleGetAllShopItem", function handleGetAllShopItem(id, type) { }), (0, _defineProperty2.default)(_methods, "handleGetAllShopItem", function handleGetAllShopItem(id, type) {
var _this11 = this; var _this11 = this;
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() { return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
var data, url, list, thisAllType, haveAll, leftIndex, shopList, thisTypeAllShop, allShopID, obj, newList, allShopList, allShopID2; var data, url, list, thisAllType, haveAll, haveFindTypeShop, showShopInSmallType, noFindTypeShopList, leftIndex, shopList, thisTypeAllShop, allShopID, obj, newList, allShopList, allShopID2;
return _regenerator.default.wrap(function _callee8$(_context8) { return _regenerator.default.wrap(function _callee8$(_context8) {
while (1) { while (1) {
switch (_context8.prev = _context8.next) { switch (_context8.prev = _context8.next) {
@ -1320,21 +1320,58 @@ var _default = {
// thisAllType 里面的值 才是当前商城分类的实际 类型 所以应该是把对应的商品拼到 thisAllType 里面去 // thisAllType 里面的值 才是当前商城分类的实际 类型 所以应该是把对应的商品拼到 thisAllType 里面去
// let COMMODITYLISTList = [] // let COMMODITYLISTList = []
console.log('thisAllTypethisAllTypethisAllType', JSON.parse(JSON.stringify(thisAllType)));
console.log('listlistlist', JSON.parse(JSON.stringify(list)));
if (thisAllType && thisAllType.length > 0) { if (thisAllType && thisAllType.length > 0) {
// 记录一下 当前找的到 分类id的 id列表
haveFindTypeShop = []; // 已经在小类里面出现过的商品id
showShopInSmallType = [];
thisAllType.forEach(function (item) { thisAllType.forEach(function (item) {
if (list && list.length > 0) { if (list && list.length > 0) {
list.forEach(function (subItem) { list.forEach(function (subItem) {
if (item.UserdefinedType_Id === subItem.USERDEFINEDTYPE_ID) { if (item.UserdefinedType_Id === subItem.USERDEFINEDTYPE_ID) {
haveFindTypeShop.push(item.UserdefinedType_Id);
item.COMMODITYLIST = subItem.COMMODITYLIST; item.COMMODITYLIST = subItem.COMMODITYLIST;
// if (subItem.COMMODITYLIST && subItem.COMMODITYLIST.length > 0) { // 拿到已经在小类里面出现过的商品id
// subItem.COMMODITYLIST.forEach((thirdItem) => { if (subItem.COMMODITYLIST && subItem.COMMODITYLIST.length > 0) {
// COMMODITYLISTList.push(thirdItem.COMMODITY_NAME) subItem.COMMODITYLIST.forEach(function (thirdItem) {
// }) // COMMODITYLISTList.push(thirdItem.COMMODITY_NAME)
// } showShopInSmallType.push(thirdItem.COMMODITY_ID);
});
}
} }
}); });
} }
}); });
// 再遍历一遍 将没有匹配到商品的 小类里面的商品 全部到一个数组里面去
noFindTypeShopList = [];
list.forEach(function (item) {
if (haveFindTypeShop.indexOf(item.USERDEFINEDTYPE_ID) === -1) {
if (item.COMMODITYLIST && item.COMMODITYLIST.length > 0) {
item.COMMODITYLIST.forEach(function (subItem) {
noFindTypeShopList.push(subItem);
});
}
}
});
// 若已经找到实际有找不到小类的商品的话 就将这些商品赋值给 全部分类下
// 这里再加一步去重 若 现在想要放在全部下面的商品 已经在别的小类里面出现了 那么就不再这个里面
// console.log('全部小类中出现过的商品id', showShopInSmallType);
noFindTypeShopList = noFindTypeShopList.filter(function (item) {
return showShopInSmallType.indexOf(item.COMMODITY_ID) === -1;
});
// console.log('noFindTypeShopListnoFindTypeShopListnoFindTypeShopList', noFindTypeShopList);
thisAllType.forEach(function (item) {
if (item.UserdefinedType_Name === '全部') {
item.COMMODITYLIST = noFindTypeShopList;
}
});
} }
leftIndex = -1; // if (this.pageType === "UnionMall" && this.leftId) { leftIndex = -1; // if (this.pageType === "UnionMall" && this.leftId) {
// if (thisAllType && thisAllType.length > 0) { // if (thisAllType && thisAllType.length > 0) {
@ -1369,6 +1406,7 @@ var _default = {
// 当前选中的商品列表 // 当前选中的商品列表
shopList = []; shopList = [];
console.log('thisAllTypethisAllTypethisAllType', JSON.parse(JSON.stringify(thisAllType)));
if (thisAllType && thisAllType.length > 0) { if (thisAllType && thisAllType.length > 0) {
// 这一大类的全部商品 // 这一大类的全部商品
thisTypeAllShop = []; // 当前的全部商品id thisTypeAllShop = []; // 当前的全部商品id
@ -1386,7 +1424,13 @@ var _default = {
} }
} }
}); });
thisAllType[0].COMMODITYLIST = thisTypeAllShop;
// 判断原先是不是有值的 有值的话 新的全部商品 拼在后面
if (thisAllType[0].COMMODITYLIST && thisAllType[0].COMMODITYLIST.length > 0) {
thisAllType[0].COMMODITYLIST = thisAllType[0].COMMODITYLIST.concat(thisTypeAllShop);
} else {
thisAllType[0].COMMODITYLIST = thisTypeAllShop;
}
if (leftIndex !== -1 && thisAllType[leftIndex] && thisAllType[leftIndex].COMMODITYLIST && thisAllType[leftIndex].COMMODITYLIST.length > 0) { if (leftIndex !== -1 && thisAllType[leftIndex] && thisAllType[leftIndex].COMMODITYLIST && thisAllType[leftIndex].COMMODITYLIST.length > 0) {
if (_this11.pageType === "UnionMall" && _this11.leftId) { if (_this11.pageType === "UnionMall" && _this11.leftId) {
if (_this11.leftId) { if (_this11.leftId) {
@ -1493,7 +1537,7 @@ var _default = {
_this11.rightShopList = []; _this11.rightShopList = [];
} }
uni.hideLoading(); uni.hideLoading();
case 27: case 30:
case "end": case "end":
return _context8.stop(); return _context8.stop();
} }