Commit 0577300e90d7c2d87bca88a8e90e86ec2fcdaf18

Authored by yvan.ni
1 parent 60132776

礼包,通过链接进入的,活动还没有开始,就提示活动还没开始,不能购买

pages/giftpack/giftpacklist/giftpacklist.js
@@ -61,6 +61,13 @@ Page({ @@ -61,6 +61,13 @@ Page({
61 var that = this.data; 61 var that = this.data;
62 var th = this; 62 var th = this;
63 // var id = e.currentTarget.dataset.id;//活动id 63 // var id = e.currentTarget.dataset.id;//活动id
  64 + //如果还没有开始的话
  65 + if(th.data.isStart!=1){
  66 + getApp().my_warnning("活动还没有开始", 0, th);
  67 + return false;
  68 + }
  69 +
  70 +
64 var money = e.currentTarget.dataset.money; 71 var money = e.currentTarget.dataset.money;
65 var my_confirm = th.selectComponent("#my_confirm"); //组件的id 72 var my_confirm = th.selectComponent("#my_confirm"); //组件的id
66 my_confirm.open( 73 my_confirm.open(
@@ -101,7 +108,7 @@ Page({ @@ -101,7 +108,7 @@ Page({
101 getApp().goto(url); 108 getApp().goto(url);
102 }, 109 },
103 fail: function(n) { 110 fail: function(n) {
104 - getApp().my_confirm("取消支付", 0, th); 111 + getApp().my_warnning("取消支付", 0, th);
105 } 112 }
106 }); 113 });
107 } else { 114 } else {
@@ -125,6 +132,12 @@ Page({ @@ -125,6 +132,12 @@ Page({
125 GetBuyIntegral: function(e) { 132 GetBuyIntegral: function(e) {
126 var that = this.data; 133 var that = this.data;
127 var th = this; 134 var th = this;
  135 +
  136 + //如果还没有开始的话
  137 + if(th.data.isStart!=1){
  138 + getApp().my_warnning("活动还没有开始", 0, th);
  139 + return false;
  140 + }
128 // var id = e.currentTarget.dataset.id;//活动id 141 // var id = e.currentTarget.dataset.id;//活动id
129 var my_confirm = th.selectComponent("#my_confirm"); //组件的id 142 var my_confirm = th.selectComponent("#my_confirm"); //组件的id
130 my_confirm.open( 143 my_confirm.open(
@@ -260,6 +273,14 @@ Page({ @@ -260,6 +273,14 @@ Page({
260 }) 273 })
261 } 274 }
262 275
  276 + var isStart=0;
  277 + var now=ut.gettimestamp();
  278 +
  279 + var str = res.data.data.starTime.replace(/-/g,'/');
  280 + var start = Date.parse(new Date(str));
  281 + start = start / 1000;
  282 + if(start<now) isStart=1;
  283 +
263 _this2.setData({ 284 _this2.setData({
264 giftDate: res.data.data.endTime, 285 giftDate: res.data.data.endTime,
265 giftPosPrice: res.data.data.giftPosPrice, 286 giftPosPrice: res.data.data.giftPosPrice,
@@ -268,7 +289,8 @@ Page({ @@ -268,7 +289,8 @@ Page({
268 giftPrice: res.data.data.payMoney, 289 giftPrice: res.data.data.payMoney,
269 giftType: res.data.data.actType, 290 giftType: res.data.data.actType,
270 actTitle: res.data.data.actTitle, 291 actTitle: res.data.data.actTitle,
271 - wareCard: res.data.data.wareCard 292 + wareCard: res.data.data.wareCard,
  293 + isStart:isStart,
272 }) 294 })
273 } else { 295 } else {
274 getApp().my_warnning("系统繁忙,请稍后再试", 0, _this2); 296 getApp().my_warnning("系统繁忙,请稍后再试", 0, _this2);
pages/giftpack/giftpacklist/giftpacklist.wxml
@@ -7,7 +7,8 @@ @@ -7,7 +7,8 @@
7 <text class="data-v-3a5b7e36 ellipsis-2">{{giftTitle}}</text> 7 <text class="data-v-3a5b7e36 ellipsis-2">{{giftTitle}}</text>
8 </view> 8 </view>
9 <view class="top_time data-v-3a5b7e36"> 9 <view class="top_time data-v-3a5b7e36">
10 - <text class="data-v-3a5b7e36">{{"兑换截至时间:"+giftDate}}</text> 10 + <text class="data-v-3a5b7e36" wx:if="{{isBuy==0}}">{{"兑换截至时间:"+giftDate}}</text>
  11 + <text class="data-v-3a5b7e36" wx:else>{{"活动结束至时间:"+giftDate}}</text>
11 </view> 12 </view>
12 <view class="top_price data-v-3a5b7e36"> 13 <view class="top_price data-v-3a5b7e36">
13 <block wx:if="{{giftPrice>0}}"> 14 <block wx:if="{{giftPrice>0}}">
@@ -102,22 +103,22 @@ @@ -102,22 +103,22 @@
102 <block wx:if="{{isBuy==1}}"> 103 <block wx:if="{{isBuy==1}}">
103 <view class="foot_button data-v-3a5b7e36"> 104 <view class="foot_button data-v-3a5b7e36">
104 <block wx:if="{{giftPrice>0&&giftIntegral>0}}"> 105 <block wx:if="{{giftPrice>0&&giftIntegral>0}}">
105 - <view class="foot_button_left data-v-3a5b7e36" data-money="{{giftPrice}}" data-id="{{lbId}}" bindtap="GetBuyPrice">  
106 - <text class="data-v-3a5b7e36">立即购买</text> 106 + <view class="foot_button_left data-v-3a5b7e36 {{isStart?'':'gray'}}" data-money="{{giftPrice}}" data-id="{{lbId}}" bindtap="GetBuyPrice">
  107 + <text class="data-v-3a5b7e36 ">立即购买</text>
107 </view> 108 </view>
108 </block> 109 </block>
109 <block wx:if="{{giftPrice>0 && giftIntegral>0}}"> 110 <block wx:if="{{giftPrice>0 && giftIntegral>0}}">
110 - <view class="foot_button_right data-v-3a5b7e36" bindtap="GetBuyIntegral" data-id="{{lbId}}"> 111 + <view class="foot_button_right data-v-3a5b7e36 {{isStart?'':'gray'}}" bindtap="GetBuyIntegral" data-id="{{lbId}}">
111 <text class="data-v-3a5b7e36">立即兑换</text> 112 <text class="data-v-3a5b7e36">立即兑换</text>
112 </view> 113 </view>
113 </block> 114 </block>
114 <block wx:if="{{giftPrice>0 && giftIntegral<=0}}"> 115 <block wx:if="{{giftPrice>0 && giftIntegral<=0}}">
115 - <view class="foot_button_buy data-v-3a5b7e36" data-money="{{giftPrice}}" bindtap="GetBuyPrice" data-id="{{lbId}}"> 116 + <view class="foot_button_buy data-v-3a5b7e36 {{isStart?'':'gray'}}" data-money="{{giftPrice}}" bindtap="GetBuyPrice" data-id="{{lbId}}">
116 <text class="data-v-3a5b7e36">立即购买</text> 117 <text class="data-v-3a5b7e36">立即购买</text>
117 </view> 118 </view>
118 </block> 119 </block>
119 <block wx:if="{{giftPrice<=0 && giftIntegral>0}}"> 120 <block wx:if="{{giftPrice<=0 && giftIntegral>0}}">
120 - <view class="foot_button_intalge data-v-3a5b7e36" bindtap="GetBuyIntegral" data-id="{{lbId}}"> 121 + <view class="foot_button_intalge data-v-3a5b7e36 {{isStart?'':'gray'}}" bindtap="GetBuyIntegral" data-id="{{lbId}}">
121 <text class="data-v-3a5b7e36">立即兑换</text> 122 <text class="data-v-3a5b7e36">立即兑换</text>
122 </view> 123 </view>
123 </block> 124 </block>
pages/giftpack/giftpacklist/giftpacklist.wxss
@@ -197,6 +197,7 @@ @@ -197,6 +197,7 @@
197 font-size: 28rpx; 197 font-size: 28rpx;
198 line-height: 70rpx; 198 line-height: 70rpx;
199 border-radius: 40rpx; 199 border-radius: 40rpx;
  200 + margin-right: 20rpx;
200 } 201 }
201 202
202 .foot_button_right.data-v-3a5b7e36 { 203 .foot_button_right.data-v-3a5b7e36 {
@@ -243,3 +244,6 @@ page.data-v-3a5b7e36 { @@ -243,3 +244,6 @@ page.data-v-3a5b7e36 {
243 .overdue.data-v-3a5b7e36{ 244 .overdue.data-v-3a5b7e36{
244 background-color: rgb(153,153,153); 245 background-color: rgb(153,153,153);
245 } 246 }
  247 +
  248 +.foot_button_left.data-v-3a5b7e36.gray{ background-color: #aaa; }
  249 +.foot_button_right.data-v-3a5b7e36.gray{ background-color: #aaa;}