优化
This commit is contained in:
@@ -16,11 +16,13 @@ import {
|
||||
estimateMerchantFirstLegPrice,
|
||||
downloadMerchantOrderCartonLabelsBatch,
|
||||
downloadMerchantProductImage,
|
||||
getMerchantInboundCodePolicy,
|
||||
getMerchantPricingChannels,
|
||||
uploadMerchantProductImage,
|
||||
type MerchantPriceEstimate,
|
||||
type MerchantPriceEstimateRequest,
|
||||
type MerchantPricingChannel,
|
||||
type InboundCodePolicy,
|
||||
} from '@/modules/first-leg/api/firstLeg'
|
||||
import { useFirstLegOrdersStore } from '@/modules/first-leg/store/firstLegOrders'
|
||||
import { useTenantAdministrationStore } from '@/modules/tenant-management/public'
|
||||
@@ -68,6 +70,8 @@ const queryFields = computed<QueryField[]>(() => [
|
||||
{ key: 'trackingNumber', label: '快递单号', type: 'input', placeholder: '请输入快递单号', props: { 'aria-label': '快递单号' } },
|
||||
])
|
||||
const channelOptions = ref<MerchantPricingChannel[]>([])
|
||||
const inboundCodePolicy = ref<InboundCodePolicy | null>(null)
|
||||
const manualInboundCodeRequired = computed(() => inboundCodePolicy.value?.mode === 'LEGACY_MANUAL')
|
||||
const channelLoading = ref(false)
|
||||
const channelError = ref('')
|
||||
const priceEstimate = ref<MerchantPriceEstimate | null>(null)
|
||||
@@ -331,6 +335,7 @@ function displayValue(value: string | null | undefined) {
|
||||
|
||||
function emptyDraft(): FirstLegOrderDraft {
|
||||
return {
|
||||
inboundCode: '',
|
||||
referenceNo: '',
|
||||
transportMode: 'FCL',
|
||||
businessType: 'EXPORT',
|
||||
@@ -512,11 +517,17 @@ async function loadPageData() {
|
||||
const orderPageRequest = isCreatePage.value
|
||||
? store.loadWarehouseType('DOMESTIC', true)
|
||||
: store.load()
|
||||
const [ordersResult, companyResult, destinationResult] = await Promise.allSettled([
|
||||
const [ordersResult, companyResult, destinationResult, policyResult] = await Promise.allSettled([
|
||||
orderPageRequest,
|
||||
companyRequest,
|
||||
destinationRequest,
|
||||
getMerchantInboundCodePolicy(),
|
||||
])
|
||||
if (policyResult.status === 'fulfilled') inboundCodePolicy.value = policyResult.value
|
||||
else {
|
||||
inboundCodePolicy.value = null
|
||||
supportingDataErrors.value.push(`入仓码配置加载失败:${errorMessage(policyResult.reason)}`)
|
||||
}
|
||||
if (canViewCompanyProfile.value && companyResult.status === 'fulfilled') {
|
||||
companyAuditLoaded.value = true
|
||||
} else if (companyResult.status === 'rejected') {
|
||||
@@ -675,6 +686,7 @@ function removeCargoProductImage(item: FirstLegCargoItem) {
|
||||
|
||||
function draftFromOrder(order: FirstLegOrder): FirstLegOrderDraft {
|
||||
return {
|
||||
inboundCode: order.businessSummary.inboundCode,
|
||||
referenceNo: order.referenceNo,
|
||||
transportMode: order.transportMode ?? 'FCL',
|
||||
businessType: order.businessType,
|
||||
@@ -1388,6 +1400,15 @@ async function validateEditorForm() {
|
||||
return false
|
||||
}
|
||||
|
||||
if (!inboundCodePolicy.value) {
|
||||
ElMessage.warning('入仓码配置尚未加载,请稍后重试')
|
||||
return false
|
||||
}
|
||||
if (manualInboundCodeRequired.value && !form.inboundCode?.trim()) {
|
||||
ElMessage.warning('当前为旧系统并跑模式,请填写旧系统入仓码')
|
||||
return false
|
||||
}
|
||||
|
||||
const errors = validateFirstLegOrderDraft(form)
|
||||
if (errors.length > 0) {
|
||||
ElMessage.warning(errors[0])
|
||||
@@ -1631,6 +1652,10 @@ async function searchOrders(model: QueryModel) {
|
||||
<el-form-item label="国内收货仓" prop="receivingWarehouseId" required class="prototype-form-row prototype-form-row--wide"><el-radio-group v-model="form.receivingWarehouseId" class="warehouse-options" @change="loadSelectedWarehouse"><el-radio v-for="warehouse in availableWarehouses" :key="warehouse.id" :value="warehouse.id">{{ warehouse.name }}</el-radio></el-radio-group></el-form-item>
|
||||
</div>
|
||||
<div class="order-form-grid compact-transport-grid">
|
||||
<el-form-item v-if="manualInboundCodeRequired" label="旧系统入仓码" prop="inboundCode" required :rules="requiredTextRules('请输入旧系统生成的入仓码')">
|
||||
<el-input v-model="form.inboundCode" maxlength="40" placeholder="例如:NYEXX2608140001" @input="form.inboundCode = String($event).trim().toUpperCase()" />
|
||||
<small class="field-guidance">当前全系统处于旧系统并跑模式,请粘贴旧系统生成的入仓码;订单提交后不可修改。</small>
|
||||
</el-form-item>
|
||||
<el-form-item label="渠道" prop="channelCode" required>
|
||||
<el-select v-model="form.channelCode" :loading="channelLoading" :disabled="!form.receivingWarehouseId || channelLoading" :placeholder="form.receivingWarehouseId ? '请选择运输渠道' : '请先选择国内收货仓'" @change="selectChannel"><el-option v-for="channel in channelOptions" :key="channel.channelCode" :label="channel.channelName" :value="channel.channelCode" /></el-select>
|
||||
<small v-if="channelError" class="field-guidance field-guidance--error">渠道加载失败:{{ channelError }} <el-button link type="primary" @click="retryPricingChannels">重试</el-button></small>
|
||||
|
||||
Reference in New Issue
Block a user