{
timeLeft.value = calculateTimeLeft();
prescriptionElapsed.value = calculatePrescriptionElapsed();
-
+
clearInterval(intervalId);
intervalId = setInterval(updateCountdown, 1000);
}
@@ -146,4 +146,4 @@ watch(
font-weight: bold;
margin-left: 8px;
}
-
\ No newline at end of file
+
diff --git a/src/views/hlw-hospital/chat-home/index.vue b/src/views/hlw-hospital/chat-home/index.vue
index a4b22ca..4024de9 100644
--- a/src/views/hlw-hospital/chat-home/index.vue
+++ b/src/views/hlw-hospital/chat-home/index.vue
@@ -13,7 +13,7 @@
:order="order"
@handRefundConsultation="handRefundConsultation"
@endConsultation="endConsultation"
- @countdownFinished="endConsultation"
+ @countdownFinished="endConsultation('COUNTDOWN')"
@onMessageListUpdated="onMessageListUpdated"
>
请在左侧选择会话,进入聊天
@@ -219,19 +219,28 @@ async function refund(arr) {
rejectVisible.value = false;
}
// 倒计时结束
-async function endConsultation() {
- // 如果有正在进行的视频问诊,先结束视频问诊
- if (videoConsultStore.status !== "idle" && videoConsultStore.activeOrderId === order.value.orderId) {
+async function endConsultation(triggerSource = "MANUAL") {
+ const hasActiveVideoConsult =
+ videoConsultStore.status !== "idle" &&
+ videoConsultStore.activeOrderId === order.value.orderId;
+ // 手动结束时保持原流程;倒计时结束需要先由后端确认确实已过期。
+ if (triggerSource === "MANUAL" && hasActiveVideoConsult) {
console.log("[VIDEO][PC] endConsultation: ending video consult before finishing order");
await videoConsultStore.leaveRoom({ reason: "consult_ended", skipSendSignal: false });
}
const { data, success, message } = await finishConsultOrder({
orderId: order.value.orderId,
+ triggerSource,
});
if (success) {
+ if (triggerSource === "COUNTDOWN" && hasActiveVideoConsult) {
+ await videoConsultStore.leaveRoom({ reason: "consult_ended", skipSendSignal: false });
+ }
order.value.orderStatus = "finished";
order.value.status = "已结束";
+ } else if (triggerSource === "COUNTDOWN" && data && data.expired === false) {
+ order.value.expireTime = data.expireTime;
} else {
ElMessage.warning(message);
}