Release/test 合并上生产 #1

Merged
admin merged 236 commits from release/test into main 2026-09-17 11:51:50 +08:00
6 changed files with 145 additions and 13 deletions
Showing only changes of commit 6780228f86 - Show all commits
@@ -9,6 +9,9 @@ import type {
interface MerchantInboundBillingWireResponse {
inbound: MerchantInboundResult
measurementSummary: MerchantInboundBilling['measurementSummary']
measurementItems: MerchantInboundBilling['measurementItems']
billingBasis: MerchantInboundBilling['billingBasis']
latestFee: MerchantInboundFeeSnapshot
}
@@ -101,6 +104,35 @@ function sanitizeFee(fee: MerchantInboundFeeSnapshot): MerchantInboundFeeSnapsho
}
}
function sanitizeMeasurementSummary(item: MerchantInboundBilling['measurementSummary']): MerchantInboundBilling['measurementSummary'] {
return {
measurementId: item.measurementId == null ? null : String(item.measurementId),
sourceType: item.sourceType,
measurementStatus: item.measurementStatus,
actualPackageCount: item.actualPackageCount,
actualGrossWeightKg: item.actualGrossWeightKg,
actualNetWeightKg: item.actualNetWeightKg,
actualVolumeCbm: item.actualVolumeCbm,
volumeWeightKg: item.volumeWeightKg,
actualGoodsName: item.actualGoodsName,
}
}
function sanitizeMeasurementItem(item: MerchantInboundBilling['measurementItems'][number]): MerchantInboundBilling['measurementItems'][number] {
return {
id: String(item.id),
itemNo: item.itemNo,
boxSpecification: item.boxSpecification,
packageCount: item.packageCount,
lengthCm: item.lengthCm,
widthCm: item.widthCm,
heightCm: item.heightCm,
unitVolumeCbm: item.unitVolumeCbm,
totalVolumeCbm: item.totalVolumeCbm,
volumeWeightKg: item.volumeWeightKg,
}
}
function sanitizeInboundBilling(response: MerchantInboundBillingWireResponse): MerchantInboundBilling {
return {
inbound: {
@@ -108,6 +140,9 @@ function sanitizeInboundBilling(response: MerchantInboundBillingWireResponse): M
publicRemark: response.inbound.publicRemark,
palletLocations: response.inbound.palletLocations.map(sanitizePalletLocation),
},
measurementSummary: sanitizeMeasurementSummary(response.measurementSummary),
measurementItems: (response.measurementItems || []).map(sanitizeMeasurementItem),
billingBasis: response.billingBasis,
latestFee: sanitizeFee(response.latestFee),
}
}
@@ -14,13 +14,15 @@ test('renders loading, pending, isolated error, and published states', () => {
assert.match(source, /\$emit\('retry'\)/)
})
test('shows the confirmed merchant inbound and fee fields without write actions', () => {
test('shows the confirmed merchant inbound, measurement details and customer confirmation entry', () => {
for (const label of ['入仓码', '平台收货仓', '实际毛重', '实测体积', '托盘与库位', '换算与精度', '最终计费量', '基础费用', '附加费用', '费用合计', '平台备注']) {
assert.match(source, new RegExp(label))
}
assert.match(source, /formatInboundMoney\(props\.data\.latestFee\.totalAmount/)
assert.match(source, /formatConversionPrecision\(/)
assert.doesNotMatch(source, /确认费用|调整费用|发送费用|下载照片/)
assert.match(source, /确认费用/)
assert.match(source, /measurementItems/)
assert.doesNotMatch(source, /调整费用|发送费用|下载照片/)
assert.doesNotMatch(source, /internalNotes|statusHistory|files/)
assert.match(source, /latestFee\.ruleCode/)
assert.match(source, /latestFee\.rateCode/)
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { ref, watch } from 'vue'
import { Clock3, PackageCheck, RefreshCw, TriangleAlert } from '@lucide/vue'
import type { MerchantInboundBilling } from '@/modules/first-leg/types/inboundBilling'
import {
@@ -17,24 +18,34 @@ const props = withDefaults(defineProps<{
unavailable?: boolean
unavailableMessage?: string
error?: string
autoOpen?: boolean
}>(), {
data: null,
loading: false,
unavailable: false,
unavailableMessage: '入库及费用结果尚未发布',
unavailableMessage: '还未测量推送',
error: '',
autoOpen: false,
})
defineEmits<{
retry: []
}>()
const feeDialogOpen = ref(false)
watch(() => [props.autoOpen, props.data] as const, ([autoOpen, data]) => {
if (autoOpen && data) feeDialogOpen.value = true
}, { immediate: true })
</script>
<template>
<section class="inbound-billing-panel" aria-labelledby="inbound-billing-title">
<header class="inbound-billing-heading">
<h3 id="inbound-billing-title">入库与费用</h3>
<el-tag v-if="props.data" type="success" effect="light">待分柜 · 费用已发布</el-tag>
<div v-if="props.data" class="inbound-billing-actions">
<el-tag type="success" effect="light">待分柜 · 费用已发布</el-tag>
<el-button type="primary" @click="feeDialogOpen = true">确认费用</el-button>
</div>
</header>
<div v-if="props.loading" class="inbound-billing-loading" aria-live="polite" aria-busy="true">
@@ -55,7 +66,7 @@ defineEmits<{
<Clock3 :size="22" />
<div>
<strong>{{ props.unavailableMessage }}</strong>
<span>客服完成测量审核、入库并发布费用后,将在这里展示最终结果。</span>
<span>平台完成测量审核并确认推送费用后,将在这里展示测量与计费结果。</span>
</div>
</div>
@@ -68,7 +79,7 @@ defineEmits<{
</dl>
<div class="inbound-result-section">
<h4>实测结果</h4>
<div class="inbound-section-title"><h4>测量数据</h4><el-tag size="small" type="warning" effect="light">后台推送</el-tag></div>
<dl class="inbound-measurements">
<div><dt>实际箱数</dt><dd>{{ formatInboundNumber(props.data.inbound.summary.totalPackageCount, 0) }}</dd></div>
<div><dt>实际毛重</dt><dd>{{ formatInboundMeasure(props.data.inbound.summary.actualGrossWeightKg, 'kg') }}</dd></div>
@@ -77,6 +88,17 @@ defineEmits<{
<div><dt>材积重</dt><dd>{{ formatInboundMeasure(props.data.inbound.summary.volumeWeightKg, 'kg') }}</dd></div>
<div><dt>测量完成</dt><dd>{{ formatInboundDateTime(props.data.inbound.summary.measureCompletedAt) }}</dd></div>
</dl>
<el-table v-if="props.data.measurementItems.length" class="measurement-detail-table" :data="props.data.measurementItems" border size="small">
<el-table-column type="index" label="#" width="54" />
<el-table-column prop="lengthCm" label="箱规长(cm)" min-width="105" />
<el-table-column prop="widthCm" label="箱规宽(cm)" min-width="105" />
<el-table-column prop="heightCm" label="箱规高(cm)" min-width="105" />
<el-table-column prop="packageCount" label="箱数" min-width="76" />
<el-table-column label="每箱体积" min-width="105"><template #default="{ row }">{{ formatInboundMeasure(row.unitVolumeCbm, 'm³') }}</template></el-table-column>
<el-table-column label="总体积" min-width="105"><template #default="{ row }">{{ formatInboundMeasure(row.totalVolumeCbm, 'm³') }}</template></el-table-column>
<el-table-column label="总材积重" min-width="105"><template #default="{ row }">{{ formatInboundMeasure(row.volumeWeightKg, 'kg') }}</template></el-table-column>
<el-table-column prop="boxSpecification" label="备注" min-width="130" />
</el-table>
</div>
<div class="inbound-result-section">
@@ -138,12 +160,36 @@ defineEmits<{
<p>{{ props.data.inbound.publicRemark }}</p>
</div>
</template>
<el-dialog v-model="feeDialogOpen" title="确认测量与计费数据" width="min(980px, 94vw)" append-to-body>
<dl v-if="props.data" class="inbound-measurements fee-dialog-summary">
<div><dt>测量总箱数</dt><dd>{{ formatInboundNumber(props.data.measurementSummary.actualPackageCount, 0) }}</dd></div>
<div><dt>测量总毛重</dt><dd>{{ formatInboundMeasure(props.data.measurementSummary.actualGrossWeightKg, 'kg') }}</dd></div>
<div><dt>测量总体积</dt><dd>{{ formatInboundMeasure(props.data.measurementSummary.actualVolumeCbm, 'm³') }}</dd></div>
<div><dt>测量总材积重</dt><dd>{{ formatInboundMeasure(props.data.measurementSummary.volumeWeightKg, 'kg') }}</dd></div>
<div><dt>计费体积</dt><dd>{{ formatInboundMeasure(props.data.billingBasis.chargeableVolumeCbm, 'm³') }}</dd></div>
<div><dt>计费重量</dt><dd>{{ formatInboundMeasure(props.data.billingBasis.chargeableWeightKg, 'kg') }}</dd></div>
</dl>
<el-table v-if="props.data?.measurementItems.length" class="measurement-detail-table" :data="props.data.measurementItems" border size="small">
<el-table-column type="index" label="#" width="54" />
<el-table-column prop="lengthCm" label="箱规长(cm)" min-width="105" />
<el-table-column prop="widthCm" label="箱规宽(cm)" min-width="105" />
<el-table-column prop="heightCm" label="箱规高(cm)" min-width="105" />
<el-table-column prop="packageCount" label="箱数" min-width="76" />
<el-table-column label="每箱体积" min-width="105"><template #default="{ row }">{{ formatInboundMeasure(row.unitVolumeCbm, 'm³') }}</template></el-table-column>
<el-table-column label="总体积" min-width="105"><template #default="{ row }">{{ formatInboundMeasure(row.totalVolumeCbm, 'm³') }}</template></el-table-column>
<el-table-column label="总材积重" min-width="105"><template #default="{ row }">{{ formatInboundMeasure(row.volumeWeightKg, 'kg') }}</template></el-table-column>
<el-table-column prop="boxSpecification" label="备注" min-width="130" />
</el-table>
<template #footer><el-button type="primary" @click="feeDialogOpen = false">确认</el-button></template>
</el-dialog>
</section>
</template>
<style scoped>
.inbound-billing-panel { margin-top: 22px; }
.inbound-billing-heading, .inbound-section-title, .fee-total { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.inbound-billing-actions { display: flex; align-items: center; gap: 10px; }
.inbound-billing-heading h3, .inbound-result-section h4 { margin: 0; color: var(--navy); }
.inbound-billing-heading h3 { font-size: 15px; }
.inbound-result-section h4 { font-size: 13px; }
@@ -166,6 +212,8 @@ defineEmits<{
.inbound-section-title > span { color: var(--muted); font-size: 10px; text-align: right; }
.inbound-measurements { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 10px 0 0; background: #f6f8f8; }
.inbound-measurements > div { min-width: 0; padding: 12px; }
.measurement-detail-table { margin-top: 12px; }
.fee-dialog-summary { margin-top: 0; }
.pallet-location-list { margin-top: 9px; border-top: 1px solid var(--border); }
.pallet-location-list article { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.pallet-location-list article > svg { color: var(--primary); }
@@ -100,7 +100,45 @@ export interface MerchantInboundFeeSnapshot {
nextProcessStatus: MerchantInboundProcessStatus | null
}
export interface MerchantMeasurementItem {
id: string
itemNo: string | null
boxSpecification: string | null
packageCount: number | null
lengthCm: number | null
widthCm: number | null
heightCm: number | null
unitVolumeCbm: number | null
totalVolumeCbm: number | null
volumeWeightKg: number | null
}
export interface MerchantBillingBasis {
chargeMode: string
chargeUnit: string
chargeableBasis: string
actualWeightKg: number
actualVolumeCbm: number
convertedQuantity: number
chargeableQuantity: number
chargeableWeightKg: number | null
chargeableVolumeCbm: number | null
}
export interface MerchantInboundBilling {
inbound: MerchantInboundResult
measurementSummary: {
measurementId: string | null
sourceType: string | null
measurementStatus: string | null
actualPackageCount: number | null
actualGrossWeightKg: number | null
actualNetWeightKg: number | null
actualVolumeCbm: number | null
volumeWeightKg: number | null
actualGoodsName: string | null
}
measurementItems: MerchantMeasurementItem[]
billingBasis: MerchantBillingBasis
latestFee: MerchantInboundFeeSnapshot
}
@@ -32,7 +32,7 @@ test('exposes real list, draft, submit, and detail workflow entries without canc
assert.match(source, /function openCreate\(\)/)
assert.match(source, /async function saveDraft\(\)/)
assert.match(source, /function submitOrder\(\)/)
assert.match(source, /async function openDetail\(order: FirstLegOrder\)/)
assert.match(source, /async function openDetail\(order: FirstLegOrder, showFeeDialog = false\)/)
assert.match(source, /Promise\.allSettled\(\[/)
assert.match(source, /const orderPageRequest = isCreatePage\.value\s*\? store\.loadWarehouseType\('DOMESTIC', true\)\s*:\s*store\.load\(\{ includeDrafts: true \}\)/)
assert.match(source, /Promise\.allSettled\(\[\s*orderPageRequest,\s*companyRequest/)
@@ -481,7 +481,7 @@ test('loads merchant inbound billing as an isolated read-only detail section', (
assert.match(source, /<InboundBillingPanel/)
assert.match(source, /@retry="retryInboundBilling"/)
assert.match(source, /error instanceof ApiError && error\.code === 'A0404'/)
assert.match(source, /inboundBillingUnavailableMessage\.value = error\.message \|\| '入库及费用结果尚未发布'/)
assert.match(source, /inboundBillingUnavailableMessage\.value = error\.message \|\| '还未测量推送'/)
assert.match(source, /order\.status === 'DRAFT'/)
assert.match(source, /订单提交后可查看入库结果/)
assert.doesNotMatch(source, /confirmMerchantInbound|adjustMerchantInbound|sendMerchantInbound/)
@@ -198,7 +198,8 @@ const detailCargoPageSize = ref(5)
const inboundBilling = ref<MerchantInboundBilling | null>(null)
const inboundBillingLoading = ref(false)
const inboundBillingUnavailable = ref(false)
const inboundBillingUnavailableMessage = ref('入库及费用结果尚未发布')
const inboundBillingUnavailableMessage = ref('还未测量推送')
const openFeeDialogWithDetail = ref(false)
const inboundBillingError = ref('')
const customsByOrder = reactive<Record<string, MerchantCustomsContainer | null | undefined>>({})
const customsEligibilityPending = new Set<string>()
@@ -1192,7 +1193,8 @@ async function openEdit(order: FirstLegOrder) {
}
}
async function openDetail(order: FirstLegOrder) {
async function openDetail(order: FirstLegOrder, showFeeDialog = false) {
openFeeDialogWithDetail.value = showFeeDialog
detailId.value = order.id
detailCargoPage.value = 1
detailOpen.value = true
@@ -1211,6 +1213,10 @@ async function openDetail(order: FirstLegOrder) {
}
}
function openFeeConfirmation(order: FirstLegOrder) {
void openDetail(order, true)
}
async function retryDetail() {
const order = detailId.value ? store.getById(detailId.value) : undefined
if (order) await openDetail(order)
@@ -1221,7 +1227,7 @@ function resetInboundBillingState() {
inboundBilling.value = null
inboundBillingLoading.value = false
inboundBillingUnavailable.value = false
inboundBillingUnavailableMessage.value = '入库及费用结果尚未发布'
inboundBillingUnavailableMessage.value = '还未测量推送'
inboundBillingError.value = ''
}
@@ -1236,7 +1242,7 @@ async function loadInboundBilling(order: FirstLegOrder) {
inboundBilling.value = null
inboundBillingLoading.value = false
inboundBillingUnavailable.value = false
inboundBillingUnavailableMessage.value = '入库及费用结果尚未发布'
inboundBillingUnavailableMessage.value = '还未测量推送'
inboundBillingError.value = ''
if (order.status === 'DRAFT') {
@@ -1254,7 +1260,7 @@ async function loadInboundBilling(order: FirstLegOrder) {
if (!isCurrentInboundBillingRequest(sequence, order.id)) return
if (error instanceof ApiError && error.code === 'A0404') {
inboundBillingUnavailable.value = true
inboundBillingUnavailableMessage.value = error.message || '入库及费用结果尚未发布'
inboundBillingUnavailableMessage.value = error.message || '还未测量推送'
} else {
inboundBillingError.value = error instanceof Error ? error.message : '入库与费用加载失败'
}
@@ -1769,6 +1775,7 @@ async function searchOrders(model: QueryModel) {
<template #actions="{ row }">
<div class="order-row-actions">
<el-button link type="primary" @click="openDetail(row as FirstLegOrder)"><Eye :size="15" />详情</el-button>
<el-button v-if="(row as FirstLegOrder).status === 'WAIT_SPLIT'" link type="primary" @click="openFeeConfirmation(row as FirstLegOrder)">确认费用</el-button>
<el-button v-if="canEditOrder && canClientEditFirstLegOrder((row as FirstLegOrder).status)" link type="primary" :loading="openingEditor" @click="openEdit(row as FirstLegOrder)"><Pencil :size="15" />编辑</el-button>
<el-button v-if="eligibleCustomsDetail(row as FirstLegOrder)" link type="primary" @click="openCustomsDocuments(row as FirstLegOrder)"><FileText :size="15" />报关资料</el-button>
</div>
@@ -1834,6 +1841,7 @@ async function searchOrders(model: QueryModel) {
<span>更新于 {{ formatDateTime(order.updatedAt) }}</span>
<div>
<el-button link type="primary" @click="openDetail(order)"><Eye :size="15" />详情</el-button>
<el-button v-if="order.status === 'WAIT_SPLIT'" link type="primary" @click="openFeeConfirmation(order)">确认费用</el-button>
<el-button v-if="canEditOrder && canClientEditFirstLegOrder(order.status)" link type="primary" :loading="openingEditor" @click="openEdit(order)"><Pencil :size="15" />编辑</el-button>
<el-button v-if="eligibleCustomsDetail(order)" link type="primary" @click="openCustomsDocuments(order)"><FileText :size="15" />报关资料</el-button>
</div>
@@ -2135,6 +2143,7 @@ async function searchOrders(model: QueryModel) {
<OrderProgressPanel :order="detailOrder" />
<InboundBillingPanel
:data="inboundBilling"
:auto-open="openFeeDialogWithDetail"
:loading="inboundBillingLoading"
:unavailable="inboundBillingUnavailable"
:unavailable-message="inboundBillingUnavailableMessage"