feat(order): 派单实时通知 + 订单站内聊天

- 新派单(余额支付立即入池 / 微信支付确认后入池)向在线认证大神推送 ORDER_POOL 站内通知;雷达 20s、接单大厅 30s 自动轮询

- 新增 order_messages 表与订单会话接口:仅买家与已认领大神可访问,服务端拦截手机号与违规内容,消息落库并推送 CHAT 通知

- 新增 pages/order/chat 聊天页(3s 轮询、已读、发送),买家订单「联系大神」与大神工作台「联系老板」接入

- 114 套件/744 用例全绿;线上实测聊天/越权/手机号拦截/新单通知均通过,测试数据已清理
这个提交包含在:
xcbyy
2026-10-22 08:52:12 +08:00
父节点 33b6a3ea7d
当前提交 aca35db200
共有 13 个文件被更改,包括 698 次插入 和 9 次删除

查看文件

@@ -246,7 +246,7 @@
<script setup>
import { ref, computed, onMounted, onUnmounted } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import { onShow, onHide } from '@dcloudio/uni-app';
import AppTabBar from '@/components/CustomTabBar.vue';
import { ICONS } from '@/common/icons.js';
import { getCurrentThemeKey, applyThemeToNativeUI } from '@/common/theme.js';
@@ -399,6 +399,22 @@ onMounted(() => {
loadHallData();
});
let hallPollTimer = null;
const stopHallPolling = () => {
if (hallPollTimer) {
clearInterval(hallPollTimer);
hallPollTimer = null;
}
};
const startHallPolling = () => {
stopHallPolling();
hallPollTimer = setInterval(() => {
void loadHallData();
}, 30000);
};
onShow(() => {
if (!isExpertCertified()) {
uni.showToast({
@@ -416,10 +432,16 @@ onShow(() => {
applyThemeToNativeUI(currentThemeKey.value);
uni.hideTabBar({ animation: false, fail: () => {} });
loadHallData();
startHallPolling();
});
onHide(() => {
stopHallPolling();
});
onUnmounted(() => {
uni.$off('theme-change', onThemeChanged);
stopHallPolling();
});

查看文件

@@ -183,7 +183,7 @@
<script setup>
import { ref, computed, onMounted, onUnmounted } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import { onShow, onHide } from '@dcloudio/uni-app';
import AppTabBar from '@/components/CustomTabBar.vue';
import { ICONS } from '@/common/icons.js';
import { getCurrentThemeKey, applyThemeToNativeUI } from '@/common/theme.js';
@@ -315,6 +315,23 @@ onMounted(() => {
uni.$on('theme-change', onThemeChanged);
});
let pollTimer = null;
const stopPolling = () => {
if (pollTimer) {
clearInterval(pollTimer);
pollTimer = null;
}
};
const startPolling = () => {
stopPolling();
if (!isRadarActive.value) return;
pollTimer = setInterval(() => {
if (isRadarActive.value) void loadNearbyOrdersFromPool();
}, 20000);
};
onShow(() => {
if (!isExpertCertified()) {
uni.showToast({
@@ -332,10 +349,16 @@ onShow(() => {
applyThemeToNativeUI(currentThemeKey.value);
uni.hideTabBar({ animation: false, fail: () => {} });
refreshLocation();
startPolling();
});
onHide(() => {
stopPolling();
});
onUnmounted(() => {
uni.$off('theme-change', onThemeChanged);
stopPolling();
});
@@ -364,6 +387,11 @@ const handleRelocate = async () => {
const toggleRadarSwitch = (e) => {
isRadarActive.value = e.detail.value;
if (isRadarActive.value) {
startPolling();
} else {
stopPolling();
}
uni.showToast({
title: isRadarActive.value ? '已开启 5km 智能巡航接单' : '已挂起智能巡航',
icon: isRadarActive.value ? 'success' : 'none'

查看文件

@@ -360,7 +360,7 @@
<view class="order-progress-row">
<text class="prog-text">状态:{{ order.statusText }}</text>
<view class="order-btns">
<button class="btn-chat btn-active" @click="chatWithBuyer">联系老板</button>
<button class="btn-chat btn-active" @click="chatWithBuyer(order)">联系老板</button>
<button class="btn-complete btn-active" @click="completeOrder(order.id)">
申请验收结算
</button>
@@ -1024,7 +1024,12 @@ const handleRejectOrder = (order) => {
};
const chatWithBuyer = () => {
const chatWithBuyer = (order) => {
const orderId = order && order.id;
if (orderId) {
uni.navigateTo({ url: `/pages/order/chat?orderId=${encodeURIComponent(orderId)}` });
return;
}
uni.showActionSheet({
itemList: ['联系 7x24h 官方客服'],
success: (res) => {