描述:预约记录-参与记录

This commit is contained in:
SelfRidicule 2024-03-07 11:12:57 +08:00
parent ccc08adbb6
commit 54124297bc
6 changed files with 230 additions and 78 deletions

View File

@ -75,7 +75,7 @@ export function saveMeetingRecordRq(data) {
});
}
// 根据用户id查询已预约的列表
// 根据用户id查询预约记录
export function selectReservationListByUserIdRq(data) {
return request({
url: '/api/roomContent/selectReservationListByUserId?pageNum=' + data.pageNum + '&pageSize=' + data.pageSize,
@ -84,6 +84,14 @@ export function selectReservationListByUserIdRq(data) {
});
}
// 根据用户id查询参与记录
export function selectVisitorInvitationRecordRq(data) {
return request({
url: '/api/visitor/selectVisitorInvitationRecord/' + data.userId + '?pageNum=' + data.pageNum + '&pageSize=' + data.pageSize,
method: "get",
});
}
// 根据id查询预约信息
export function selectReservationByIdRq(id) {
return request({

View File

@ -3,7 +3,8 @@
"van-icon": "@vant/weapp/icon/index",
"van-field": "@vant/weapp/field/index",
"van-dialog": "@vant/weapp/dialog/index",
"van-notify": "@vant/weapp/notify/index"
"van-notify": "@vant/weapp/notify/index",
"van-checkbox": "@vant/weapp/checkbox/index"
},
"navigationBarTitleText": "预约信息"
}

View File

@ -6,7 +6,8 @@ import {
} from "../../../../utils/util.js"
import {
selectReservationListByUserIdRq
selectReservationListByUserIdRq,
selectVisitorInvitationRecordRq
} from "../../../../api/meeting/meetingRoom.js"
Page({
@ -17,10 +18,17 @@ Page({
data: {
IMG_NAME: app.IMG_NAME,
userData: null,
pageNum: 1,
pageSize: 10,
dataList: [],
isDataAll: false,
tabTitle: '预约记录',
// 预约记录参数
reservationPageNum: 1,
reservationPageSize: 4,
reservationDataList: [],
reservationIsDataAll: false,
// 参与记录参数
participatePageNum: 1,
participatePageSize: 4,
participateDataList: [],
participateIsDataAll: false,
},
/**
@ -32,21 +40,76 @@ Page({
userData: wx.getStorageSync('user'),
})
// 获取数据
_this.getDataList()
let userId = _this.data.userData.id
// 获取预约数据
_this.getReservationData({
userId,
pageNum: _this.data.reservationPageNum,
pageSize: _this.data.reservationPageSize,
})
// 获取参与数据
_this.getParticipateData({
userId,
pageNum: _this.data.participatePageNum,
pageSize: _this.data.participatePageSize
})
},
// 获取数据
getDataList() {
// 获取参数
let _this = this;
let isDataAll = _this.data.isDataAll
let pageNum = _this.data.pageNum
let pageSize = _this.data.pageSize
let tabTitle = _this.data.tabTitle
let userId = _this.data.userData.id
let isDataAll = null
let pageNum = null
let pageSize = null
if (tabTitle == '预约记录') {
// 预约记录参数
isDataAll = _this.data.reservationIsDataAll
pageNum = _this.data.reservationPageNum
pageSize = _this.data.reservationPageSize
} else if (tabTitle == '预约记录') {
// 参与记录参数
isDataAll = _this.data.participateIsDataAll
pageNum = _this.data.participatePageNum
pageSize = _this.data.participatePageSize
} else {
wx.showToast({
title: `tab 切换错误(${tabTitle})`,
icon: 'none',
});
return;
}
// 判断数据是否已全部加载
if (isDataAll) {
return;
}
// 传递参数
let param = {
userId,
pageNum,
pageSize
}
if (tabTitle == '预约记录') {
// 获取预约数据
_this.getReservationData(param)
} else if (tabTitle == '预约记录') {
// 获取参与数据
_this.getParticipateData(param)
}
},
// 获取预约数据
getReservationData(param) {
let _this = this;
let {
pageNum,
pageSize,
userId
} = param
// 查询数据
selectReservationListByUserIdRq({
pageNum,
@ -55,10 +118,60 @@ Page({
}).then(res => {
console.log('selectReservationListByUserIdRq', res);
// 判断数据是否全部查询
let queryDataList = res.rows;
let queryDataList = res.page.records;
if (queryDataList && queryDataList.length > 0) {
// 更新参数
let reservationDataList = _this.data.reservationDataList.concat(_this.formartData(queryDataList));
let reservationPageNum = _this.data.reservationPageNum + 1;
_this.setData({
reservationPageNum,
reservationDataList,
})
} else {
_this.setData({
reservationIsDataAll: true
})
}
})
},
// 获取参与数据
getParticipateData(param) {
let _this = this;
let {
pageNum,
pageSize,
userId
} = param
// 查询数据
selectVisitorInvitationRecordRq({
pageNum,
pageSize,
userId
}).then(res => {
console.log('selectVisitorInvitationRecordRq', res);
// 判断数据是否全部查询
let queryDataList = res.page.records;
if (queryDataList && queryDataList.length > 0) {
// 更新参数
let participateDataList = _this.data.participateDataList.concat(_this.formartData(queryDataList));
let participatePageNum = _this.data.participatePageNum + 1;
_this.setData({
participatePageNum,
participateDataList,
})
} else {
_this.setData({
participateIsDataAll: true
})
}
})
},
// 格式化数据
queryDataList = queryDataList.map(item => {
formartData(queryDataList) {
// 格式化数据
return queryDataList.map(item => {
item.timeSlot = selfFormatTimeYMD(item.startTime) + ' ' + selfFormatTimeHM(item.startTime) + '~' + selfFormatTimeHM(item.endDate);
// 状态字体颜色
let statusColor = "#FFB119";
@ -113,19 +226,7 @@ Page({
item.statusColor = statusColor;
return item;
})
// 更新参数
let dataList = _this.data.dataList.concat(queryDataList);
let pageNum = _this.data.pageNum + 1;
_this.setData({
pageNum,
dataList,
})
} else {
_this.setData({
isDataAll: true
})
}
})
},
// 跳转-支付
@ -144,6 +245,24 @@ Page({
})
},
// 跳转-参与详情
jumpParticipateDetail(e) {
console.log('jumpParticipateDetail', e);
let id = e.currentTarget.dataset.id
wx.navigateTo({
url: "/pages/meeting/invite/invite?id=" + id,
})
},
// tab 点击切换
tabClickSwitch(event) {
console.log('tabClickSwitch', event);
let _this = this;
_this.setData({
tabTitle: event.detail.title
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/

View File

@ -1,7 +1,8 @@
{
"usingComponents": {
"van-tab": "@vant/weapp/tab/index",
"van-tabs": "@vant/weapp/tabs/index"
"van-tabs": "@vant/weapp/tabs/index",
"van-divider": "@vant/weapp/divider/index"
},
"navigationBarTitleText": "会议预约记录",
"onReachBottomDistance": 100

View File

@ -1,7 +1,7 @@
<view class="containerView public">
<van-tabs bind:click="onClick" color="#4e96f8" border animated title-active-color="black" title-inactive-color="gray">
<van-tabs bind:click="tabClickSwitch" color="#4e96f8" border animated title-active-color="black" title-inactive-color="gray">
<van-tab title="预约记录">
<view class="itemView" wx:for="{{dataList}}" wx:for-item="item" wx:key="*this">
<view class="itemView" wx:for="{{reservationDataList}}" wx:for-item="item" wx:key="*this">
<view class="headView">
<view class="number">{{item.reservationNumber}}</view>
<view class="status" style="color: {{item.statusColor}};">{{item.statusName}}</view>
@ -27,10 +27,29 @@
<view class="btn" wx:if="{{item.showDetail}}" bind:tap="jumpMeetingDetail" data-id="{{item.id}}">查看详情</view>
</view>
</view>
<view class="loadAllLine" wx:if="{{reservationIsDataAll}}">
<van-divider class="van-divider" customStyle="font-size: 26rpx;" contentPosition="center">数据已全部加载</van-divider>
</view>
</van-tab>
<van-tab title="参与记录">
<view class="itemView" wx:for="{{participateDataList}}" wx:for-item="item" wx:key="*this" bind:tap="jumpParticipateDetail" data-id="{{item.id}}">
<view class="headView">
<view class="number">{{item.reservationNumber}}</view>
<view class="status" style="color: {{item.statusColor}};">{{item.statusName}}</view>
</view>
<view class="contentView">
<image class="img" src="{{IMG_NAME + item.roomContent.indoorPicUrl}}" mode="aspectFill"></image>
<view class="msgView">
<view class="title">{{item.roomContent.capacityNum}}人间 | {{item.roomContent.roomName}} | {{item.roomContent.buildingName}}</view>
<view class="name">{{item.title}}</view>
<view class="time">{{item.timeSlot}}</view>
</view>
</view>
</view>
<view class="loadAllLine" wx:if="{{participateIsDataAll}}">
<van-divider class="van-divider" customStyle="font-size: 26rpx;" contentPosition="center">数据已全部加载</van-divider>
</view>
</van-tab>
</van-tabs>

View File

@ -96,7 +96,7 @@
color: #4e96f8;
}
.shareBtn{
.shareBtn {
position: absolute;
z-index: 1;
width: 100%;
@ -105,3 +105,7 @@
top: 0;
opacity: 0;
}
.loadAllLine {
margin-top: 80rpx;
}