Commit c5a0eeeb by 高淑倩

add: 列表页状态

parent 78b8e6e3
......@@ -7,7 +7,7 @@
overflow: hidden;
}
.status-tips {
width: 143rpx;
width: 130rpx;
height: 58rpx;
margin-top: 12px;
box-sizing: border-box;
......
<!--pages/pointDetail/pointDetail.wxml-->
<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}}"/>
<view class="detail-info border_box" wx:if="{{goal}}">
......
......@@ -8,7 +8,9 @@ wxService.page({
* 页面的初始数据
*/
data: {
pointList: []
pointList: [],
currentStatus: 2, // 活动状态 1 未生效 2 生效中 3 已失效 0 已删除
currentTimeStatus: 1, // 1 进行中 2 已结束
},
/**
......@@ -36,10 +38,22 @@ wxService.page({
const { result, data } = res.data
if (result == 0) {
data.forEach(item => {
// 是否在有效期
let timeFlag = 1
let endT = item.endTime
let startT = item.startTime
// ios 兼容
let currentEndTime = (new Date(endT.replace(/-/g, '/'))).getTime();
let currentstartTime = (new Date(startT.replace(/-/g, '/'))).getTime();
let currentTime = (new Date()).getTime();
// 开始时间 小于 现在 && 小于 结束时间 进行中
if (currentstartTime < currentTime && currentTime < currentEndTime) {
timeFlag = 1
} else if (currentEndTime < currentTime) {
// 结束时间 小于 现在时间 已结束
timeFlag = 2
}
let distancetime = currentEndTime - currentTime
let result = {
......@@ -68,7 +82,9 @@ wxService.page({
}
item.countdown = result
this.setData({
pointList: data
pointList: data,
currentStatus: data.status,
currentTimeStatus: timeFlag
}, () => {
wx.hideLoading()
this.getPointConsumptionCount(item.id)
......
......@@ -3,7 +3,7 @@
<view class="point-list border_box">
<block wx:for="{{pointList}}" wx:key="item">
<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="rate">进度:
<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