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:
@@ -23,8 +23,10 @@ import { formatCent, formatMoney, yuanToCent } from '@/shared/utils/money'
|
||||
import { formatDateMinute } from '@/shared/utils/time'
|
||||
import alipayReceiveQrExample from '@/assets/alipay-receive-qr-example.png'
|
||||
import wechatReceiveQrExample from '@/assets/wechat-receive-qr-example.png'
|
||||
import { useDistributionSiteStore } from '@/stores/distributionSite'
|
||||
|
||||
const router = useRouter()
|
||||
const distributionStore = useDistributionSiteStore()
|
||||
|
||||
const loading = ref(false)
|
||||
const submitting = ref(false)
|
||||
@@ -104,10 +106,11 @@ onMounted(loadData)
|
||||
async function loadData() {
|
||||
loading.value = true
|
||||
try {
|
||||
const siteCode = distributionStore.isDistribution ? distributionStore.siteCode : undefined
|
||||
const [balanceData, accountsData, withdrawalsData] = await Promise.all([
|
||||
fetchWalletBalance(),
|
||||
fetchWalletBalance(siteCode),
|
||||
fetchPaymentAccounts(1, 100),
|
||||
fetchWithdrawals(1, 20),
|
||||
fetchWithdrawals(1, 20, siteCode),
|
||||
])
|
||||
account.value = balanceData
|
||||
paymentAccounts.value = accountsData.items
|
||||
@@ -142,10 +145,13 @@ async function handleSubmit() {
|
||||
|
||||
submitting.value = true
|
||||
try {
|
||||
await createWithdrawal({
|
||||
payment_account_id: withdrawForm.payment_account_id,
|
||||
amount_cent: amountCent.value,
|
||||
})
|
||||
await createWithdrawal(
|
||||
{
|
||||
payment_account_id: withdrawForm.payment_account_id,
|
||||
amount_cent: amountCent.value,
|
||||
},
|
||||
distributionStore.isDistribution ? distributionStore.siteCode : undefined
|
||||
)
|
||||
showToast({ message: '提现申请已提交', icon: 'passed' })
|
||||
withdrawForm.amount = ''
|
||||
await loadData()
|
||||
@@ -386,13 +392,18 @@ function statusType(status: string): 'primary' | 'success' | 'danger' | 'warning
|
||||
<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>
|
||||
<button class="refresh-btn" type="button" @click="loadData">
|
||||
<van-icon name="replay" :size="18" />
|
||||
</button>
|
||||
</header>
|
||||
|
||||
<section class="balance-panel">
|
||||
<div v-if="distributionStore.isDistribution" class="site-account-tip">
|
||||
{{ distributionStore.siteName }}独立账户
|
||||
</div>
|
||||
<span>可用余额</span>
|
||||
<strong>¥{{ formatCent(availableBalanceCent) }}</strong>
|
||||
<small>冻结余额 ¥{{ formatCent(account?.frozen_balance_cent) }}</small>
|
||||
|
||||
Reference in New Issue
Block a user