Commit 0a98958a2a33f0d4354193b8e1e12596ba64f419

Authored by yvan.ni
1 parent 82539a1b

规格使用过滤器

pages/goods/goodsInfo/goodsInfo.wxml
@@ -464,7 +464,7 @@ @@ -464,7 +464,7 @@
464 <text>规格</text> 464 <text>规格</text>
465 </view> 465 </view>
466 <view class="item_right"> 466 <view class="item_right">
467 - <text>{{data.goods_spec==""?"规格1":data.goods_spec}}</text> 467 + <text>{{filters.show_gui_ge(data.goods_spec,data.goods_color)}}</text>
468 </view> 468 </view>
469 </view> 469 </view>
470 <view class="tb_item tb-l"> 470 <view class="tb_item tb-l">
utils/filter.wxs
@@ -22,13 +22,23 @@ var filters = { @@ -22,13 +22,23 @@ var filters = {
22 22
23 pInt:function(t) { 23 pInt:function(t) {
24 var d = parseInt(t); return d; 24 var d = parseInt(t); return d;
25 - } 25 + },
26 26
  27 + show_gui_ge:function(spec,color){
  28 + if((spec=="" || spec==null)){
  29 + if((color=="" || color==null)){ return "规格1";
  30 + }else{return color; }
  31 + }else{
  32 + if((color=="" || color==null)){ return spec;
  33 + }else{ return spec+"/"+color; }
  34 + }
  35 + }
27 } 36 }
28 module.exports = { 37 module.exports = {
29 toFix: filters.toFix, 38 toFix: filters.toFix,
30 replace_time:filters.replace_time, 39 replace_time:filters.replace_time,
31 replace_time2: filters.replace_time2, 40 replace_time2: filters.replace_time2,
32 format_time:filters.format_time, 41 format_time:filters.format_time,
33 - pInt:filters.pInt 42 + pInt:filters.pInt,
  43 + show_gui_ge:filters.show_gui_ge
34 } 44 }
35 \ No newline at end of file 45 \ No newline at end of file