Commit c5a0eeeb by 高淑倩

add: 列表页状态

parent 78b8e6e3
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
overflow: hidden; overflow: hidden;
} }
.status-tips { .status-tips {
width: 143rpx; width: 130rpx;
height: 58rpx; height: 58rpx;
margin-top: 12px; margin-top: 12px;
box-sizing: border-box; box-sizing: border-box;
......
<!--pages/pointDetail/pointDetail.wxml--> <!--pages/pointDetail/pointDetail.wxml-->
<wxs src="./tools.wxs" module="tools" /> <wxs src="./tools.wxs" module="tools" />
<!--
<view class="status-tips" wx:if="{{currentStatus == 2 && currentTimeStatus == 1}}">进行中 >></view>
<view class="status-tips" wx:if="{{currentStatus == 3}}"> 已失效 </view>
<view class="status-tips" wx:if="{{currentTimeStatus == 2}}">已结束</view>-->
<status-img imgHeight="{{imgHeight}}" img="{{detailImage}}" currentStatus="{{currentStatus}}" currentTimeStatus="{{currentTimeStatus}}"/> <status-img imgHeight="{{imgHeight}}" img="{{detailImage}}" currentStatus="{{currentStatus}}" currentTimeStatus="{{currentTimeStatus}}"/>
<view class="detail-info border_box" wx:if="{{goal}}"> <view class="detail-info border_box" wx:if="{{goal}}">
......
...@@ -8,7 +8,9 @@ wxService.page({ ...@@ -8,7 +8,9 @@ wxService.page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
pointList: [] pointList: [],
currentStatus: 2, // 活动状态 1 未生效 2 生效中 3 已失效 0 已删除
currentTimeStatus: 1, // 1 进行中 2 已结束
}, },
/** /**
...@@ -36,10 +38,22 @@ wxService.page({ ...@@ -36,10 +38,22 @@ wxService.page({
const { result, data } = res.data const { result, data } = res.data
if (result == 0) { if (result == 0) {
data.forEach(item => { data.forEach(item => {
// 是否在有效期
let timeFlag = 1
let endT = item.endTime let endT = item.endTime
let startT = item.startTime
// ios 兼容 // ios 兼容
let currentEndTime = (new Date(endT.replace(/-/g, '/'))).getTime(); let currentEndTime = (new Date(endT.replace(/-/g, '/'))).getTime();
let currentstartTime = (new Date(startT.replace(/-/g, '/'))).getTime();
let currentTime = (new Date()).getTime(); let currentTime = (new Date()).getTime();
// 开始时间 小于 现在 && 小于 结束时间 进行中
if (currentstartTime < currentTime && currentTime < currentEndTime) {
timeFlag = 1
} else if (currentEndTime < currentTime) {
// 结束时间 小于 现在时间 已结束
timeFlag = 2
}
let distancetime = currentEndTime - currentTime let distancetime = currentEndTime - currentTime
let result = { let result = {
...@@ -68,7 +82,9 @@ wxService.page({ ...@@ -68,7 +82,9 @@ wxService.page({
} }
item.countdown = result item.countdown = result
this.setData({ this.setData({
pointList: data pointList: data,
currentStatus: data.status,
currentTimeStatus: timeFlag
}, () => { }, () => {
wx.hideLoading() wx.hideLoading()
this.getPointConsumptionCount(item.id) this.getPointConsumptionCount(item.id)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<view class="point-list border_box"> <view class="point-list border_box">
<block wx:for="{{pointList}}" wx:key="item"> <block wx:for="{{pointList}}" wx:key="item">
<view class="point border_box" data-id="{{item.id}}" bindtap="handleDetail"> <view class="point border_box" data-id="{{item.id}}" bindtap="handleDetail">
<status-img img="{{item.listImage}}" /> <status-img img="{{item.listImage}}" currentStatus="{{currentStatus}}" currentTimeStatus="{{currentTimeStatus}}"-/>
<view class="progress weui-flex df-j--bt"> <view class="progress weui-flex df-j--bt">
<view class="rate">进度: <view class="rate">进度:
<span wx:if="{{item.surplusExchangeCount}}"> <span wx:if="{{item.surplusExchangeCount}}">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment