Commit 288fade0b6a866f214c212d357b376aa8129f154
1 parent
1a3fe053
自定义模板
Showing
2 changed files
with
83 additions
and
18 deletions
components/diy_goodsGroup/diy_goodsGroup.js
| @@ -303,6 +303,81 @@ Component({ | @@ -303,6 +303,81 @@ Component({ | ||
| 303 | var _errObj = {}; | 303 | var _errObj = {}; |
| 304 | _errObj[_errImg] = this.data.imghost + "/public/images/default_goods_image_240.gif"; | 304 | _errObj[_errImg] = this.data.imghost + "/public/images/default_goods_image_240.gif"; |
| 305 | this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; | 305 | this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; |
| 306 | - } | 306 | + }, |
| 307 | + | ||
| 308 | + //---卡的初始化---- | ||
| 309 | + card_init: function() { | ||
| 310 | + var th = this; | ||
| 311 | + getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.user_id, { | ||
| 312 | + success: function(e) { | ||
| 313 | + getApp().globalData.userInfo = e.data.data; | ||
| 314 | + getApp().getConfig2(function(e) { | ||
| 315 | + var swithc_list = e.switch_list; | ||
| 316 | + var sw_arr = JSON.parse(swithc_list); | ||
| 317 | + //---如果后台又开等级卡的开关--- | ||
| 318 | + if (sw_arr.rank_switch && sw_arr.rank_switch == "2") { | ||
| 319 | + th.setData({ | ||
| 320 | + rank_switch: true | ||
| 321 | + }); | ||
| 322 | + //---回调卡的列表--- | ||
| 323 | + th.getPlusCardType(function(ob) { | ||
| 324 | + th.setData({ | ||
| 325 | + card_list: ob.card_list | ||
| 326 | + }); | ||
| 327 | + var ti = setInterval(function() { | ||
| 328 | + var user = getApp().globalData.userInfo; | ||
| 329 | + if (!user) return false; | ||
| 330 | + clearInterval(ti); | ||
| 331 | + | ||
| 332 | + if (user.card_field) { | ||
| 333 | + var str = user['card_expiredate'].replace(/-/g, '/'); | ||
| 334 | + var end = new Date(str); | ||
| 335 | + end = Date.parse(end) / 1000; | ||
| 336 | + var now = ut.gettimestamp(); | ||
| 337 | + | ||
| 338 | + //--- 判断是等级会员,且在有效期范围内 --- | ||
| 339 | + if (user.card_field && now < end) { | ||
| 340 | + var card_name = ob.name_map.get(user.card_field); | ||
| 341 | + if (card_name.length > 4) card_name = card_name.substring(0, 4); | ||
| 342 | + th.setData({ | ||
| 343 | + card_field: user.card_field, | ||
| 344 | + card_name: card_name, | ||
| 345 | + card_list: ob.card_list | ||
| 346 | + }); | ||
| 347 | + } | ||
| 348 | + } | ||
| 349 | + }, 500) | ||
| 350 | + }) | ||
| 351 | + | ||
| 352 | + } | ||
| 353 | + }) | ||
| 354 | + } | ||
| 355 | + }) | ||
| 356 | + | ||
| 357 | + }, | ||
| 358 | + | ||
| 359 | + //--- 获取卡类列表 --- | ||
| 360 | + getPlusCardType: function(func) { | ||
| 361 | + var storid = o.stoid; | ||
| 362 | + var th = this; | ||
| 363 | + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => { | ||
| 364 | + var plusCard = res.data.data; | ||
| 365 | + var arr = [1219, 2089, 3031]; | ||
| 366 | + var new_arr = new Array(); | ||
| 367 | + var card_name_map = new Map(); | ||
| 368 | + for (var i = 0; i < plusCard.length; i++) { | ||
| 369 | + var name = "card" + plusCard[i].CorrPrice.toLowerCase(); | ||
| 370 | + card_name_map.set(name, plusCard[i].CardName); | ||
| 371 | + } | ||
| 372 | + | ||
| 373 | + var ob = { | ||
| 374 | + "card_list": plusCard, | ||
| 375 | + "name_map": card_name_map | ||
| 376 | + }; | ||
| 377 | + func(ob); | ||
| 378 | + }) | ||
| 379 | + }, | ||
| 380 | + | ||
| 381 | + | ||
| 307 | } | 382 | } |
| 308 | }) | 383 | }) |
| 309 | \ No newline at end of file | 384 | \ No newline at end of file |
components/diy_goodsGroup/diy_goodsGroup.wxml
| @@ -2,7 +2,6 @@ | @@ -2,7 +2,6 @@ | ||
| 2 | <!--1个--> | 2 | <!--1个--> |
| 3 | <view class="zs_goods_wai"> | 3 | <view class="zs_goods_wai"> |
| 4 | <!--右下角--> | 4 | <!--右下角--> |
| 5 | - | ||
| 6 | <block wx:if='{{object.column==1 && object.position==4}}'> | 5 | <block wx:if='{{object.column==1 && object.position==4}}'> |
| 7 | <block wx:for="{{goods_array}}" > | 6 | <block wx:for="{{goods_array}}" > |
| 8 | <view class='zs_goods'> | 7 | <view class='zs_goods'> |
| @@ -835,7 +834,7 @@ | @@ -835,7 +834,7 @@ | ||
| 835 | 834 | ||
| 836 | <view class="clear"></view> | 835 | <view class="clear"></view> |
| 837 | </block> | 836 | </block> |
| 838 | -<!--左下角--> | 837 | +<!-- ----左下角---- --> |
| 839 | <block wx:if='{{object.column==3 && object.position==3}}'> | 838 | <block wx:if='{{object.column==3 && object.position==3}}'> |
| 840 | <block wx:for="{{goods_array}}" > | 839 | <block wx:for="{{goods_array}}" > |
| 841 | <navigator url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}" class="s1_gk_a1"> | 840 | <navigator url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}" class="s1_gk_a1"> |
| @@ -898,14 +897,6 @@ | @@ -898,14 +897,6 @@ | ||
| 898 | </block> | 897 | </block> |
| 899 | 898 | ||
| 900 | 899 | ||
| 901 | -<!-- <block wx:if="{{object.classstyle=='2' }}"> | ||
| 902 | -<view class="button-wrapper" wx:if="{{object.goodscount * page <total }}" style="border: none"> | ||
| 903 | - <button type="default" size="default" loading="{{loading}}" disabled="{{disabled}}" bindtap="setLoading" style="background-color: rgba(0,0,0,0);border:none"> | ||
| 904 | - {{loadText}} | ||
| 905 | - </button> | ||
| 906 | -</view> | ||
| 907 | -</block> --> | ||
| 908 | - | ||
| 909 | <block wx:if="{{object.classstyle=='1' }}"> | 900 | <block wx:if="{{object.classstyle=='1' }}"> |
| 910 | <view class="button-wrapper" wx:if="{{goods_btn.length!=0 }}" style="border: none"> | 901 | <view class="button-wrapper" wx:if="{{goods_btn.length!=0 }}" style="border: none"> |
| 911 | <button type="default" size="default" loading="{{loading}}" disabled="{{disabled}}" bindtap="setLoading" style="background-color: rgba(0,0,0,0);border:none"> | 902 | <button type="default" size="default" loading="{{loading}}" disabled="{{disabled}}" bindtap="setLoading" style="background-color: rgba(0,0,0,0);border:none"> |
| @@ -915,10 +906,9 @@ | @@ -915,10 +906,9 @@ | ||
| 915 | </block> | 906 | </block> |
| 916 | 907 | ||
| 917 | <block wx:if="{{object.classstyle!='1' }}"> | 908 | <block wx:if="{{object.classstyle!='1' }}"> |
| 918 | - <view class="button-wrapper" wx:if="{{object.goodscount * page <total }}" style="border: none"> | ||
| 919 | - <button type="default" size="default" loading="{{loading}}" disabled="{{disabled}}" bindtap="setLoading" style="background-color: rgba(0,0,0,0);border:none"> | ||
| 920 | - {{loadText}} | ||
| 921 | - </button> | ||
| 922 | -</view> | ||
| 923 | - | ||
| 924 | - </block> | ||
| 925 | \ No newline at end of file | 909 | \ No newline at end of file |
| 910 | + <view class="button-wrapper" wx:if="{{object.goodscount * page <total }}" style="border: none"> | ||
| 911 | + <button type="default" size="default" loading="{{loading}}" disabled="{{disabled}}" bindtap="setLoading" style="background-color: rgba(0,0,0,0);border:none"> | ||
| 912 | + {{loadText}} | ||
| 913 | + </button> | ||
| 914 | + </view> | ||
| 915 | +</block> | ||
| 926 | \ No newline at end of file | 916 | \ No newline at end of file |