From 5bddd309b9ca7c8c4479de0ab0849412d1768069 Mon Sep 17 00:00:00 2001 From: luo <17530855@qq.com> Date: Mon, 4 Sep 2023 11:45:15 +0800 Subject: [PATCH] 分组过滤 --- components/diy_goodsGroup/filter.js | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+), 0 deletions(-) create mode 100644 components/diy_goodsGroup/filter.js diff --git a/components/diy_goodsGroup/filter.js b/components/diy_goodsGroup/filter.js new file mode 100644 index 0000000..d92ae8e --- /dev/null +++ b/components/diy_goodsGroup/filter.js @@ -0,0 +1,115 @@ +//获取样式 +var get_class = function(column,position) { + //--列的情况 + if(column==1){ return "zs_t"+position; } + //--俩列的情况 + if(column==2){ return "zs_t"+position+"_2l"; } + //--三列的情况 + if(column==3){ return "zs_t"+position+"_3l"; } + //----列表的情况----- + if(column==4 ){ return "zs_t1_x"+position; } +//--滑动的情况 +if(column==5){ return "zs_t"+position+"_3l"; } +} + + +var g_filters = { + //判断边框类型 + get_border_type:function(type){ + if(!type) type=0; + var type=parseInt(type); + switch(type){ + case 0: return "border_zhijiao"; + case 1: return "border_yuanjiao"; + } + return ""; + }, + + //-- 判断是不是有等级价 -- + is_has_rank:function(rank_switch,item){ + if(!rank_switch) return false; + if(item.cardprice1 || item.cardprice2 || item.cardprice3) {return true} + return false; + }, + + //-- 判断,不是等级会员时候,要显示的最低等级价和名称 -- + get_card_price:function(goods,all_card,type){ + var price1=parseFloat(goods['cardprice1']); + var price2 = parseFloat(goods['cardprice2']); + var price3 = parseFloat(goods['cardprice3']); + if(!all_card){ + if(type==0) return 0; + return ""; + } + + var min_price=null; + var min_name=null; + //---设置对应的价格名字---- + for(var i=0;i<3;i++) { + var vl=all_card[i]; + if(!vl) continue; + if(vl['CorrPrice']=="Price1" && price1>0) + { + if(min_price==null) { + min_price=price1;min_name=vl['CardName']; + } + else if(price10) + { + if(min_price==null) { + min_price=price2;min_name=vl['CardName']; + } + else if(price20) + { + if(min_price==null) { + min_price=price3;min_name=vl['CardName']; + } + else if(price34 ) min_name=min_name.substring(0, 4); + return min_name; + }, + + + get_url_by_type: function(item) { + var url = ''; + if(item.prom_type == 9) { + url = '/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id=' + item.goods_id + '&group_id=' + item.prom_id; + } + else if(item.prom_type==8){ + url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id="+item.goods_id+"&prom_id="+item.prom_id + } + else { + url = '/pages/goods/goodsInfo/goodsInfo?goods_id=' + item.goods_id + '&prom_id=' + item.prom_id + '&prom_type=' + item.prom_type; + }; + return url; + }, + +} + + +module.exports = { + get_class: get_class, + is_has_rank:g_filters.is_has_rank, + get_card_price:g_filters.get_card_price, + get_border_type:g_filters.get_border_type, + get_url_by_type: g_filters.get_url_by_type, +} -- libgit2 0.21.4