Commit 5bddd309b9ca7c8c4479de0ab0849412d1768069

Authored by 前端开发-罗建龙
1 parent 843e7715

分组过滤

components/diy_goodsGroup/filter.js 0 → 100644
  1 +//获取样式
  2 +var get_class = function(column,position) {
  3 + //--列的情况
  4 + if(column==1){ return "zs_t"+position; }
  5 + //--俩列的情况
  6 + if(column==2){ return "zs_t"+position+"_2l"; }
  7 + //--三列的情况
  8 + if(column==3){ return "zs_t"+position+"_3l"; }
  9 + //----列表的情况-----
  10 + if(column==4 ){ return "zs_t1_x"+position; }
  11 +//--滑动的情况
  12 +if(column==5){ return "zs_t"+position+"_3l"; }
  13 +}
  14 +
  15 +
  16 +var g_filters = {
  17 + //判断边框类型
  18 + get_border_type:function(type){
  19 + if(!type) type=0;
  20 + var type=parseInt(type);
  21 + switch(type){
  22 + case 0: return "border_zhijiao";
  23 + case 1: return "border_yuanjiao";
  24 + }
  25 + return "";
  26 + },
  27 +
  28 + //-- 判断是不是有等级价 --
  29 + is_has_rank:function(rank_switch,item){
  30 + if(!rank_switch) return false;
  31 + if(item.cardprice1 || item.cardprice2 || item.cardprice3) {return true}
  32 + return false;
  33 + },
  34 +
  35 + //-- 判断,不是等级会员时候,要显示的最低等级价和名称 --
  36 + get_card_price:function(goods,all_card,type){
  37 + var price1=parseFloat(goods['cardprice1']);
  38 + var price2 = parseFloat(goods['cardprice2']);
  39 + var price3 = parseFloat(goods['cardprice3']);
  40 + if(!all_card){
  41 + if(type==0) return 0;
  42 + return "";
  43 + }
  44 +
  45 + var min_price=null;
  46 + var min_name=null;
  47 + //---设置对应的价格名字----
  48 + for(var i=0;i<3;i++) {
  49 + var vl=all_card[i];
  50 + if(!vl) continue;
  51 + if(vl['CorrPrice']=="Price1" && price1>0)
  52 + {
  53 + if(min_price==null) {
  54 + min_price=price1;min_name=vl['CardName'];
  55 + }
  56 + else if(price1<min_price) {
  57 + min_price=price1;min_name=vl['CardName'];
  58 + }
  59 + }
  60 + if(vl['CorrPrice']=="Price2" && price2>0)
  61 + {
  62 + if(min_price==null) {
  63 + min_price=price2;min_name=vl['CardName'];
  64 + }
  65 + else if(price2<min_price) {
  66 + min_price=price2;min_name=vl['CardName'];
  67 + }
  68 + }
  69 +
  70 + if(vl['CorrPrice']=="Price3" && price3>0)
  71 + {
  72 + if(min_price==null) {
  73 + min_price=price3;min_name=vl['CardName'];
  74 + }
  75 + else if(price3<min_price) {
  76 + min_price=price3;min_name=vl['CardName'];
  77 + }
  78 + }
  79 +
  80 + }
  81 + if(min_price==null){
  82 + if(type==0) return 0;
  83 + return "";
  84 + }
  85 +
  86 + if(type==0) return min_price;
  87 + if(min_name.length>4 ) min_name=min_name.substring(0, 4);
  88 + return min_name;
  89 + },
  90 +
  91 +
  92 + get_url_by_type: function(item) {
  93 + var url = '';
  94 + if(item.prom_type == 9) {
  95 + url = '/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id=' + item.goods_id + '&group_id=' + item.prom_id;
  96 + }
  97 + else if(item.prom_type==8){
  98 + url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id="+item.goods_id+"&prom_id="+item.prom_id
  99 + }
  100 + else {
  101 + url = '/pages/goods/goodsInfo/goodsInfo?goods_id=' + item.goods_id + '&prom_id=' + item.prom_id + '&prom_type=' + item.prom_type;
  102 + };
  103 + return url;
  104 + },
  105 +
  106 +}
  107 +
  108 +
  109 +module.exports = {
  110 + get_class: get_class,
  111 + is_has_rank:g_filters.is_has_rank,
  112 + get_card_price:g_filters.get_card_price,
  113 + get_border_type:g_filters.get_border_type,
  114 + get_url_by_type: g_filters.get_url_by_type,
  115 +}
... ...