Commit 78b8e6e3 by 高淑倩

“已结束”,“已失效”

parent 85e65b1e
...@@ -13,7 +13,16 @@ Component({ ...@@ -13,7 +13,16 @@ Component({
imgHeight: { imgHeight: {
type: Number, type: Number,
value: 320 value: 320
} },
currentStatus: {
type: Number,
value: 2
},
currentTimeStatus: {
type: Number,
value: 1
},
}, },
attached() { }, attached() { },
/** /**
......
<!--component/statusPoint/statusPoint.wxml--> <!--component/statusPoint/statusPoint.wxml-->
<!--#05C35B -->
<view class="status" style="height: {{imgHeight}}rpx"> <view class="status" style="height: {{imgHeight}}rpx">
<image class='status-tips' src='/assets/imgs/point/status.png' mode="widthFix"/> <view class="status-tips" style="background-color:rgba(5, 195, 91, 1);" wx:if="{{currentStatus == 2 && currentTimeStatus == 1}}">进行中 >></view>
<image wx:if="{{img}}" class='status-img' src='{{img}}'/> <view class="status-tips" style="background-color:rgb(170, 170, 170);" wx:elif="{{currentStatus == 3}}"> 已失效 >></view>
<view class="status-tips" style="background-color:rgb(170, 170, 170);" wx:elif="{{currentTimeStatus == 2}}">已结束 >></view>
<view class="status-tips" style="background-color:rgb(170, 170, 170);" wx:else>已结束 >></view>
<!--<image class='status-tips' src='/assets/imgs/point/status.png' mode="widthFix"/>-->
<image wx:if="{{img}}" class='status-img' src='{{img}}' />
</view> </view>
...@@ -2,15 +2,21 @@ ...@@ -2,15 +2,21 @@
@import './../../base/base.wxss'; @import './../../base/base.wxss';
.status { .status {
height: 320rpx; height: 320rpx;
/* background-color: rgba(216, 216, 216, 1); */
border-radius: 8rpx; border-radius: 8rpx;
position: relative; position: relative;
overflow: hidden;
} }
.status-tips { .status-tips {
width: 143rpx; width: 143rpx;
height: 58rpx; height: 58rpx;
padding-top: 12px; margin-top: 12px;
box-sizing: border-box;
position: absolute; position: absolute;
color: #fff;
text-align: center;
line-height: 58rpx;
font-size: 24rpx;
border-radius: 10rpx 100rpx 100rpx 10rpx;
} }
.status-img { .status-img {
border-radius: 8rpx; border-radius: 8rpx;
......
...@@ -32,6 +32,9 @@ wxService.page({ ...@@ -32,6 +32,9 @@ wxService.page({
isDisabled: false, isDisabled: false,
hideGetBtn: true, // 默认隐藏 可领取按钮 hideGetBtn: true, // 默认隐藏 可领取按钮
showGetBtn: true, // 默认展示 未达成按钮 showGetBtn: true, // 默认展示 未达成按钮
currentStatus: 2, // 活动状态 1 未生效 2 生效中 3 已失效 0 已删除
currentTimeStatus: 1, // 1 进行中 2 已结束
// 状态变更为 “已结束”,“已失效”
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
...@@ -50,32 +53,55 @@ wxService.page({ ...@@ -50,32 +53,55 @@ wxService.page({
if (result == 0) { if (result == 0) {
wx.hideLoading() wx.hideLoading()
let dialog = this.data.dialog let dialog = this.data.dialog
// popupType: 0 1 优惠券 2 积分
// if (data.popupType == 1) {
// dialog.content = '优惠券'
// } else if (data.popupType == 2) {
// dialog.content = '积分流水'
// }
dialog.show = false dialog.show = false
// 弹框背景 // 弹框背景
dialog.image = data.popupImage dialog.image = data.popupImage
// 是否在有效期
let timeFlag = 1
let endT = data.endTime
let startT = data.startTime
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
}
this.setData({ this.setData({
activityId: data.id, activityId: data.id,
type: data.showActivitys, type: data.showActivitys,
currentStatus: data.status,
popupType: data.popupType, popupType: data.popupType,
goal: data.goal, goal: data.goal,
desc: JSON.parse(data.content), desc: JSON.parse(data.content),
detailImage: data.detailImage, detailImage: data.detailImage,
dialog dialog,
currentTimeStatus: timeFlag
}, () => { }, () => {
// 会员集点活动统计信息 // 1 进行中 2 已结束
this.getPointConsumptionCount(id) if (timeFlag == 2) {
this.showTimeStatus('已结束')
} else if (data.status == 3) {
// 活动状态 1 未生效 2 生效中 3 已失效 0 已删除
this.showTimeStatus('已失效')
} else {
// 会员集点活动统计信息 进行中且有效
this.getPointConsumptionCount(id)
}
}) })
} }
} }
}) })
}, },
showTimeStatus(status) {
wx.showToast({
title: `${status}`,
icon: 'none'
})
},
// 会员集点活动统计信息 // 会员集点活动统计信息
getPointConsumptionCount(activityId) { getPointConsumptionCount(activityId) {
const { memberId } = wx.getStorageSync('_baseUserInfo') const { memberId } = wx.getStorageSync('_baseUserInfo')
...@@ -90,24 +116,24 @@ wxService.page({ ...@@ -90,24 +116,24 @@ wxService.page({
let hasNum = data.surplusExchangeCount let hasNum = data.surplusExchangeCount
let totalPoints = data.totalPoints let totalPoints = data.totalPoints
let goal = this.data.goal let goal = this.data.goal
if(hasNum) { if (hasNum) {
if(parseInt( totalPoints % goal) == 0 ) { if (parseInt(totalPoints % goal) == 0) {
newPercent = goal newPercent = goal
}else { } else {
if(totalPoints) { if (totalPoints) {
newPercent = totalPoints % goal newPercent = totalPoints % goal
} else { } else {
newPercent = 0 newPercent = 0
} }
} }
} else { } else {
if(totalPoints) { if (totalPoints) {
newPercent = totalPoints % goal newPercent = totalPoints % goal
} else { } else {
newPercent = 0 newPercent = 0
} }
} }
if (result == 0) { if (result == 0) {
this.setData({ this.setData({
countObj: data, countObj: data,
...@@ -128,7 +154,7 @@ wxService.page({ ...@@ -128,7 +154,7 @@ wxService.page({
}, },
_closeDialog() { _closeDialog() {
const { id } = this.data const { id } = this.data
if(id) this.getPointDetail(id) if (id) this.getPointDetail(id)
}, },
handleGo() { handleGo() {
// 跳转 popupType: 0 默认不跳转 1 优惠券 2 积分 // 跳转 popupType: 0 默认不跳转 1 优惠券 2 积分
...@@ -170,19 +196,19 @@ wxService.page({ ...@@ -170,19 +196,19 @@ wxService.page({
}) })
}, },
handleToGet() { handleToGet() {
// 按钮防止短时间多次点击 // 按钮防止短时间多次点击
const { countObj } = this.data const { countObj } = this.data
if(countObj.surplusExchangeCount) { if (countObj.surplusExchangeCount) {
this.getPointExchange() this.getPointExchange()
} }
this.setData({
isDisabled: true
})
setTimeout(() => {
this.setData({ this.setData({
isDisabled: true isDisabled: false
}) })
setTimeout(()=> { }, 3000)
this.setData({
isDisabled: false
})
}, 3000)
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
...@@ -199,12 +225,12 @@ wxService.page({ ...@@ -199,12 +225,12 @@ wxService.page({
if (id) { if (id) {
this.setData({ this.setData({
id id
},()=> { }, () => {
this.getPointDetail(id) this.getPointDetail(id)
}) })
} }
// 隐藏 dialog // 隐藏 dialog
this.isShowDialog(false) this.isShowDialog(false)
}, },
/** /**
......
<!--pages/pointDetail/pointDetail.wxml--> <!--pages/pointDetail/pointDetail.wxml-->
<wxs src="./tools.wxs" module="tools" /> <wxs src="./tools.wxs" module="tools" />
<status-img imgHeight="{{imgHeight}}" img="{{detailImage}}" /> <!--
<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}}"> <view class="detail-info border_box" wx:if="{{goal}}">
<view class="info-top weui-flex df-j--bt"> <view class="info-top weui-flex df-j--bt">
<view class="info-num"> <view class="info-num">
......
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