Commit 07fc4ff7694ed94d27e042259c8fb4187bda34fe
1 parent
6079fc4d
OA单 分类优化
Showing
2 changed files
with
47 additions
and
13 deletions
packageD/pages/user/coupons/coupons.js
@@ -111,12 +111,14 @@ Page({ | @@ -111,12 +111,14 @@ Page({ | ||
111 | erpwareid: useobjectid, | 111 | erpwareid: useobjectid, |
112 | }, | 112 | }, |
113 | success(res) { | 113 | success(res) { |
114 | - if (ut.ajax_ok2(res)) { | 114 | + if (res.data.code ==0) { |
115 | let good = res.data.data; | 115 | let good = res.data.data; |
116 | if (good.length>0) { | 116 | if (good.length>0) { |
117 | let item = good[0] | 117 | let item = good[0] |
118 | let url = `/pages/goods/goodsInfo/goodsInfo?goods_id=${item.goods_id}&prom_type=${item.prom_type}&prom_id=${item.prom_id}` | 118 | let url = `/pages/goods/goodsInfo/goodsInfo?goods_id=${item.goods_id}&prom_type=${item.prom_type}&prom_id=${item.prom_id}` |
119 | getApp().goto(url) | 119 | getApp().goto(url) |
120 | + }else{ | ||
121 | + getApp().showWarning("未找到该商品"); | ||
120 | } | 122 | } |
121 | } | 123 | } |
122 | } | 124 | } |
pages/goods/categoryList/categoryList.js
@@ -389,7 +389,7 @@ Page({ | @@ -389,7 +389,7 @@ Page({ | ||
389 | var arr = item.array; | 389 | var arr = item.array; |
390 | 390 | ||
391 | console.log("11111", item); | 391 | console.log("11111", item); |
392 | - | 392 | + console.log(arr.length); |
393 | 393 | ||
394 | if (arr.length == 0) { | 394 | if (arr.length == 0) { |
395 | t.setData({ | 395 | t.setData({ |
@@ -407,7 +407,7 @@ Page({ | @@ -407,7 +407,7 @@ Page({ | ||
407 | for (var i = 0; i < arr.length; i++) { | 407 | for (var i = 0; i < arr.length; i++) { |
408 | if (arr[i].arrays.length > 0) { is_lev_thr = 1; break; } | 408 | if (arr[i].arrays.length > 0) { is_lev_thr = 1; break; } |
409 | } | 409 | } |
410 | - t.setData({ is_level_three: is_lev_thr }); | 410 | + t.setData({ is_level_three: is_lev_thr ,cat_id:cid}); |
411 | 411 | ||
412 | if (this.data.is_level_three != 1) { | 412 | if (this.data.is_level_three != 1) { |
413 | t.setData({ index: 0, classify_name: name, goodslist: arr }); | 413 | t.setData({ index: 0, classify_name: name, goodslist: arr }); |
@@ -751,17 +751,22 @@ Page({ | @@ -751,17 +751,22 @@ Page({ | ||
751 | clearInterval(this.data.timer); | 751 | clearInterval(this.data.timer); |
752 | console.log('类别切换---------------'); | 752 | console.log('类别切换---------------'); |
753 | this.setData({ | 753 | this.setData({ |
754 | - toupper:true | 754 | + toupper:true, |
755 | + nextShow:false, | ||
756 | + nextShow2:false | ||
755 | }) | 757 | }) |
756 | let cur = e.currentTarget.dataset.current; | 758 | let cur = e.currentTarget.dataset.current; |
757 | console.log(cur); | 759 | console.log(cur); |
758 | - if (cur) { | 760 | + console.log(this.data.currentTab); |
761 | + if (cur > -1) { | ||
762 | + | ||
759 | if (this.data.currentTab == cur) { | 763 | if (this.data.currentTab == cur) { |
764 | + | ||
760 | if (this.data.select_classify_on != 220 && this.data.select_classify_on != 221 && this.data.select_classify_on != 223) { | 765 | if (this.data.select_classify_on != 220 && this.data.select_classify_on != 221 && this.data.select_classify_on != 223) { |
761 | return false; | 766 | return false; |
762 | } else if (cur != 0) { | 767 | } else if (cur != 0) { |
763 | return false; | 768 | return false; |
764 | - } | 769 | + } |
765 | } else { | 770 | } else { |
766 | wx.pageScrollTo({ | 771 | wx.pageScrollTo({ |
767 | scrollTop: 0 | 772 | scrollTop: 0 |
@@ -919,12 +924,12 @@ Page({ | @@ -919,12 +924,12 @@ Page({ | ||
919 | countDownNum: 3, | 924 | countDownNum: 3, |
920 | lastMsg: false, | 925 | lastMsg: false, |
921 | }); | 926 | }); |
922 | - if (nextTimeOff) { | ||
923 | - clearTimeout(nextTimeOff) | ||
924 | - } | ||
925 | - nextTimeOff = setTimeout(()=>{ | 927 | + // if (nextTimeOff) { |
928 | + // clearTimeout(nextTimeOff) | ||
929 | + // } | ||
930 | + // nextTimeOff = setTimeout(()=>{ | ||
926 | that.style(that.data.stylePage, that.data.cat_id); | 931 | that.style(that.data.stylePage, that.data.cat_id); |
927 | - },1000) | 932 | + // },1000) |
928 | }, | 933 | }, |
929 | scrolltoupper(){ | 934 | scrolltoupper(){ |
930 | console.log('到顶部--------'); | 935 | console.log('到顶部--------'); |
@@ -992,6 +997,8 @@ Page({ | @@ -992,6 +997,8 @@ Page({ | ||
992 | //页面版面风格三的时候请求推荐商品 返回 | 997 | //页面版面风格三的时候请求推荐商品 返回 |
993 | style: function (page, cid) { | 998 | style: function (page, cid) { |
994 | console.log("page:=" + page) | 999 | console.log("page:=" + page) |
1000 | + console.log("cid:=" + cid) | ||
1001 | + console.log("cid:=" + this.data.cat_id); | ||
995 | var s = this | 1002 | var s = this |
996 | e.get("/api/weshop/goods/page?1=1", { | 1003 | e.get("/api/weshop/goods/page?1=1", { |
997 | 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 }, | 1004 | 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({ | @@ -1002,7 +1009,7 @@ Page({ | ||
1002 | if (e.data.data.pageData.length > 0) { | 1009 | if (e.data.data.pageData.length > 0) { |
1003 | clearInterval(s.data.timer); | 1010 | clearInterval(s.data.timer); |
1004 | s.setData({ | 1011 | s.setData({ |
1005 | - msgStatus: false, is_no_more: 0,nextShow:false,nextShow2:false | 1012 | + msgStatus: false, is_no_more: 0 |
1006 | }); | 1013 | }); |
1007 | //如果有数据 判断分页为第一页的时候直接渲染数据 | 1014 | //如果有数据 判断分页为第一页的时候直接渲染数据 |
1008 | if (page > 1) { | 1015 | if (page > 1) { |
@@ -1013,6 +1020,13 @@ Page({ | @@ -1013,6 +1020,13 @@ Page({ | ||
1013 | arr.push(e.data.data.pageData[i]); | 1020 | arr.push(e.data.data.pageData[i]); |
1014 | } | 1021 | } |
1015 | 1022 | ||
1023 | + if (e.data.data.pageData.length < e.data.data.pageSize) { | ||
1024 | + s.setData({ | ||
1025 | + nextShow:true, | ||
1026 | + // nextShow2:true | ||
1027 | + }) | ||
1028 | + } | ||
1029 | + | ||
1016 | s.setData({ | 1030 | s.setData({ |
1017 | requestData: arr | 1031 | requestData: arr |
1018 | }); | 1032 | }); |
@@ -1021,6 +1035,23 @@ Page({ | @@ -1021,6 +1035,23 @@ Page({ | ||
1021 | s.setData({ | 1035 | s.setData({ |
1022 | requestData: e.data.data.pageData | 1036 | requestData: e.data.data.pageData |
1023 | }); | 1037 | }); |
1038 | + if ( e.data.data.pageData.length && (e.data.data.pageData.length < e.data.data.pageSize)) { | ||
1039 | + s.setData({ | ||
1040 | + nextShow:true, | ||
1041 | + // nextShow2:true | ||
1042 | + }) | ||
1043 | + const { windowHeight } = wx.getSystemInfoSync() | ||
1044 | + wx.createSelectorQuery().select('#sview').boundingClientRect(function(rect){ | ||
1045 | + if (rect) { | ||
1046 | + const { top,height } = rect | ||
1047 | + if ((top < windowHeight) && (top + height >0) ) { | ||
1048 | + s.setData({ | ||
1049 | + nextShow2:true | ||
1050 | + }) | ||
1051 | + } | ||
1052 | + } | ||
1053 | + }).exec() | ||
1054 | + } | ||
1024 | if (wx.pageScrollTo) { | 1055 | if (wx.pageScrollTo) { |
1025 | wx.pageScrollTo({ | 1056 | wx.pageScrollTo({ |
1026 | scrollTop: 0 | 1057 | scrollTop: 0 |
@@ -1139,7 +1170,8 @@ Page({ | @@ -1139,7 +1170,8 @@ Page({ | ||
1139 | cat_id: dataArray[index + s]['items']['id'], | 1170 | cat_id: dataArray[index + s]['items']['id'], |
1140 | classify_name: dataArray[index + s]['items']['name'], | 1171 | classify_name: dataArray[index + s]['items']['name'], |
1141 | one_level_classify: dataArray, | 1172 | one_level_classify: dataArray, |
1142 | - is_no_more: 0 | 1173 | + is_no_more: 0, |
1174 | + currentTab:index + s | ||
1143 | }); | 1175 | }); |
1144 | this.style(this.data.stylePage, dataArray[index + s]['items']['id']) | 1176 | this.style(this.data.stylePage, dataArray[index + s]['items']['id']) |
1145 | } | 1177 | } |