@@ -1206,6 +1206,15 @@ function displayListValue(value: string | number | null | undefined) {
return value === '' || value == null ? '-' : String ( value )
}
function orderMatchesCargoKeyword ( order : FirstLegOrder , keyword : string ) {
const normalized = keyword . toLowerCase ( )
return [
order . businessSummary . inboundCode ,
... order . skuNos ,
... order . items . map ( ( item ) => item . sku ) ,
] . some ( ( value ) => String ( value ? ? '' ) . toLowerCase ( ) . includes ( normalized ) )
}
function uniqueItemValues ( order : FirstLegOrder , key : 'sku' | 'shipmentId' | 'referenceId' ) {
if ( key === 'sku' && order . skuNos . length ) return [ ... new Set ( order . skuNos ) ] . join ( '、' )
const values = order . items . map ( ( item ) => item [ key ] ? . trim ( ) ) . filter ( ( value ) : value is string => Boolean ( value ) )
@@ -1534,8 +1543,9 @@ async function searchOrders(model: QueryModel) {
const orderNo = typeof model . orderNo === 'string' ? model . orderNo . trim ( ) : ''
const cargoKeyword = typeof model . cargoKeyword === 'string' ? model . cargoKeyword . trim ( ) : ''
const range = Array . isArray ( createdRange ) ? createdRange . filter ( ( value ) : value is string => typeof value === 'string' ) : [ ]
await store . load ( {
keyword : cargoKeyword || undefined ,
const query = {
keyword : undefined ,
inboundCode : cargoKeyword || undefined ,
orderNo : orderNo || undefined ,
receivingWarehouseId : typeof model . receivingWarehouseId === 'string' && model . receivingWarehouseId ? model . receivingWarehouseId : undefined ,
mainStatus : statusValue && statusValue !== 'DRAFT' ? statusValue : undefined ,
@@ -1543,7 +1553,12 @@ async function searchOrders(model: QueryModel) {
includeDrafts : ! statusValue ,
createdFrom : range [ 0 ] ? ` ${ range [ 0 ] } T00:00:00 ` : undefined ,
createdTo : range [ 1 ] ? ` ${ range [ 1 ] } T23:59:59 ` : undefined ,
} )
}
await store . load ( query )
const cargoMatched = cargoKeyword && store . orders . some ( ( order ) => order . status !== 'DRAFT' && orderMatchesCargoKeyword ( order , cargoKeyword ) )
if ( cargoKeyword && ! cargoMatched && statusValue !== 'DRAFT' ) {
await store . load ( { ... query , keyword : undefined , inboundCode : undefined , fbaCode : cargoKeyword } )
}
selectedOrders . value = [ ]
orderTableVersion . value += 1
} catch {
@@ -1755,9 +1770,9 @@ async function searchOrders(model: QueryModel) {
< table class = "cargo-edit-table" >
< thead > < tr >
< th class = "cargo-check-cell" > < el-checkbox :model-value = "allCargoSelected" :indeterminate = "someCargoSelected" aria -label = " 全选货物 " @change ="toggleAllCargoItems" / > < / th > < th class = "cargo-index-cell" > # < / th >
< th > SKU NO . < small > FBA 必填< / small > < / th > < th > 中文品名 < / th > < th class = "cargo-image-column" > 图片 < / th > < th > 英文品名 < / th > < th > 报关 HS CODE < / th > < th > 清关 HS CODE < / th > < th > 包装类型 < / th >
< th > SKU NO . < small > SKU 必填< / small > < / th > < th > 中文品名 < / th > < th class = "cargo-image-column" > 图片 < / th > < th > 英文品名 < / th > < th > 报关 HS CODE < / th > < th > 清关 HS CODE < / th > < th > 包装类型 < / th >
< th class = "cargo-number-column" > 箱规长 cm < / th > < th class = "cargo-number-column" > 箱规宽 cm < / th > < th class = "cargo-number-column" > 箱规高 cm < / th > < th class = "cargo-number-column" > 每箱数量 < / th > < th class = "cargo-number-column" > 箱数 < / th > < th class = "cargo-number-column" > 总毛重 < / th > < th class = "cargo-number-column" > 总体积 < / th > < th class = "cargo-number-column" > 总数量 < / th > < th class = "cargo-number-column" > 总净重 < / th >
< th > 清关申报单价 USD < / th > < th > 清关申报金额 USD < / th > < th > 材质 < / th > < th > 用途 < / th > < th > 型号 < / th > < th > 品牌 < / th > < th class = "cargo-dimensions-column" > 产品规格 长 × 宽 × 高 < / th > < th > 危险品 < / th > < th > 货件编号 < small > FBA 必填< / small > < / th > < th > 跟踪编号 < small > FBA 必填< / small > < / th > < th > UPC NO . < small > FBA 必填< / small > < / th > < th > 备注 < / th > < th class = "cargo-operation-column" > 操作 < / th >
< th > 清关申报单价 USD < / th > < th > 清关申报金额 USD < / th > < th > 材质 < / th > < th > 用途 < / th > < th > 型号 < / th > < th > 品牌 < / th > < th class = "cargo-dimensions-column" > 产品规格 长 × 宽 × 高 < / th > < th > 危险品 < / th > < th > 货件编号 < small > 货件编号 必填< / small > < / th > < th > 跟踪编号 < small > 跟踪编号 必填< / small > < / th > < th > UPC NO . < small > UPC 必填< / small > < / th > < th > 备注 < / th > < th class = "cargo-operation-column" > 操作 < / th >
< / tr > < / thead >
< tbody > < tr v-for = "(item, index) in form.items" :key="item.id" >
< td class = "cargo-check-cell" > < el-checkbox :model-value = "selectedCargoIds.includes(item.id)" : aria -label = " ` 选择货物 $ { index + 1 } ` " @change ="toggleCargoItem(item.id, $event)" / > < / td > < td class = "cargo-index-cell" > { { index + 1 } } < / td >
@@ -1770,11 +1785,11 @@ async function searchOrders(model: QueryModel) {
< td > < el-form-item :prop = "`items.${index}.unitsPerPackage`" required : rules = "positiveNumberRules('每箱数量必须大于 0', true)" > < el-input-number v-model = "item.unitsPerPackage" :min="1" :controls="false" /></el-form-item></td><td><el-form-item :prop="`items.${index}.packageCount`" required :rules="positiveNumberRules('箱数必须大于 0', true)"><el-input-number v-model="item.packageCount" :min="1" :controls="false" /></el-form-item></td><td><el-form-item :prop="`items.${index}.grossWeightKg`" required :rules="positiveNumberRules('总毛重必须大于 0')"><el-input-number v-model="item.grossWeightKg" :min="0" :precision="3" :controls="false" /></el-form-item></td><td><el-form-item :prop="`items.${index}.volumeCbm`" required :rules="positiveNumberRules('总体积必须大于 0')"><el-input-number v-model="item.volumeCbm" :min="0" :precision="4" :controls="false" /></el-form-item></td><td><el-form-item :prop="`items.${index}.pieces`" required :rules="positiveNumberRules('总数量必须大于 0', true)"><el-input-number v-model="item.pieces" :min="1" :controls="false" /></el-form-item></td><td><el-input-number v-model="item.netWeightKg" :min="0" :precision="3" :controls="false" / > < / td >
< td > < el-input-number v-model = "item.unitDeclaredValue" :min="0" :precision="2" :controls="false" /></td><td><el-input-number v-model="item.declaredValue" :min="0" :precision="2" :controls="false" /></td><td><el-input v-model="item.material" maxlength="128" placeholder="材质" /></td><td><el-input v-model="item.usage" maxlength="128" placeholder="用途" /></td><td><el-input v-model="item.model" maxlength="64" placeholder="型号" /></td><td><el-input v-model="item.brand" maxlength="64" placeholder="品牌" / > < / td >
< td class = "cargo-dimensions-column" > < div class = "cargo-table-dimensions" > < el-input-number v-model = "item.productLengthCm" :min="0" :precision="2" :controls="false" /><span>× </span><el-input-number v-model="item.productWidthCm" :min="0" :precision="2" :controls="false" /><span>× </span><el-input-number v-model="item.productHeightCm" :min="0" :precision="2" :controls="false" /></div></td><td class="cargo-danger-cell"><el-switch v-model="item.dangerousGoods" / > < / td >
< td > < el-form-item :prop = "`items.${index}.shipmentId`" : required = "form.destinationType === 'FBA'" : rules = "form.destinationType === 'FBA' ? requiredTextRules('亚马逊 货物请输入 Shipment ID ') : undefined" > < el-input v-model = "item.shipmentId" maxlength="64" placeholder="SHIPMENT ID " /></el-form-item></td><td><el-form-item :prop="`items.${index}.referenceId`" :required="form.destinationType === 'FBA'" :rules="form.destinationType === 'FBA' ? requiredTextRules('亚马逊 货物请输入 Reference ID ') : undefined"><el-input v-model="item.referenceId" maxlength="64" placeholder="REFERENCE ID " /></el-form-item></td><td><el-form-item :prop="`items.${index}.upc`" :required="form.destinationType === 'FBA'" :rules="form.destinationType === 'FBA' ? requiredTextRules('FBA 货物请输入 UPC NO.') : undefined"><el-input v-model="item.upc" maxlength="64" placeholder="UPC NO." /></el-form-item></td><td><el-input v-model="item.remark" maxlength="500" placeholder="备注" /></td><td class="cargo-operation-column"><el-button link type="danger" :aria-label="`删除货物 ${index + 1}`" @click="removeCargoItem(index)"><Trash2 :size="15" / > 删除 < / el-button > < / td >
< td > < el-form-item :prop = "`items.${index}.shipmentId`" : required = "form.destinationType === 'FBA'" : rules = "form.destinationType === 'FBA' ? requiredTextRules('FBA 货物请输入货件编号 ') : undefined" > < el-input v-model = "item.shipmentId" maxlength="64" placeholder="货件编号 " /></el-form-item></td><td><el-form-item :prop="`items.${index}.referenceId`" :required="form.destinationType === 'FBA'" :rules="form.destinationType === 'FBA' ? requiredTextRules('FBA 货物请输入跟踪编号 ') : undefined"><el-input v-model="item.referenceId" maxlength="64" placeholder="跟踪编号 " /></el-form-item></td><td><el-form-item :prop="`items.${index}.upc`" :required="form.destinationType === 'FBA'" :rules="form.destinationType === 'FBA' ? requiredTextRules('FBA 货物请输入 UPC NO.') : undefined"><el-input v-model="item.upc" maxlength="64" placeholder="UPC NO." /></el-form-item></td><td><el-input v-model="item.remark" maxlength="500" placeholder="备注" /></td><td class="cargo-operation-column"><el-button link type="danger" :aria-label="`删除货物 ${index + 1}`" @click="removeCargoItem(index)"><Trash2 :size="15" / > 删除 < / el-button > < / td >
< / tr > < / tbody >
< / table >
< / div >
< div class = "cargo-table-hint" > < span > FBA 货物的 SKU NO . 、 UPC NO . 为必填项 < / span > < i > < / i > < span > 亚马逊货物的货件编号和跟踪编号 为必填项< / span > < / div >
< div class = "cargo-table-hint" > < span > SKU NO . 、 货件编号 、 跟踪编号 、 UPC NO . 均 为必填项< / span > < / div >
< / section >
< section class = "order-form-section prototype-section cost-estimate-section" aria -label = " 费用预估 " >