diff --git a/miniapp/pages/login/login.vue b/miniapp/pages/login/login.vue index e703869..0fe6a77 100644 --- a/miniapp/pages/login/login.vue +++ b/miniapp/pages/login/login.vue @@ -92,7 +92,7 @@ async function onWxLogin() { const redirect = uni.getStorageSync('loginRedirect') if (redirect) { uni.removeStorageSync('loginRedirect') - uni.navigateTo({ url: redirect }) + uni.redirectTo({ url: redirect }) } else { uni.reLaunch({ url: '/pages/index/index' }) } diff --git a/miniapp/pages/message/chat.vue b/miniapp/pages/message/chat.vue index bf57566..1bc3b69 100644 --- a/miniapp/pages/message/chat.vue +++ b/miniapp/pages/message/chat.vue @@ -331,7 +331,10 @@ onNewMessage((msgList) => { for (const msg of msgList) { if (msg.from === this.targetImUserId || msg.from === this.imUserId) { - this.chatMessages.push(formatIMMessage(msg, this.imUserId)) + const formatted = formatIMMessage(msg, this.imUserId) + // 按订单ID过滤 + if (this.orderId && formatted.orderId && String(formatted.orderId) !== String(this.orderId)) continue + this.chatMessages.push(formatted) } } this.scrollToBottom() @@ -350,7 +353,11 @@ this.loadingHistory = true try { const res = await getMessageList(this.targetImUserId, this.nextReqMessageID) - const formatted = res.messageList.map(m => formatIMMessage(m, this.imUserId)) + const allFormatted = res.messageList.map(m => formatIMMessage(m, this.imUserId)) + // 按订单ID过滤:只显示当前订单的消息,或没有orderId的旧消息 + const formatted = this.orderId + ? allFormatted.filter(m => !m.orderId || String(m.orderId) === String(this.orderId)) + : allFormatted this.chatMessages = [...formatted, ...this.chatMessages] this.nextReqMessageID = res.nextReqMessageID this.historyCompleted = res.isCompleted @@ -377,7 +384,7 @@ const text = this.inputText this.inputText = '' try { - const msg = await sendTextMessage(this.targetImUserId, text) + const msg = await sendTextMessage(this.targetImUserId, text, this.orderId) this.chatMessages.push(formatIMMessage(msg, this.imUserId)) this.scrollToBottom() } catch (e) { @@ -410,7 +417,7 @@ sourceType: ['album', 'camera'], success: async (res) => { try { - const msg = await sendImageMessage(this.targetImUserId, res.tempFilePaths[0]) + const msg = await sendImageMessage(this.targetImUserId, res.tempFilePaths[0], this.orderId) this.chatMessages.push(formatIMMessage(msg, this.imUserId)) this.scrollToBottom() } catch (e) { @@ -477,7 +484,7 @@ difference: res.difference, status: res.status, description: `发起了${changeTypeLabel}改价申请` - }) + }, this.orderId) } this.chatMessages.push({ id: `pc_${res.id}`, diff --git a/miniapp/pages/message/message.vue b/miniapp/pages/message/message.vue index 5877995..be7de8b 100644 --- a/miniapp/pages/message/message.vue +++ b/miniapp/pages/message/message.vue @@ -52,13 +52,16 @@ :key="item.orderId" @click="goChat(item)" > - + - {{ item.nickname || '用户' }} - {{ formatTime(item.lastMessageTime) }} + {{ item.targetNickname || '用户' }} + {{ formatTime(item.lastTime) }} - {{ item.lastMessage || '' }} + {{ getOrderLabel(item) }} + + + {{ getStatusLabel(item.status) }} @@ -71,8 +74,7 @@