Files
income_payments_applet/pages/meetingDetailSigned/meetingDetailSigned.js
T

218 lines
4.5 KiB
JavaScript

// pages/meeting/meeting.js
import {
previewFile
} from '../../assets/js/preview'
import MeetingApi from '../../assets/js/http/meetingApi'
import signUpApi from '../../assets/js/http/signUp'
import {baseUrl,URL_CONFIG} from '../../assets/js/http/api'
Page({
/**
* 页面的初始数据
*/
data: {
payProveImage: '',
// 会议详情
meetingInfo: {},
// 参会人信息
singInPersonInfo: {},
// 会议通知文件资料数组
meetingFilesList: [],
// 会议资料文件数组
meetingDataList: [],
// 缴费凭证id
imageIds:[],
// 订单后四位
ordeCode:'',
// 缴费凭证的回显
payRecordImgSrc:'',
// 签到图片的回显
signImgSrc:''
},
// 获取图片的id
getImagesId(e) {
this.setData({
imageIds: e.detail.join(',')
})
},
// 订单后四位
setOrdeCode(e){
this.setData({
ordeCode:e.detail.value
})
},
// 上传汇款凭证
editPayRecord(){
const param = {
id:this.data.meetingInfo.situationId,
orderCode:this.data.ordeCode,
paymentRecord:this.data.imageIds
}
signUpApi.uploadPayRecord(param).then(res => {
console.log(res);
if(res.success){
wx.showToast({
title:res.message,
icon: "success",
duration: 800,
});
wx.navigateBack({
delta: 1,
})
}else{
wx.showToast({
title:res.message,
icon: "error",
duration: 800,
});
}
})
},
//参会人信息
queryPeronInfo(id) {
MeetingApi.queryPersongInfoById({
id: id
}).then(res => {
if (res.success) {
this.setData({
singInPersonInfo: res.result
})
// 已经审核的获取审核凭证的src
if(res.result.checkResult !== 0){
this.setData({
payRecordImgSrc:baseUrl + URL_CONFIG + 'sys/common/download/' + res.result.paymentRecord
})
}
console.log(this.data.payRecordImgSrc);
// 已经签到的获取签到的图片的src
if(res.result.checkIn === 1){
this.setData({
signImgSrc:baseUrl + URL_CONFIG + 'sys/common/download/' + res.result.check_file
})
}
}
})
},
// 通过文件id获取文件的相关信息
getFileInfo(id) {
return new Promise(resolve => {
let result = {}
MeetingApi.queryFileInfoById({
id: id
}).then(res => {
if (res.success) {
result = res.result
}
}).finally(() => {
resolve(result)
})
})
},
// 获取文件信息
async initFileList(fileIds) {
if (fileIds) {
const fileList = []
let arr = fileIds.split(',')
for (let i = 0; i < arr.length; i++) {
let fileObj = {}
fileObj = await this.getFileInfo(arr[i])
fileList.push({
id: fileObj.id,
name: fileObj.fileName
})
}
return fileList
}
},
// 预览
previewFile(e) {
const fileObj = e.currentTarget.dataset.file
previewFile(fileObj.id, fileObj.name)
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
// 获取上一个页面的会议数据
const meetingInfo = JSON.parse(options.meetingInfo)
console.log(meetingInfo);
const that = this
this.setData({
meetingInfo: meetingInfo
})
//
let {
meetingFiles,
meetingData
} = meetingInfo
// 获取参会人信息
this.queryPeronInfo(meetingInfo.situationId)
// this.queryFileInfo(meetingFiles)
// 获取会议资料文件
this.initFileList(meetingData).then(res => {
that.setData({
meetingDataList: res
})
})
// 会议通知文件
this.initFileList(meetingFiles).then(res => {
that.setData({
meetingFilesList: res
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})