我的页面,首页来款项目
This commit is contained in:
+41
-12
@@ -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()
|
||||
},
|
||||
})
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"navigationBarTitleText": "项目",
|
||||
"usingComponents": {
|
||||
"popup": "../../components/popup/popup"
|
||||
"popup": "../../components/popup/popup",
|
||||
"dateMonth": "../../components/dateMonth/dateMonth"
|
||||
}
|
||||
}
|
||||
@@ -7,17 +7,21 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="list">
|
||||
<view class="list-item" wx:for="{{[1,1,1,1]}}" bindtap="projectDetail" wx:key="item">
|
||||
<view class="list-item" wx:for="{{list}}" bindtap="projectDetail" wx:key="item">
|
||||
<view class="title">
|
||||
<text>项目名称文字占位符项目名称文字占位符项目名称文字占位符</text>
|
||||
<text>2021-12-12</text>
|
||||
<text>{{item.chargeUse_dictText}}</text>
|
||||
<text>{{item.year}}年</text>
|
||||
</view>
|
||||
<view class="content-text">
|
||||
<text>需要发票</text>
|
||||
<text>到账</text>
|
||||
<text>开票</text>
|
||||
<text>邮寄</text>
|
||||
<text class="all">{{item.needInvoice === 0 ? '不需要发票' : '需要发票'}}</text>
|
||||
<text class="{{item.inAccount === 0 ? '' : item.inAccount === 2 ? 'half' : 'all'}}">到账</text>
|
||||
<text class="{{item.makeInvoice === 0 ? '' : item.makeInvoice === 2 ? 'half' : 'all'}}">开票</text>
|
||||
<text class="{{item.mail === 0 ? '' : item.mail === 2 ? 'half' : 'all'}}">邮寄</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{list.length === 0}}" class="no-data">
|
||||
<text>暂无数据</text>
|
||||
</view>
|
||||
<popup visible="{{visible}}" bindclose="close" outClickCanClose="true" bindok="ok" data="{{data}}"></popup>
|
||||
<dateMonth visible="{{visibleDate}}" mode="year" bindok="dateOk"></dateMonth>
|
||||
|
||||
@@ -71,3 +71,9 @@ page {
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.half{
|
||||
color: burlywood;
|
||||
}
|
||||
.all{
|
||||
color: #069F99;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user