115 lines
2.8 KiB
JavaScript
Raw Permalink Normal View History

2024-02-21 17:43:11 +08:00
let app = getApp()
Page({
2024-02-23 09:56:56 +08:00
data: {
currentTab: 0,
repairList: []
},
2024-02-21 17:43:11 +08:00
2024-02-23 09:56:56 +08:00
onLoad(options) {
// 页面初始化 options为页面跳转所带来的参数
wx.setNavigationBarTitle({
title: options.name
})
},
2024-02-21 17:43:11 +08:00
2024-02-23 09:56:56 +08:00
onShow() {
switch (this.data.currentTab) {
case 0:
this.getList()
break
case 1:
this.getList('PENDING_ASSIGN')
break
case 2:
this.getList('PENDING_PROCESS')
break
case 3:
this.getList('COMPLETED')
break
case 4:
this.getList('SCORE')
break
case 5:
this.getList('CANCELED')
}
},
2024-02-21 17:43:11 +08:00
2024-02-23 09:56:56 +08:00
getList(status) {
let that = this
let workCondition = ''
that.data.repairList = []
if (status) {
workCondition = '/repair/list?status=' + status
} else {
workCondition = '/repair/list'
}
app.AjaxRequest('get', {
'content-type': 'application/json',
'Authorization': 'Bearer ' + app.Getopenid()
}, workCondition, {}, function (res) {
that.setData({
repairList: res.rows
})
})
},
2024-02-21 17:43:11 +08:00
2024-02-23 09:56:56 +08:00
//滑动切换
swiperTab: function (e) {
var that = this
that.setData({
currentTab: e.detail.current
})
switch (e.detail.current) {
case 0:
this.getList()
break
case 1:
this.getList('PENDING_ASSIGN')
break
case 2:
this.getList('PENDING_PROCESS')
break
case 3:
this.getList('COMPLETED')
break
case 4:
this.getList('SCORE')
break
case 5:
this.getList('CANCELED')
}
},
2024-02-21 17:43:11 +08:00
2024-02-23 09:56:56 +08:00
//点击切换
clickTab: function (e) {
var that = this
console.log(e.target.dataset.current)
if (this.data.currentTab === e.target.dataset.current) {
return false
} else {
that.setData({
currentTab: e.target.dataset.current
})
}
},
2024-02-21 17:43:11 +08:00
2024-02-23 09:56:56 +08:00
scrollToLower() {
2024-02-21 17:43:11 +08:00
2024-02-23 09:56:56 +08:00
},
2024-02-21 17:43:11 +08:00
2024-02-23 09:56:56 +08:00
repairapply() {
wx.navigateTo({
url: '../parkRepair/repairInApply/repairInApply',
})
},
repairDetail(e) {
wx.navigateTo({
url: '../parkRepair/repairDetail/repairDetail?id=' + e.currentTarget.dataset.id,
})
},
navEvaluate(e) {
wx.navigateTo({
url: '../parkRepair/evaluate/evaluate?id=' + e.currentTarget.dataset.id,
})
}
2024-02-21 17:43:11 +08:00
})