功能完善
This commit is contained in:
1 parent
091cb9d76c
commit
3829c1671e
3 files changed
+114
-10
No files matched your search
@@ -20,15 +20,15 @@ VITE_OAUTH2_APP_CLIENT='mini:mini'
|
||||
# VITE_APP_DEV_SERVICE = https://stgl.pj.gov.cn/api # 域名线上
|
||||
#VITE_APP_DEV_SERVICE = http://59.202.170.152:81/api # 信创线上
|
||||
# VITE_APP_DEV_SERVICE = http://192.168.101.174:9999 # 邓-本地
|
||||
# VITE_APP_DEV_SERVICE = http://127.0.0.1:9999 # 邓-本地
|
||||
VITE_APP_DEV_SERVICE = http://123.157.250.162:8089/api # 测试线上
|
||||
VITE_APP_DEV_SERVICE = http://127.0.0.1:9999 # 邓-本地
|
||||
; VITE_APP_DEV_SERVICE = http://123.157.250.162:8089/api # 测试线上
|
||||
|
||||
# --------------------------- 开发环境 图片访问基础地址 ---------------------------
|
||||
# VITE_IMAGE_DEV_PATH = https://stgl.pj.gov.cn/api # 域名线上
|
||||
#VITE_IMAGE_DEV_PATH = http://59.202.170.152:81/api # 信创线上
|
||||
# VITE_IMAGE_DEV_PATH = http://192.168.101.174:9999 # 邓-本地
|
||||
#VITE_IMAGE_DEV_PATH = http://127.0.0.1:9999
|
||||
VITE_IMAGE_DEV_PATH = http://123.157.250.162:8089/api # 测试线上
|
||||
VITE_IMAGE_DEV_PATH = http://127.0.0.1:9999
|
||||
; VITE_IMAGE_DEV_PATH = http://123.157.250.162:8089/api # 测试线上
|
||||
|
||||
# --------------------------- 生产环境 api地址 ----------------------------------
|
||||
VITE_APP_PROD_SERVICE = https://stgl.pj.gov.cn/api # 域名线上
|
||||
|
||||
@@ -14,11 +14,13 @@
|
||||
|
||||
<!-- 预约卡片列表 -->
|
||||
<view v-if="reservationList.length">
|
||||
<view v-for="item in reservationList" :key="item.id" class="card">
|
||||
<view v-for="item in reservationList" :key="item.id" class="card">
|
||||
<view class="card-header">
|
||||
<image src="/static/icons/meeting.png" class="card-icon" />
|
||||
<text class="card-title">{{ item.title }}</text>
|
||||
<text class="card-status" :class="statusMap[item.checkStatus]?.class">{{ statusMap[item.checkStatus]?.text }}</text>
|
||||
<text class="card-status" :class="statusMap[item.checkStatus]?.class">{{ statusMap[item.checkStatus]?.text }}</text>
|
||||
<text v-if="isEnded(item)" class="tag ended">已结束</text>
|
||||
<text v-else-if="isExpired(item)" class="tag expired">已过期</text>
|
||||
</view>
|
||||
<view class="card-info">
|
||||
<view>预约日期:{{ item.bookingDate }}</view>
|
||||
@@ -28,7 +30,8 @@
|
||||
</view>
|
||||
<view class="card-footer">
|
||||
<view class="card-btn" @tap="viewDetail(item)">查看详情</view>
|
||||
<view v-if="item.checkStatus === 1 || item.checkStatus === 2" class="card-btn cancel" @tap="cancelBooking(item)">取消预约</view>
|
||||
<view v-if="Number(item.checkStatus) === 1" class="card-btn cancel" @tap="cancelBooking(item)">取消预约</view>
|
||||
<view v-if="Number(item.checkStatus) === 2 && !isEnded(item)" class="card-btn end" @tap="endMeeting(item)">结束会议</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -96,10 +99,75 @@ function cancelBooking(item: any) {
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
content: "确定要取消该预约吗?",
|
||||
success: (res) => {
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
// TODO: 调用取消预约接口
|
||||
uni.showToast({ title: "已取消(待接入接口)", icon: "none" })
|
||||
try {
|
||||
uni.showLoading({ title: "处理中..." })
|
||||
const response: any = await meetingRoomApi.cancelBooking(item.id)
|
||||
uni.hideLoading()
|
||||
|
||||
if (response.code === 0) {
|
||||
uni.showToast({ title: "预约已取消", icon: "success" })
|
||||
// 刷新列表
|
||||
fetchReservations()
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: response.msg || "操作失败",
|
||||
icon: "none"
|
||||
})
|
||||
}
|
||||
} catch (error) {
|
||||
uni.hideLoading()
|
||||
uni.showToast({ title: "操作失败,请重试", icon: "none" })
|
||||
console.error("取消预约失败:", error)
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 是否已结束
|
||||
function isEnded(item: any) {
|
||||
return Number(item.isConfirmEnd) === 1
|
||||
}
|
||||
|
||||
// 是否已过期(当前日期大于预约日期,且未结束)
|
||||
function isExpired(item: any) {
|
||||
try {
|
||||
if (!item.bookingDate) return false
|
||||
const todayStr = new Date().toISOString().split('T')[0]
|
||||
return todayStr > item.bookingDate && !isEnded(item)
|
||||
} catch (e) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
function endMeeting(item: any) {
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
content: "确定要结束该会议吗?",
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
try {
|
||||
uni.showLoading({ title: "处理中..." })
|
||||
const response: any = await meetingRoomApi.confirmEndMeeting(item.id)
|
||||
uni.hideLoading()
|
||||
|
||||
if (response.code === 0) {
|
||||
uni.showToast({ title: "会议已结束", icon: "success" })
|
||||
// 刷新列表
|
||||
fetchReservations()
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: response.msg || "操作失败",
|
||||
icon: "none"
|
||||
})
|
||||
}
|
||||
} catch (error) {
|
||||
uni.hideLoading()
|
||||
uni.showToast({ title: "操作失败,请重试", icon: "none" })
|
||||
console.error("结束会议失败:", error)
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
@@ -194,6 +262,20 @@ function viewDetail(item: any) {
|
||||
.card-status.cancel {
|
||||
color: #ff4d4f;
|
||||
}
|
||||
.tag {
|
||||
margin-left: 8rpx;
|
||||
font-size: 22rpx;
|
||||
padding: 2rpx 10rpx;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
.tag.ended {
|
||||
background: #f5f5f5;
|
||||
color: #999;
|
||||
}
|
||||
.tag.expired {
|
||||
background: #fff1f0;
|
||||
color: #ff4d4f;
|
||||
}
|
||||
.card-info {
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
@@ -215,6 +297,10 @@ function viewDetail(item: any) {
|
||||
background: #ffeaea;
|
||||
color: #ff4d4f;
|
||||
}
|
||||
.card-btn.end {
|
||||
background: #e6f7ff;
|
||||
color: #1890ff;
|
||||
}
|
||||
.empty {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@@ -69,6 +69,24 @@ export default {
|
||||
method: 'GET',
|
||||
}),
|
||||
|
||||
/**
|
||||
* 确认结束会议
|
||||
*/
|
||||
confirmEndMeeting: (bookingId: string) =>
|
||||
request({
|
||||
url: `/integrated/meetingBooking/app/confirm-end-meeting/${bookingId}`,
|
||||
method: 'POST',
|
||||
}),
|
||||
|
||||
/**
|
||||
* 取消预约
|
||||
*/
|
||||
cancelBooking: (bookingId: string) =>
|
||||
request({
|
||||
url: `/integrated/meetingRoom/app/cancel-booking/${bookingId}`,
|
||||
method: 'POST',
|
||||
}),
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user