Commit e176e772 by 侯体倬

限时折扣组件展示优化

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