From 07fc4ff7694ed94d27e042259c8fb4187bda34fe Mon Sep 17 00:00:00 2001 From: luo <17530855@qq.com> Date: Thu, 15 Sep 2022 10:10:44 +0800 Subject: [PATCH] OA单 分类优化 --- packageD/pages/user/coupons/coupons.js | 4 +++- pages/goods/categoryList/categoryList.js | 56 ++++++++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 47 insertions(+), 13 deletions(-) diff --git a/packageD/pages/user/coupons/coupons.js b/packageD/pages/user/coupons/coupons.js index 377ce3a..4b40c14 100644 --- a/packageD/pages/user/coupons/coupons.js +++ b/packageD/pages/user/coupons/coupons.js @@ -111,12 +111,14 @@ Page({ erpwareid: useobjectid, }, success(res) { - if (ut.ajax_ok2(res)) { + if (res.data.code ==0) { let good = res.data.data; if (good.length>0) { let item = good[0] let url = `/pages/goods/goodsInfo/goodsInfo?goods_id=${item.goods_id}&prom_type=${item.prom_type}&prom_id=${item.prom_id}` getApp().goto(url) + }else{ + getApp().showWarning("未找到该商品"); } } } diff --git a/pages/goods/categoryList/categoryList.js b/pages/goods/categoryList/categoryList.js index c970523..676e71c 100644 --- a/pages/goods/categoryList/categoryList.js +++ b/pages/goods/categoryList/categoryList.js @@ -389,7 +389,7 @@ Page({ var arr = item.array; console.log("11111", item); - + console.log(arr.length); if (arr.length == 0) { t.setData({ @@ -407,7 +407,7 @@ Page({ for (var i = 0; i < arr.length; i++) { if (arr[i].arrays.length > 0) { is_lev_thr = 1; break; } } - t.setData({ is_level_three: is_lev_thr }); + t.setData({ is_level_three: is_lev_thr ,cat_id:cid}); if (this.data.is_level_three != 1) { t.setData({ index: 0, classify_name: name, goodslist: arr }); @@ -751,17 +751,22 @@ Page({ clearInterval(this.data.timer); console.log('类别切换---------------'); this.setData({ - toupper:true + toupper:true, + nextShow:false, + nextShow2:false }) let cur = e.currentTarget.dataset.current; console.log(cur); - if (cur) { + console.log(this.data.currentTab); + if (cur > -1) { + if (this.data.currentTab == cur) { + if (this.data.select_classify_on != 220 && this.data.select_classify_on != 221 && this.data.select_classify_on != 223) { return false; } else if (cur != 0) { return false; - } + } } else { wx.pageScrollTo({ scrollTop: 0 @@ -919,12 +924,12 @@ Page({ countDownNum: 3, lastMsg: false, }); - if (nextTimeOff) { - clearTimeout(nextTimeOff) - } - nextTimeOff = setTimeout(()=>{ + // if (nextTimeOff) { + // clearTimeout(nextTimeOff) + // } + // nextTimeOff = setTimeout(()=>{ that.style(that.data.stylePage, that.data.cat_id); - },1000) + // },1000) }, scrolltoupper(){ console.log('到顶部--------'); @@ -992,6 +997,8 @@ Page({ //页面版面风格三的时候请求推荐商品 返回 style: function (page, cid) { console.log("page:=" + page) + console.log("cid:=" + cid) + console.log("cid:=" + this.data.cat_id); var s = this e.get("/api/weshop/goods/page?1=1", { data: { page: page, cat_id: cid, parent_id: 0, orderField: 'sort', orderType: 'asc', is_mainshow: 1, isonsale: 1, store_id: oo.stoid, is_recommend: 1 }, @@ -1002,7 +1009,7 @@ Page({ if (e.data.data.pageData.length > 0) { clearInterval(s.data.timer); s.setData({ - msgStatus: false, is_no_more: 0,nextShow:false,nextShow2:false + msgStatus: false, is_no_more: 0 }); //如果有数据 判断分页为第一页的时候直接渲染数据 if (page > 1) { @@ -1013,6 +1020,13 @@ Page({ arr.push(e.data.data.pageData[i]); } + if (e.data.data.pageData.length < e.data.data.pageSize) { + s.setData({ + nextShow:true, + // nextShow2:true + }) + } + s.setData({ requestData: arr }); @@ -1021,6 +1035,23 @@ Page({ s.setData({ requestData: e.data.data.pageData }); + if ( e.data.data.pageData.length && (e.data.data.pageData.length < e.data.data.pageSize)) { + s.setData({ + nextShow:true, + // nextShow2:true + }) + const { windowHeight } = wx.getSystemInfoSync() + wx.createSelectorQuery().select('#sview').boundingClientRect(function(rect){ + if (rect) { + const { top,height } = rect + if ((top < windowHeight) && (top + height >0) ) { + s.setData({ + nextShow2:true + }) + } + } + }).exec() + } if (wx.pageScrollTo) { wx.pageScrollTo({ scrollTop: 0 @@ -1139,7 +1170,8 @@ Page({ cat_id: dataArray[index + s]['items']['id'], classify_name: dataArray[index + s]['items']['name'], one_level_classify: dataArray, - is_no_more: 0 + is_no_more: 0, + currentTab:index + s }); this.style(this.data.stylePage, dataArray[index + s]['items']['id']) } -- libgit2 0.21.4