Commit 78b8e6e3 by 高淑倩

“已结束”,“已失效”

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