master
Tuisku 3 years ago
parent dd24ae2e83
commit a7c8d6e057

@ -28,32 +28,32 @@ Page({
}, { }, {
id: 1, id: 1,
rank: [{ rank: [{
title: '全部日期', name: '全部日期',
is: true, is: true,
month: '', month: '',
id: '' id: ''
}, { }, {
title: '一个月内', name: '一个月内',
is: false, is: false,
month: 1, month: 1,
id: 0 id: 0
}, { }, {
title: '三个月内', name: '三个月内',
is: false, is: false,
month: 3, month: 3,
id: 1 id: 1
}, { }, {
title: '半年内', name: '半年内',
is: false, is: false,
month: 6, month: 6,
id: 2 id: 2
}, { }, {
title: '一年内', name: '一年内',
is: false, is: false,
month: 12, month: 12,
id: 3 id: 3
}, { }, {
title: '自定义', name: '自定义',
is: false, is: false,
month: 99, month: 99,
id: 4 id: 4
@ -76,7 +76,10 @@ Page({
keyword: '', keyword: '',
cdn: getApp().globalData.cdn, cdn: getApp().globalData.cdn,
searchid: '', searchid: '',
flag: true flag: true,
beginTime: '',
endTime: '',
datepick: false
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
@ -120,6 +123,8 @@ Page({
http("/reference/listByDay", "post", { http("/reference/listByDay", "post", {
pageNum: this.data.page, pageNum: this.data.page,
month: this.data.month, month: this.data.month,
beginTime:this.data.beginTime?this.data.beginTime + ' 00:00:00':'',
endTime:this.data.endTime?this.data.endTime + ' 00:00:00':'',
tagIdList: this.data.tagIdList[0]?this.data.tagIdList:[], tagIdList: this.data.tagIdList[0]?this.data.tagIdList:[],
brandIdList: [this.data.searchid], brandIdList: [this.data.searchid],
keyword: this.data.keyword keyword: this.data.keyword
@ -160,7 +165,7 @@ Page({
// 点击事件,开始时一定会执行的,先令所有下拉选项先隐藏 // 点击事件,开始时一定会执行的,先令所有下拉选项先隐藏
const promise = new Promise((res) => { const promise = new Promise((res) => {
this.setData({ this.setData({
showOrHide: true showOrHide: false
}) })
res() res()
}) })
@ -224,10 +229,18 @@ Page({
}) })
this.data.selectItem[1].rank.forEach(el=>{ this.data.selectItem[1].rank.forEach(el=>{
// console.log(el) // console.log(el)
if(el.is){ if (el.is) {
this.setData({ if (el.month === 99) {
month: el.month this.setData({
}) datepick: true
})
} else {
this.setData({
month: el.month,
beginTime: '',
endTime: ''
})
}
} }
}) })
this.data.selectItem[0].rank.forEach(el=>{ this.data.selectItem[0].rank.forEach(el=>{
@ -245,6 +258,64 @@ Page({
}) })
this.getdata() this.getdata()
}, },
bindDateChange: function (e) {
this.setData({
beginTime: e.detail.value
})
},
bindDateChange2: function (e) {
this.setData({
endTime: e.detail.value
})
},
timeclick(e) {
console.log(e)
if (e.currentTarget.dataset.tu === '1') {
this.setData({
beginTime: '',
endTime: '',
datepick: false,
'selectItem[1].rank[5].title': '自定义',
'selectItem[1].rank[0].is': true,
'selectItem[1].rank[0].is': false,
'navItem[1].name': '全部日期'
})
let e = {
currentTarget:{
dataset:{
contant: '全部日期',
id: 0
}
}
}
this.closeMask(e)
} else {
if (this.data.beginTime === '') {
wx.showToast({
title: '请输入开始时间',
icon: 'none',
duration: 2000
})
} else if (this.data.endTime === '') {
wx.showToast({
title: '请输入结束时间',
icon: 'none',
duration: 2000
})
} else {
this.setData({
datepick: false,
'selectItem[1].rank[5].title': this.data.beginTime + ' ~ ' + this.data.endTime,
'navItem[1].name': this.data.beginTime + ' ~ ' + this.data.endTime,
month: '',
questes: [],
page: 1,
maxpage: 1
})
this.getdata()
}
}
},
handleSearch(e){ handleSearch(e){
console.log(e) console.log(e)
this.setData({ this.setData({

@ -22,32 +22,32 @@ Page({
selectItem: [{ selectItem: [{
id: 0, id: 0,
rank: [{ rank: [{
title: '全部日期', name: '全部日期',
is: true, is: true,
month: '', month: '',
id: '' id: ''
}, { }, {
title: '一个月内', name: '一个月内',
is: false, is: false,
month: 1, month: 1,
id: 0 id: 0
}, { }, {
title: '三个月内', name: '三个月内',
is: false, is: false,
month: 3, month: 3,
id: 1 id: 1
}, { }, {
title: '半年内', name: '半年内',
is: false, is: false,
month: 6, month: 6,
id: 2 id: 2
}, { }, {
title: '一年内', name: '一年内',
is: false, is: false,
month: 12, month: 12,
id: 3 id: 3
}, { }, {
title: '自定义', name: '自定义',
is: false, is: false,
month: 99, month: 99,
id: 4 id: 4
@ -76,7 +76,10 @@ Page({
keyword: '', keyword: '',
cdn: getApp().globalData.cdn, cdn: getApp().globalData.cdn,
tagid: '', tagid: '',
flag:true flag:true,
beginTime: '',
endTime: '',
datepick: false
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
@ -119,6 +122,8 @@ Page({
http("/reference/listByDay", "post", { http("/reference/listByDay", "post", {
pageNum: this.data.page, pageNum: this.data.page,
month: this.data.month, month: this.data.month,
beginTime:this.data.beginTime?this.data.beginTime + ' 00:00:00':'',
endTime:this.data.endTime?this.data.endTime + ' 00:00:00':'',
tagIdList: [this.data.tagid], tagIdList: [this.data.tagid],
brandIdList: this.data.brandIdList[0]?this.data.brandIdList:[], brandIdList: this.data.brandIdList[0]?this.data.brandIdList:[],
keyword: this.data.keyword keyword: this.data.keyword
@ -159,7 +164,7 @@ Page({
// 点击事件,开始时一定会执行的,先令所有下拉选项先隐藏 // 点击事件,开始时一定会执行的,先令所有下拉选项先隐藏
const promise = new Promise((res) => { const promise = new Promise((res) => {
this.setData({ this.setData({
showOrHide: true showOrHide: false
}) })
res() res()
}) })
@ -223,10 +228,18 @@ Page({
}) })
this.data.selectItem[0].rank.forEach(el=>{ this.data.selectItem[0].rank.forEach(el=>{
// console.log(el) // console.log(el)
if(el.is){ if (el.is) {
this.setData({ if (el.month === 99) {
month: el.month this.setData({
}) datepick: true
})
} else {
this.setData({
month: el.month,
beginTime: '',
endTime: ''
})
}
} }
}) })
this.data.selectItem[1].rank.forEach(el=>{ this.data.selectItem[1].rank.forEach(el=>{
@ -244,6 +257,64 @@ Page({
}) })
this.getdata() this.getdata()
}, },
bindDateChange: function (e) {
this.setData({
beginTime: e.detail.value
})
},
bindDateChange2: function (e) {
this.setData({
endTime: e.detail.value
})
},
timeclick(e) {
console.log(e)
if (e.currentTarget.dataset.tu === '1') {
this.setData({
beginTime: '',
endTime: '',
datepick: false,
'selectItem[0].rank[5].title': '自定义',
'selectItem[0].rank[0].is': true,
'selectItem[0].rank[0].is': false,
'navItem[0].name': '全部日期'
})
let e = {
currentTarget:{
dataset:{
contant: '全部日期',
id: 0
}
}
}
this.closeMask(e)
} else {
if (this.data.beginTime === '') {
wx.showToast({
title: '请输入开始时间',
icon: 'none',
duration: 2000
})
} else if (this.data.endTime === '') {
wx.showToast({
title: '请输入结束时间',
icon: 'none',
duration: 2000
})
} else {
this.setData({
datepick: false,
'selectItem[0].rank[5].title': this.data.beginTime + ' ~ ' + this.data.endTime,
'navItem[0].name': this.data.beginTime + ' ~ ' + this.data.endTime,
month: '',
questes: [],
page: 1,
maxpage: 1
})
this.getdata()
}
}
},
handleSearch(e){ handleSearch(e){
console.log(e) console.log(e)
this.setData({ this.setData({

Loading…
Cancel
Save