Commit 79be5da3 by 李嘉林

单品优惠问题修改

parent cc98ee00
...@@ -111,14 +111,14 @@ const componentOptions = { ...@@ -111,14 +111,14 @@ const componentOptions = {
datas: { datas: {
type: Object type: Object
}, },
k:{ k: {
type:String type: String
} }
}, },
// 组件数据 // 组件数据
data: { data: {
loaded:false, loaded: false,
isContain:false, isContain: false,
isPageHidden: false, // 页面是否处于隐藏状态 isPageHidden: false, // 页面是否处于隐藏状态
timeData: {}, timeData: {},
isLoading: true, isLoading: true,
...@@ -130,7 +130,8 @@ const componentOptions = { ...@@ -130,7 +130,8 @@ const componentOptions = {
hours: 0, hours: 0,
minute: 0, minute: 0,
second: 0, second: 0,
goodsList:[], goodsList: [],
selectActivityValue:"",
}, },
// 数据监听器 // 数据监听器
observers: {}, observers: {},
...@@ -183,6 +184,7 @@ const componentOptions = { ...@@ -183,6 +184,7 @@ const componentOptions = {
// this.setData({ isLoading: true }); // this.setData({ isLoading: true });
// }, 100); // }, 100);
// }, 100); // }, 100);
this.setData({ isLoading: false });
copyData.goodsItems.forEach((item, index) => { copyData.goodsItems.forEach((item, index) => {
item.productImgUrl = DFSImg(item.imgUrl); item.productImgUrl = DFSImg(item.imgUrl);
item.productImgUrl1 = DFSImg(item.imgUrl); item.productImgUrl1 = DFSImg(item.imgUrl);
...@@ -193,6 +195,7 @@ const componentOptions = { ...@@ -193,6 +195,7 @@ const componentOptions = {
goodsList: copyData.goodsItems, goodsList: copyData.goodsItems,
selectActivityValue: copyData.singleItemActivityName selectActivityValue: copyData.singleItemActivityName
}); });
console.log(_this.data.selectActivityValue, "--------------197");
} }
}); });
}, },
...@@ -232,7 +235,10 @@ const componentOptions = { ...@@ -232,7 +235,10 @@ const componentOptions = {
new Date(item.endTime.replace(/-/g, "/")).getTime() - new Date(item.endTime.replace(/-/g, "/")).getTime() -
new Date().getTime(); new Date().getTime();
item.singleItemActivityCoverImage = DFSImg( item.singleItemActivityCoverImage = DFSImg(
item.singleItemActivityCoverImage,400,400,1 item.singleItemActivityCoverImage,
400,
400,
1
); );
item.isStart = item.isStart =
new Date(item.startTime.replace(/-/g, "/")).getTime() > new Date(item.startTime.replace(/-/g, "/")).getTime() >
...@@ -240,9 +246,13 @@ const componentOptions = { ...@@ -240,9 +246,13 @@ const componentOptions = {
? true ? true
: false; : false;
}); });
let newList = list.filter((item) => { let newList = list.filter(item => {
return new Date(item.endTime.replace(/-/g, "/")).getTime() - new Date().getTime() > 0; return (
}) new Date(item.endTime.replace(/-/g, "/")).getTime() -
new Date().getTime() >
0
);
});
this.setData({ "datas.componentData.actList": newList }); this.setData({ "datas.componentData.actList": newList });
if (hideNum == actList.length) { if (hideNum == actList.length) {
this.setData({ hideAll: true }); this.setData({ hideAll: true });
...@@ -252,23 +262,26 @@ const componentOptions = { ...@@ -252,23 +262,26 @@ const componentOptions = {
} }
}); });
}, },
getScroll(){ getScroll() {
this.getEleInfo(()=>{ this.getEleInfo(() => {
this.getData() this.getData();
}); });
}, },
// 获取当前组件位置信息 // 获取当前组件位置信息
getEleInfo(cb){ getEleInfo(cb) {
if(this.loaded || this.isContain) return if (this.loaded || this.isContain) return;
this.isContain=true; this.isContain = true;
let {windowHeight} = wx.getSystemInfoSync() let { windowHeight } = wx.getSystemInfoSync();
let query=wx.createSelectorQuery().in(this); let query = wx.createSelectorQuery().in(this);
query.select('.time-limited-discount').boundingClientRect(rect=>{ query
if (rect.top<windowHeight && rect.top+rect.height>0) { .select(".time-limited-discount")
cb && cb() .boundingClientRect(rect => {
if (rect.top < windowHeight && rect.top + rect.height > 0) {
cb && cb();
} }
this.isContain=false; this.isContain = false;
}).exec(); })
.exec();
}, },
onChange(e) { onChange(e) {
this.setData({ timeData: e.detail }); this.setData({ timeData: e.detail });
...@@ -302,8 +315,8 @@ const componentOptions = { ...@@ -302,8 +315,8 @@ const componentOptions = {
}); });
}, },
getData() { getData() {
if(this.loaded) return if (this.loaded) return;
this.loaded=true this.loaded = true;
let { dimension } = this.data.datas.componentData; let { dimension } = this.data.datas.componentData;
if (dimension == 0) { if (dimension == 0) {
this.init(); this.init();
...@@ -316,10 +329,10 @@ const componentOptions = { ...@@ -316,10 +329,10 @@ const componentOptions = {
lifetimes: { lifetimes: {
created() {}, created() {},
ready() { ready() {
this.loaded=false; this.loaded = false;
this.isContain=false; this.isContain = false;
this.getEleInfo(()=>{ this.getEleInfo(() => {
this.getData() this.getData();
}); });
}, },
moved() {}, moved() {},
...@@ -330,10 +343,10 @@ const componentOptions = { ...@@ -330,10 +343,10 @@ const componentOptions = {
pageLifetimes: { pageLifetimes: {
// 页面被展示 // 页面被展示
show() { show() {
this.loaded=false; this.loaded = false;
this.isContain=false; this.isContain = false;
this.getEleInfo(()=>{ this.getEleInfo(() => {
this.getData() this.getData();
}); });
const { isPageHidden } = this.data; const { isPageHidden } = this.data;
// show事件发生前,页面不是处于隐藏状态时 // show事件发生前,页面不是处于隐藏状态时
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<view class="tops {{datas.componentData['countDownShow']?'hideCountDown':''}}"> <view class="tops {{datas.componentData['countDownShow']?'hideCountDown':''}}">
<view class="topInfo"> <view class="topInfo">
<view class="title"> <view class="title">
{{datas.componentData.dimension ==0?datas.componentData.selectActivityValue:datas.componentData.actTitle}} {{datas.componentData.dimension ==0?selectActivityValue:datas.componentData.actTitle}}
</view> </view>
<view class="subheading" wx:if="{{datas.componentData['countDownShow']&&datas.componentData.dimension==0}}"> <view class="subheading" wx:if="{{datas.componentData['countDownShow']&&datas.componentData.dimension==0}}">
<view wx:if="{{datas.componentData['endTime']&&endTime>0}}"> <view wx:if="{{datas.componentData['endTime']&&endTime>0}}">
......
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