diff --git a/pages/message/components/chat-input.vue b/pages/message/components/chat-input.vue index f8f7ac0..d31c866 100644 --- a/pages/message/components/chat-input.vue +++ b/pages/message/components/chat-input.vue @@ -78,6 +78,7 @@ const props = defineProps({ userId: { type: String, default: "" }, patientId: { type: String, default: "" }, corpId: { type: String, default: "" }, + orderStatus: { type: String, default: "" }, }); // Emits @@ -422,39 +423,50 @@ const handleOpenConsult = () => { }); }; -const morePanelButtons = [ - { text: "照片", icon: "/static/icon/zhaopian.png", action: showImagePicker }, - { - text: "回访任务", - icon: "/static/icon/huifangrenwu.png", - action: showFollowUpTasks, - }, - { - text: "常用语", - icon: "/static/icon/changyongyu.png", - action: goToCommonPhrases, - }, - { - text: "宣教", - icon: "/static/icon/xuanjiaowenzhang.png", - action: goToArticleList, - }, - { - text: "问卷", - icon: "/static/icon/wenjuan.png", - action: goToSurveyList, - }, - { - text: "结束问诊", - icon: "/static/icon/jieshuzixun.png", - action: handleEndConsult, - }, - { - text: "开启会话", - icon: "/static/icon/kaiqihuihua.png", - action: handleOpenConsult, - }, -]; +const morePanelButtons = computed(() => { + const buttons = [ + { text: "照片", icon: "/static/icon/zhaopian.png", action: showImagePicker }, + { + text: "回访任务", + icon: "/static/icon/huifangrenwu.png", + action: showFollowUpTasks, + }, + { + text: "常用语", + icon: "/static/icon/changyongyu.png", + action: goToCommonPhrases, + }, + { + text: "宣教", + icon: "/static/icon/xuanjiaowenzhang.png", + action: goToArticleList, + }, + { + text: "问卷", + icon: "/static/icon/wenjuan.png", + action: goToSurveyList, + }, + ]; + + // 根据订单状态显示不同的按钮 + if (props.orderStatus === "finished") { + // 已结束状态:显示"开启会话"按钮 + buttons.push({ + text: "开启会话", + icon: "/static/icon/kaiqihuihua.png", + action: handleOpenConsult, + }); + } else { + // 处理中状态:显示"结束问诊"按钮 + buttons.push({ + text: "结束问诊", + icon: "/static/icon/jieshuzixun.png", + action: handleEndConsult, + }); + } + + return buttons; +}); function handleInputFocus() { console.log("handleInputFocus"); diff --git a/pages/message/components/system-message.vue b/pages/message/components/system-message.vue index de4a907..df33d00 100644 --- a/pages/message/components/system-message.vue +++ b/pages/message/components/system-message.vue @@ -75,6 +75,8 @@ const text = computed(() => { return '问诊已结束'; case 'consult_timeout': return '问诊已超时'; + case 'consult_reopened': + return '会话已重新开启'; default: return systemMessageData.value.content || '[系统消息]'; } diff --git a/pages/message/index.vue b/pages/message/index.vue index f40deff..af3b417 100644 --- a/pages/message/index.vue +++ b/pages/message/index.vue @@ -163,6 +163,7 @@ :patientId="patientId" :corpId="corpId" :patientInfo="patientInfo" + :orderStatus="orderStatus" @scrollToBottom="() => scrollToBottom(true)" @messageSent="() => scrollToBottom(true)" @endConsult="handleEndConsult" diff --git a/utils/api.js b/utils/api.js index 618ee68..ba46fa2 100644 --- a/utils/api.js +++ b/utils/api.js @@ -94,6 +94,7 @@ const urlsConfig = { getChatRecordsByGroupId: "getChatRecordsByGroupId", sendConsultRejectedMessage: "sendConsultRejectedMessage", endConsultation: "endConsultation", + openConsultation: "openConsultation", getGroupListByGroupId: "getGroupListByGroupId", acceptConsultation: "acceptConsultation", sendArticleMessage: "sendArticleMessage",