Commit 650a94a05cb1e5d2a975d231bbdb4c4fbbbc394c
1 parent
70ad5f28
商品分类数据填充
Showing
4 changed files
with
94 additions
and
46 deletions
pages/cart/cart2/c_filter.wxs
0 → 100644
| 1 | +var filters = { | |
| 2 | + toFix:function(val,count){ | |
| 3 | + return val.toFixed(count) | |
| 4 | + }, | |
| 5 | + format_time:function(ts,isFull) { | |
| 6 | + var d = getDate(ts*1000) | |
| 7 | + var fm=[d.getFullYear(), d.getMonth()+1, d.getDate()].join('-'); | |
| 8 | + if(isFull==1) | |
| 9 | + fm=fm + ' '+ [d.getHours(), d.getMinutes(), d.getSeconds()].join(':') | |
| 10 | + return fm; | |
| 11 | + }, | |
| 12 | + setcolor:function(ind){ | |
| 13 | + if (ind == 0 || ind ==null) return "red"; | |
| 14 | + if(ind==1 ) return "green"; | |
| 15 | + if(ind==2) return "blue"; | |
| 16 | + if(ind==11) return "green"; | |
| 17 | + if(ind==12) return "blue"; | |
| 18 | + return ""; | |
| 19 | + }, | |
| 20 | + setbgcolor: function (ind) { | |
| 21 | + if (ind == 0 || ind == null) return "#ffa1b9"; | |
| 22 | + if (ind == 1) return "#59e1d2"; | |
| 23 | + if (ind == 2) return "#a3bcff"; | |
| 24 | + if (ind == 11) return "#59e1d2"; | |
| 25 | + if (ind == 12) return "#a3bcff"; | |
| 26 | + return ""; | |
| 27 | + }, | |
| 28 | + | |
| 29 | + get_type:function(ind){ | |
| 30 | + if (ind == 0 || ind == null) return "全场通用"; | |
| 31 | + if (ind == 1) return "品牌"; | |
| 32 | + if (ind == 2) return "品类"; | |
| 33 | + if (ind == 11) return "用途"; | |
| 34 | + if (ind == 12) return "分类1"; | |
| 35 | + return ""; | |
| 36 | + }, | |
| 37 | + get_type_card:function(ind){ | |
| 38 | + if (ind == 0 || ind == null) return "全场通用"; | |
| 39 | + if (ind == 1) return "指定品牌"; | |
| 40 | + if (ind == 2) return "指定品类"; | |
| 41 | + if (ind == 11) return "指定用途"; | |
| 42 | + if (ind == 12) return "指定分类1"; | |
| 43 | + return ""; | |
| 44 | + }, | |
| 45 | + format_huiche:function (text) { | |
| 46 | + if (!text) { | |
| 47 | + return ""; | |
| 48 | + } | |
| 49 | + var reg = getRegExp('\\\\n', 'g') | |
| 50 | + return text.replace(reg, '\n') | |
| 51 | + } | |
| 52 | +} | |
| 53 | + | |
| 54 | +module.exports = { | |
| 55 | + toFix: filters.toFix, | |
| 56 | + format_time:filters.format_time, | |
| 57 | + setcolor:filters.setcolor, | |
| 58 | + setbgcolor: filters.setbgcolor, | |
| 59 | + get_type: filters.get_type, | |
| 60 | + get_split_name: filters.get_split_name, | |
| 61 | + get_type_card: filters.get_type_card, | |
| 62 | + format_huiche: filters.format_huiche, | |
| 63 | +} | |
| 0 | 64 | \ No newline at end of file | ... | ... |
pages/cart/cart2/filter.wxs
0 → 100644
pages/goods/categoryList/categoryList.js
| ... | ... | @@ -28,6 +28,7 @@ Page({ |
| 28 | 28 | is_country:1, |
| 29 | 29 | //品牌的控制属性 |
| 30 | 30 | is_brand:1, |
| 31 | + goodslist: [{ good_name: "你号", logo: "../../ggg.png" }, { good_name: "你号", logo: "../../ggg.png" }, { good_name: "你号", logo: "../../ggg.png" }, { good_name: "海泥面膜", logo: "../../ggg.png" }, { good_name: "男孩女孩", logo: "../../ggg.png" }, { good_name: "你间距", logo: "../../ggg.png" }, { good_name: "你号", logo: "../../ggg.png" }, { good_name: "谢谢谢谢下", logo: "../../ggg.png" }, { good_name: "你号", logo: "../../ggg.png"}], | |
| 31 | 32 | name: [{ names: "洗护用品" }, { names: "天天护理" }, { names: "共顺利" },{ names: "个人洗护" }, { names: "轻奢" }, { names: "路虎" }, { names: "身体护理" }, { names: "品牌" }, { names: "面部护理" }], |
| 32 | 33 | //选择分类的控制属性 |
| 33 | 34 | select_classify_on:223, |
| ... | ... | @@ -338,9 +339,17 @@ Page({ |
| 338 | 339 | //图片失败,默认图片 |
| 339 | 340 | bind_bnerr: function (e) { |
| 340 | 341 | var _errImg = e.target.dataset.errorimg; |
| 342 | + console.log(_errImg, "品牌的图片来吗"); | |
| 341 | 343 | var _errObj = {}; |
| 342 | 344 | _errObj[_errImg] = this.data.iurl+"/miniapp/images/default_g_img.gif"; |
| 343 | - this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; | |
| 345 | + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; | |
| 346 | + }, | |
| 347 | + //商品图片失败,默认图片 | |
| 348 | + goods_bnerr: function (e) { | |
| 349 | + var _errImg = e.target.dataset.err; | |
| 350 | + var _errObj = {}; | |
| 351 | + _errObj[_errImg] = this.data.iurl + "/miniapp/images/no_cate_def.png"; | |
| 352 | + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; | |
| 344 | 353 | }, |
| 345 | 354 | |
| 346 | 355 | goseach:function(){ | ... | ... |
pages/goods/categoryList/categoryList.wxml
| ... | ... | @@ -29,7 +29,7 @@ |
| 29 | 29 | |
| 30 | 30 | <block wx:for="{{catelist}}" wx:for-item="fitem" > |
| 31 | 31 | <view class='f_item'> |
| 32 | - <view class="pic_view" bindtap="go_cate" data-cid="{{fitem.items.id}}" data-pid="0"><image class='fl_img' src='{{iurl}}{{fitem.items.image}}' binderror="bind_bnerr2" data-errorimg="catelist[{{index}}].items.image"></image> | |
| 32 | + <view class="pic_view" bindtap="go_cate" data-cid="{{fitem.items.id}}" data-pid="0"><image class='fl_img' src='{{iurl}}{{fitem.items.image}}' binderror="bind_bnerr2" data-errorimg="catelist[{{index}}].items.image"></image> | |
| 33 | 33 | <view class='over_view'></view> |
| 34 | 34 | <text class='f_item_over_t'>{{fitem.items.name}}</text></view> |
| 35 | 35 | <view class='fenlei_text_v'> |
| ... | ... | @@ -68,8 +68,9 @@ |
| 68 | 68 | <view class="group-users"> |
| 69 | 69 | <view wx:for="{{group.array}}" bindtap="go_brand" data-bid="{{user.id}}" |
| 70 | 70 | wx:for-item="user" wx:for-index="idx" class="user box box-lr"> |
| 71 | - <image class="user-avatar-img" src="{{user.logo}}" | |
| 72 | - binderror="bind_bnerr" data-errorimg="groups[{{pidx}}].array[{{idx}}].logo"></image> | |
| 71 | + <image class="user-avatar-img" src="{{user.logo}}" | |
| 72 | + data-errorimg="groups[{{pidx}}].array[{{idx}}].logo" | |
| 73 | + binderror="bind_bnerr"></image> | |
| 73 | 74 | </view> |
| 74 | 75 | </view> |
| 75 | 76 | </view> |
| ... | ... | @@ -182,7 +183,7 @@ |
| 182 | 183 | <view class="brand_img_frame "wx:for="{{brand_list.array}}"wx:for-item="user" wx:for-index="idx" bindtap="go_brand" data-bid="{{user.id}}" > |
| 183 | 184 | |
| 184 | 185 | <view class="brand_img t-c"> |
| 185 | - <image class="brand_img"src="{{user.logo}}"data-errorimg="brand_list[{{pidx}}].array[{{idx}}].logo" binderror="bind_bnerr"></image> | |
| 186 | + <image class="brand_img"src="{{user.logo}}"data-errorimg="groups[{{pidx}}].array[{{idx}}].logo" binderror="bind_bnerr"></image> | |
| 186 | 187 | <view class="brand_img_name fs24">{{user.name}}</view> |
| 187 | 188 | </view> |
| 188 | 189 | </view> |
| ... | ... | @@ -192,50 +193,14 @@ |
| 192 | 193 | <!-- 商品 --> |
| 193 | 194 | <block wx:if="{{select_classify_on!=220&&select_classify_on!=223}}"> |
| 194 | 195 | <view class="classify_content-frame flex flex-wrap"> |
| 195 | - <view class="brand_img_frame t-c"> | |
| 196 | - <image class="brand_img"src="../../../images/1.png"></image> | |
| 197 | - <view class="brand_img_name fs24">你好呃呃</view> | |
| 198 | - </view> | |
| 199 | - | |
| 200 | - <view class="brand_img_frame t-c"> | |
| 201 | - <image class="brand_img"src="../../../images/2.png"></image> | |
| 202 | - <view class="brand_img_name fs24">你好</view> | |
| 203 | - </view> | |
| 204 | - | |
| 205 | - <view class="brand_img_frame t-c"> | |
| 206 | - <image class="brand_img"src="../../../images/3.png"></image> | |
| 207 | - <view class="brand_img_name fs24">你好</view> | |
| 208 | - </view> | |
| 209 | - | |
| 210 | - <view class="brand_img_frame t-c"> | |
| 211 | - <image class="brand_img"src="../../../images/4.png"></image> | |
| 212 | - <view class="brand_img_name fs24">你好</view> | |
| 213 | - </view> | |
| 196 | + | |
| 214 | 197 | |
| 215 | - <view class="brand_img_frame t-c"> | |
| 216 | - <image class="brand_img"src="../../../images/5.png"></image> | |
| 217 | - <view class="brand_img_name fs24">你好</view> | |
| 198 | + <view class="brand_img_frame t-c"wx:for="{{goodslist}}" wx:for-index="index" wx:for-item="item" > | |
| 199 | + <image class="brand_img"src="{{item.logo}}"binderror="goods_bnerr" data-err="goodslist[{{index}}].logo"></image> | |
| 200 | + <view class="brand_img_name fs24">{{item.good_name}}</view> | |
| 218 | 201 | </view> |
| 219 | 202 | |
| 220 | - <view class="brand_img_frame t-c"> | |
| 221 | - <image class="brand_img"src="../../../images/6.png"></image> | |
| 222 | - <view class="brand_img_name fs24">你好品牌</view> | |
| 223 | - </view> | |
| 224 | - | |
| 225 | - <view class="brand_img_frame t-c"> | |
| 226 | - <image class="brand_img"src="../../../images/7.png"></image> | |
| 227 | - <view class="brand_img_name fs24">你好慢慢</view> | |
| 228 | - </view> | |
| 229 | - | |
| 230 | - <view class="brand_img_frame t-c"> | |
| 231 | - <image class="brand_img"src="../../../images/8.png"></image> | |
| 232 | - <view class="brand_img_name fs24">你好</view> | |
| 233 | - </view> | |
| 234 | - | |
| 235 | - <view class="brand_img_frame t-c"> | |
| 236 | - <image class="brand_img"src="../../../images/9.png"></image> | |
| 237 | - <view class="brand_img_name fs24">你好匿名</view> | |
| 238 | - </view> | |
| 203 | + | |
| 239 | 204 | |
| 240 | 205 | </view> |
| 241 | 206 | </block> | ... | ... |