Commit e176e772 by 侯体倬

限时折扣组件展示优化

parent 7c86d2ba
......@@ -117,6 +117,7 @@ const componentOptions = {
},
// 组件数据
data: {
isStart: true, // 活动是否开始
loaded: false,
isContain: false,
isPageHidden: false, // 页面是否处于隐藏状态
......@@ -144,7 +145,7 @@ const componentOptions = {
selectActivityValue,
dimension
} = this.data.datas.componentData;
let { deleteFlag, endTimeData } = this.data;
let { deleteFlag, endTimeData, isStart } = this.data;
let _this = this;
if (activityCode == "") {
return;
......@@ -156,16 +157,21 @@ const componentOptions = {
promoteApi.getSingleItemActivityV2(query).then(res => {
if (res.data.code == 200) {
let copyData = res.data.data;
deleteFlag = copyData.activityStatus != 2 ? true : false;
// 未开始和进行中的活动
deleteFlag = ![1, 2].includes(+copyData.activityStatus);
if (dimension == 0 && copyData.goodsItems.length == 0) {
deleteFlag = true;
}
endTimeData =
new Date(copyData.endTime.replace(/-/g, "/")).getTime() -
new Date().getTime();
console.log(endTimeData, "----------------------150");
const now = new Date().getTime();
if (new Date(copyData.startTime.replace(/-/g, "/")).getTime() > now) {
isStart = false;
endTimeData = new Date(copyData.startTime.replace(/-/g, "/")).getTime() - now;
} else {
isStart = true;
endTimeData = new Date(copyData.endTime.replace(/-/g, "/")).getTime() - now;
}
this.setData({ endTime: endTimeData });
this.setData({ isStart });
this.setData({ deleteFlag });
console.log("------------155");
// setTimeout(() => {
......
......@@ -43,6 +43,7 @@
class="countDown"
bind:change="onChange"
>
<text wx:if="{{!isStart}}">距开始:</text>
<text class="endTime days">{{ timeData.days }}</text>
<text class="endTimedot">天</text>
<text class="endTime hours">{{ timeData.hours }}</text>
......
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