diff --git a/admin/src/api/tcm.ts b/admin/src/api/tcm.ts
index 87725a67..55a698a0 100644
--- a/admin/src/api/tcm.ts
+++ b/admin/src/api/tcm.ts
@@ -221,7 +221,7 @@ export function generateOrderQrcode(params: any) {
// ========== IM / 企业微信聊天记录 ==========
/** 腾讯云 IM 单聊漫游消息(诊单维度:患者 patient_* 与医生 doctor_*) */
-export function getImChatMessages(params: { diagnosis_id: number }) {
+export function getImChatMessages(params: { diagnosis_id: number; only_archived?: 0 | 1 }) {
return request.get({ url: '/tcm.diagnosis/getImChatMessages', params })
}
diff --git a/admin/src/views/consumer/prescription/index.vue b/admin/src/views/consumer/prescription/index.vue
index 0a831575..5c1cdaec 100644
--- a/admin/src/views/consumer/prescription/index.vue
+++ b/admin/src/views/consumer/prescription/index.vue
@@ -1448,6 +1448,7 @@ const createOrderRules: FormRules = {
patient_id: [{ required: true, message: '请选择诊单患者', trigger: 'change' }],
recipient_name: [{ required: true, message: '请输入收货人', trigger: 'blur' }],
recipient_phone: [{ required: true, message: '请输入收货手机', trigger: 'blur' }],
+ region: [{ required: true, message: '请选择省/市/区', trigger: 'change', type: 'array' }],
shipping_address: [{ required: true, message: '请输入收货地址', trigger: 'blur' }],
fee_type: [{ required: true, message: '请选择费用类别', trigger: 'change' }],
amount: [
diff --git a/admin/src/views/consumer/prescription/order_list.vue b/admin/src/views/consumer/prescription/order_list.vue
index 9b945386..4eea0cae 100644
--- a/admin/src/views/consumer/prescription/order_list.vue
+++ b/admin/src/views/consumer/prescription/order_list.vue
@@ -2243,6 +2243,7 @@ async function loadEditPaidOrders(diagnosisId: number, prescriptionOrderId?: num
const editRules: FormRules = {
recipient_name: [{ required: true, message: '请输入收货人', trigger: 'blur' }],
recipient_phone: [{ required: true, message: '请输入手机', trigger: 'blur' }],
+ region: [{ required: true, message: '请选择省/市/区', trigger: 'change', type: 'array' }],
shipping_address: [{ required: true, message: '请输入地址', trigger: 'blur' }],
fee_type: [{ required: true, message: '请选择费用类别', trigger: 'change' }],
amount: [
diff --git a/admin/src/views/tcm/diagnosis/components/ImChatRecordPanel.vue b/admin/src/views/tcm/diagnosis/components/ImChatRecordPanel.vue
index 29c72975..27289296 100644
--- a/admin/src/views/tcm/diagnosis/components/ImChatRecordPanel.vue
+++ b/admin/src/views/tcm/diagnosis/components/ImChatRecordPanel.vue
@@ -9,9 +9,9 @@
-
+
- 刷新
+ 刷新(同步云端最新)
@@ -19,44 +19,42 @@
- {{ senderLabel(row) }}
- {{ formatTime(row.time) }}
-
- {{ typeLabel(row) }}
+ {{ senderLabel(item.raw) }}
+ {{ formatTime(item.raw.time) }}
+
+ {{ item.tag }}
-
+
-
-
- {{ row.file_name || '打开文件' }}
+
+
+ {{ item.raw.file_name || '打开文件' }}
-
-
-
{{ fr.main }}
-
{{ fr.sub }}
-
-
- {{ row.text }}
-
- {{ row.text }}
- (无法展示该消息类型)
-
+
+
{{ item.friendly.main }}
+
{{ item.friendly.sub }}
+
+
+ {{ item.raw.text }}
+
+ {{ item.raw.text }}
+ (无法展示该消息类型)
@@ -80,12 +78,43 @@ const props = defineProps<{
}>()
const loading = ref(false)
-const rows = shallowRef
([])
+const rawRows = shallowRef([])
const patientImId = ref('')
const patientName = ref('')
const patientImHint = computed(() => patientImId.value || 'patient_*')
+interface EnrichedRow {
+ raw: any
+ friendly: FriendlyParse | null
+ tag: string
+}
+
+const MSG_TYPE_LABELS: Record = {
+ text: '',
+ image: '图片',
+ file: '文件',
+ sound: '语音',
+ video: '视频',
+ location: '位置',
+ custom: '自定义',
+ face: '表情',
+ other: ''
+}
+
+const rows = computed(() =>
+ rawRows.value.map((row) => {
+ const fr = parseImFriendly(row)
+ let tag = ''
+ if (fr?.tag) {
+ tag = fr.tag
+ } else {
+ tag = MSG_TYPE_LABELS[row.msg_type] || (row.msg_type !== 'other' ? row.msg_type : '')
+ }
+ return { raw: row, friendly: fr, tag }
+ })
+)
+
function formatTime(ts: number | undefined) {
if (ts == null || !ts) return '—'
const sec = ts > 1e12 ? Math.floor(ts / 1000) : ts
@@ -103,23 +132,6 @@ function parseImFriendly(row: any): FriendlyParse | null {
return null
}
-function typeLabel(row: any) {
- const fr = parseImFriendly(row)
- if (fr?.tag) return fr.tag
- const m: Record = {
- text: '',
- image: '图片',
- file: '文件',
- sound: '语音',
- video: '视频',
- location: '位置',
- custom: '自定义',
- face: '表情',
- other: ''
- }
- return m[row.msg_type] || (row.msg_type !== 'other' ? row.msg_type : '')
-}
-
function senderLabel(row: any) {
if (row.is_from_doctor) {
return row.from_staff_name ? `医生(${row.from_staff_name})` : '医生/员工'
@@ -127,35 +139,42 @@ function senderLabel(row: any) {
return patientName.value ? `患者(${patientName.value})` : '患者'
}
-async function load() {
+async function load(onlyArchived = false) {
if (!props.diagnosisId) return
loading.value = true
try {
- const res = (await getImChatMessages({ diagnosis_id: props.diagnosisId })) as {
+ const res = (await getImChatMessages({
+ diagnosis_id: props.diagnosisId,
+ only_archived: onlyArchived ? 1 : 0
+ })) as {
lists?: any[]
patient_im_id?: string
patient_name?: string
}
- rows.value = res?.lists || []
+ rawRows.value = res?.lists || []
patientImId.value = res?.patient_im_id || ''
patientName.value = res?.patient_name || ''
} catch (e) {
console.error(e)
- rows.value = []
+ rawRows.value = []
} finally {
loading.value = false
}
}
+function refreshLive() {
+ load(false)
+}
+
watch(
() => props.diagnosisId,
() => {
- load()
+ load(true)
},
{ immediate: true }
)
-defineExpose({ refresh: load })
+defineExpose({ refresh: refreshLive })