From 1bce4681985c31c25e2d98492d265fb03701f809 Mon Sep 17 00:00:00 2001 From: xiaoning <1097449274@qq.com> Date: Fri, 6 Nov 2026 07:19:43 +0000 Subject: [PATCH] revert 0067a6a3c15d99b655c320d843c9292f2e5475c7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit revert 修改预约相关功能 --- pages/book/book.vue | 193 +++++------- pages/book/bookinfo.vue | 11 +- pages/book/booklist.vue | 21 +- pages/book/bookteacher.vue | 3 - pages/chatbox/im-user-info.vue | 50 +++- pages/components/member-card-scroll.vue | 34 +-- pages/components/member-card.vue | 16 +- pages/user/cardDetail.vue | 2 +- pages/user/courselist.vue | 7 +- pages/user/mycourseinfo.vue | 378 ++---------------------- pages/user/user.vue | 116 ++++++-- 11 files changed, 269 insertions(+), 562 deletions(-) diff --git a/pages/book/book.vue b/pages/book/book.vue index 8f14758..a9d4771 100644 --- a/pages/book/book.vue +++ b/pages/book/book.vue @@ -10,7 +10,7 @@ - + @@ -51,8 +51,8 @@ - - + + @@ -73,53 +73,46 @@ - - - 无对应会员卡可使用 - - - - - {{ item.courseName}} - - 需扣 {{ selectedCard.memberChargeType === 'total_fee' - ? '¥' + selectedCard.chargeFee - : selectedCard.chargeCnt + '次'}} - - - - - 本次使用卡片: - - {{ effectiveCardName }} - - 默认 - + + + {{ currentCourse.courseName }} + + 需扣 {{ currentCourse.deductType === 'count' + ? currentCourse.deductCount + '次' + : '¥' + currentCourse.deductAmount }} + - - - - - - + + + 本次使用卡片: + + {{ effectiveCardName }} + + 默认 - + + + + + + - @@ -142,27 +135,31 @@ export default { userid: "", id: "", item: { - courseTimeId: null, - claName: "", - courseName: "", - storeName: "", + courseTimeId: 1935590320322428931, + claName: "普拉提A班", + courseName: "普拉提", + storeName: "慢瑜伽-三台子店", pic: null, - claDate: "", - weekDay: "", - startTime: "", - endTime: "", - staffName: "", - studentCount: null, + claDate: "2025-10-01", + weekDay: "星期二", + startTime: "08:00", + endTime: "09:30", + staffName: "冉洪涛老师", + studentCount: 1, roomName: null, - claColor: "", - claTimeStatus: "", - bookAttendCnt: "", - atClassCnt: "", - lessCnt: "" + claColor: "#409EFF", + claTimeStatus: "1", + bookAttendCnt: "1", + atClassCnt: "5", + lessCnt: "3" }, remark: null, memberCards: [], currentCourse: { + courseName: '普拉提A班', + deductType: 'COUNT', + deductCount: 1, + deductAmount: 0 }, defaultCardId: null, // ✅ 用户手动选中的卡(父组件持有) @@ -213,9 +210,9 @@ export default { isCardUsable(card) { if (!card) return false; if (card.status && card.status !== 'ACTIVE') return false; - if (card.expiryDate) { + if (card.expireDate) { const now = new Date(); - const expire = new Date(card.expiryDate.replace(/-/g, '/')); + const expire = new Date(card.expireDate.replace(/-/g, '/')); if (now > expire) return false; } const type = this.currentCourse.deductType; @@ -238,19 +235,15 @@ export default { // ✅ 打开弹窗:重置手动选择,用默认卡 async openCardSelect(item) { var user = myCache('userInfo'); - item.visitStore=user.visitStore; - console.log('item',item) const { data: memberCards } = await uni.$http.post("/api/memberCard/getMemberCardListByCourseTimeId", - item); + {visitStore:user.visitStore, + courseId:item.courseId + }); + console.log("memberCards",memberCards) //如果为空 则没有适合的卡片 this.memberCards = memberCards.data - console.log('this.memberCards',this.memberCards) - if(this.memberCards&&this.memberCards.length > 0){ - this.selectedCard = this.memberCards[0]; - }else{ - this.selectedCard = null; - } + this.selectedCard = null; this.$refs.cardPopup.open(); }, @@ -259,53 +252,37 @@ export default { }, async confirmSelect() { + // ✅ 直接从父组件 computed 拿有效卡 const card = this.effectiveCard; if (!card) { uni.showToast({ title: '无可用会员卡', icon: 'none' }); return; } - // 开启loading - uni.showLoading({ - title: '预约中...', - mask: true // 遮罩,防止重复点击 + const { data: res } = await uni.$http.post('/api/course/bookCourse', { + courseTimeId: this.item.courseTimeId, + cardId: card.id }); - try { - const { data: res } = await uni.$http.post('/api/course/bookCourse', { - courseTimeId: this.item.courseTimeId, - memberCardId: card.memberCardId, - memberChargeType: this.selectedCard.memberChargeType, - chargeCnt: this.selectedCard.chargeCnt, - chargeFee: this.selectedCard.chargeFee + if (res && res.success) { + myCache('courserefresh', 1); + uni.showModal({ + title: '提示', + content: '课程已预约!', + cancelText: '返回', + confirmText: '确定', + success: ress => { + uni.navigateBack({ delta: 1 }); + } }); - if (res && res.success) { - myCache('courserefresh', 1); - this.closeCardSelect(); - this.$refs.uToast.show({ - title: '课程预约成功,请到 我的预约-预约中 查看', - type: 'success', - duration: 2000 - }); - } else { - this.$refs.uToast.show({ - title: res.message ? res.message : '课程预约失败!', - type: 'error', - duration: 2000 - }); - } - } catch (err) { - // 网络异常捕获 - this.$refs.uToast.show({ - title: '预约请求异常,请稍后重试', - type: 'error', - duration: 2000 + } else { + uni.showModal({ + title: '提示', + content: res.message ? res.message : '课程预约失败!', + cancelText: '取消', + confirmText: '确定' }); - } finally { - // 不管成功失败、报错,都关闭loading - uni.hideLoading(); } }, - formatTime(timeStr) { return timeStr.slice(0, 5); }, @@ -842,11 +819,5 @@ export default { border: none; &::after { border: none; } } - .empty-tip { - padding: 60rpx 20rpx; - text-align: center; - font-size: 28rpx; - color: #999; - } diff --git a/pages/book/bookinfo.vue b/pages/book/bookinfo.vue index b865925..ada0ea6 100644 --- a/pages/book/bookinfo.vue +++ b/pages/book/bookinfo.vue @@ -23,24 +23,19 @@ 预约状态: - 预约中 + 教练确认 预约中 - 预约成功,待上课 + 待上课 已完成 已取消 - - 签到状态: - 已签到 - 未签到 - 授课教练: {{info.teacherName }} 上课教室: - {{info.roomName?info.roomName:'待定'}} + {{info.roomName }} 上课时间: diff --git a/pages/book/booklist.vue b/pages/book/booklist.vue index 9747bac..59090d4 100644 --- a/pages/book/booklist.vue +++ b/pages/book/booklist.vue @@ -19,13 +19,11 @@ - - 预约中 + 教练确认 预约中 - 预约成功,待上课 + 待上课 已完成 已取消 - 预约失败 @@ -37,8 +35,7 @@ {{item.courseName}} {{item.claName}} 教练:{{item.teacherName || '-'}} 上课时间:{{ item.claDate+' '+item.startTime+'-'+item.endTime}} - 教室:{{item.roomName?item.roomName:'待定'}} - 使用会员卡号:{{item.cardNo}} + 教室:{{item.roomName}} @@ -52,7 +49,7 @@ - + @@ -680,7 +677,7 @@ import { mapState, mapGetters, mapActions } from 'vuex'; // 取消预约 cancelyydo(e){ console.log(e); - // var id= e.currentTarget.dataset.id; + var id= e.currentTarget.dataset.id; var that = this; //取消预约 uni.showModal({ @@ -690,14 +687,16 @@ import { mapState, mapGetters, mapActions } from 'vuex'; confirmText: '确定', success: ress => { if (ress.confirm) { - that.delyydo(e); + that.delyydo(id); } } }); }, // 取消预约 - async delyydo(e){ - var param=e; + async delyydo(id){ + var param={ + "courseTimeId":id + }; uni.showToast({ title: '取消中...', icon: 'success', diff --git a/pages/book/bookteacher.vue b/pages/book/bookteacher.vue index 73d1244..13aa2f3 100644 --- a/pages/book/bookteacher.vue +++ b/pages/book/bookteacher.vue @@ -12,12 +12,10 @@ 性别:{{item.sex==2?'男':(item.sex==1?'女':'未知')}} 电话:{{item.phone?item.phone:'-'}} - 会员卡号:{{item.cardNo?item.cardNo:'-'}} - 教练确认 预约中 待上课 @@ -141,7 +139,6 @@ // 全部 this.loadStatus="noMore"; this.list=res.data; - console.log('this.list',this.list) this.$forceUpdate(); } else{ diff --git a/pages/chatbox/im-user-info.vue b/pages/chatbox/im-user-info.vue index a3ed2e1..91f9ebb 100644 --- a/pages/chatbox/im-user-info.vue +++ b/pages/chatbox/im-user-info.vue @@ -8,6 +8,16 @@ ID:{{ userInfo.id || userInfo.userId || '-' }} + + + + + + + + + + 加入黑名单 @@ -74,7 +84,45 @@ export default { console.error('查询黑名单状态失败', e) } }, + /** + * switch点击,不直接改状态,弹出确认弹窗 + */ + onBlackSwitchChange(e) { + // e.detail.value 是用户想要切换到的目标状态 + const targetStatus = e.detail.value + const title = targetStatus ? '加入黑名单' : '取消黑名单' + const content = targetStatus + ? '加入黑名单后,对方将无法给你发送消息,确定?' + : '确定将该用户移出黑名单?' + + uni.showModal({ + title, + content, + success: async (res) => { + if (!res.confirm) { + // 用户点取消,不做任何操作,switch会自动回弹回旧状态,无需手动赋值 + return + } + try { + const url = targetStatus ? '/api/blacklist/add?targetUid=' : '/api/blacklist/cancel?targetUid=' + await uni.$http.post(`${url}${this.userId}`) + // 接口成功才更新本地状态 + this.isBlacked = targetStatus + uni.showToast({ + title: this.isBlacked ? '已加入黑名单' : '已取消黑名单', + icon: 'none' + }) + } catch (err) { + uni.showToast({ title: '操作失败', icon: 'none' }) + } + } + }) + }, onSendMessage() { + // if (this.isBlacked) { + // uni.showToast({ title: '你已将对方加入黑名单', icon: 'none' }) + // return + // } let chat = { type: 'PRIVATE', targetId: this.userId, @@ -142,7 +190,7 @@ export default { onBackPress(e) { // 来源是左上角返回 / 安卓返回键 if(e.from === 'backbutton'){ - if(this.isBlacked && this.chatIndex){ + if(this.isBlacked){ // 拉黑成功,自定义跳转chat this.goBackChat() return true // return true 阻止原生默认返回 diff --git a/pages/components/member-card-scroll.vue b/pages/components/member-card-scroll.vue index 61a5d35..a467312 100644 --- a/pages/components/member-card-scroll.vue +++ b/pages/components/member-card-scroll.vue @@ -1,7 +1,7 @@