yuminge-app/yun-min-program-plugin-master/packageD/mycomponent/group_level/group_level.js

66 lines
1.6 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var app = getApp();
Component({
properties: {
data: {
type: []
},
params: {
type: null
}
},
data: {
language: '',
datas: []
}, // 私有数据,可用于模板渲染
lifetimes: {
// 生命周期函数可以为函数或一个在methods段中定义的方法名
attached() {
let language = wx.getStorageSync('langIndex');
this.setData({ 'language': language.en});
let arr = this.properties.data;
arr.map(item => {
if (!app._isTextEmpty(item.end_time)) {
item.nowTime = new Date().getTime() / 1000;
if (!app._isTextEmpty(item.start_time)) {
let start_time = new Date(item.start_time).getTime() / 1000;
if (start_time > item.nowTime) {
item.ishow = false;
item.getTime = new Date(item.start_time).getTime() / 1000;
} else {
item.ishow = true;
}
}
item.overTime = new Date(item.end_time).getTime() / 1000;
}
});
let dataArr = this.properties.data;
dataArr.map(item => {
if (app._isTextEmpty(item.min_price)) {
item.min_price = '';
}
if (app._isTextEmpty(item.max_price)) {
item.max_price = '';
}
});
this.setData({
datas: dataArr
});
},
moved() {},
detached() {}
},
methods: {
// 去开团
buy(e) {
let item = e.target.dataset.item || e.currentTarget.dataset.item;
wx.navigateTo({
url: '/packageA/detail_v2/detail_v2?id=' + item.id + '&name=group'
});
}
}
});