From d398beb748ef022827f37517210534ba8743952f Mon Sep 17 00:00:00 2001 From: luo <17530855@qq.com> Date: Tue, 13 Sep 2022 20:32:55 +0800 Subject: [PATCH] OA单 小程序商城里的分类,拉到最下面的时候,商品还没看完就跳到下一个分类去了 --- pages/goods/categoryList/categoryList.js | 1445 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- pages/goods/categoryList/categoryList.wxml | 1196 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- pages/user/assistance/task_assistance.wxml | 6 ++++++ 3 files changed, 1369 insertions(+), 1278 deletions(-) diff --git a/pages/goods/categoryList/categoryList.js b/pages/goods/categoryList/categoryList.js index d245ad4..f4a931e 100644 --- a/pages/goods/categoryList/categoryList.js +++ b/pages/goods/categoryList/categoryList.js @@ -5,21 +5,26 @@ var i = function (i) { }; }(require("../../../utils/LoadMore.js")), a = new i.default(), ut = require("../../../utils/util.js"); //t = i,e = t +var nextTimeOff=null Page({ data: { - is_date:true, + is_date: true, scrollHeight: 0, - currentTab:-1, - abc:0, - windowHeight:0, + currentTab: -1, + abc: 0, + windowHeight: 0, windowWidth: 0, - eachLetterHeight:0, - lettersPosition:0, - catelist:null, //分类读取 + eachLetterHeight: 0, + lettersPosition: 0, + catelist: null, //分类读取 nationlist: null,//国家读取 groups: null, //品牌读取 iurl: oo.imghost,//图片地址 - + nextShow:false, //是否跳转下个类型 + nextShow2:false, //是否跳转下个类型 + toupper:true, + sClientY:0, //滑动初始值 + eClientY:0, //滑动终值 // 当前选择的导航字母 selected: 0, // 选择字母视图滚动的位置id @@ -27,55 +32,55 @@ Page({ // 导航字母 letters: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'], - //控制新旧分类版本 - is_used_share:0, + //控制新旧分类版本 + is_used_share: 0, //国家的控制属性 - is_country:1, + is_country: 1, //品牌的控制属性 - is_brand:1, + is_brand: 1, //选择分类的控制属性 - select_classify_on:223, - index:223, - classify_name:"国家",//项目类型 - brand_list:null,//品牌列表 - - one_level_classify:[],// 新的版本左边的边分类1级 - is_level_three:0,//判断有没有3级 - cat_id:0, + select_classify_on: 223, + index: 223, + classify_name: "国家",//项目类型 + brand_list: null,//品牌列表 + + one_level_classify: [],// 新的版本左边的边分类1级 + is_level_three: 0,//判断有没有3级 + cat_id: 0, pl_timer: null,//只有品类的定时器 - is_pl_time:0, - requestData:null, //风格三的商品数据列表 分页 - stylePage:1, //商品列表分页标识 + is_pl_time: 0, + requestData: null, //风格三的商品数据列表 分页 + stylePage: 1, //商品列表分页标识 //风格三使用 url: t.globalData.setting.imghost, currentPage: 1, allData: null, openFilterModal: !1, - baseUrl: "api/weshop/goods/page?1=1&cat_id=1&parent_id=0&orderField=sort&orderType=asc&page=1&is_mainshow=1&isonsale=1&store_id="+oo.stoid+"&is_recommend=1", + baseUrl: "api/weshop/goods/page?1=1&cat_id=1&parent_id=0&orderField=sort&orderType=asc&page=1&is_mainshow=1&isonsale=1&store_id=" + oo.stoid + "&is_recommend=1", requestUrl: "", tabname: "goods_id", //排序的字段 adname: "desc", //升降的字段 is_new: 0, is_hot: 0, - msgStatus:false, //页面显示暂无数据状态 + msgStatus: false, //页面显示暂无数据状态 countDownNum: 3, timer: null, //定时器 - lastMsg:false, - toView:"", - is_show_class:false,//是否添加新样式 - status_show:0, + lastMsg: false, + toView: "", + is_show_class: false,//是否添加新样式 + status_show: 0, currentTab: 0, //预设当前项的值 - - load:0, + + load: 0, xmlist: null, - + }, //判断当前滚动超过一屏时,设置tab标题滚动条。 - checkCor: function() { + checkCor: function () { let that = this; //这里计算按照实际情况进行修改,动态数据要进行动态分析 //思路:窗体高度/单个分类高度 200rpx 转px计算 =>得到一屏幕所显示的个数,结合后台传回分类总数进行计算 @@ -92,413 +97,418 @@ Page({ }, - onLoad: function(tt) { - var that = this; - var first_leader=tt.first_leader; - if(first_leader){ - //-- user_id代过来免登录 -- - getApp().globalData.first_leader=first_leader; - } + onLoad: function (tt) { + // wx.createSelectorQuery().select('#sview').boundingClientRect(function(rect){ + // console.log('显示下滑区域'); + // console.log(rect); + // }).exec() - if(tt.type) this.data.type= parseInt(tt.type); - that.get_brand(); - - clearInterval(that.data.timer); - that.setData({ countDownNum: 3, stylePage: 1 }); + var that = this; + var first_leader = tt.first_leader; + if (first_leader) { + //-- user_id代过来免登录 -- + getApp().globalData.first_leader = first_leader; + } - const res = wx.getSystemInfoSync(), - letters = this.data.letters; - this.setData({ - abc: t.globalData.heigth-88-88-16, - windowHeight: res.windowHeight, - windowWidth: res.windowWidth, - - }); + if (tt.type) this.data.type = parseInt(tt.type); + that.get_brand(); - var bli = res.windowWidth/750; - //--------第一个字母距离顶部高度,单位使用的是rpx,须除以bli------ - //才能与touch事件中的数值相加减,css中定义nav高度为94%,所以 *0.94 - const eachLetterHeight = 35.4*bli, - comTop = (88+88) * bli, - temp = []; + clearInterval(that.data.timer); + that.setData({ countDownNum: 3, stylePage: 1 }); - this.setData({ - eachLetterHeight: eachLetterHeight - }); - //---------求各字母距离设备左上角所处位置--------- - for (let i = 0, len = letters.length; i < len; i++) { - const x = (this.data.windowWidth - (30 + 50)) * bli, - y = comTop + (i * eachLetterHeight); - temp.push([x, y]); + const res = wx.getSystemInfoSync(), + letters = this.data.letters; + this.setData({ + abc: t.globalData.heigth - 88 - 88 - 16, + windowHeight: res.windowHeight, + windowWidth: res.windowWidth, + + }); + + var bli = res.windowWidth / 750; + //--------第一个字母距离顶部高度,单位使用的是rpx,须除以bli------ + //才能与touch事件中的数值相加减,css中定义nav高度为94%,所以 *0.94 + const eachLetterHeight = 35.4 * bli, + comTop = (88 + 88) * bli, + temp = []; + + this.setData({ + eachLetterHeight: eachLetterHeight + }); + //---------求各字母距离设备左上角所处位置--------- + for (let i = 0, len = letters.length; i < len; i++) { + const x = (this.data.windowWidth - (30 + 50)) * bli, + y = comTop + (i * eachLetterHeight); + temp.push([x, y]); + } + this.setData({ + lettersPosition: temp + }); + + if (this.data.is_used_share == 0) { + this.get_nation(); + this.getServiceCategory(); + } + + //风格三 + //t = i,e = t + var th = this; + a.init(this, "", "requestData"); + var url = this.data.baseUrl; + this.data.is_new = i.is_new; + this.data.is_hot = i.is_hot; + if (0 != this.data.cat_id) { + url += "&cat_id=" + this.data.cat_id; + } + + // this.requestGoodsList(url); + getApp().getConfig2(function (rs) { + //计算等级价相关 + var swithc_list = rs.switch_list; + var sw_arr = JSON.parse(swithc_list); + //---如果后台又开等级卡的开关--- + if (sw_arr.rank_switch && sw_arr.rank_switch == "2") { + th.setData({ rank_switch: true }); + var user = getApp().globalData.userInfo; + var ti = setInterval(function () { + if (!user) return false; + clearInterval(ti); + //---回调卡的列表--- + th.getPlusCardType(function (ob) { + th.setData({ card_list: ob.card_list }); + if (user.card_field && user['card_expiredate']) { + var str = user['card_expiredate'].replace(/-/g, '/'); + var end = new Date(str); + end = Date.parse(end) / 1000; + var now = ut.gettimestamp(); + + //--- 判断是等级会员,且在有效期范围内 --- + if (user.card_field && now < end) { + var card_name = ob.name_map.get(user.card_field); + //if (card_name.length > 4) card_name = card_name.substring(0, 4); + th.setData({ card_field: user.card_field, card_name: card_name, card_list: ob.card_list }); + } + } + }) + }, 500) } - this.setData({ - lettersPosition: temp + }); + }, + onShow: function () { + getApp().check_can_share(); + + if (typeof this.getTabBar === 'function' && this.getTabBar()) { + var index = getApp().getPageIndex(this); + this.getTabBar().setData({ + active: index //数字是当前页面在tabbar的索引 }); - - if (this.data.is_used_share==0){ - this.get_nation(); - this.getServiceCategory(); + getApp().requestCardNum(this); + } + + + var that = this; + //调用底部导航 + //t.editTabBar(that,getApp().globalData.setting.stoid,getApp().globalData.url); + //this.requestFirstCategoris(); + setTimeout(function () { + //if (getApp().globalData.user_id) getApp().requestCardNum(that); + }, 500) + + if (this.data.load) return false; + + getApp().getConfig2(function (e) { + console.log('card------------>>>>', e); + var data = e; + var switch_list_data = data.switch_list; + var switch_list = JSON.parse(switch_list_data); + var is_newsgoodstype = switch_list.is_newsgoodstype; + if (is_newsgoodstype == undefined) { + is_newsgoodstype = 0; } - - //风格三 - //t = i,e = t - var th = this; - a.init(this, "", "requestData"); - var url = this.data.baseUrl; - this.data.is_new = i.is_new; - this.data.is_hot = i.is_hot; - if (0 != this.data.cat_id) { - url += "&cat_id=" + this.data.cat_id; + that.setData({ is_used_share: is_newsgoodstype }); + if (e.categoryset.indexOf("," + 1 + ",") != -1) { that.setData({ is_show_pl: 1 }); } + if (e.categoryset.indexOf("," + 3 + ",") != -1) { that.setData({ is_show_pp: 1 }); } + if (e.categoryset.indexOf("," + 2 + ",") != -1) { that.setData({ is_show_gb: 1 }); } + if (e.categoryset.indexOf("," + 4 + ",") != -1) { that.setData({ is_show_xm: 1 }); } + that.setData({ store_config: e, is_do: 1 }); + + //---有勾品类--- + if (that.data.is_show_pl) { + that.requestFirstCategoris(); } - - // this.requestGoodsList(url); - getApp().getConfig2(function (rs) { - //计算等级价相关 - var swithc_list = rs.switch_list; - var sw_arr = JSON.parse(swithc_list); - //---如果后台又开等级卡的开关--- - if (sw_arr.rank_switch && sw_arr.rank_switch == "2") { - th.setData({ rank_switch: true }); - var user = getApp().globalData.userInfo; - var ti = setInterval(function () { - if (!user) return false; - clearInterval(ti); - //---回调卡的列表--- - th.getPlusCardType(function (ob) { - th.setData({ card_list: ob.card_list }); - if (user.card_field && user['card_expiredate']) { - var str = user['card_expiredate'].replace(/-/g, '/'); - var end = new Date(str); - end = Date.parse(end) / 1000; - var now = ut.gettimestamp(); - - //--- 判断是等级会员,且在有效期范围内 --- - if (user.card_field && now < end) { - var card_name = ob.name_map.get(user.card_field); - //if (card_name.length > 4) card_name = card_name.substring(0, 4); - th.setData({ card_field: user.card_field, card_name: card_name, card_list: ob.card_list }); - } + if (that.data.is_show_xm != 1 && that.data.is_show_gb != 1 && that.data.is_show_pp != 1 && that.data.is_show_pl) { + that.data.pl_timer = setInterval(function () { + if (that.data.one_level_classify.length > 0) { + var item = that.data.one_level_classify[0], arr = item.array; + //----如果有下级的时候----- + if (item.array && item.array.length > 0) { + var is_lev_thr = 0 + for (var i = 0; i < arr.length; i++) { + if (arr[i].arrays.length > 0) { is_lev_thr = 1; break; } } - }) - }, 500) - } - }); - }, - onShow:function(){ - getApp().check_can_share(); - - if (typeof this.getTabBar === 'function' && this.getTabBar()) { - var index=getApp().getPageIndex(this); - this.getTabBar().setData({ - active: index //数字是当前页面在tabbar的索引 - }); - getApp().requestCardNum(this); - } - - - var that=this; - //调用底部导航 - //t.editTabBar(that,getApp().globalData.setting.stoid,getApp().globalData.url); - //this.requestFirstCategoris(); - setTimeout(function () { - //if (getApp().globalData.user_id) getApp().requestCardNum(that); - },500) - - if(this.data.load) return false; - - getApp().getConfig2(function (e) { - console.log('card------------>>>>', e); - var data=e; - var switch_list_data = data.switch_list; - var switch_list = JSON.parse(switch_list_data); - var is_newsgoodstype = switch_list.is_newsgoodstype; - if (is_newsgoodstype==undefined) - { - is_newsgoodstype=0; - } - that.setData({ is_used_share :is_newsgoodstype}); - if (e.categoryset.indexOf("," + 1 + ",") != -1) { that.setData({ is_show_pl: 1 }); } - if (e.categoryset.indexOf("," + 3 + ",") != -1) { that.setData({ is_show_pp: 1 }); } - if (e.categoryset.indexOf("," + 2 + ",") != -1) { that.setData({ is_show_gb: 1 }); } - if (e.categoryset.indexOf("," + 4 + ",") != -1) { that.setData({ is_show_xm: 1 }); } - that.setData({ store_config: e,is_do:1 }); - - //---有勾品类--- - if (that.data.is_show_pl){ - that.requestFirstCategoris(); - } - if (that.data.is_show_xm != 1 && that.data.is_show_gb != 1 && that.data.is_show_pp != 1 && that.data.is_show_pl){ - that.data.pl_timer = setInterval(function () { - if (that.data.one_level_classify.length>0){ - var item=that.data.one_level_classify[0],arr=item.array; - //----如果有下级的时候----- - if(item.array && item.array.length>0){ - var is_lev_thr=0 - for(var i=0;i0) {is_lev_thr=1;break; } - } - that.setData({ is_level_three: is_lev_thr }); - if (is_lev_thr!=1) { - that.setData({ select_classify_on: 0, index: 0, classify_name: item.items.name,cat_id: item.items.id,goodslist: item.array }); - console.log("id:="+item.items.id) - that.style(that.data.stylePage,that.data.cat_id); - } else { - that.setData({ select_classify_on: 0, index: 0, classify_name: item.items.name,cat_id: item.items.id,goodslist: arr }); - console.log("id:="+item.items.id) - that.style(that.data.stylePage,that.data.cat_id); - } - } - else{ - that.setData({ select_classify_on: 0, index: 0, goodslist: null,classify_name:item.items.name,is_level_three: 0}); - } - clearInterval(that.data.pl_timer); - } - },1000); - - } else if (that.data.is_show_gb != 1 && that.data.is_show_pp ){ - that.setData({ select_classify_on: 220, classify_name: "品牌" }); - } - - - var one_level_classify = that.data.one_level_classify; - - if (that.data.is_show_pl) that.setData({ currentTab: 0 }); - else if (that.data.is_show_gb){ that.setData({ currentTab: 1 });that.get_nation(); } - else if (that.data.is_show_pp) {that.setData({ currentTab: 2 });that.get_brand(); } - else if (that.data.is_show_xm) {that.setData({ currentTab: 3 });that.getServiceCategory(); } - - - var t_type=that.data.type; - //----求传参过来的控制----- - if (t_type == 1 && that.data.is_show_gb ) { - that.setData({ currentTab: 1,select_classify_on:223 }); - that.get_nation(); - } else if (t_type == 2 && that.data.is_show_pp ) { - that.setData({ currentTab: 2,select_classify_on:220}); - that.get_brand(); - } else if (t_type == 3 && that.data.is_show_xm ) { - that.setData({ currentTab: 3,select_classify_on:221 }); - that.getServiceCategory(); - } else if (that.data.is_show_pl) { - that.setData({ currentTab: 0,select_classify_on:0 }); - } - // 获取默认选中的第一个 - if(that.data.is_show_gb && that.data.select_classify_on == 223){ - that.setData({ status_show: 1 }); - }else if(that.data.is_show_pp && that.data.select_classify_on == 220){ - that.setData({ status_show: 2 }); + that.setData({ is_level_three: is_lev_thr }); + if (is_lev_thr != 1) { + that.setData({ select_classify_on: 0, index: 0, classify_name: item.items.name, cat_id: item.items.id, goodslist: item.array }); + console.log("id:=" + item.items.id) + that.style(that.data.stylePage, that.data.cat_id); + } else { + that.setData({ select_classify_on: 0, index: 0, classify_name: item.items.name, cat_id: item.items.id, goodslist: arr }); + console.log("id:=" + item.items.id) + that.style(that.data.stylePage, that.data.cat_id); + } + } + else { + that.setData({ select_classify_on: 0, index: 0, goodslist: null, classify_name: item.items.name, is_level_three: 0 }); + } + clearInterval(that.data.pl_timer); + } + }, 1000); + + } else if (that.data.is_show_gb != 1 && that.data.is_show_pp) { + that.setData({ select_classify_on: 220, classify_name: "品牌" }); + } + + + var one_level_classify = that.data.one_level_classify; + + if (that.data.is_show_pl) that.setData({ currentTab: 0 }); + else if (that.data.is_show_gb) { that.setData({ currentTab: 1 }); that.get_nation(); } + else if (that.data.is_show_pp) { that.setData({ currentTab: 2 }); that.get_brand(); } + else if (that.data.is_show_xm) { that.setData({ currentTab: 3 }); that.getServiceCategory(); } + + + var t_type = that.data.type; + //----求传参过来的控制----- + if (t_type == 1 && that.data.is_show_gb) { + that.setData({ currentTab: 1, select_classify_on: 223 }); + that.get_nation(); + } else if (t_type == 2 && that.data.is_show_pp) { + that.setData({ currentTab: 2, select_classify_on: 220 }); + that.get_brand(); + } else if (t_type == 3 && that.data.is_show_xm) { + that.setData({ currentTab: 3, select_classify_on: 221 }); + that.getServiceCategory(); + } else if (that.data.is_show_pl) { + that.setData({ currentTab: 0, select_classify_on: 0 }); + } + // 获取默认选中的第一个 + if (that.data.is_show_gb && that.data.select_classify_on == 223) { + that.setData({ status_show: 1 }); + } else if (that.data.is_show_pp && that.data.select_classify_on == 220) { + that.setData({ status_show: 2 }); + } + + that.data.load = 1; + }) + + }, + + //---------------分类请求接口,数据进行拼装------------------ + requestFirstCategoris: function () { + var t = this; + e.get("/api/weshop/goodscategory/page", { + data: { store_id: oo.stoid, pageSize: 6600, is_show: 1 }, + success: function (e) { + var arr = new Array(); + var dda = e.data.data.pageData; + if (dda != null && dda != "" && dda != undefined) { + t.setData({ is_pl_time: 1 }); } - - that.data.load=1; - }) - - }, - - //---------------分类请求接口,数据进行拼装------------------ - requestFirstCategoris: function() { - var t = this; - e.get("/api/weshop/goodscategory/page", { - data: { store_id: oo.stoid,pageSize:6600,is_show:1}, - success: function(e) { - var arr=new Array(); - var dda = e.data.data.pageData; - if (dda != null && dda !=""&&dda!=undefined){ - t.setData({is_pl_time:1}); + + if (t.data.is_used_share == 0) {//is_used_share控制新旧版本 + for (var i = 0; i < dda.length; i++) { + if (parseInt(dda[i].level) == 1) { + var item = { items: dda[i], array: new Array() } + arr.push(item); + } else if (parseInt(dda[i].level) == 2) { + for (var j = 0; j < arr.length; j++) { + if (parseInt(dda[i].parent_id) == parseInt(arr[j].items.id)) { + arr[j].array.push(dda[i]); break; + } } - - if (t.data.is_used_share == 0) {//is_used_share控制新旧版本 - for(var i=0;i0){ - - if (parseInt(need_to_insert.parent_id) == parseInt(two_item[pp].items.id)) { - - arr[dd].array[pp].arrays.push(need_to_insert); arr.ishaf_three = 0; break; - } - } + } + } else if (parseInt(need_to_insert.level) == 3) {//判断有3级的时候在二级里添加一个数组 + + for (var dd = 0; dd < arr.length; dd++) { + for (var pp = 0; pp < arr[dd].array.length; pp++) { + //--判断二级-- + var two_item = arr[dd].array; + + if (two_item && two_item.length > 0) { + + if (parseInt(need_to_insert.parent_id) == parseInt(two_item[pp].items.id)) { + + arr[dd].array[pp].arrays.push(need_to_insert); arr.ishaf_three = 0; break; } } } } - for(var i=0;i 4){ - //arr[i]['items']['name'] = mobile_name.substring(0, 4) - //} - } - if(t.data.is_show_pl==1 && t.data.is_show_pp != 1 && t.data.is_show_gb != 1){ - arr[0]['items']['is_show_class'] = true; - } - //console.log(arr) - t.setData({one_level_classify:arr}); - if(t.data.select_classify_on==0){ - var item=arr[0]; + } + } + for (var i = 0; i < arr.length; i++) { + arr[i]['items']['is_show_class'] = false; + var mobile_name = arr[i]['items']['name'] + //if(mobile_name.length > 4){ + //arr[i]['items']['name'] = mobile_name.substring(0, 4) + //} + } + if (t.data.is_show_pl == 1 && t.data.is_show_pp != 1 && t.data.is_show_gb != 1) { + arr[0]['items']['is_show_class'] = true; + } + //console.log(arr) + t.setData({ one_level_classify: arr }); + if (t.data.select_classify_on == 0) { + var item = arr[0]; - var name = item.items.name; - var cid = item.items.id; - var arr = item.array; + var name = item.items.name; + var cid = item.items.id; + var arr = item.array; - console.log("11111",item); + console.log("11111", item); - if (arr.length == 0) { - t.setData({ - select_classify_on: 0, index: 0, classify_name: name, cat_id: cid, - goodslist: null, is_level_three: 0 - }); + if (arr.length == 0) { + t.setData({ + select_classify_on: 0, index: 0, classify_name: name, cat_id: cid, + goodslist: null, is_level_three: 0 + }); - if(t.data.is_used_share == 2) - t.style(t.data.stylePage, cid) + if (t.data.is_used_share == 2) + t.style(t.data.stylePage, cid) - return false; - } - if (arr.length != 0) { - var is_lev_thr = 0 - 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 }); - - if (this.data.is_level_three != 1) { - t.setData({ index: 0, classify_name: name, goodslist: arr }); - } else { - t.setData({ index: 0, goodslist: arr }); - } - } + return false; + } + if (arr.length != 0) { + var is_lev_thr = 0 + 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.style(t.data.stylePage, cid) + if (this.data.is_level_three != 1) { + t.setData({ index: 0, classify_name: name, goodslist: arr }); + } else { + t.setData({ index: 0, goodslist: arr }); + } + } - } + t.style(t.data.stylePage, cid) - } - } - }); - }, - - requestCategories: function(t) { - var s = this; - e.get("/api/goods/goodsSecAndThirdCategoryList", { - data: { - parent_id: t - }, - success: function(e) { - s.setData({ - categories: e.data.result, - currentCategoryId: t - }); - } - }); - }, + } - switchFirstCategory: function(t) { - this.requestCategories(t.currentTarget.dataset.id); - }, + } + } + }); + }, - //-----------滑动切换---------- - swiperTab: function (e) { - var that = this; - if (e.detail.source == "touch") { - this.setData({ - currentTab: e.detail.current, + requestCategories: function (t) { + var s = this; + e.get("/api/goods/goodsSecAndThirdCategoryList", { + data: { + parent_id: t + }, + success: function (e) { + s.setData({ + categories: e.data.result, + currentCategoryId: t }); } + }); + }, - //获取国别 - if (e.detail.current == 1 && that.data.nationlist == null) { - that.get_nation(); - } - //获取品牌 - if (e.detail.current == 2 && that.data.groups == null) { - that.get_brand(); - } + switchFirstCategory: function (t) { + this.requestCategories(t.currentTarget.dataset.id); + }, - //获取服务卡项 - if (e.detail.current == 3 && that.data.xmlist == null) { - that.getServiceCategory(); - } + //-----------滑动切换---------- + swiperTab: function (e) { + var that = this; + if (e.detail.source == "touch") { + this.setData({ + currentTab: e.detail.current, + }); + } + //获取国别 + if (e.detail.current == 1 && that.data.nationlist == null) { + that.get_nation(); + } + //获取品牌 + if (e.detail.current == 2 && that.data.groups == null) { + that.get_brand(); + } - }, - //-----------点击切换----------- - clickTab: function (e) { - var that = this; - if (this.data.currentTab === e.target.dataset.current) { - return false; - } else { - that.setData({ - currentTab: e.target.dataset.current - }) - } - //获取国别 - if (e.detail.current == 1 && that.data.nationlist == null) { - that.get_nation(); - } + //获取服务卡项 + if (e.detail.current == 3 && that.data.xmlist == null) { + that.getServiceCategory(); + } - //获取品牌 - if (e.detail.current == 2 && that.data.groups == null) { - that.get_brand(); - } - //获取服务卡项 - if (e.detail.current == 3 && that.data.xmlist == null) { - that.getServiceCategory(); - } + }, + //-----------点击切换----------- + clickTab: function (e) { + var that = this; + if (this.data.currentTab === e.target.dataset.current) { + return false; + } else { + that.setData({ + currentTab: e.target.dataset.current + }) + } + //获取国别 + if (e.detail.current == 1 && that.data.nationlist == null) { + that.get_nation(); + } - }, + //获取品牌 + if (e.detail.current == 2 && that.data.groups == null) { + that.get_brand(); + } + + //获取服务卡项 + if (e.detail.current == 3 && that.data.xmlist == null) { + that.getServiceCategory(); + } + + }, tabLetter(e) { - const index = e.currentTarget.dataset.index; - this.setData({ - selected: index, - scrollIntoView: index - }) - this.cleanAcitvedStatus(); + const index = e.currentTarget.dataset.index; + this.setData({ + selected: index, + scrollIntoView: index + }) + this.cleanAcitvedStatus(); }, //-------------------清除字母选中状态--------------- cleanAcitvedStatus() { setTimeout(() => { - this.setData({selected: 0}) }, 500); + this.setData({ selected: 0 }) + }, 500); }, //------------手指滑动------------------ @@ -530,19 +540,19 @@ Page({ }, //跳转到分类的商品列表 - go_cate:function(t){ - var cid= t.currentTarget.dataset.cid; - var pid = t.currentTarget.dataset.pid; - var lurl = "/pages/goods/goodsList/goodsList?cat_id=" + cid; - lurl+="&pid="+pid; - wx.navigateTo({ url: lurl}); + go_cate: function (t) { + var cid = t.currentTarget.dataset.cid; + var pid = t.currentTarget.dataset.pid; + var lurl = "/pages/goods/goodsList/goodsList?cat_id=" + cid; + lurl += "&pid=" + pid; + wx.navigateTo({ url: lurl }); }, //跳转到品牌的商品列表 go_brand: function (t) { var cid = t.currentTarget.dataset.bid; var lurl = "/pages/goods/goodsList/goodsList?brand_id=" + cid; - wx.navigateTo({ url: lurl}); + wx.navigateTo({ url: lurl }); }, //跳转到国别的商品列表 @@ -551,24 +561,24 @@ Page({ var lurl = "/pages/goods/goodsList/goodsList?nation_id=" + cid; wx.navigateTo({ url: lurl }); }, - + //获取国别 - get_nation:function() { + get_nation: function () { var s = this; e.get("/api/weshop/nation/page", { data: { is_hot: 1, - store_id:oo.stoid, - pageSize:300, + store_id: oo.stoid, + pageSize: 300, }, success: function (e) { var dda = e.data.data.pageData; - s.setData({ nationlist:dda}) + s.setData({ nationlist: dda }) } }); }, - //获取品牌 + //获取品牌 get_brand: function () { var compare = function (prop) { return function (obj1, obj2) { @@ -576,8 +586,10 @@ Page({ if (!isNaN(Number(val1)) && !isNaN(Number(val2))) { val1 = Number(val1); val2 = Number(val2); } - if (val1 < val2) { return -1; - } else if (val1 > val2) { return 1; + if (val1 < val2) { + return -1; + } else if (val1 > val2) { + return 1; } else { return 0; } } } @@ -590,77 +602,77 @@ Page({ pageSize: 10000, }, success: function (e) { - var arr=new Array(); - var dda = e.data.data.pageData; - s.setData({brand_list:dda}); - - - for (var i = 0; i < dda.length; i++) { - //console.log(dda[i].logo) - if(dda[i].logo==""){ - dda[i].logo= s.data.iurl+"/miniapp/images/no_brand_def.jpg"; - }else if(dda[i].logo && dda[i].logo.indexOf("http")<0){ - dda[i].logo = oo.imghost+dda[i].logo; - } - - //进行排序,只有是默认排序的时候,才按首字母排序 - // if(parseInt(s.data.is_used_share)!=0) continue; - - if (arr.length>0){ - var find = 0; - //寻找字母在arr数组中是否存在,不存在就要添加,存在就在要这个数组添加元素 - for (var k = 0; k < arr.length;k++){ - if(dda[i].zm == arr[k].zm){ find=k+1; break;} - } - if (find == 0) { - var item = { zm: dda[i].zm, array: new Array() } - item.array.push(dda[i]); - arr.push(item); - } else{ - arr[find - 1].array.push(dda[i]); - } - }else{ - var item = { zm: dda[i].zm, array: new Array() } - item.array.push(dda[i]); - arr.push(item); - } - } - // if(parseInt(s.data.is_used_share)==0){ - // arr.sort(compare("zm")); - // }else{ - // var ob={array:dda}; - // arr.push(ob); - // } - - arr.sort(compare("zm")); - - s.setData({ groups: arr }); - //console.log(s.data.groups) + var arr = new Array(); + var dda = e.data.data.pageData; + s.setData({ brand_list: dda }); + + + for (var i = 0; i < dda.length; i++) { + //console.log(dda[i].logo) + if (dda[i].logo == "") { + dda[i].logo = s.data.iurl + "/miniapp/images/no_brand_def.jpg"; + } else if (dda[i].logo && dda[i].logo.indexOf("http") < 0) { + dda[i].logo = oo.imghost + dda[i].logo; + } + + //进行排序,只有是默认排序的时候,才按首字母排序 + // if(parseInt(s.data.is_used_share)!=0) continue; + + if (arr.length > 0) { + var find = 0; + //寻找字母在arr数组中是否存在,不存在就要添加,存在就在要这个数组添加元素 + for (var k = 0; k < arr.length; k++) { + if (dda[i].zm == arr[k].zm) { find = k + 1; break; } + } + if (find == 0) { + var item = { zm: dda[i].zm, array: new Array() } + item.array.push(dda[i]); + arr.push(item); + } else { + arr[find - 1].array.push(dda[i]); + } + } else { + var item = { zm: dda[i].zm, array: new Array() } + item.array.push(dda[i]); + arr.push(item); + } + } + // if(parseInt(s.data.is_used_share)==0){ + // arr.sort(compare("zm")); + // }else{ + // var ob={array:dda}; + // arr.push(ob); + // } + + arr.sort(compare("zm")); + + s.setData({ groups: arr }); + //console.log(s.data.groups) } }); }, // 获取服务卡项分类 - getServiceCategory: function() { + getServiceCategory: function () { var s = this; e.get("/api/weshop/serviceCategory/page", { data: { is_show: 1, - store_id:oo.stoid, - pageSize: 1000, + store_id: oo.stoid, + pageSize: 1000, }, success: function (e) { var dda = e.data.data.pageData; - s.setData({ - xmlist:dda, - }); + s.setData({ + xmlist: dda, + }); } }); }, - - goServiceCategoryList: function(t) { + + goServiceCategoryList: function (t) { var cid = t.currentTarget.dataset.cid; var lurl = "/packageA/pages/cardList/cardList?cat_id=" + cid; wx.navigateTo({ url: lurl }); @@ -668,45 +680,45 @@ Page({ //---------分享配置-------- onShareAppMessage: function (e) { - getApp().globalData.no_clear=1; - var url="pages/goods/categoryList/categoryList"; - var userInfo=getApp().globalData.userInfo; - //是分销商才带 - if(userInfo){ - url+="?first_leader="+userInfo.user_id; - } - console.log("--分类分享---分享--"); - console.log(url); - + getApp().globalData.no_clear = 1; + var url = "pages/goods/categoryList/categoryList"; + var userInfo = getApp().globalData.userInfo; + //是分销商才带 + if (userInfo) { + url += "?first_leader=" + userInfo.user_id; + } + console.log("--分类分享---分享--"); + console.log(url); + return { - title: "商品分类", - path:url, + title: "商品分类", + path: url, } }, //图片失败,默认图片 - bind_bnerr: function (e) { + bind_bnerr: function (e) { var _errImg = e.target.dataset.errorimg; var _errObj = {}; - _errObj[_errImg] = this.data.iurl+"/miniapp/images/default_g_img.gif"; + _errObj[_errImg] = this.data.iurl + "/miniapp/images/default_g_img.gif"; this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; }, - //图片失败,默认图片 - bind_bnerr_pp: function (e) { - var list = this.data.groups - var _errImg = e.target.dataset.errorimg; - var idx = e.target.dataset.idx; - var pix = e.target.dataset.pix; - - }, - //商品图片失败,默认图片 + //图片失败,默认图片 + bind_bnerr_pp: function (e) { + var list = this.data.groups + var _errImg = e.target.dataset.errorimg; + var idx = e.target.dataset.idx; + var pix = e.target.dataset.pix; + + }, + //商品图片失败,默认图片 goods_bnerr: function (e) { - var _errImg = e.target.dataset.err; + var _errImg = e.target.dataset.err; var _errObj = {}; _errObj[_errImg] = this.data.iurl + "/miniapp/images/no_cate_def.png"; this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; }, - goseach:function(){ + goseach: function () { wx.navigateTo({ url: "/pages/goods/search/search" }); @@ -714,106 +726,108 @@ Page({ //图片失败,默认图片 bind_bnerr2: function (e) { - var _errImg = e.target.dataset.errorimg; - var _errObj = {}; - _errObj[_errImg] = "/public/images/category.png"; - this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; - + var _errImg = e.target.dataset.errorimg; + var _errObj = {}; + _errObj[_errImg] = "/public/images/category.png"; + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; + }, - //图片失败,默认图片 - bind_bnerr_t3: function (e) { - var _errImg = e.target.dataset.errorimg; - var _errObj = {}; - _errObj[_errImg] = "/miniapp/images/default_g_img.gif"; - this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; + //图片失败,默认图片 + bind_bnerr_t3: function (e) { + var _errImg = e.target.dataset.errorimg; + var _errObj = {}; + _errObj[_errImg] = "/miniapp/images/default_g_img.gif"; + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; - }, + }, // 新的版本分类点击一级分类 - click_classify:function(e){ - // 在风格三的时候,才会有current - clearInterval(this.data.timer); - - let cur = e.currentTarget.dataset.current; - if(cur) { + click_classify: function (e) { + // 在风格三的时候,才会有current + clearInterval(this.data.timer); + this.setData({ + toupper:true + }) + let cur = e.currentTarget.dataset.current; + if (cur) { 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; - } + 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 - }) - this.setData({ - currentTab: cur, - select_classify_on: cur - }) - this.checkCor(); + wx.pageScrollTo({ + scrollTop: 0 + }) + this.setData({ + currentTab: cur, + select_classify_on: cur + }) + this.checkCor(); } - } - this.setData({ - countDownNum: 3, - }); - - var arr2 = this.data.one_level_classify - for(var i=0;i 0) { is_lev_thr = 1; break; } - } - this.setData({ is_level_three: is_lev_thr }); - - if (this.data.is_level_three != 1) { - this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, goodslist: arr }); - } else { - this.setData({ select_classify_on: indexs, index: indexs, goodslist: arr }); + } + this.setData({ + countDownNum: 3, + }); + + var arr2 = this.data.one_level_classify + for (var i = 0; i < arr2.length; i++) { + if (i == e.currentTarget.dataset.index) { + arr2[i]['items']['is_show_class'] = true + } else { + arr2[i]['items']['is_show_class'] = false + } + } + this.setData({ one_level_classify: arr2 }); + //this.data.one_level_classify[e.currentTarget.dataset.index]['items']['is_show_class'] = true + // console.log(e.currentTarget.dataset.index) + clearInterval(this.data.timer); + this.setData({ countDownNum: 3, stylePage: 1, scrollTop: 0 }); + this.data.ishaf_three = 0; + var indexs = e.currentTarget.dataset.index; + var name = e.currentTarget.dataset.name; + var cid = e.currentTarget.dataset.cid; + var pid = e.currentTarget.dataset.pid; + var arr = e.currentTarget.dataset.arr; + console.log("cid:=" + name) + if (indexs == 220) { this.get_brand(); } + //==2的时候 请求数据为商品,不为分类 + if (this.data.is_used_share == 2) { + this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid, lastMsg: false, }); + console.log("edqdqw:=" + this.data.select_classify_on) + this.style(this.data.stylePage, cid) + } else { + if (arr != "undefined" && arr != undefined) { + if (arr.length == 0) { + this.setData({ + select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid, + goodslist: null, is_level_three: 0 + }); + return false; + } + if (arr.length != 0) { + var is_lev_thr = 0 + for (var i = 0; i < arr.length; i++) { + if (arr[i].arrays.length > 0) { is_lev_thr = 1; break; } + } + this.setData({ is_level_three: is_lev_thr }); + + if (this.data.is_level_three != 1) { + this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, goodslist: arr }); + } else { + this.setData({ select_classify_on: indexs, index: indexs, goodslist: arr }); + } } - } - } - this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid, stylePage: 1,lastMsg: false,}); - } - - }, + } + this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid, stylePage: 1, lastMsg: false, }); + } + + }, //图片失败 @@ -825,34 +839,34 @@ Page({ _errObj[_errImg] = "/miniapp/images/default_g_img.gif"; this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; }, - - + + //选择更多 - select_more:function(e){ + select_more: function (e) { var cid = e.currentTarget.dataset.cid; var pid = e.currentTarget.dataset.pid; var lurl = "/pages/goods/goodsList/goodsList?cat_id=" + cid + "&pid=" + pid; wx.navigateTo({ url: lurl }); - + }, - - -//扫一扫 - getScancode:function(){ - var _this = this; - getApp().globalData.no_clear=1; + + + //扫一扫 + getScancode: function () { + var _this = this; + getApp().globalData.no_clear = 1; // 允许从相机和相册扫码 wx.scanCode({ success: (res) => { - var result = res.result; - wx.navigateTo({ - url: "/pages/goods/search/search?s_key="+result, - }); + var result = res.result; + wx.navigateTo({ + url: "/pages/goods/search/search?s_key=" + result, + }); } }) }, - - + + onUnload: function () { //this.destroyActivityTimer(); }, @@ -882,30 +896,93 @@ Page({ console.log(data.data.data.pageData) that.setData({ requestData: data.data.data.pageData, - is_go: 1 + is_go: 1 }); that.setData({ is_go: 1 }); - that.data.stylePage++ , null == that.data.allData && (that.data.allData = Object.assign({}, data.data.data.pageData)), + that.data.stylePage++, null == that.data.allData && (that.data.allData = Object.assign({}, data.data.data.pageData)), wx.stopPullDownRefresh(); } }); }, - + // 左侧更新 scrollLower: function (data) { - if(this.data.is_no_more) return false; + if (this.data.is_no_more) return false; var that = this; clearInterval(that.data.timer); that.setData({ stylePage: that.data.stylePage + 1, countDownNum: 3, lastMsg: false, - }); - that.style(that.data.stylePage, that.data.cat_id); + }); + if (nextTimeOff) { + clearTimeout(nextTimeOff) + } + nextTimeOff = setTimeout(()=>{ + that.style(that.data.stylePage, that.data.cat_id); + },1000) + }, + scrolltoupper(){ + console.log('到顶部--------'); + this.setData({ + toupper:true + }) + }, + bScroll(even){ + console.log('滑动开始'); + console.log(even); + this.setData({ + sClientY:even.changedTouches.length>0 ? even.changedTouches[0].clientY : 0 + }) + }, + btouMove(even){ + console.log('滑动结束'); + console.log(even); + let eClientY = even.changedTouches.length>0 ? even.changedTouches[0].clientY : 0 + let sClientY = this.data.sClientY + console.log(eClientY - sClientY); + if (eClientY - sClientY > 0) { + console.log('下滑'); + if (this.data.toupper) { + this.setData({msgStatus:false,is_no_more:false}) + clearInterval(this.data.timer); + this.nextCategory(true) + }else{ + this.disNexCat() + } + }else{ + console.log('上滑'); + this.setData({ + toupper:false + }) + this.disNexCat() + } + }, + disNexCat(){ + let that = this + const { windowHeight } = wx.getSystemInfoSync() + wx.createSelectorQuery().select('#sview').boundingClientRect(function(rect){ + if (rect) { + const { top,height } = rect + if ((top < windowHeight) && (top + height >0) ) { + let nextShow2 = that.data.nextShow2 + if (nextShow2) { + that.nextCategory() + }else{ + that.setData({ + nextShow2:true + }) + } + }else{ + that.setData({ + nextShow2:false + }) + } + } + }).exec() }, - //页面版面风格三的时候请求推荐商品 返回 style: function (page, cid) { console.log("page:=" + page) @@ -913,26 +990,28 @@ Page({ 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 }, success: function (e) { + console.log('上拉加载。。。。。。。。。'); console.log(e.data.data.pageData) if (e.data.data.pageData.length > 0) { + clearInterval(s.data.timer); s.setData({ - msgStatus: false,is_no_more:0 + msgStatus: false, is_no_more: 0,nextShow:false,nextShow2:false }); //如果有数据 判断分页为第一页的时候直接渲染数据 if (page > 1) { //如果分页不是在第一页 那么就把返回的数据追加到原有数据后面 var arr = s.data.requestData - - for (var i = 0; i < e.data.data.pageData.length;i++){ + + for (var i = 0; i < e.data.data.pageData.length; i++) { arr.push(e.data.data.pageData[i]); } - + s.setData({ requestData: arr }); - - }else{ + + } else { s.setData({ requestData: e.data.data.pageData }); @@ -940,39 +1019,24 @@ Page({ wx.pageScrollTo({ scrollTop: 0 }) - } + } } - s.setData({ - dataLength: s.data.requestData.length, - }); - + s.setData({ + dataLength: s.data.requestData.length, + }); + } else { //没有数据页面显示暂无数据 if (page != 1) { - var dataArray = s.data.one_level_classify - var index = s.data.index - dataArray[index]['items']['is_show_class'] = false - //没有下一个类别的时候 - if(index+1>=dataArray.length){ - s.setData({is_no_more:1}); - }else{ - dataArray[index+1]['items']['is_show_class'] = true - console.log(dataArray[index + 1]['items']) - s.setData({ - msgStatus: true, - stylePage: 1, - index: index + 1, - select_classify_on: index + 1, - cat_id: dataArray[index + 1]['items']['id'], - classify_name: dataArray[index + 1]['items']['name'], - one_level_classify: dataArray, - is_no_more:0 - }); - s.style(s.data.stylePage, dataArray[index + 1]['items']['id']) - } - - }else{ + let nextShow = s.data.nextShow + + if (!nextShow) { + s.setData({ + nextShow:true + }) + } + } else { //没有数据而且是第一页的时候 s.setData({ stylePage: 1, @@ -982,9 +1046,10 @@ Page({ msgStatus: true, countDownNum: countDownNum, requestData: [], - is_no_more:0, + is_no_more: 0, }); - s.data.timer=setInterval(function () { + clearInterval(s.data.timer); + s.data.timer = setInterval(function () { if (countDownNum == 0) { clearInterval(s.data.timer); //关闭定时器之后,可作其他处理 @@ -997,50 +1062,82 @@ Page({ var dataArray = s.data.one_level_classify var index = s.data.index console.log(dataArray[index + 1]) - if (dataArray[index + 1] == undefined || dataArray[index + 1] == "undefined"){ + if (dataArray[index + 1] == undefined || dataArray[index + 1] == "undefined") { console.log("dataArray[index + 1] = undefined") s.setData({ stylePage: 1, msgStatus: true, lastMsg: true }); - }else{ + } else { dataArray[index]['items']['is_show_class'] = false - dataArray[index+1]['items']['is_show_class'] = true + dataArray[index + 1]['items']['is_show_class'] = true s.setData({ stylePage: 1, index: index + 1, select_classify_on: index + 1, cat_id: dataArray[index + 1]['items']['id'], classify_name: dataArray[index + 1]['items']['name'], - one_level_classify:dataArray + one_level_classify: dataArray }); s.style(s.data.stylePage, dataArray[index + 1]['items']['id']); } - + } countDownNum--; s.setData({ countDownNum: countDownNum }) var arr2 = s.data.one_level_classify - for(var i=0;i= dataArray.length || index+s < 0) { + this.setData({ is_no_more: 1 }); + } else { + dataArray[index + s]['items']['is_show_class'] = true + console.log(dataArray[index + s]['items']) + this.setData({ + msgStatus: false, + stylePage: 1, + index: index + s, + select_classify_on: index + s, + cat_id: dataArray[index + s]['items']['id'], + classify_name: dataArray[index + s]['items']['name'], + one_level_classify: dataArray, + is_no_more: 0 + }); + this.style(this.data.stylePage, dataArray[index + 1]['items']['id']) + } + }, openFilterModal: function () { this.setData({ @@ -1090,28 +1187,28 @@ Page({ func(ob); }) }, - + //导航跳转 - nav_goto:function(e){ - var url=e.currentTarget.dataset.url; - if(!url || url=='') return; - if(url[0]!='/') url='/'+url; - getApp().goto(url); - }, - - onShareTimeline(){ - getApp().globalData.no_clear=1; - var store_name=getApp().globalData.config?getApp().globalData.config.store_name:''; - if(!store_name) - store_name=getApp().globalData.setting.appName; - - var user_id=getApp().globalData.user_id; - if(!user_id) user_id=0; - - return { - title:'商品分类-'+store_name, - query: "first_leader=" + user_id - } + nav_goto: function (e) { + var url = e.currentTarget.dataset.url; + if (!url || url == '') return; + if (url[0] != '/') url = '/' + url; + getApp().goto(url); + }, + + onShareTimeline() { + getApp().globalData.no_clear = 1; + var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; + if (!store_name) + store_name = getApp().globalData.setting.appName; + + var user_id = getApp().globalData.user_id; + if (!user_id) user_id = 0; + + return { + title: '商品分类-' + store_name, + query: "first_leader=" + user_id } + } }); \ No newline at end of file diff --git a/pages/goods/categoryList/categoryList.wxml b/pages/goods/categoryList/categoryList.wxml index bc82065..a784bbc 100644 --- a/pages/goods/categoryList/categoryList.wxml +++ b/pages/goods/categoryList/categoryList.wxml @@ -5,231 +5,219 @@ - - 分类 - 国家 - 品牌 - 项目 - + + 分类 + 国家 + 品牌 + 项目 + - - - - - - - + + + + + + + - + - - - - - - - {{fitem.items.name}} - - {{item.name}} - - - - + + + + + + + + {{fitem.items.name}} + + + {{item.name}} + + + + - - - - - - - - {{bitem.name}} - {{bitem.enname}} - - - - + + + + + + + + {{bitem.name}} + {{bitem.enname}} + + + + - - - - {{group.zm}} - - - - - - - - - - - - - - - {{item.zm}} + + + + {{group.zm}} + + + + + + + + + + + + + {{item.zm}} + + - - - - - - - - - - - - - {{fitem.name}} - - {{item.name}} - - - - - - - 暂无项目 - - - - + + + + + + + + + + + + + {{fitem.name}} + + + {{item.name}} + + + + + + + 暂无项目 + + + + 暂无分类 去逛逛 - + - + 商家暂未设置分类 去逛逛 - + - - - - + + - - - 搜索店铺商品 - - - - - - - - - - - - - - - - - - - - 国家 - - - - - - - - - - 品牌 - + + + 搜索店铺商品 + + + + + + + + + + + + + + + + + + + + 国家 + + + + + + + + + + 品牌 + + + + + + + 项目 + + + + + + + + + + + + {{ittms.items.name}} + - - - - - 项目 - - - - - - - - - - - - {{ittms.items.name}} - - - - - + - - + + + + - - {{ishaf_three==1?good_list.name:classify_name}} + + {{ishaf_three==1?good_list.name:classify_name}} - - - - - - - - - {{bitem.name}} - - - {{bitem.enname}} - - - - - - + + + + + + + + + {{bitem.name}} + + + {{bitem.enname}} + + + + + + - - - - - {{classify_name}} - - - {{brand_list.zm}} - - - - - {{user.name}} - - - - - - - - - {{item.zm}} - - - - - - - - - - - - - {{classify_name}} - - - - - - - - - {{item.name}} - - - - - - - 暂无项目 - - - - - - - - - {{classify_name}} - - 更多 - + + + + {{classify_name}} + + + {{brand_list.zm}} + + + + + {{user.name}} + + + + + + + + {{item.zm}} - - - - - - - {{goods.items.name}} - - - - - 该类别无子级 - - + + + + + + + + + + + {{classify_name}} + + + + + + + + {{item.name}} + + + + + + + 暂无项目 - - - - + + + + + + + {{classify_name}} + + 更多 + + + + + + + + + + {{goods.items.name}} + + + + + 该类别无子级 + + + + + - + + + + - {{goods.items.name}} - - 更多 + + + {{goods.items.name}} + + 更多 - - + + - - - - - {{item.name}} - - - - + + + + + {{item.name}} + + + + - - - + + + - - - - - - - 商家暂未设置分类 - 去逛逛 - - + + + + + + + 商家暂未设置分类 + 去逛逛 + + - - - - + + - - - - 搜索店铺商品 - - - - - + + + + 搜索店铺商品 - - - - - - - - - 国家 - - - - - - 品牌 - - - - - - - - 项目 - - - - - - - - - - - + + + + + + + + + + + 国家 + + + + + + 品牌 + + + + + + + + 项目 + + + + + + + + + + + - - - - {{ittms.items.name}} - + + + {{ittms.items.name}} + - - - - - - - - - - - + + + + + + + + + + + - - {{ishaf_three==1?good_list.name:classify_name}} + + {{ishaf_three==1?good_list.name:classify_name}} - - - - - - - - {{bitem.name}} - - - {{bitem.enname}} - - - - - - + + + + + + + + {{bitem.name}} + + + {{bitem.enname}} + + + + + + - - + + - - - - - - - {{classify_name}} - - - {{brand_list.zm}} - - - - - {{user.name}} - - - - - - - - - - {{item.zm}} - - - - - - - - - - - - {{classify_name}} - - - - - - - - - {{item.name}} - - - - - - - 暂无项目 - - - - + + + + + + {{classify_name}} + + + {{brand_list.zm}} + + + + + {{user.name}} + + + + + + + + + + {{item.zm}} + + + + + + + + + + + + {{classify_name}} + + + + + + + + + {{item.name}} + + + + + + + 暂无项目 + + + + - - - + + + - - - {{classify_name}} - - 更多 - - + + + {{classify_name}} + + 更多 + - - - - - + + + + + + - - - - - + + + + + + + + {{item.goods_name}} + + + + + + {{item.prom_integral}}积分 + + + {{item.prom_price}} + + + + + + + + 评论{{item.comment_count}} + 已售{{item.sales_sum}} + + + + + + + + + + + + + + + {{item[card_field]}} + + + {{card_name}} + - - {{item.goods_name}} - - - - - - {{item.prom_integral}}积分 - + - {{item.prom_price}} - - - - - - - - 评论{{item.comment_count}} - 已售{{item.sales_sum}} - - - - - - - - - - - - - - - {{item[card_field]}} - - - {{card_name}} - - - - - - 评论{{item.comment_count}} - 已售{{item.sales_sum}} - - - - - - {{item.shop_price}} - - - - - - 评论{{item.comment_count}} - 已售{{item.sales_sum}} - - - - - - - - - {{item.shop_price}} - - - - - {{g_filter.get_card_price(item,card_list,0)}} - - - {{g_filter.get_card_price(item,card_list,1)}} - - - - - - 评论{{item.comment_count}} - 已售{{item.sales_sum}} - - - - - - - {{item.shop_price}} - - - - - - - 评论{{item.comment_count}} - 已售{{item.sales_sum}} - - - - - - - - {{item.shop_price}} - - - - - - - 评论{{item.comment_count}} - 已售{{item.sales_sum}} - - - - + + + + 评论{{item.comment_count}} + 已售{{item.sales_sum}} - - - 暂无更多 - - - + + + + + {{item.shop_price}} + + + + + + 评论{{item.comment_count}} + 已售{{item.sales_sum}} + + + + + + + + + {{item.shop_price}} + + + + + {{g_filter.get_card_price(item,card_list,0)}} + + + {{g_filter.get_card_price(item,card_list,1)}} + + + + + + 评论{{item.comment_count}} + 已售{{item.sales_sum}} + + - - 该类别暂无推荐商品 {{countDownNum}} 秒后自动跳到下一个类别 - 该类别暂无推荐商品 - + + + + {{item.shop_price}} + + + + + + + 评论{{item.comment_count}} + 已售{{item.sales_sum}} + + + + + + + + {{item.shop_price}} + + + + + + + 评论{{item.comment_count}} + 已售{{item.sales_sum}} + + + + - - - - - - - + + + 暂无更多 + + 上滑查看下一个分类 + + + + + + + 该类别暂无推荐商品 + {{countDownNum}} 秒后自动跳到下一个类别 + + 该类别暂无推荐商品 + + + + + + + + + - - - - - - - 商家暂未设置分类 - 去逛逛 - - - + + + + + + + 商家暂未设置分类 + 去逛逛 + + + \ No newline at end of file diff --git a/pages/user/assistance/task_assistance.wxml b/pages/user/assistance/task_assistance.wxml index 045baf7..f2a12b8 100644 --- a/pages/user/assistance/task_assistance.wxml +++ b/pages/user/assistance/task_assistance.wxml @@ -59,6 +59,12 @@ style="background-color:#{{btn_color ? btn_color:'fbda0e'}};color:{{font_color?('#'+font_color):'white'}};"> 好友拆一拆 + + + 立即兑换 -- libgit2 0.21.4