Commit ac8b9f49d4ea62f4b6deefb882c89c7140381362
1 parent
24f91a58
会员中心页面的调整,会员资料页面的等级卡过期会员显示控制
Showing
4 changed files
with
34 additions
and
25 deletions
pages/index/index/index.wxml
pages/user/index/index.wxml
... | ... | @@ -69,8 +69,7 @@ |
69 | 69 | <image class="xc-icon" src="{{iurl}}/miniapp/images/user/user_vip.png"></image> |
70 | 70 | <view class="member fs28 "> 加入plus会员预计可省3031元</view> |
71 | 71 | </view> |
72 | - <view class="xc-opening-button t-c" data-url="/pages/user/plus/plus" bindtap="goto"> | |
73 | - | |
72 | + <view class="xc-opening-button t-c" data-url="/pages/user/plus/plus" bindtap="goto"> | |
74 | 73 | <view class="xc-opening fs28">立即开通</view> |
75 | 74 | </view> |
76 | 75 | </view> |
... | ... | @@ -81,7 +80,7 @@ |
81 | 80 | <image class="xc-icon" src="{{iurl}}/miniapp/images/user/user_vip.png"></image> |
82 | 81 | <view class="member"> 加入plus会员</view> |
83 | 82 | <view class="t-c xc-save-money"> 预计可省3031元</view> |
84 | - <view class="xc-opening-button t-c" data-url="/pages/user/cardinfo/cardinfo" bindtap="goto"> | |
83 | + <view class="xc-opening-button t-c" data-url="/pages/user/cardinfo/cardinfo" bindtap="goto" style="margin-left: 186rpx;"> | |
85 | 84 | <view class="xc-opening fs20">立即续费</view> |
86 | 85 | </view> |
87 | 86 | </view> | ... | ... |
pages/user/userinfo/userinfo.js
... | ... | @@ -11,7 +11,7 @@ var a = getApp(), |
11 | 11 | r = a.globalData.setting, |
12 | 12 | t = a.request, |
13 | 13 | s = require("../../../utils/common.js"), |
14 | - util = require("../../../utils/util.js"); | |
14 | + util = require("../../../utils/util.js"),ut=util; | |
15 | 15 | |
16 | 16 | var timestamp = Date.parse(new Date()); |
17 | 17 | var date = new Date(timestamp); |
... | ... | @@ -504,8 +504,18 @@ Page({ |
504 | 504 | }, |
505 | 505 | //------初始化加载---------- |
506 | 506 | onLoad: function(t) { |
507 | - this.puls_user(); | |
508 | - this.equity_user(); | |
507 | + | |
508 | + var user=getApp().globalData.userInfo; | |
509 | + if(user.card_field!=''&& user.card_field!=null && user.card_field!=undefined){ | |
510 | + var now=ut.gettimestamp(); | |
511 | + var str= user.card_expiredate; | |
512 | + var end = new Date(str); | |
513 | + end = Date.parse(end) / 1000; | |
514 | + if(now<end ){ | |
515 | + this.puls_user(); | |
516 | + } | |
517 | + } | |
518 | + | |
509 | 519 | this.initial_user(); |
510 | 520 | }, |
511 | 521 | //-----------会员是否初始化--------------------- |
... | ... | @@ -520,24 +530,24 @@ Page({ |
520 | 530 | var isBool = su.data.data.isBool; |
521 | 531 | console.log("会员是否初始化", isBool); |
522 | 532 | th.setData({isBool:isBool}); |
523 | - } | |
533 | + | |
534 | + if(!isBool) return false; | |
535 | + //-----会员权益获取-------------- | |
536 | + getApp().request.get("/api/weshop/users/grade/aftervipinfo/get", { | |
537 | + data: { | |
538 | + storeId: r.stoid, | |
539 | + userId: getApp().globalData.user_id, | |
540 | + }, | |
541 | + success: function (su) { | |
542 | + var gradename=su.data.data.GradeName; | |
543 | + th.setData({gradename: gradename}); | |
544 | + } | |
545 | + }); | |
546 | + | |
547 | + } | |
524 | 548 | }); |
525 | 549 | }, |
526 | - //-----会员等级卡获取--------------- | |
527 | - equity_user:function(){ | |
528 | - var th = this; | |
529 | - getApp().request.get("/api/weshop/users/grade/aftervipinfo/get", { | |
530 | - data: { | |
531 | - storeId: r.stoid, | |
532 | - userId: getApp().globalData.user_id, | |
533 | - }, | |
534 | - success: function (su) { | |
535 | - var gradename=su.data.data.GradeName; | |
536 | - th.setData({gradename: gradename}); | |
537 | - | |
538 | - } | |
539 | - }); | |
540 | - }, | |
550 | + | |
541 | 551 | |
542 | 552 | //-----Plus会员获取----------- |
543 | 553 | puls_user:function(){ |
... | ... | @@ -549,7 +559,7 @@ Page({ |
549 | 559 | success: function (su) { |
550 | 560 | |
551 | 561 | if (su.data.code == 0) { |
552 | - var cardname=su.data.data[0].MemCardName; | |
562 | + var cardname=su.data.data[0].MemCardName; | |
553 | 563 | console.log("卡的名字", cardname); |
554 | 564 | th.setData({pulscardname:cardname}); |
555 | 565 | } | ... | ... |
pages/user/userinfo/userinfo.wxml
... | ... | @@ -24,7 +24,7 @@ |
24 | 24 | </view> |
25 | 25 | </navigator> |
26 | 26 | </block> |
27 | - <block wx:if="{{user.card_field!=''&& user.card_field!=null && user.card_expiredate!=null&&user.card_expiredate!=null}}"> | |
27 | + <block wx:if="{{pulscardname}}"> | |
28 | 28 | <navigator url="/pages/user/plus/plus"> |
29 | 29 | <view class="flex-center plusMax"> |
30 | 30 | <image class="fuls" src="{{iurl}}/miniapp/images/userinfo/userinfo/privilege_t.png"></image> | ... | ... |