feat(order): 派单实时通知 + 订单站内聊天
- 新派单(余额支付立即入池 / 微信支付确认后入池)向在线认证大神推送 ORDER_POOL 站内通知;雷达 20s、接单大厅 30s 自动轮询 - 新增 order_messages 表与订单会话接口:仅买家与已认领大神可访问,服务端拦截手机号与违规内容,消息落库并推送 CHAT 通知 - 新增 pages/order/chat 聊天页(3s 轮询、已读、发送),买家订单「联系大神」与大神工作台「联系老板」接入 - 114 套件/744 用例全绿;线上实测聊天/越权/手机号拦截/新单通知均通过,测试数据已清理
这个提交包含在:
@@ -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'
|
||||
|
||||
在新工单中引用
屏蔽一个用户