master
Tuisku 3 years ago
parent a7c8d6e057
commit f3fb56445c

@ -34,23 +34,33 @@ Page({
rank: [{ rank: [{
name: '全部日期', name: '全部日期',
is: true, is: true,
month:'' month: '',
id: ''
}, { }, {
name: '一个月内', name: '一个月内',
is: false, is: false,
month:1 month: 1,
id: 0
}, { }, {
name: '三个月内', name: '三个月内',
is: false, is: false,
month:3 month: 3,
id: 1
}, { }, {
name: '半年内', name: '半年内',
is: false, is: false,
month:6 month: 6,
id: 2
}, { }, {
name: '一年内', name: '一年内',
is: false, is: false,
month:12 month: 12,
id: 3
}, {
name: '自定义',
is: false,
month: 99,
id: 4
}] }]
}, { }, {
id: 2, id: 2,
@ -75,7 +85,10 @@ Page({
brandIdList: [], brandIdList: [],
keyword: '', keyword: '',
cdn: getApp().globalData.cdn, cdn: getApp().globalData.cdn,
flag: true flag: true,
beginTime: '',
endTime: '',
datepick: false
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
@ -126,6 +139,8 @@ Page({
http("/userReference/list", "post", { http("/userReference/list", "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.brandIdList[0] ? this.data.brandIdList : [], brandIdList: this.data.brandIdList[0] ? this.data.brandIdList : [],
keyword: this.data.keyword keyword: this.data.keyword
@ -167,7 +182,7 @@ Page({
// 点击事件,开始时一定会执行的,先令所有下拉选项先隐藏 // 点击事件,开始时一定会执行的,先令所有下拉选项先隐藏
const promise = new Promise((res) => { const promise = new Promise((res) => {
this.setData({ this.setData({
showOrHide: true showOrHide: false
}) })
res() res()
}) })
@ -232,10 +247,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) {
if (el.month === 99) {
this.setData({
datepick: true
})
} else {
this.setData({ this.setData({
month: el.month month: el.month,
beginTime: '',
endTime: ''
}) })
} }
}
}) })
this.data.selectItem[0].rank.forEach(el => { this.data.selectItem[0].rank.forEach(el => {
// console.log(el) // console.log(el)
@ -260,6 +283,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({
@ -286,8 +367,7 @@ Page({
let flag = true let flag = true
for (let i = 0; i < this.data.listdata[a].referenceList.length; i++) { for (let i = 0; i < this.data.listdata[a].referenceList.length; i++) {
if (this.data.listdata[a].referenceList[i].choose) { if (this.data.listdata[a].referenceList[i].choose) {} else {
} else {
flag = false flag = false
} }
} }

@ -28,3 +28,20 @@
<button style="color: #D0D0D0;margin-top: 20rpx;" bindtap="getmore">加载更多</button> <button style="color: #D0D0D0;margin-top: 20rpx;" bindtap="getmore">加载更多</button>
</view> </view>
</view> </view>
<!-- 日期自定义 -->
<l-mask show="{{datepick}}" center="{{true}}">
<view class='mask-content'>
<picker mode="date" end="{{endTime}}" value="{{beginTime}}" bindchange="bindDateChange">
<view class="picker">
开始时间: {{beginTime}}
</view>
</picker>
<picker mode="date" start="{{beginTime}}" style="margin-top: 16rpx;" value="{{endTime}}" bindchange="bindDateChange2">
<view class="picker">
结束时间: {{endTime}}
</view>
</picker>
<button style="margin-top: 32rpx;background-color: white;" catchtap="timeclick" data-tu="1">取消</button>
<button style="margin-top: 32rpx;background-color: white;" catchtap="timeclick" data-tu="2">确定</button>
</view>
</l-mask>

@ -270,3 +270,21 @@
.getmore{ .getmore{
margin: 20rpx; margin: 20rpx;
} }
.mask-content {
background-color: white;
border-radius: 8rpx;
width: 500rpx;
/* height: 250rpx; */
padding: 32rpx;
}
.picker {
/* width: 622rpx; */
/* height: 80rpx; */
padding: 24rpx;
background: #F9F9F9;
border-radius: 8rpx;
display: flex;
align-items: center;
}

@ -56,23 +56,33 @@ Page({
rank: [{ rank: [{
title: '全部日期', title: '全部日期',
is: true, is: true,
month: '' month: '',
id: ''
}, { }, {
title: '一个月内', title: '一个月内',
is: false, is: false,
month: 1 month: 1,
id: 0
}, { }, {
title: '三个月内', title: '三个月内',
is: false, is: false,
month: 3 month: 3,
id: 1
}, { }, {
title: '半年内', title: '半年内',
is: false, is: false,
month: 6 month: 6,
id: 2
}, { }, {
title: '一年内', title: '一年内',
is: false, is: false,
month: 12 month: 12,
id: 3
}, {
title: '自定义',
is: false,
month: 99,
id: 4
}] }]
}, { }, {
id: 3, id: 3,
@ -96,7 +106,10 @@ Page({
month: '', month: '',
tagIdList: [], tagIdList: [],
brandIdList: [], brandIdList: [],
keyword: '' keyword: '',
beginTime: '',
endTime: '',
datepick: false
}, },
/** /**
@ -153,6 +166,8 @@ Page({
pageNum: this.data.page, pageNum: this.data.page,
status: this.data.status, status: this.data.status,
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.brandIdList[0]?this.data.brandIdList:[], brandIdList: this.data.brandIdList[0]?this.data.brandIdList:[],
keyword: this.data.keyword keyword: this.data.keyword
@ -184,7 +199,7 @@ Page({
// 点击事件,开始时一定会执行的,先令所有下拉选项先隐藏 // 点击事件,开始时一定会执行的,先令所有下拉选项先隐藏
const promise = new Promise((res) => { const promise = new Promise((res) => {
this.setData({ this.setData({
showOrHide: true showOrHide: false
}) })
res() res()
}) })
@ -251,9 +266,17 @@ Page({
this.data.selectItem[2].rank.forEach(el=>{ this.data.selectItem[2].rank.forEach(el=>{
// console.log(el) // console.log(el)
if (el.is) { if (el.is) {
if (el.month === 99) {
this.setData({ this.setData({
month: el.month datepick: true
}) })
} else {
this.setData({
month: el.month,
beginTime: '',
endTime: ''
})
}
} }
}) })
this.data.selectItem[1].rank.forEach(el=>{ this.data.selectItem[1].rank.forEach(el=>{
@ -287,6 +310,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[2].rank[5].title': '自定义',
'selectItem[2].rank[0].is': true,
'selectItem[2].rank[0].is': false,
'navItem[2].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[2].rank[5].title': this.data.beginTime + ' ~ ' + this.data.endTime,
'navItem[2].name': this.data.beginTime + ' ~ ' + this.data.endTime,
month: '',
questes: [],
page: 1,
maxpage: 1
})
this.getdata()
}
}
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */

@ -8,6 +8,7 @@
<view class="wrap"> <view class="wrap">
<view wx:for="{{navItem}}" wx:key="index" class="item {{item.is?'active':''}}" data-id="{{item.id}}" bind:tap="handleClick"> <view wx:for="{{navItem}}" wx:key="index" class="item {{item.is?'active':''}}" data-id="{{item.id}}" bind:tap="handleClick">
{{item.name}} {{item.name}}
<image style="height: 12rpx;width: 16rpx;" src="/images/ic_sanjiao_nor@2x.png"></image>
</view> </view>
</view> </view>
<!-- 导航栏选项 --> <!-- 导航栏选项 -->
@ -47,3 +48,20 @@
</view> </view>
</view> </view>
</view> </view>
<!-- 日期自定义 -->
<l-mask show="{{datepick}}" center="{{true}}">
<view class='mask-content'>
<picker mode="date" end="{{endTime}}" value="{{beginTime}}" bindchange="bindDateChange">
<view class="picker">
开始时间: {{beginTime}}
</view>
</picker>
<picker mode="date" start="{{beginTime}}" style="margin-top: 16rpx;" value="{{endTime}}" bindchange="bindDateChange2">
<view class="picker">
结束时间: {{endTime}}
</view>
</picker>
<button style="margin-top: 32rpx;background-color: white;" catchtap="timeclick" data-tu="1">取消</button>
<button style="margin-top: 32rpx;background-color: white;" catchtap="timeclick" data-tu="2">确定</button>
</view>
</l-mask>

@ -225,3 +225,21 @@
background-color: #F9F9F9; background-color: #F9F9F9;
min-height: 100vh; min-height: 100vh;
} }
.mask-content {
background-color: white;
border-radius: 8rpx;
width: 500rpx;
/* height: 250rpx; */
padding: 32rpx;
}
.picker {
/* width: 622rpx; */
/* height: 80rpx; */
padding: 24rpx;
background: #F9F9F9;
border-radius: 8rpx;
display: flex;
align-items: center;
}
Loading…
Cancel
Save