|
|
@@ -57,7 +57,8 @@ Page ({
|
|
|
todaysend: Date.parse(new Date()) / 1000,
|
|
|
showtime: '',
|
|
|
projects_more:true,
|
|
|
- userinfo:{}
|
|
|
+ userinfo:{},
|
|
|
+ nowseckill_data:''
|
|
|
},
|
|
|
onLoad: function () {
|
|
|
// this.getzhunongList()
|
|
|
@@ -342,7 +343,16 @@ Page ({
|
|
|
// var leftTime = end - now; //时间差
|
|
|
var t = Date.parse(new Date())
|
|
|
t = t / 1000;
|
|
|
- var leftTime = that.data.clock - t
|
|
|
+
|
|
|
+ var leftTime;
|
|
|
+ if(that.data.nowseckill_data['state'] == 'seckill'){
|
|
|
+ leftTime = that.data.clock - t
|
|
|
+ }else if(that.data.nowseckill_data['state'] == 'preparing'){
|
|
|
+ leftTime = that.data.nowseckill_data['start_time'] - t
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
var d, h, m, s, ms;
|
|
|
if (leftTime >= 0) {
|
|
|
// day = parseInt(ctime / 86400)
|
|
|
@@ -422,39 +432,59 @@ Page ({
|
|
|
var success = function (res) {
|
|
|
var seclist = res.data.ret_item_list
|
|
|
var singleNavWidth = that.data.windowWidth / 5
|
|
|
- for (var index in seclist) {
|
|
|
+ // for (var index in seclist) {
|
|
|
+ // if (seclist[index].state == 'seckill') {
|
|
|
+ // that.setData({
|
|
|
+ // firsttime: seclist[index].date_format,
|
|
|
+ // clock: seclist[index].end_time,
|
|
|
+ // // navScrollLeft: singleNavWidth,
|
|
|
+ // toView: 'a' + seclist[index].date_format,
|
|
|
+ // changeshow: 'seckill'
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // if (seclist[index].state == 'end' && seclist[index].date_format == that.data.currentTab) {
|
|
|
+ // that.setData({
|
|
|
+ // toView: 'a' + seclist[index].date_format,
|
|
|
+ // changeshow: 'end'
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // if (seclist[index].state == 'preparing' && seclist[index].date_format == that.data.currentTab) {
|
|
|
+ // var nowtime = util.formatTime(new Date(seclist[index].start_time * 1000))
|
|
|
+ // that.setData({
|
|
|
+ // toView: 'a' + seclist[index].date_format,
|
|
|
+ // changeshow: 'preparing',
|
|
|
+ // showtime: nowtime.substring(11,13),
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // if (seclist[index].state == 'none' && seclist[index].date_format == that.data.currentTab) {
|
|
|
+ // that.setData({
|
|
|
+ // toView: 'a' + seclist[index].date_format,
|
|
|
+ // changeshow: 'none'
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+ var nsdata;
|
|
|
+ for (var index in seclist) {
|
|
|
if (seclist[index].state == 'seckill') {
|
|
|
- that.setData({
|
|
|
- firsttime: seclist[index].date_format,
|
|
|
- clock: seclist[index].end_time,
|
|
|
- // navScrollLeft: singleNavWidth,
|
|
|
- toView: 'a' + seclist[index].date_format,
|
|
|
- changeshow: 'seckill'
|
|
|
- })
|
|
|
- }
|
|
|
- if (seclist[index].state == 'end' && seclist[index].date_format == that.data.currentTab) {
|
|
|
- that.setData({
|
|
|
- toView: 'a' + seclist[index].date_format,
|
|
|
- changeshow: 'end'
|
|
|
- })
|
|
|
- }
|
|
|
- if (seclist[index].state == 'preparing' && seclist[index].date_format == that.data.currentTab) {
|
|
|
- var nowtime = util.formatTime(new Date(seclist[index].start_time * 1000))
|
|
|
- that.setData({
|
|
|
- toView: 'a' + seclist[index].date_format,
|
|
|
- changeshow: 'preparing',
|
|
|
- showtime: nowtime.substring(11,13),
|
|
|
- })
|
|
|
- }
|
|
|
- if (seclist[index].state == 'none' && seclist[index].date_format == that.data.currentTab) {
|
|
|
- that.setData({
|
|
|
- toView: 'a' + seclist[index].date_format,
|
|
|
- changeshow: 'none'
|
|
|
- })
|
|
|
+ nsdata = seclist[index];
|
|
|
+ var showtime = util.formatTime(new Date(nsdata['start_time']* 1000));
|
|
|
+ nsdata['showtime'] = showtime.substring(11,13);
|
|
|
+ nsdata['clock'] = seclist[index].end_time;
|
|
|
+ break;
|
|
|
+ }else if (seclist[index].state == 'preparing') {
|
|
|
+ nsdata = seclist[index];
|
|
|
+ var showtime = util.formatTime(new Date(nsdata['start_time'] * 1000));
|
|
|
+ nsdata['showtime'] = showtime.substring(11,13)
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ console.log('nsdata',nsdata);
|
|
|
that.setData({
|
|
|
seckilltimelist: seclist,
|
|
|
+ clock:nsdata['clock'],
|
|
|
+ nowseckill_data:nsdata
|
|
|
})
|
|
|
that.getkillgoods()
|
|
|
that.starttime()
|
|
|
@@ -465,7 +495,7 @@ Page ({
|
|
|
var that = this
|
|
|
var url = 'v1/seckill/products'
|
|
|
var params = {
|
|
|
- query_date: that.data.firsttime,
|
|
|
+ query_date: that.data.nowseckill_data != '' ? that.data.nowseckill_data['date_format'] : '',
|
|
|
cache: false
|
|
|
}
|
|
|
var success = function (res) {
|