我的页面,首页来款项目

This commit is contained in:
姚亚男
2021-10-12 18:17:26 +08:00
parent 32e229fec3
commit 491caf06a3
41 changed files with 756 additions and 412 deletions
+41 -12
View File
@@ -6,12 +6,14 @@ Page({
*/
data: {
visible: false,
visibleDate: false,
index: 0,
list: [], // 项目列表
searchParams: {
pageNo: 1,
pageSize: 10,
needInvoice: 0, // 是否需要发票 0 4
pack: 0, // 是否打包 0 1
needInvoice: '', // 是否需要发票 0 4
pack: '', // 是否打包 0 1
year: '', // 运行年份
},
selects: [ // 自定义选择框参数
@@ -45,6 +47,9 @@ Page({
changeTab(e){
this.data.index = e.currentTarget.dataset.index
if(this.data.index === 0){
this.setData({
visible: true
})
this.setData({
data: [
{
@@ -57,6 +62,9 @@ Page({
]
})
}else if(this.data.index === 1){
this.setData({
visible: true
})
this.setData({
data: [
{
@@ -68,18 +76,29 @@ Page({
}
]
})
}else{
this.setData({
visibleDate: true
})
}
this.setData({
visible: true
})
},
// 关闭弹出层
// 关闭发票和打包的弹出层
close() {
this.setData({
visible: false
})
},
// 日期选中
dateOk(value){
this.data.pageNo = 1
this.setData({
"searchParams.year": value.detail,
visibleDate: false
})
this.loadData()
},
ok(e){
this.data.pageNo = 1
if(this.data.index === 0){
this.setData({
'searchParams.needInvoice': e.detail
@@ -89,8 +108,7 @@ Page({
'searchParams.pack': e.detail
})
}
// this.loadData()
console.log(this.data.searchParams)
this.loadData()
},
// 项目详情
projectDetail(){
@@ -100,8 +118,19 @@ Page({
},
loadData(){
UserApi.projectList(this.data.searchParams).then(res=>{
console.log(res)
if(res.success){
// 搜索时,把原数据清空,重新筛选
if(this.data.pageNo === 1) {
this.setData({
list: []
})
}
if(res.result.records && res.result.records.length){
this.setData({
list: [...this.data.list, ...res.result.records]
})
}
}
}).catch(err=>{
wx.showToast({
title: '加载失败',
@@ -114,13 +143,13 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
// this.loadData()
this.loadData()
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
this.data.pageNo++
// this.loadData()
this.loadData()
},
})