feat(distribution): 独立分销前台商城多租户体系、货源与订单数据严格隔离
This commit is contained in:
@@ -15,6 +15,7 @@ import { centToYuan, formatCent, formatMoney } from '@/shared/utils/money'
|
||||
import { orderStatusLabel } from '@/shared/utils/statusLabels'
|
||||
import { formatDateTime } from '@/shared/utils/time'
|
||||
import { formatListingNo } from '@/shared/utils/listingDisplay'
|
||||
import { useDistributionSiteStore } from '@/stores/distributionSite'
|
||||
|
||||
type BizType = 'rental' | 'crash'
|
||||
|
||||
@@ -42,6 +43,7 @@ const route = useRoute()
|
||||
const router = useRouter()
|
||||
const searchKeyword = ref('')
|
||||
const fallbackPendingPaymentMinutes = 15
|
||||
const siteStore = useDistributionSiteStore()
|
||||
const rentalTotal = ref(0)
|
||||
const rentalPage = ref(1)
|
||||
const rentalPageSize = 20
|
||||
@@ -151,10 +153,11 @@ function handleTabChange(tab: string | number) {
|
||||
async function loadOrders() {
|
||||
loading.value = true
|
||||
try {
|
||||
const [rentalResult, crashResult] = await Promise.allSettled([
|
||||
fetchOrders(rentalPage.value, rentalPageSize),
|
||||
fetchMyMohongOrders({ page: 1, page_size: 50 }),
|
||||
])
|
||||
const rentalPromise = fetchOrders(rentalPage.value, rentalPageSize)
|
||||
const crashPromise = !siteStore.isDistribution
|
||||
? fetchMyMohongOrders({ page: 1, page_size: 50 })
|
||||
: Promise.resolve(null)
|
||||
const [rentalResult, crashResult] = await Promise.allSettled([rentalPromise, crashPromise])
|
||||
|
||||
if (rentalResult.status === 'fulfilled') {
|
||||
rentalOrders.value = rentalResult.value?.items || []
|
||||
@@ -165,11 +168,13 @@ async function loadOrders() {
|
||||
ElMessage.error('租赁订单加载失败')
|
||||
}
|
||||
|
||||
if (crashResult.status === 'fulfilled') {
|
||||
crashOrders.value = crashResult.value?.items || []
|
||||
} else {
|
||||
if (!siteStore.isDistribution && crashResult.status === 'fulfilled' && crashResult.value) {
|
||||
crashOrders.value = crashResult.value.items || []
|
||||
} else if (!siteStore.isDistribution && crashResult.status === 'rejected') {
|
||||
crashOrders.value = []
|
||||
ElMessage.error(readError(crashResult.reason, '撞车订单加载失败'))
|
||||
} else {
|
||||
crashOrders.value = []
|
||||
}
|
||||
} finally {
|
||||
loading.value = false
|
||||
@@ -298,9 +303,17 @@ function bizTypeLabel(bizType: BizType) {
|
||||
<template>
|
||||
<section class="page">
|
||||
<div class="page-header">
|
||||
<p class="eyebrow">ORDERS</p>
|
||||
<h1>我的订单</h1>
|
||||
<p>租赁与撞车订单统一展示,按创建时间倒序排列。</p>
|
||||
<p class="eyebrow">{{ siteStore.isDistribution ? 'DISTRIBUTION ORDERS' : 'ORDERS' }}</p>
|
||||
<div class="header-title-row">
|
||||
<h1>我的订单</h1>
|
||||
<span v-if="siteStore.isDistribution" class="site-order-tag">
|
||||
{{ siteStore.siteName }} · 专属订单
|
||||
</span>
|
||||
</div>
|
||||
<p v-if="siteStore.isDistribution">
|
||||
当前为【{{ siteStore.siteName }}】专属分销商城,仅展示在此分销站产生的订单记录。
|
||||
</p>
|
||||
<p v-else>租赁与撞车订单统一展示,按创建时间倒序排列。</p>
|
||||
</div>
|
||||
|
||||
<div class="orders-toolbar">
|
||||
|
||||
Reference in New Issue
Block a user