You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

183 lines
3.6 KiB

3 years ago
// pages/user/resourcesOrder/index.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
tabActive: 1,
list: []
},
toDemandHall(){
wx.switchTab({
url: '/pages/demandHall/index',
})
},
tabClick(e){
let i = e.currentTarget.dataset.i
this.setData({
tabActive: i
})
if(i == 1){
this.getCommunicates()
} else{
this.getProjectList()
}
},
// 获取 沟通中
getCommunicates(){
app.http('get','Communicate/resourceCommunicates').then((res)=>{
if(res.data.success){
if(res.data.data.length > 0){
res.data.data.map((item)=>{
item.open = false
})
res.data.data[0].open = true
}
this.setData({
list: res.data.data
})
}
})
},
//获取进行中、已结束列表
getProjectList(){
app.http('get','Project/listProject',{projectState: this.data.tabActive -1, projectType: 1}).then((res)=>{
if(res.data.success){
res.data.data.map((item)=>{
item.stageResultsDtoList.map((stage)=>{
if(stage.state == 1){
item.showBtn = true
}
})
})
this.setData({
list: res.data.data
})
}
})
},
// 开启下一阶段
openNextProgress(e){
let item = e.currentTarget.dataset.item
console.log(item)
wx.showModal({
title: '提示!',
content: '是否申请开启下阶段?',
success(res){
if(res.confirm){
app.http('get','Project/applyNextStage',{projectCode: item.projectCode}).then((res)=>{
if(res.data.success){
wx.showToast({
title: '操作成功!',
duration: 2000
})
}
})
}
}
})
},
//点击展开
openClick(e){
let idx = e.currentTarget.dataset.idx
console.log(idx)
let list = this.data.list
list[idx].open = !list[idx].open
this.setData({
list: list
})
},
// 跳转申请详情
toApplyDetail(e){
let data = encodeURIComponent(JSON.stringify(e.currentTarget.dataset.item));
wx.navigateTo({
url: '/pages/demandHall/applyDetail/index?data=' + data,
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getCommunicates()
},
// 拨打电话
call(e){
3 years ago
let item = e.currentTarget.dataset.item
wx.makePhoneCall({
phoneNumber: item.phone,
})
3 years ago
},
// 立项
createProject(e){
let id = e.currentTarget.dataset.id
wx.showModal({
title: "提示!",
content: '是否确认立项?',
success(res){
if(res.confirm){
wx.navigateTo({
url: '/pages/demandHall/createProject/index?id='+ id,
})
}
}
})
},
// 平台介入
toPlatform(e){
let code = e.currentTarget.dataset.item.projectCode
wx.navigateTo({
url: '/pages/demandHall/platform/index?code=' + code,
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})