Commit 824b5d99 by 李嘉林

删除商品列表console

parent 3907d08c
...@@ -77,7 +77,6 @@ const componentOptions = { ...@@ -77,7 +77,6 @@ const componentOptions = {
lifetimes: { lifetimes: {
created() {}, created() {},
ready() { ready() {
console.log(this.data.storageKey, "--goodsList-ready")
let _this = this; let _this = this;
let { clientHeight } = this.data; let { clientHeight } = this.data;
wx.getSystemInfo({ wx.getSystemInfo({
...@@ -88,7 +87,6 @@ const componentOptions = { ...@@ -88,7 +87,6 @@ const componentOptions = {
}); });
app.getFilterGoodsData = (val) => { app.getFilterGoodsData = (val) => {
if (val.randomNumber != _this.data.randomNumber) return; if (val.randomNumber != _this.data.randomNumber) return;
console.log(val,'-------------------------77')
let selectScreen = val.submitFliterVal.minPrice!="" let selectScreen = val.submitFliterVal.minPrice!=""
|| val.submitFliterVal.maxPrice!="" || val.submitFliterVal.maxPrice!=""
|| val.submitFliterVal.attribute.length>0 || val.submitFliterVal.attribute.length>0
...@@ -102,10 +100,8 @@ const componentOptions = { ...@@ -102,10 +100,8 @@ const componentOptions = {
selectScreen, selectScreen,
loading: true loading: true
}) })
console.log(_this.data.submitFliterVal, '----------submitFliterVal')
_this.init(); _this.init();
} }
console.log(this.data.datas.componentData.filterBrand,'---this.data.datas.componentData.filterBrand')
this.setData({ this.setData({
"submitFliterVal.brandIdList": this.data.datas.componentData.filterBrand && this.data.datas.componentData.filterBrand.length>0?JSON.parse(JSON.stringify(this.data.datas.componentData.filterBrand)) : [], "submitFliterVal.brandIdList": this.data.datas.componentData.filterBrand && this.data.datas.componentData.filterBrand.length>0?JSON.parse(JSON.stringify(this.data.datas.componentData.filterBrand)) : [],
}) })
...@@ -120,7 +116,6 @@ const componentOptions = { ...@@ -120,7 +116,6 @@ const componentOptions = {
pageLifetimes: { pageLifetimes: {
// 页面被展示 // 页面被展示
show() { show() {
console.log("--goodsList-show")
const { isPageHidden } = this.data; const { isPageHidden } = this.data;
// show事件发生前,页面不是处于隐藏状态时 // show事件发生前,页面不是处于隐藏状态时
...@@ -199,9 +194,7 @@ const componentOptions = { ...@@ -199,9 +194,7 @@ const componentOptions = {
mainColor: app.themeColor["--main-color"], mainColor: app.themeColor["--main-color"],
randomNumber: random_string(6), randomNumber: random_string(6),
}); });
console.log(this.data.titleIcon, "----------------------------68");
let ids = this.getStorageSync(`ids`); let ids = this.getStorageSync(`ids`);
console.log(ids,'---ids--104'+this.data.storageKey)
log.info(ids,'---ids--105') log.info(ids,'---ids--105')
// 如果不是横向标签组件初始化缓存 // 如果不是横向标签组件初始化缓存
if (!this.data.storageKey.includes('transverse-label')) { if (!this.data.storageKey.includes('transverse-label')) {
...@@ -258,7 +251,6 @@ const componentOptions = { ...@@ -258,7 +251,6 @@ const componentOptions = {
this.setData({ finished: false }); this.setData({ finished: false });
goodsList = this.data.datas.componentData.goodsList; goodsList = this.data.datas.componentData.goodsList;
} }
console.log(goodsList,'--------------------------246')
let { let {
classificationLoadPage, classificationLoadPage,
loading, loading,
...@@ -366,12 +358,10 @@ const componentOptions = { ...@@ -366,12 +358,10 @@ const componentOptions = {
}); });
let storageIds = this.getStorageSync('ids') let storageIds = this.getStorageSync('ids')
console.log(this.data.goodsListIndex,storageIds,'--storageIds')
storageIds[this.data.goodsListIndex] = ids storageIds[this.data.goodsListIndex] = ids
this.setStorageSync('ids',storageIds) this.setStorageSync('ids',storageIds)
let storageDatasList = this.getStorageSync('storageDatasList') let storageDatasList = this.getStorageSync('storageDatasList')
console.log(storageDatasList,'------228'+this.data.storageKey)
storageDatasList[this.data.goodsListIndex] = this.data.datas.componentData storageDatasList[this.data.goodsListIndex] = this.data.datas.componentData
this.setStorageSync('storageDatasList',storageDatasList) this.setStorageSync('storageDatasList',storageDatasList)
...@@ -388,7 +378,6 @@ const componentOptions = { ...@@ -388,7 +378,6 @@ const componentOptions = {
}) })
let terminalProductIds = [] let terminalProductIds = []
terminalProductIds = this.getStorageSync('ids')[this.data.goodsListIndex]; terminalProductIds = this.getStorageSync('ids')[this.data.goodsListIndex];
console.log(terminalProductIds, this.data.storageKey, 'page-----');
let { let {
vipPrice, vipPrice,
marketingTag, marketingTag,
...@@ -411,14 +400,12 @@ const componentOptions = { ...@@ -411,14 +400,12 @@ const componentOptions = {
if (res.data.code == 200) { if (res.data.code == 200) {
goodsList = res.data.data; goodsList = res.data.data;
let pageGoodsList = this.data.pageGoodsList[this.data.goodsListIndex] || []; let pageGoodsList = this.data.pageGoodsList[this.data.goodsListIndex] || [];
console.log(goodsList, pageGoodsList, this.data.storageKey, '------------------------goodsList----433')
this.goodsListVal(goodsList, 1,flag); this.goodsListVal(goodsList, 1,flag);
} }
}); });
}, },
goodsListVal(goodsList, type,flag) { goodsListVal(goodsList, type,flag) {
let { attributeValueList } = this.data.datas.componentData; let { attributeValueList } = this.data.datas.componentData;
console.log(goodsList,this.data.storageKey, "------------goodsListVal");
goodsList.forEach((item, index) => { goodsList.forEach((item, index) => {
item.marketingTag = item.defaultTags item.marketingTag = item.defaultTags
? this.filtermark( ? this.filtermark(
...@@ -459,8 +446,6 @@ const componentOptions = { ...@@ -459,8 +446,6 @@ const componentOptions = {
// 过滤商品属性 // 过滤商品属性
if (item.attributeList) { if (item.attributeList) {
let list = item.attributeList.filter(item1=>attributeValueList.includes(item1.attributeName)) || []; let list = item.attributeList.filter(item1=>attributeValueList.includes(item1.attributeName)) || [];
console.log("list",list)
console.log(item.attributeValueList,'--item.attributeValueList')
item.attributeValueList = list ? list.map(item1 => item1.attributeValue) : []; item.attributeValueList = list ? list.map(item1 => item1.attributeValue) : [];
} }
} }
...@@ -475,7 +460,6 @@ const componentOptions = { ...@@ -475,7 +460,6 @@ const componentOptions = {
pageGoodsList[that.data.goodsListIndex] = list; pageGoodsList[that.data.goodsListIndex] = list;
}else{ }else{
pageGoodsList[that.data.datasIndex] = list; pageGoodsList[that.data.datasIndex] = list;
console.log(pageGoodsList[that.data.datasIndex],'--pageGoodsList[that.data.datasIndex]')
} }
this.setStorageSync('pageGoodsList', pageGoodsList); this.setStorageSync('pageGoodsList', pageGoodsList);
...@@ -484,7 +468,6 @@ const componentOptions = { ...@@ -484,7 +468,6 @@ const componentOptions = {
let loadingFlag = this.getStorageSync('loadingFlag') let loadingFlag = this.getStorageSync('loadingFlag')
loadingFlag[that.data.datasIndex] = false loadingFlag[that.data.datasIndex] = false
this.setStorageSync('loadingFlag', loadingFlag); this.setStorageSync('loadingFlag', loadingFlag);
console.log(this.data.storageKey, pageGoodsList,'-----pageGoodsList')
that.setData({ that.setData({
"datas.componentData.goodsList": list, "datas.componentData.goodsList": list,
pageGoodsList, pageGoodsList,
...@@ -511,22 +494,18 @@ const componentOptions = { ...@@ -511,22 +494,18 @@ const componentOptions = {
let { purchased } = this.data.datas.componentData; let { purchased } = this.data.datas.componentData;
let list = goodsList.map(item=>item.productId); let list = goodsList.map(item=>item.productId);
if(purchased) { if(purchased) {
console.log("getPurchased-list",list)
// if(!this.render) return; // if(!this.render) return;
goodsApi.query_goods_cart_info(list).then(res=>{ goodsApi.query_goods_cart_info(list).then(res=>{
if (res.data.code == 200) { if (res.data.code == 200) {
let purchasedList = res.data.data || []; let purchasedList = res.data.data || [];
let purchasedListIds = [...new Set(purchasedList.map(item=>item.productId))]; let purchasedListIds = [...new Set(purchasedList.map(item=>item.productId))];
console.log(purchasedListIds,'---purchasedListIds')
goodsList.forEach(item=>{ goodsList.forEach(item=>{
item.purchased = false; item.purchased = false;
if(purchasedListIds.includes(item.productId)) { if(purchasedListIds.includes(item.productId)) {
item.purchased = true; item.purchased = true;
console.log("---------------1039")
} }
}) })
callback(goodsList); callback(goodsList);
console.log(goodsList,'getPurchased---goodsList')
} }
}) })
} else { } else {
...@@ -538,22 +517,18 @@ const componentOptions = { ...@@ -538,22 +517,18 @@ const componentOptions = {
let { collectFlag } = this.data.datas.componentData; let { collectFlag } = this.data.datas.componentData;
let list = goodsList.map(item => item.productId); let list = goodsList.map(item => item.productId);
if(collectFlag) { if(collectFlag) {
console.log("getcollectFlag-list",list)
// if(!this.render) return; // if(!this.render) return;
goodsApi.batch_query_collect_count(list).then(res=>{ goodsApi.batch_query_collect_count(list).then(res=>{
if (res.data.code == 200) { if (res.data.code == 200) {
let collectFlagList = res.data.data || []; let collectFlagList = res.data.data || [];
let collectFlagListIds = [...new Set(collectFlagList.map(item=>item.productId))]; let collectFlagListIds = [...new Set(collectFlagList.map(item=>item.productId))];
console.log(collectFlagListIds,'---collectFlagListIds')
goodsList.forEach(item=>{ goodsList.forEach(item=>{
item.collectFlag = false; item.collectFlag = false;
if(collectFlagListIds.includes(item.productId)) { if(collectFlagListIds.includes(item.productId)) {
item.collectFlag = true; item.collectFlag = true;
console.log("---------------1039")
} }
}) })
callback(goodsList); callback(goodsList);
console.log(goodsList,'getcollectFlag---goodsList')
} }
}) })
} else { } else {
...@@ -563,8 +538,6 @@ const componentOptions = { ...@@ -563,8 +538,6 @@ const componentOptions = {
// 触发图片加载 // 触发图片加载
lazyloading(){ lazyloading(){
var that = this var that = this
console.log(that.data.datasIndex,that.data.goodsListIndex,'datasIndex');
console.log(that.data.pageGoodsList[that.data.datasIndex]);
let storageDatasList = this.getStorageSync('storageDatasList') || [] let storageDatasList = this.getStorageSync('storageDatasList') || []
let { style } = storageDatasList[that.data.datasIndex]; let { style } = storageDatasList[that.data.datasIndex];
...@@ -572,18 +545,15 @@ const componentOptions = { ...@@ -572,18 +545,15 @@ const componentOptions = {
if(style == 'list' || style == 'rowList'){ if(style == 'list' || style == 'rowList'){
type = 'goods-item' type = 'goods-item'
}else{ }else{
console.log("不是goods-item");
return return
} }
let windowHeight = wx.getSystemInfoSync().windowHeight let windowHeight = wx.getSystemInfoSync().windowHeight
let pageGoodsList = this.getStorageSync('pageGoodsList') || [] let pageGoodsList = this.getStorageSync('pageGoodsList') || []
console.log(that.data.pageGoodsList,pageGoodsList,that.data.datasIndex,'pageGoodsList--loading');
let loadingFlag = this.getStorageSync('loadingFlag') let loadingFlag = this.getStorageSync('loadingFlag')
// 如果所有的商品都加载完成直接return // 如果所有的商品都加载完成直接return
if (loadingFlag[that.data.datasIndex]) { if (loadingFlag[that.data.datasIndex]) {
console.log("如果所有的商品都加载完成直接return");
return return
} }
...@@ -594,7 +564,6 @@ const componentOptions = { ...@@ -594,7 +564,6 @@ const componentOptions = {
return return
} }
wx.createSelectorQuery().selectAll(`.goodsListItemIndex${that.data.datasIndex}>>>.${type}`).boundingClientRect(function(rects){ wx.createSelectorQuery().selectAll(`.goodsListItemIndex${that.data.datasIndex}>>>.${type}`).boundingClientRect(function(rects){
console.log(rects.length,'------rectslength')
for (let index = 0; index < rects.length; index++) { for (let index = 0; index < rects.length; index++) {
if (rects[index].top == 0 && rects[index].bottom == 0 && rects[index].left == 0 && rects[index].right == 0) { if (rects[index].top == 0 && rects[index].bottom == 0 && rects[index].left == 0 && rects[index].right == 0) {
break break
...@@ -607,7 +576,6 @@ const componentOptions = { ...@@ -607,7 +576,6 @@ const componentOptions = {
pageGoodsList, pageGoodsList,
}) })
// that.pageGoodsList = pageGoodsList // that.pageGoodsList = pageGoodsList
console.log(rects,pageGoodsList[that.data.goodsListIndex], pageGoodsList[that.data.datasIndex],'fff');
that.setStorageSync('pageGoodsList',pageGoodsList) that.setStorageSync('pageGoodsList',pageGoodsList)
...@@ -620,7 +588,6 @@ const componentOptions = { ...@@ -620,7 +588,6 @@ const componentOptions = {
}) })
that.setStorageSync('loadingFlag',loadingFlag) that.setStorageSync('loadingFlag',loadingFlag)
console.log('load--ok');
} }
}).exec(); }).exec();
...@@ -705,7 +672,6 @@ const componentOptions = { ...@@ -705,7 +672,6 @@ const componentOptions = {
if (this.data.datasIndex != this.data.goodsListIndex) return; if (this.data.datasIndex != this.data.goodsListIndex) return;
// 是指定分类且不显示查看更多的瀑布流组件滚动加载 // 是指定分类且不显示查看更多的瀑布流组件滚动加载
let { goodsSource, moreShow, style } = this.data.datas.componentData; let { goodsSource, moreShow, style } = this.data.datas.componentData;
console.log('goodsSource, moreShow, style',goodsSource, moreShow, style);
this.lazyloading() this.lazyloading()
if ( if (
(goodsSource == "classify" || goodsSource == "specifyFilter") && (goodsSource == "classify" || goodsSource == "specifyFilter") &&
...@@ -714,7 +680,6 @@ const componentOptions = { ...@@ -714,7 +680,6 @@ const componentOptions = {
if (style == "waterfall") { if (style == "waterfall") {
this.selectComponent("#waterfallFlow").getScroll(el); this.selectComponent("#waterfallFlow").getScroll(el);
} else if (style == "rowList") { } else if (style == "rowList") {
console.log("rowList--滚动加载")
this.getScrollEl(el); this.getScrollEl(el);
} }
} }
...@@ -730,7 +695,6 @@ const componentOptions = { ...@@ -730,7 +695,6 @@ const componentOptions = {
let scrollTop = parseInt(el.scrollTop); let scrollTop = parseInt(el.scrollTop);
let domHeight = parseInt(res.height); let domHeight = parseInt(res.height);
// 窗口高度+滚动高度等于 = 元素整体高度 -(预留一段距离加载) 触发父组件查询接口 // 窗口高度+滚动高度等于 = 元素整体高度 -(预留一段距离加载) 触发父组件查询接口
console.log(scrollTop,_this.data.clientHeight,domHeight - 150,domHeight,finished,'--------------finished1')
if ( if (
scrollTop + _this.data.clientHeight >= domHeight - 150 && scrollTop + _this.data.clientHeight >= domHeight - 150 &&
finished == false finished == false
...@@ -743,7 +707,6 @@ const componentOptions = { ...@@ -743,7 +707,6 @@ const componentOptions = {
}, },
// 分页加载 // 分页加载
onLoad() { onLoad() {
console.log("---触发分页加载");
this.getProductList(1, 2); this.getProductList(1, 2);
}, },
viewMore(e) { viewMore(e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment