feat(distribution): 分销站点消息中心与钱包提现多租户独立分支隔离

- 新增 000070 数据库迁移:支持 chat_conversations、wallet_accounts、wallet_ledger、withdrawal_requests 按 distribution_site_id 隔离
- 消息中心:会话列表、未读数统计、站点专属客服及订单群聊与主站实现双向完全隔离
- 资金账户与提现:独立按 (user_id, distribution_site_id) 建账,分销订单自动结算至对应分站钱包,提现与流水相互独立
- 前台界面:Axios 自动透传 X-Distribution-Site-Code,钱包、提现与消息页面呈现分站专属标牌与独立说明
This commit is contained in:
yml2213
2026-09-07 18:11:27 +08:00
parent 72b805c499
commit e024319860
35 changed files with 1109 additions and 298 deletions
@@ -5,8 +5,10 @@ import { showToast } from 'vant'
import MobileBottomNav from '@/components/MobileBottomNav.vue'
import { fetchChats, type ChatConversation } from '@/features/chats/api/chats'
import { formatDateMinute } from '@/shared/utils/time'
import { useDistributionSiteStore } from '@/stores/distributionSite'
const router = useRouter()
const distributionStore = useDistributionSiteStore()
const loading = ref(false)
const refreshing = ref(false)
const finished = ref(false)
@@ -26,7 +28,11 @@ async function loadChats(isRefresh = false) {
}
loading.value = true
try {
const res = await fetchChats(page.value, pageSize)
const res = await fetchChats(
page.value,
pageSize,
distributionStore.isDistribution ? distributionStore.siteCode : undefined
)
conversations.value = isRefresh ? res.items : [...conversations.value, ...res.items]
total.value = res.total
if (conversations.value.length >= res.total || res.items.length === 0) {
@@ -85,7 +91,9 @@ const unreadTotal = computed(() =>
<button class="back-btn" type="button" @click="router.back()">
<van-icon name="arrow-left" :size="20" />
</button>
<h1>消息</h1>
<h1>
{{ distributionStore.isDistribution ? `${distributionStore.siteName} · 消息` : '消息' }}
</h1>
<span class="header-count">{{ unreadTotal > 0 ? `${unreadTotal} 未读` : '' }}</span>
</header>