feat: H5 仓操接入上架扫描与换库位,地址簿省市可手填
All checks were successful
Build and Deploy Front / deploy (push) Successful in 3m57s
All checks were successful
Build and Deploy Front / deploy (push) Successful in 3m57s
补齐仓操入口页与图标;寄件/H5 地址省市支持 allow-create,手机改必填;顺带调整经营地图工作台筛选布局。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
fd80bdee06
commit
25874478d0
@ -128,6 +128,12 @@ export const saveWarehouseBinLocation = (body: Record<string, unknown>) =>
|
||||
export const getWarehouseInboundList = (body: Record<string, unknown>) => postList('/warehouse/inbound/list', body)
|
||||
export const getWarehouseInboundDetail = (id: number, customerId?: number) =>
|
||||
getData('/warehouse/inbound/detail', { id, customerId })
|
||||
/** H5 上架扫描:按预报单号 / 箱唛 / NoticeNo-Seq 定位待收货预报详情 */
|
||||
export const lookupWarehouseInboundByScan = (body: {
|
||||
code: string
|
||||
warehouseId?: number
|
||||
customerId?: number
|
||||
}) => postOk('/warehouse/inbound/lookup-by-scan', body)
|
||||
export const saveWarehouseInbound = (body: Record<string, unknown>) => postOk('/warehouse/inbound/save', body)
|
||||
export const deleteWarehouseInbound = (id: number) => postOk('/warehouse/inbound/delete', { id })
|
||||
export const confirmWarehouseInboundReceive = (body: Record<string, unknown>) =>
|
||||
|
||||
19
src/assets/icons/h5/ops-putaway.svg
Normal file
19
src/assets/icons/h5/ops-putaway.svg
Normal file
@ -0,0 +1,19 @@
|
||||
<svg width="54" height="54" viewBox="0 0 54 54" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<ellipse cx="27" cy="44" rx="13" ry="3" fill="#00B42A" opacity="0.28"/>
|
||||
<!-- shelf rack -->
|
||||
<path d="M11 18h32c.8 0 1.4.6 1.4 1.4v20.2c0 .8-.6 1.4-1.4 1.4H11c-.8 0-1.4-.6-1.4-1.4V19.4c0-.8.6-1.4 1.4-1.4z" fill="url(#opsPw)"/>
|
||||
<path d="M12.2 27.5h29.6M12.2 36h29.6" stroke="#fff" stroke-width="1.7" stroke-linecap="round" opacity="0.55"/>
|
||||
<path d="M18 18.2v22.6M36 18.2v22.6" stroke="#E8FFEA" stroke-width="1.8" stroke-linecap="round" opacity="0.45"/>
|
||||
<!-- box on middle shelf -->
|
||||
<path d="M21.5 20.8h11c.7 0 1.2.5 1.2 1.2v4.3c0 .7-.5 1.2-1.2 1.2h-11c-.7 0-1.2-.5-1.2-1.2v-4.3c0-.7.5-1.2 1.2-1.2z" fill="#E8FFEA"/>
|
||||
<path d="M21.5 23.5h13.4" stroke="#00B42A" stroke-width="1.2" opacity="0.45"/>
|
||||
<!-- up arrow -->
|
||||
<path d="M27 14.2v7.2" stroke="#009A29" stroke-width="2.4" stroke-linecap="round"/>
|
||||
<path d="M23.4 17.4L27 13.8l3.6 3.6" stroke="#009A29" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<defs>
|
||||
<linearGradient id="opsPw" x1="11" y1="18" x2="43" y2="41" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#4CD263"/>
|
||||
<stop offset="1" stop-color="#00B42A"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
20
src/assets/icons/h5/ops-relocate.svg
Normal file
20
src/assets/icons/h5/ops-relocate.svg
Normal file
@ -0,0 +1,20 @@
|
||||
<svg width="54" height="54" viewBox="0 0 54 54" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<ellipse cx="27" cy="44" rx="13" ry="3" fill="#722ED1" opacity="0.28"/>
|
||||
<!-- left bin -->
|
||||
<path d="M9.5 21.5h13c.9 0 1.6.7 1.6 1.6v14.4c0 .9-.7 1.6-1.6 1.6h-13c-.9 0-1.6-.7-1.6-1.6V23.1c0-.9.7-1.6 1.6-1.6z" fill="url(#opsRl)"/>
|
||||
<path d="M11.2 26.2h9.6M11.2 30.8h9.6M11.2 35.4h6.2" stroke="#fff" stroke-width="1.6" stroke-linecap="round" opacity="0.85"/>
|
||||
<!-- right bin -->
|
||||
<path d="M31.5 21.5h13c.9 0 1.6.7 1.6 1.6v14.4c0 .9-.7 1.6-1.6 1.6h-13c-.9 0-1.6-.7-1.6-1.6V23.1c0-.9.7-1.6 1.6-1.6z" fill="#551DB0"/>
|
||||
<path d="M33.2 26.2h9.6M33.2 30.8h9.6M33.2 35.4h6.2" stroke="#F5E8FF" stroke-width="1.6" stroke-linecap="round" opacity="0.75"/>
|
||||
<!-- transfer arrows -->
|
||||
<path d="M24.2 25.2h5.6" stroke="#B37FEB" stroke-width="2.2" stroke-linecap="round"/>
|
||||
<path d="M27.6 22.8L30.4 25.2 27.6 27.6" stroke="#B37FEB" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M29.8 33.8h-5.6" stroke="#D3ADF7" stroke-width="2.2" stroke-linecap="round"/>
|
||||
<path d="M26.4 31.4L23.6 33.8l2.8 2.4" stroke="#D3ADF7" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<defs>
|
||||
<linearGradient id="opsRl" x1="9.5" y1="21" x2="24" y2="39" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#B37FEB"/>
|
||||
<stop offset="1" stop-color="#722ED1"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
@ -760,7 +760,9 @@ export default {
|
||||
'user.senderAddress.tip.addressType':
|
||||
'Domestic sender / return / pickup / overseas receiver; one default per type',
|
||||
'user.senderAddress.tip.addressName': 'Short name for quick pick when placing orders',
|
||||
'user.senderAddress.tip.countryCode': 'Pick from country master; province and city must also use dropdowns',
|
||||
'user.senderAddress.tip.countryCode': 'Pick from country master data',
|
||||
'user.senderAddress.tip.province': 'Prefer dropdown; if master data is incomplete, type and press Enter',
|
||||
'user.senderAddress.tip.city': 'Prefer dropdown; if master data is incomplete, type and press Enter',
|
||||
'user.senderAddress.tip.isDefault': 'Replaces the previous default for this type',
|
||||
'user.senderAddress.hint.defaultOn': 'Default',
|
||||
'user.senderAddress.hint.defaultOff': 'Not default',
|
||||
@ -780,13 +782,14 @@ export default {
|
||||
'user.senderAddress.message.setDefaultSuccess': 'Default address updated for this type',
|
||||
'user.senderAddress.message.typeRequired': 'Address type is required',
|
||||
'user.senderAddress.message.senderNameRequired': 'Contact is required',
|
||||
'user.senderAddress.message.phoneRequired': 'Phone is required',
|
||||
'user.senderAddress.message.countryRequired': 'Country is required',
|
||||
'user.senderAddress.message.provinceRequired': 'Province / state is required',
|
||||
'user.senderAddress.message.cityRequired': 'City is required',
|
||||
'user.senderAddress.message.addressRequired': 'Street address is required',
|
||||
'user.senderAddress.placeholder.countryCode': 'Select country',
|
||||
'user.senderAddress.placeholder.province': 'Select province / state',
|
||||
'user.senderAddress.placeholder.city': 'Select city',
|
||||
'user.senderAddress.placeholder.province': 'Select or type province / state',
|
||||
'user.senderAddress.placeholder.city': 'Select or type city',
|
||||
'order.customs9610.status.pending': 'Pending declare',
|
||||
'order.customs9610.status.declared': 'Declared',
|
||||
'order.customs9610.search.keyword': 'Service No. / Client No. / Customs order No.',
|
||||
|
||||
@ -752,7 +752,9 @@ export default {
|
||||
'user.senderAddress.section.other': '其他',
|
||||
'user.senderAddress.tip.addressType': '国内发件 / 国内退件 / 国内揽收 / 海外收件,同类型可各设一个默认',
|
||||
'user.senderAddress.tip.addressName': '便于识别的短名称,如下单页快速选用',
|
||||
'user.senderAddress.tip.countryCode': '从国家地区主数据选择;省/州、城市也必须从下拉选择',
|
||||
'user.senderAddress.tip.countryCode': '从国家地区主数据选择',
|
||||
'user.senderAddress.tip.province': '优先从下拉选择;主数据不全时可直接输入,回车确认',
|
||||
'user.senderAddress.tip.city': '优先从下拉选择;主数据不全时可直接输入,回车确认',
|
||||
'user.senderAddress.tip.isDefault': '开启后将替换该类型下原有默认地址',
|
||||
'user.senderAddress.hint.defaultOn': '已设为默认',
|
||||
'user.senderAddress.hint.defaultOff': '非默认',
|
||||
@ -772,13 +774,14 @@ export default {
|
||||
'user.senderAddress.message.setDefaultSuccess': '已设为同类型默认地址',
|
||||
'user.senderAddress.message.typeRequired': '请选择地址类型',
|
||||
'user.senderAddress.message.senderNameRequired': '请填写联系人',
|
||||
'user.senderAddress.message.phoneRequired': '请填写手机',
|
||||
'user.senderAddress.message.countryRequired': '请选择国家二字码',
|
||||
'user.senderAddress.message.provinceRequired': '请选择省/州',
|
||||
'user.senderAddress.message.cityRequired': '请选择城市',
|
||||
'user.senderAddress.message.addressRequired': '请填写详细地址',
|
||||
'user.senderAddress.placeholder.countryCode': '请选择国家',
|
||||
'user.senderAddress.placeholder.province': '请选择省/州',
|
||||
'user.senderAddress.placeholder.city': '请选择城市',
|
||||
'user.senderAddress.placeholder.province': '选择或输入省/州',
|
||||
'user.senderAddress.placeholder.city': '选择或输入城市',
|
||||
'order.customs9610.status.pending': '待申报',
|
||||
'order.customs9610.status.declared': '已申报',
|
||||
'order.customs9610.search.keyword': '运单号/客户单号/海关订单号',
|
||||
|
||||
@ -315,6 +315,28 @@ const router = createRouter({
|
||||
adminPortalOnly: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'ops/putaway',
|
||||
name: 'H5AdminOpsPutaway',
|
||||
component: () => import('@/views/h5/admin-center/ops/putaway.vue'),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
locale: 'h5Admin.ops.putaway',
|
||||
h5HideHeader: true,
|
||||
adminPortalOnly: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'ops/relocate',
|
||||
name: 'H5AdminOpsRelocate',
|
||||
component: () => import('@/views/h5/admin-center/ops/relocate.vue'),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
locale: 'h5Admin.ops.relocate',
|
||||
h5HideHeader: true,
|
||||
adminPortalOnly: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'ops/outbound',
|
||||
name: 'H5AdminOpsOutbound',
|
||||
|
||||
@ -61,6 +61,8 @@ import { useI18n } from 'vue-i18n';
|
||||
import { hasPermission } from '@/utils/rbac-permission';
|
||||
import iconParcel from '@/assets/icons/h5/ops-parcel.svg?url';
|
||||
import iconInbound from '@/assets/icons/h5/ops-inbound.svg?url';
|
||||
import iconPutaway from '@/assets/icons/h5/ops-putaway.svg?url';
|
||||
import iconRelocate from '@/assets/icons/h5/ops-relocate.svg?url';
|
||||
import iconOutbound from '@/assets/icons/h5/ops-outbound.svg?url';
|
||||
import iconFulfill from '@/assets/icons/h5/ops-fulfill.svg?url';
|
||||
import iconBag from '@/assets/icons/h5/ops-bag.svg?url';
|
||||
@ -79,7 +81,16 @@ const emit = defineEmits<{
|
||||
const { t } = useI18n();
|
||||
const router = useRouter();
|
||||
|
||||
const items = [
|
||||
type HubItem = {
|
||||
key: string;
|
||||
labelKey: string;
|
||||
path: string;
|
||||
icon: string;
|
||||
permission?: string;
|
||||
permissionAny?: string[];
|
||||
};
|
||||
|
||||
const items: HubItem[] = [
|
||||
{
|
||||
key: 'parcel',
|
||||
labelKey: 'h5Admin.ops.parcelArrival',
|
||||
@ -94,6 +105,23 @@ const items = [
|
||||
icon: iconInbound,
|
||||
permission: 'Operation.InboundScan.Query',
|
||||
},
|
||||
{
|
||||
key: 'putaway',
|
||||
labelKey: 'h5Admin.ops.putaway',
|
||||
path: '/h5/admin/ops/putaway',
|
||||
icon: iconPutaway,
|
||||
permissionAny: [
|
||||
'Warehouse.InboundNotice.ConfirmReceive',
|
||||
'Warehouse.InboundNotice.Save',
|
||||
],
|
||||
},
|
||||
{
|
||||
key: 'relocate',
|
||||
labelKey: 'h5Admin.ops.relocate',
|
||||
path: '/h5/admin/ops/relocate',
|
||||
icon: iconRelocate,
|
||||
permission: 'Warehouse.Inventory.Relocate',
|
||||
},
|
||||
{
|
||||
key: 'outbound',
|
||||
labelKey: 'h5Admin.ops.outbound',
|
||||
@ -124,9 +152,14 @@ const items = [
|
||||
},
|
||||
];
|
||||
|
||||
const visibleItems = computed(() =>
|
||||
items.filter((item) => hasPermission(item.permission)),
|
||||
);
|
||||
function canSeeHubItem(item: HubItem) {
|
||||
if (item.permissionAny?.length) {
|
||||
return item.permissionAny.some((p) => hasPermission(p));
|
||||
}
|
||||
return item.permission ? hasPermission(item.permission) : false;
|
||||
}
|
||||
|
||||
const visibleItems = computed(() => items.filter((item) => canSeeHubItem(item)));
|
||||
|
||||
function close() {
|
||||
emit('update:visible', false);
|
||||
|
||||
@ -163,12 +163,46 @@ export default {
|
||||
|
||||
'h5Admin.ops.fab': 'Ops',
|
||||
'h5Admin.ops.hubTitle': 'Warehouse ops',
|
||||
'h5Admin.ops.hubHint': 'Arrival, inbound, outbound, pick, bag & board',
|
||||
'h5Admin.ops.hubHint': 'Arrival, inbound, putaway, relocate, outbound, pick, bag & board',
|
||||
'h5Admin.ops.noPermission': 'No ops permission',
|
||||
'h5Admin.ops.parcelArrival': 'Parcel arrival',
|
||||
'h5Admin.ops.parcelArrivalDesc': 'Scan domestic tracking to arrive',
|
||||
'h5Admin.ops.inbound': 'Inbound scan',
|
||||
'h5Admin.ops.inboundDesc': 'Scan waybill and enter dimensions',
|
||||
'h5Admin.ops.putaway': 'Putaway scan',
|
||||
'h5Admin.ops.putawayDesc': 'Scan notice/box mark to receive & putaway',
|
||||
'h5Admin.ops.putaway.scanPlaceholder': 'Scan notice no. or box mark',
|
||||
'h5Admin.ops.putaway.lookup': 'Lookup',
|
||||
'h5Admin.ops.putaway.confirm': 'Confirm putaway',
|
||||
'h5Admin.ops.putaway.applyBin': 'Apply bin to all',
|
||||
'h5Admin.ops.putaway.pending': 'Pending putaway',
|
||||
'h5Admin.ops.putaway.emptyPending': 'No pending inbound notices',
|
||||
'h5Admin.ops.putaway.codeRequired': 'Scan or enter notice no. / box mark',
|
||||
'h5Admin.ops.putaway.binRequired': 'Bin required for lines with received qty',
|
||||
'h5Admin.ops.putaway.qtyInvalid': 'Received qty cannot be negative',
|
||||
'h5Admin.ops.putaway.success': 'Putaway succeeded',
|
||||
'h5Admin.ops.putaway.failed': 'Putaway failed',
|
||||
'h5Admin.ops.putaway.loadFailed': 'Load failed',
|
||||
'h5Admin.ops.putaway.selectBin': 'Select bin',
|
||||
'h5Admin.ops.putaway.plannedQty': 'Planned',
|
||||
'h5Admin.ops.putaway.receivedQty': 'Received',
|
||||
'h5Admin.ops.putaway.bin': 'Bin',
|
||||
'h5Admin.ops.relocate': 'Relocate',
|
||||
'h5Admin.ops.relocateDesc': 'Scan SKU then move between bins',
|
||||
'h5Admin.ops.relocate.scanPlaceholder': 'Scan or enter SKU code',
|
||||
'h5Admin.ops.relocate.lookup': 'Lookup',
|
||||
'h5Admin.ops.relocate.confirm': 'Confirm relocate',
|
||||
'h5Admin.ops.relocate.pickSku': 'Pick SKU',
|
||||
'h5Admin.ops.relocate.stockList': 'Warehouse stock',
|
||||
'h5Admin.ops.relocate.emptyStock': 'No stock',
|
||||
'h5Admin.ops.relocate.codeRequired': 'Scan or enter SKU code',
|
||||
'h5Admin.ops.relocate.notFound': 'No matching inventory',
|
||||
'h5Admin.ops.relocate.loadFailed': 'Load failed',
|
||||
'h5Admin.ops.relocate.sourceBin': 'Source bin',
|
||||
'h5Admin.ops.relocate.targetBin': 'Target bin',
|
||||
'h5Admin.ops.relocate.selectSource': 'Select source bin',
|
||||
'h5Admin.ops.relocate.selectTarget': 'Select target bin',
|
||||
'h5Admin.ops.relocate.qty': 'Qty',
|
||||
'h5Admin.ops.outbound': 'Outbound scan',
|
||||
'h5Admin.ops.outboundDesc': 'Scan waybill and verify weight',
|
||||
'h5Admin.ops.fulfillPack': 'Fulfill pick',
|
||||
|
||||
@ -163,12 +163,46 @@ export default {
|
||||
|
||||
'h5Admin.ops.fab': '操作',
|
||||
'h5Admin.ops.hubTitle': '仓操入口',
|
||||
'h5Admin.ops.hubHint': '到仓、入库、出库、拣货、装袋与打板',
|
||||
'h5Admin.ops.hubHint': '到仓、入库、上架、换库位、出库、拣货、装袋与打板',
|
||||
'h5Admin.ops.noPermission': '暂无操作权限',
|
||||
'h5Admin.ops.parcelArrival': '快递到仓',
|
||||
'h5Admin.ops.parcelArrivalDesc': '扫国内快递单确认到仓',
|
||||
'h5Admin.ops.inbound': '入库扫描',
|
||||
'h5Admin.ops.inboundDesc': '扫运单入库并录入材积',
|
||||
'h5Admin.ops.putaway': '上架扫描',
|
||||
'h5Admin.ops.putawayDesc': '扫预报/箱唛确认收货上架',
|
||||
'h5Admin.ops.putaway.scanPlaceholder': '扫描预报单号或箱唛',
|
||||
'h5Admin.ops.putaway.lookup': '查询',
|
||||
'h5Admin.ops.putaway.confirm': '确认上架',
|
||||
'h5Admin.ops.putaway.applyBin': '库位应用到全部',
|
||||
'h5Admin.ops.putaway.pending': '待上架',
|
||||
'h5Admin.ops.putaway.emptyPending': '暂无待上架预报',
|
||||
'h5Admin.ops.putaway.codeRequired': '请扫描或输入预报单号 / 箱唛',
|
||||
'h5Admin.ops.putaway.binRequired': '有实收的明细必须选择库位',
|
||||
'h5Admin.ops.putaway.qtyInvalid': '实收数量不能为负',
|
||||
'h5Admin.ops.putaway.success': '上架成功',
|
||||
'h5Admin.ops.putaway.failed': '上架失败',
|
||||
'h5Admin.ops.putaway.loadFailed': '加载失败',
|
||||
'h5Admin.ops.putaway.selectBin': '选择库位',
|
||||
'h5Admin.ops.putaway.plannedQty': '预报',
|
||||
'h5Admin.ops.putaway.receivedQty': '实收',
|
||||
'h5Admin.ops.putaway.bin': '库位',
|
||||
'h5Admin.ops.relocate': '换库位',
|
||||
'h5Admin.ops.relocateDesc': '扫 SKU 选择源/目标库位调拨',
|
||||
'h5Admin.ops.relocate.scanPlaceholder': '扫描或输入 SKU 编码',
|
||||
'h5Admin.ops.relocate.lookup': '查询',
|
||||
'h5Admin.ops.relocate.confirm': '确认换库位',
|
||||
'h5Admin.ops.relocate.pickSku': '选择 SKU',
|
||||
'h5Admin.ops.relocate.stockList': '当前仓库存',
|
||||
'h5Admin.ops.relocate.emptyStock': '暂无库存',
|
||||
'h5Admin.ops.relocate.codeRequired': '请扫描或输入 SKU 编码',
|
||||
'h5Admin.ops.relocate.notFound': '未找到匹配库存',
|
||||
'h5Admin.ops.relocate.loadFailed': '加载失败',
|
||||
'h5Admin.ops.relocate.sourceBin': '源库位',
|
||||
'h5Admin.ops.relocate.targetBin': '目标库位',
|
||||
'h5Admin.ops.relocate.selectSource': '选择源库位',
|
||||
'h5Admin.ops.relocate.selectTarget': '选择目标库位',
|
||||
'h5Admin.ops.relocate.qty': '调拨数量',
|
||||
'h5Admin.ops.outbound': '出库扫描',
|
||||
'h5Admin.ops.outboundDesc': '扫运单出库并核对重量',
|
||||
'h5Admin.ops.fulfillPack': '代发拣货',
|
||||
|
||||
570
src/views/h5/admin-center/ops/putaway.vue
Normal file
570
src/views/h5/admin-center/ops/putaway.vue
Normal file
@ -0,0 +1,570 @@
|
||||
<template>
|
||||
<div class="h5-ops">
|
||||
<H5OpsPageHeader :title="t('h5Admin.ops.putaway')" @change="onWarehouseChange" />
|
||||
|
||||
<div class="h5-ops__scan-row">
|
||||
<H5ScanInput
|
||||
ref="scanRef"
|
||||
v-model="scanCode"
|
||||
:placeholder="t('h5Admin.ops.putaway.scanPlaceholder')"
|
||||
:sheet-title="t('h5Admin.ops.cameraSheetTitle')"
|
||||
:sheet-hint="t('h5Admin.ops.cameraSheetHint')"
|
||||
:close-label="t('h5Admin.ops.cameraClose')"
|
||||
:torch-on-label="t('h5Admin.ops.torchOn')"
|
||||
:torch-off-label="t('h5Admin.ops.torchOff')"
|
||||
@enter="lookup"
|
||||
@detect="onDetect"
|
||||
@error="onScanError"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
class="h5-ops__primary"
|
||||
:disabled="lookingUp || submitting"
|
||||
@click="lookup"
|
||||
>
|
||||
{{ t('h5Admin.ops.putaway.lookup') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<p v-if="feedbackMessage" class="h5-ops__feedback" :class="`is-${feedbackType}`">
|
||||
{{ feedbackMessage }}
|
||||
</p>
|
||||
|
||||
<section v-if="notice" class="h5-ops__panel h5-putaway__panel">
|
||||
<p class="h5-ops__waybill">{{ notice.noticeNo }}</p>
|
||||
<p class="h5-ops__meta">
|
||||
{{ notice.customerName || notice.customerCode || '-' }}
|
||||
· {{ notice.boxCount }} {{ t('warehouse.inbound.box') }}
|
||||
· {{ notice.plannedQty }} pcs
|
||||
</p>
|
||||
|
||||
<div class="h5-putaway__bulk">
|
||||
<label>{{ t('h5Admin.ops.putaway.applyBin') }}</label>
|
||||
<a-select
|
||||
v-model="bulkBinId"
|
||||
:options="binOptions"
|
||||
allow-search
|
||||
allow-clear
|
||||
:placeholder="t('h5Admin.ops.putaway.selectBin')"
|
||||
@change="applyBinToAll"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div v-for="box in boxes" :key="box.boxId" class="h5-putaway__box">
|
||||
<h3>
|
||||
{{ t('warehouse.inbound.box') }} {{ box.boxSeqNo || '-' }}
|
||||
<span v-if="box.markBoxNo">({{ box.markBoxNo }})</span>
|
||||
</h3>
|
||||
<article v-for="line in box.lines" :key="line.lineId" class="h5-putaway__line">
|
||||
<strong>{{ line.skuCode }}</strong>
|
||||
<div class="h5-putaway__line-row">
|
||||
<span>{{ t('h5Admin.ops.putaway.plannedQty') }} {{ line.plannedQty }}</span>
|
||||
<label>
|
||||
{{ t('h5Admin.ops.putaway.receivedQty') }}
|
||||
<input
|
||||
v-model.number="line.receivedQty"
|
||||
type="number"
|
||||
inputmode="numeric"
|
||||
min="0"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
<label class="h5-putaway__bin">
|
||||
{{ t('h5Admin.ops.putaway.bin') }}
|
||||
<a-select
|
||||
v-model="line.binLocationId"
|
||||
:options="binOptions"
|
||||
allow-search
|
||||
allow-clear
|
||||
:disabled="!(line.receivedQty > 0)"
|
||||
:placeholder="t('h5Admin.ops.putaway.selectBin')"
|
||||
/>
|
||||
</label>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="h5-ops__primary h5-putaway__submit"
|
||||
:disabled="submitting || lookingUp"
|
||||
@click="submit"
|
||||
>
|
||||
{{ t('h5Admin.ops.putaway.confirm') }}
|
||||
</button>
|
||||
</section>
|
||||
|
||||
<section class="h5-ops__recent">
|
||||
<div class="h5-ops__queue-head">
|
||||
<h2>{{ t('h5Admin.ops.putaway.pending') }}</h2>
|
||||
<button type="button" @click="loadPending">{{ t('h5Admin.ops.refresh') }}</button>
|
||||
</div>
|
||||
<a-spin :loading="listLoading" style="width: 100%">
|
||||
<p v-if="!listLoading && !pendingRows.length" class="h5-ops__empty">
|
||||
{{ t('h5Admin.ops.putaway.emptyPending') }}
|
||||
</p>
|
||||
<article
|
||||
v-for="row in pendingRows"
|
||||
:key="row.id"
|
||||
class="h5-ops__card"
|
||||
:class="{ 'is-active': notice?.id === row.id }"
|
||||
@click="loadById(row)"
|
||||
>
|
||||
<strong>{{ row.noticeNo }}</strong>
|
||||
<span>{{ row.customerName || '-' }} · {{ row.boxCount }} box · {{ row.plannedQty }} pcs</span>
|
||||
<em>{{ row.receiptStatus }} · {{ row.createTime }}</em>
|
||||
</article>
|
||||
</a-spin>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { nextTick, onMounted, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import H5ScanInput from '@/components/h5/H5ScanInput.vue';
|
||||
import H5OpsPageHeader from './H5OpsPageHeader.vue';
|
||||
import {
|
||||
confirmWarehouseInboundReceive,
|
||||
getWarehouseBinLocationList,
|
||||
getWarehouseInboundDetail,
|
||||
getWarehouseInboundList,
|
||||
lookupWarehouseInboundByScan,
|
||||
} from '@/api/warehouse';
|
||||
import { useCurrentWarehouseStore } from '@/store';
|
||||
import { useOperationScanFeedback } from '@/composables/useOperationScanFeedback';
|
||||
import { hasPermission } from '@/utils/rbac-permission';
|
||||
import { formatDateTime, normalizeListRow, pickField } from '@/utils/warehouseListMapper';
|
||||
|
||||
defineOptions({ name: 'H5AdminOpsPutaway' });
|
||||
|
||||
type PutawayLine = {
|
||||
lineId: number;
|
||||
skuCode: string;
|
||||
plannedQty: number;
|
||||
receivedQty: number;
|
||||
binLocationId?: number;
|
||||
};
|
||||
|
||||
type PutawayBox = {
|
||||
boxId: number;
|
||||
boxSeqNo: string;
|
||||
markBoxNo: string;
|
||||
lines: PutawayLine[];
|
||||
};
|
||||
|
||||
type NoticeHead = {
|
||||
id: number;
|
||||
customerId: number;
|
||||
warehouseId: number;
|
||||
noticeNo: string;
|
||||
customerName: string;
|
||||
customerCode: string;
|
||||
boxCount: number;
|
||||
plannedQty: number;
|
||||
};
|
||||
|
||||
type PendingRow = {
|
||||
id: number;
|
||||
customerId: number;
|
||||
noticeNo: string;
|
||||
customerName: string;
|
||||
boxCount: number;
|
||||
plannedQty: number;
|
||||
receiptStatus: string;
|
||||
createTime: string;
|
||||
};
|
||||
|
||||
const { t } = useI18n();
|
||||
const scanRef = ref<InstanceType<typeof H5ScanInput> | null>(null);
|
||||
const currentWarehouseStore = useCurrentWarehouseStore();
|
||||
const {
|
||||
feedbackType,
|
||||
feedbackMessage,
|
||||
clearFeedback,
|
||||
showError,
|
||||
showSuccess,
|
||||
showWarning,
|
||||
} = useOperationScanFeedback('h5Putaway');
|
||||
|
||||
const scanCode = ref('');
|
||||
const lookingUp = ref(false);
|
||||
const submitting = ref(false);
|
||||
const listLoading = ref(false);
|
||||
const notice = ref<NoticeHead | null>(null);
|
||||
const boxes = ref<PutawayBox[]>([]);
|
||||
const binOptions = ref<Array<{ label: string; value: number }>>([]);
|
||||
const bulkBinId = ref<number | undefined>();
|
||||
const pendingRows = ref<PendingRow[]>([]);
|
||||
|
||||
function canMutate() {
|
||||
return (
|
||||
hasPermission('Warehouse.InboundNotice.ConfirmReceive')
|
||||
|| hasPermission('Warehouse.InboundNotice.Save')
|
||||
);
|
||||
}
|
||||
|
||||
function refocus() {
|
||||
nextTick(() => scanRef.value?.focus());
|
||||
}
|
||||
|
||||
function resetForm() {
|
||||
notice.value = null;
|
||||
boxes.value = [];
|
||||
bulkBinId.value = undefined;
|
||||
}
|
||||
|
||||
function applyDetail(raw: Record<string, unknown>) {
|
||||
const row = normalizeListRow(raw);
|
||||
const whId = Number(pickField(row, 'warehouseId', 'WarehouseId') || 0);
|
||||
notice.value = {
|
||||
id: Number(pickField(row, 'id', 'Id') || 0),
|
||||
customerId: Number(pickField(row, 'customerId', 'CustomerId') || 0),
|
||||
warehouseId: whId,
|
||||
noticeNo: String(pickField(row, 'noticeNo', 'NoticeNo') || ''),
|
||||
customerName: String(pickField(row, 'customerName', 'CustomerName') || ''),
|
||||
customerCode: String(pickField(row, 'customerCode', 'CustomerCode') || ''),
|
||||
boxCount: Number(pickField(row, 'boxCount', 'BoxCount') || 0),
|
||||
plannedQty: Number(pickField(row, 'plannedQty', 'PlannedQty') || 0),
|
||||
};
|
||||
|
||||
const boxesRaw = pickField(row, 'boxes', 'Boxes');
|
||||
const boxList = Array.isArray(boxesRaw) ? boxesRaw : [];
|
||||
boxes.value = boxList.map((boxRaw: Record<string, unknown>) => {
|
||||
const box = normalizeListRow(boxRaw);
|
||||
const linesRaw = pickField(box, 'lines', 'Lines');
|
||||
const lines = Array.isArray(linesRaw) ? linesRaw : [];
|
||||
return {
|
||||
boxId: Number(pickField(box, 'id', 'Id') || 0),
|
||||
boxSeqNo: String(pickField(box, 'boxSeqNo', 'BoxSeqNo') || ''),
|
||||
markBoxNo: String(pickField(box, 'markBoxNo', 'MarkBoxNo') || ''),
|
||||
lines: lines.map((lineRaw: Record<string, unknown>) => {
|
||||
const line = normalizeListRow(lineRaw);
|
||||
const planned = Number(pickField(line, 'plannedQty', 'PlannedQty') || 0);
|
||||
const received = pickField<number>(line, 'receivedQty', 'ReceivedQty');
|
||||
const binId = pickField<number>(line, 'binLocationId', 'BinLocationId');
|
||||
return {
|
||||
lineId: Number(pickField(line, 'id', 'Id') || 0),
|
||||
skuCode: String(pickField(line, 'skuCode', 'SkuCode') || '-'),
|
||||
plannedQty: planned,
|
||||
receivedQty: received != null ? Number(received) : planned,
|
||||
binLocationId: binId != null && Number(binId) > 0 ? Number(binId) : undefined,
|
||||
};
|
||||
}),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
async function loadBinOptions(warehouseId?: number) {
|
||||
if (!warehouseId) {
|
||||
binOptions.value = [];
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const { items } = await getWarehouseBinLocationList({
|
||||
warehouseId,
|
||||
isEnabled: true,
|
||||
});
|
||||
binOptions.value = (items || []).map((b: Record<string, unknown>) => {
|
||||
const row = normalizeListRow(b);
|
||||
const code = String(pickField(row, 'binCode', 'BinCode') || '');
|
||||
const name = String(pickField(row, 'binName', 'BinName') || '');
|
||||
return {
|
||||
label: name ? `${code} - ${name}` : code,
|
||||
value: Number(pickField(row, 'id', 'Id') || 0),
|
||||
};
|
||||
});
|
||||
} catch {
|
||||
binOptions.value = [];
|
||||
}
|
||||
}
|
||||
|
||||
function applyBinToAll(binId?: number) {
|
||||
const id = binId != null ? Number(binId) : undefined;
|
||||
bulkBinId.value = id && id > 0 ? id : undefined;
|
||||
if (!bulkBinId.value) return;
|
||||
for (const box of boxes.value) {
|
||||
for (const line of box.lines) {
|
||||
if (line.receivedQty > 0) {
|
||||
line.binLocationId = bulkBinId.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function onDetect(code: string) {
|
||||
scanCode.value = code;
|
||||
await lookup();
|
||||
}
|
||||
|
||||
function onScanError(message: string) {
|
||||
showError(message);
|
||||
}
|
||||
|
||||
async function onWarehouseChange() {
|
||||
clearFeedback();
|
||||
scanCode.value = '';
|
||||
resetForm();
|
||||
await loadBinOptions(currentWarehouseStore.warehouseId);
|
||||
await loadPending();
|
||||
refocus();
|
||||
}
|
||||
|
||||
async function lookup() {
|
||||
if (!canMutate()) {
|
||||
showWarning(t('h5Admin.ops.noPermission'));
|
||||
return;
|
||||
}
|
||||
const code = scanCode.value.trim();
|
||||
if (!code) {
|
||||
showWarning(t('h5Admin.ops.putaway.codeRequired'));
|
||||
refocus();
|
||||
return;
|
||||
}
|
||||
const warehouseId = currentWarehouseStore.warehouseId;
|
||||
if (!warehouseId) {
|
||||
showWarning(t('warehouse.common.noCurrentWarehouse'));
|
||||
return;
|
||||
}
|
||||
|
||||
lookingUp.value = true;
|
||||
clearFeedback();
|
||||
try {
|
||||
const detail = (await lookupWarehouseInboundByScan({
|
||||
code,
|
||||
warehouseId,
|
||||
})) as Record<string, unknown>;
|
||||
applyDetail(detail || {});
|
||||
const noticeWh = notice.value?.warehouseId;
|
||||
if (noticeWh && noticeWh !== warehouseId) {
|
||||
showWarning(t('h5Admin.ops.putaway.loadFailed'));
|
||||
resetForm();
|
||||
return;
|
||||
}
|
||||
await loadBinOptions(warehouseId);
|
||||
scanCode.value = '';
|
||||
} catch (e: any) {
|
||||
resetForm();
|
||||
showError(e?.message || t('h5Admin.ops.putaway.loadFailed'));
|
||||
refocus();
|
||||
} finally {
|
||||
lookingUp.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function loadById(row: PendingRow) {
|
||||
if (!canMutate()) {
|
||||
showWarning(t('h5Admin.ops.noPermission'));
|
||||
return;
|
||||
}
|
||||
lookingUp.value = true;
|
||||
clearFeedback();
|
||||
try {
|
||||
const detail = (await getWarehouseInboundDetail(
|
||||
row.id,
|
||||
row.customerId > 0 ? row.customerId : undefined,
|
||||
)) as Record<string, unknown>;
|
||||
applyDetail(detail || {});
|
||||
await loadBinOptions(currentWarehouseStore.warehouseId || notice.value?.warehouseId);
|
||||
} catch (e: any) {
|
||||
showError(e?.message || t('h5Admin.ops.putaway.loadFailed'));
|
||||
} finally {
|
||||
lookingUp.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function loadPending() {
|
||||
const warehouseId = currentWarehouseStore.warehouseId;
|
||||
if (!warehouseId) {
|
||||
pendingRows.value = [];
|
||||
return;
|
||||
}
|
||||
listLoading.value = true;
|
||||
try {
|
||||
const [forecasted, received] = await Promise.all([
|
||||
getWarehouseInboundList({
|
||||
page: 1,
|
||||
pageSize: 30,
|
||||
warehouseId,
|
||||
receiptStatus: 'forecasted',
|
||||
}),
|
||||
getWarehouseInboundList({
|
||||
page: 1,
|
||||
pageSize: 30,
|
||||
warehouseId,
|
||||
receiptStatus: 'received',
|
||||
}),
|
||||
]);
|
||||
const mapRow = (raw: Record<string, unknown>): PendingRow => {
|
||||
const row = normalizeListRow(raw);
|
||||
return {
|
||||
id: Number(pickField(row, 'id', 'Id') || 0),
|
||||
customerId: Number(pickField(row, 'customerId', 'CustomerId') || 0),
|
||||
noticeNo: String(pickField(row, 'noticeNo', 'NoticeNo') || '-'),
|
||||
customerName: String(pickField(row, 'customerName', 'CustomerName') || ''),
|
||||
boxCount: Number(pickField(row, 'boxCount', 'BoxCount') || 0),
|
||||
plannedQty: Number(pickField(row, 'plannedQty', 'PlannedQty') || 0),
|
||||
receiptStatus: String(pickField(row, 'receiptStatus', 'ReceiptStatus') || ''),
|
||||
createTime: formatDateTime(pickField(row, 'createTime', 'CreateTime')),
|
||||
};
|
||||
};
|
||||
const merged = [...(forecasted.items || []), ...(received.items || [])]
|
||||
.map((x) => mapRow(x as Record<string, unknown>))
|
||||
.filter((x) => x.id > 0);
|
||||
merged.sort((a, b) => (a.createTime < b.createTime ? 1 : -1));
|
||||
pendingRows.value = merged.slice(0, 30);
|
||||
} catch (e: any) {
|
||||
pendingRows.value = [];
|
||||
showError(e?.message || t('h5Admin.ops.putaway.loadFailed'));
|
||||
} finally {
|
||||
listLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function submit() {
|
||||
if (!canMutate()) {
|
||||
showWarning(t('h5Admin.ops.noPermission'));
|
||||
return;
|
||||
}
|
||||
const head = notice.value;
|
||||
if (!head?.id) return;
|
||||
|
||||
for (const box of boxes.value) {
|
||||
for (const line of box.lines) {
|
||||
if (line.receivedQty < 0) {
|
||||
showWarning(t('h5Admin.ops.putaway.qtyInvalid'));
|
||||
return;
|
||||
}
|
||||
if (line.receivedQty > 0 && !line.binLocationId) {
|
||||
showWarning(t('h5Admin.ops.putaway.binRequired'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
submitting.value = true;
|
||||
try {
|
||||
await confirmWarehouseInboundReceive({
|
||||
inboundNoticeId: head.id,
|
||||
customerId: head.customerId > 0 ? head.customerId : undefined,
|
||||
boxes: boxes.value.map((box) => ({
|
||||
boxId: box.boxId,
|
||||
lines: box.lines.map((line) => ({
|
||||
lineId: line.lineId,
|
||||
receivedQty: Number(line.receivedQty) || 0,
|
||||
binLocationId: line.receivedQty > 0 ? Number(line.binLocationId) : 0,
|
||||
})),
|
||||
})),
|
||||
});
|
||||
showSuccess(t('h5Admin.ops.putaway.success'));
|
||||
resetForm();
|
||||
scanCode.value = '';
|
||||
await loadPending();
|
||||
refocus();
|
||||
} catch (e: any) {
|
||||
showError(e?.message || t('h5Admin.ops.putaway.failed'));
|
||||
} finally {
|
||||
submitting.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
clearFeedback();
|
||||
await loadBinOptions(currentWarehouseStore.warehouseId);
|
||||
await loadPending();
|
||||
refocus();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
@import './ops-shared.less';
|
||||
|
||||
.h5-putaway__panel {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.h5-putaway__bulk {
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
|
||||
label {
|
||||
font-size: 12px;
|
||||
color: var(--h5-text-2, #4e5969);
|
||||
}
|
||||
}
|
||||
|
||||
.h5-putaway__box {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
padding-top: 4px;
|
||||
|
||||
h3 {
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
font-weight: 650;
|
||||
color: var(--h5-text, #1d2129);
|
||||
|
||||
span {
|
||||
font-weight: 400;
|
||||
color: var(--h5-text-3, #86909c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.h5-putaway__line {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
padding: 10px;
|
||||
border-radius: 10px;
|
||||
background: var(--h5-well-bg, #f0f3f4);
|
||||
|
||||
strong {
|
||||
font-size: 14px;
|
||||
color: var(--h5-text, #1d2129);
|
||||
word-break: break-all;
|
||||
}
|
||||
}
|
||||
|
||||
.h5-putaway__line-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
font-size: 12px;
|
||||
color: var(--h5-text-2, #4e5969);
|
||||
|
||||
label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
input {
|
||||
width: 72px;
|
||||
height: 32px;
|
||||
padding: 0 8px;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
background: #fff;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.h5-putaway__bin {
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
font-size: 12px;
|
||||
color: var(--h5-text-2, #4e5969);
|
||||
}
|
||||
|
||||
.h5-putaway__submit {
|
||||
width: 100%;
|
||||
height: 44px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.h5-ops__card {
|
||||
cursor: pointer;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
</style>
|
||||
517
src/views/h5/admin-center/ops/relocate.vue
Normal file
517
src/views/h5/admin-center/ops/relocate.vue
Normal file
@ -0,0 +1,517 @@
|
||||
<template>
|
||||
<div class="h5-ops">
|
||||
<H5OpsPageHeader :title="t('h5Admin.ops.relocate')" @change="onWarehouseChange" />
|
||||
|
||||
<div class="h5-ops__scan-row">
|
||||
<H5ScanInput
|
||||
ref="scanRef"
|
||||
v-model="scanCode"
|
||||
:placeholder="t('h5Admin.ops.relocate.scanPlaceholder')"
|
||||
:sheet-title="t('h5Admin.ops.cameraSheetTitle')"
|
||||
:sheet-hint="t('h5Admin.ops.cameraSheetHint')"
|
||||
:close-label="t('h5Admin.ops.cameraClose')"
|
||||
:torch-on-label="t('h5Admin.ops.torchOn')"
|
||||
:torch-off-label="t('h5Admin.ops.torchOff')"
|
||||
@enter="lookup"
|
||||
@detect="onDetect"
|
||||
@error="onScanError"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
class="h5-ops__primary"
|
||||
:disabled="lookingUp || submitting"
|
||||
@click="lookup"
|
||||
>
|
||||
{{ t('h5Admin.ops.relocate.lookup') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<p v-if="feedbackMessage" class="h5-ops__feedback" :class="`is-${feedbackType}`">
|
||||
{{ feedbackMessage }}
|
||||
</p>
|
||||
|
||||
<section v-if="candidates.length > 1 && !activeSku" class="h5-ops__recent">
|
||||
<h2>{{ t('h5Admin.ops.relocate.pickSku') }}</h2>
|
||||
<article
|
||||
v-for="row in candidates"
|
||||
:key="`${row.customerId}-${row.skuId}`"
|
||||
class="h5-ops__card"
|
||||
@click="selectSku(row)"
|
||||
>
|
||||
<strong>{{ row.skuCode }}</strong>
|
||||
<span>{{ row.skuName || '-' }} · {{ row.customerName || '-' }}</span>
|
||||
<em>{{ row.availableQty }} / {{ row.totalQty }} · {{ row.binCount }} bin</em>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<section v-if="activeSku" class="h5-ops__panel h5-relocate__panel">
|
||||
<p class="h5-ops__waybill">{{ activeSku.skuCode }}</p>
|
||||
<p class="h5-ops__meta">
|
||||
{{ activeSku.skuName || '-' }}
|
||||
· {{ activeSku.customerName || activeSku.customerCode || '-' }}
|
||||
· {{ activeSku.availableQty }} / {{ activeSku.totalQty }}
|
||||
</p>
|
||||
|
||||
<label class="h5-relocate__field">
|
||||
{{ t('h5Admin.ops.relocate.sourceBin') }}
|
||||
<a-select
|
||||
v-model="form.sourceBinLocationId"
|
||||
:options="sourceBinOptions"
|
||||
allow-search
|
||||
allow-clear
|
||||
:placeholder="t('h5Admin.ops.relocate.selectSource')"
|
||||
@change="onSourceBinChange"
|
||||
/>
|
||||
</label>
|
||||
|
||||
<label class="h5-relocate__field">
|
||||
{{ t('h5Admin.ops.relocate.targetBin') }}
|
||||
<a-select
|
||||
v-model="form.targetBinLocationId"
|
||||
:options="targetBinOptions"
|
||||
allow-search
|
||||
allow-clear
|
||||
:placeholder="t('h5Admin.ops.relocate.selectTarget')"
|
||||
/>
|
||||
</label>
|
||||
|
||||
<label class="h5-relocate__field">
|
||||
{{ t('h5Admin.ops.relocate.qty') }}
|
||||
<span class="h5-relocate__qty-hint">max {{ sourceMaxQty }}</span>
|
||||
<input
|
||||
v-model.number="form.qty"
|
||||
type="number"
|
||||
inputmode="numeric"
|
||||
min="1"
|
||||
:max="sourceMaxQty"
|
||||
/>
|
||||
</label>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="h5-ops__primary h5-relocate__submit"
|
||||
:disabled="submitting || lookingUp"
|
||||
@click="submit"
|
||||
>
|
||||
{{ t('h5Admin.ops.relocate.confirm') }}
|
||||
</button>
|
||||
</section>
|
||||
|
||||
<section class="h5-ops__recent">
|
||||
<div class="h5-ops__queue-head">
|
||||
<h2>{{ t('h5Admin.ops.relocate.stockList') }}</h2>
|
||||
<button type="button" @click="loadStockList">{{ t('h5Admin.ops.refresh') }}</button>
|
||||
</div>
|
||||
<a-spin :loading="listLoading" style="width: 100%">
|
||||
<p v-if="!listLoading && !stockRows.length" class="h5-ops__empty">
|
||||
{{ t('h5Admin.ops.relocate.emptyStock') }}
|
||||
</p>
|
||||
<article
|
||||
v-for="row in stockRows"
|
||||
:key="`${row.customerId}-${row.skuId}`"
|
||||
class="h5-ops__card"
|
||||
:class="{
|
||||
'is-active':
|
||||
activeSku?.skuId === row.skuId && activeSku?.customerId === row.customerId,
|
||||
}"
|
||||
@click="selectSku(row)"
|
||||
>
|
||||
<strong>{{ row.skuCode }}</strong>
|
||||
<span>{{ row.skuName || '-' }} · {{ row.customerName || '-' }}</span>
|
||||
<em>{{ row.availableQty }} / {{ row.totalQty }} · {{ row.binCount }} bin</em>
|
||||
</article>
|
||||
</a-spin>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, nextTick, onMounted, reactive, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import H5ScanInput from '@/components/h5/H5ScanInput.vue';
|
||||
import H5OpsPageHeader from './H5OpsPageHeader.vue';
|
||||
import {
|
||||
getWarehouseBinLocationList,
|
||||
getWarehouseInventoryBinDetail,
|
||||
getWarehouseInventoryList,
|
||||
relocateWarehouseInventory,
|
||||
} from '@/api/warehouse';
|
||||
import { useCurrentWarehouseStore } from '@/store';
|
||||
import { useOperationScanFeedback } from '@/composables/useOperationScanFeedback';
|
||||
import { hasPermission } from '@/utils/rbac-permission';
|
||||
import { normalizeListRow, pickField } from '@/utils/warehouseListMapper';
|
||||
|
||||
defineOptions({ name: 'H5AdminOpsRelocate' });
|
||||
|
||||
type StockRow = {
|
||||
customerId: number;
|
||||
customerName: string;
|
||||
customerCode: string;
|
||||
skuId: number;
|
||||
skuCode: string;
|
||||
skuName: string;
|
||||
warehouseId: number;
|
||||
availableQty: number;
|
||||
totalQty: number;
|
||||
binCount: number;
|
||||
};
|
||||
|
||||
type BinOpt = { label: string; value: number; qty?: number };
|
||||
|
||||
const { t } = useI18n();
|
||||
const scanRef = ref<InstanceType<typeof H5ScanInput> | null>(null);
|
||||
const currentWarehouseStore = useCurrentWarehouseStore();
|
||||
const {
|
||||
feedbackType,
|
||||
feedbackMessage,
|
||||
clearFeedback,
|
||||
showError,
|
||||
showSuccess,
|
||||
showWarning,
|
||||
} = useOperationScanFeedback('h5Relocate');
|
||||
|
||||
const scanCode = ref('');
|
||||
const lookingUp = ref(false);
|
||||
const submitting = ref(false);
|
||||
const listLoading = ref(false);
|
||||
const candidates = ref<StockRow[]>([]);
|
||||
const activeSku = ref<StockRow | null>(null);
|
||||
const stockRows = ref<StockRow[]>([]);
|
||||
const sourceBinOptions = ref<BinOpt[]>([]);
|
||||
const targetBinOptions = ref<BinOpt[]>([]);
|
||||
const form = reactive({
|
||||
sourceBinLocationId: undefined as number | undefined,
|
||||
targetBinLocationId: undefined as number | undefined,
|
||||
qty: 1,
|
||||
});
|
||||
|
||||
const sourceMaxQty = computed(() => {
|
||||
const sourceId = form.sourceBinLocationId;
|
||||
if (!sourceId) return activeSku.value?.totalQty || 1;
|
||||
const hit = sourceBinOptions.value.find((b) => b.value === sourceId);
|
||||
return hit?.qty || 1;
|
||||
});
|
||||
|
||||
function canMutate() {
|
||||
return hasPermission('Warehouse.Inventory.Relocate');
|
||||
}
|
||||
|
||||
function refocus() {
|
||||
nextTick(() => scanRef.value?.focus());
|
||||
}
|
||||
|
||||
function mapStockRow(raw: Record<string, unknown>): StockRow {
|
||||
const row = normalizeListRow(raw);
|
||||
return {
|
||||
customerId: Number(pickField(row, 'customerId', 'CustomerId') || 0),
|
||||
customerName: String(pickField(row, 'customerName', 'CustomerName') || ''),
|
||||
customerCode: String(pickField(row, 'customerCode', 'CustomerCode') || ''),
|
||||
skuId: Number(pickField(row, 'skuId', 'SkuId') || 0),
|
||||
skuCode: String(pickField(row, 'skuCode', 'SkuCode') || '-'),
|
||||
skuName: String(pickField(row, 'skuName', 'SkuName') || ''),
|
||||
warehouseId: Number(pickField(row, 'warehouseId', 'WarehouseId') || 0),
|
||||
availableQty: Number(pickField(row, 'availableQty', 'AvailableQty') || 0),
|
||||
totalQty: Number(pickField(row, 'totalQty', 'TotalQty') || 0),
|
||||
binCount: Number(pickField(row, 'binCount', 'BinCount') || 0),
|
||||
};
|
||||
}
|
||||
|
||||
function resetForm() {
|
||||
activeSku.value = null;
|
||||
candidates.value = [];
|
||||
sourceBinOptions.value = [];
|
||||
form.sourceBinLocationId = undefined;
|
||||
form.targetBinLocationId = undefined;
|
||||
form.qty = 1;
|
||||
}
|
||||
|
||||
async function loadTargetBins(warehouseId?: number) {
|
||||
if (!warehouseId) {
|
||||
targetBinOptions.value = [];
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const { items } = await getWarehouseBinLocationList({
|
||||
warehouseId,
|
||||
isEnabled: true,
|
||||
});
|
||||
targetBinOptions.value = (items || []).map((b: Record<string, unknown>) => {
|
||||
const row = normalizeListRow(b);
|
||||
const code = String(pickField(row, 'binCode', 'BinCode') || '');
|
||||
const name = String(pickField(row, 'binName', 'BinName') || '');
|
||||
return {
|
||||
label: name ? `${code} - ${name}` : code,
|
||||
value: Number(pickField(row, 'id', 'Id') || 0),
|
||||
};
|
||||
});
|
||||
} catch {
|
||||
targetBinOptions.value = [];
|
||||
}
|
||||
}
|
||||
|
||||
async function loadSourceBins(sku: StockRow) {
|
||||
try {
|
||||
const data = (await getWarehouseInventoryBinDetail(
|
||||
sku.skuId,
|
||||
sku.warehouseId,
|
||||
sku.customerId > 0 ? sku.customerId : undefined,
|
||||
)) as Record<string, unknown>;
|
||||
const itemsRaw = pickField(data, 'items', 'Items');
|
||||
const items = Array.isArray(itemsRaw)
|
||||
? itemsRaw
|
||||
: Array.isArray(data)
|
||||
? data
|
||||
: [];
|
||||
sourceBinOptions.value = items
|
||||
.map((item: Record<string, unknown>) => {
|
||||
const row = normalizeListRow(item);
|
||||
const qty = Number(pickField(row, 'qty', 'Qty') || 0);
|
||||
const code = String(pickField(row, 'binCode', 'BinCode') || '-');
|
||||
const name = String(pickField(row, 'binName', 'BinName') || '');
|
||||
return {
|
||||
label: `${code}${name ? ` - ${name}` : ''}(${qty})`,
|
||||
value: Number(pickField(row, 'binLocationId', 'BinLocationId') || 0),
|
||||
qty,
|
||||
};
|
||||
})
|
||||
.filter((b: BinOpt) => b.value > 0 && (b.qty || 0) > 0);
|
||||
} catch {
|
||||
sourceBinOptions.value = [];
|
||||
}
|
||||
}
|
||||
|
||||
function onSourceBinChange(binId?: number) {
|
||||
form.sourceBinLocationId = binId;
|
||||
const hit = sourceBinOptions.value.find((b) => b.value === binId);
|
||||
if (hit && form.qty > (hit.qty || 0)) {
|
||||
form.qty = hit.qty || 1;
|
||||
}
|
||||
}
|
||||
|
||||
async function selectSku(row: StockRow) {
|
||||
if (!canMutate()) {
|
||||
showWarning(t('h5Admin.ops.noPermission'));
|
||||
return;
|
||||
}
|
||||
lookingUp.value = true;
|
||||
clearFeedback();
|
||||
try {
|
||||
activeSku.value = row;
|
||||
candidates.value = [];
|
||||
form.sourceBinLocationId = undefined;
|
||||
form.targetBinLocationId = undefined;
|
||||
form.qty = 1;
|
||||
await Promise.all([
|
||||
loadSourceBins(row),
|
||||
loadTargetBins(row.warehouseId || currentWarehouseStore.warehouseId),
|
||||
]);
|
||||
if (sourceBinOptions.value.length === 1) {
|
||||
form.sourceBinLocationId = sourceBinOptions.value[0].value;
|
||||
form.qty = Math.min(1, sourceBinOptions.value[0].qty || 1) || 1;
|
||||
}
|
||||
} catch (e: any) {
|
||||
showError(e?.message || t('h5Admin.ops.relocate.loadFailed'));
|
||||
} finally {
|
||||
lookingUp.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function onDetect(code: string) {
|
||||
scanCode.value = code;
|
||||
await lookup();
|
||||
}
|
||||
|
||||
function onScanError(message: string) {
|
||||
showError(message);
|
||||
}
|
||||
|
||||
async function onWarehouseChange() {
|
||||
clearFeedback();
|
||||
scanCode.value = '';
|
||||
resetForm();
|
||||
await loadStockList();
|
||||
refocus();
|
||||
}
|
||||
|
||||
async function lookup() {
|
||||
if (!canMutate()) {
|
||||
showWarning(t('h5Admin.ops.noPermission'));
|
||||
return;
|
||||
}
|
||||
const code = scanCode.value.trim();
|
||||
if (!code) {
|
||||
showWarning(t('h5Admin.ops.relocate.codeRequired'));
|
||||
refocus();
|
||||
return;
|
||||
}
|
||||
const warehouseId = currentWarehouseStore.warehouseId;
|
||||
if (!warehouseId) {
|
||||
showWarning(t('warehouse.common.noCurrentWarehouse'));
|
||||
return;
|
||||
}
|
||||
|
||||
lookingUp.value = true;
|
||||
clearFeedback();
|
||||
try {
|
||||
const { items } = await getWarehouseInventoryList({
|
||||
page: 1,
|
||||
pageSize: 30,
|
||||
warehouseId,
|
||||
keyword: code,
|
||||
});
|
||||
const rows = (items || [])
|
||||
.map((x) => mapStockRow(x as Record<string, unknown>))
|
||||
.filter((x) => x.skuId > 0);
|
||||
|
||||
const exact = rows.filter(
|
||||
(x) => x.skuCode.toLowerCase() === code.toLowerCase(),
|
||||
);
|
||||
const matched = exact.length ? exact : rows;
|
||||
|
||||
if (!matched.length) {
|
||||
resetForm();
|
||||
showWarning(t('h5Admin.ops.relocate.notFound'));
|
||||
refocus();
|
||||
return;
|
||||
}
|
||||
|
||||
if (matched.length === 1) {
|
||||
scanCode.value = '';
|
||||
await selectSku(matched[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
activeSku.value = null;
|
||||
candidates.value = matched;
|
||||
scanCode.value = '';
|
||||
} catch (e: any) {
|
||||
resetForm();
|
||||
showError(e?.message || t('h5Admin.ops.relocate.loadFailed'));
|
||||
refocus();
|
||||
} finally {
|
||||
lookingUp.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function loadStockList() {
|
||||
const warehouseId = currentWarehouseStore.warehouseId;
|
||||
if (!warehouseId) {
|
||||
stockRows.value = [];
|
||||
return;
|
||||
}
|
||||
listLoading.value = true;
|
||||
try {
|
||||
const { items } = await getWarehouseInventoryList({
|
||||
page: 1,
|
||||
pageSize: 30,
|
||||
warehouseId,
|
||||
});
|
||||
stockRows.value = (items || [])
|
||||
.map((x) => mapStockRow(x as Record<string, unknown>))
|
||||
.filter((x) => x.skuId > 0);
|
||||
} catch (e: any) {
|
||||
stockRows.value = [];
|
||||
showError(e?.message || t('h5Admin.ops.relocate.loadFailed'));
|
||||
} finally {
|
||||
listLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function submit() {
|
||||
if (!canMutate()) {
|
||||
showWarning(t('h5Admin.ops.noPermission'));
|
||||
return;
|
||||
}
|
||||
const sku = activeSku.value;
|
||||
if (
|
||||
!sku
|
||||
|| !form.sourceBinLocationId
|
||||
|| !form.targetBinLocationId
|
||||
|| !form.qty
|
||||
) {
|
||||
showWarning(t('warehouse.inventory.message.relocateRequired'));
|
||||
return;
|
||||
}
|
||||
if (form.sourceBinLocationId === form.targetBinLocationId) {
|
||||
showWarning(t('warehouse.inventory.message.sameBin'));
|
||||
return;
|
||||
}
|
||||
if (form.qty > sourceMaxQty.value) {
|
||||
showWarning(t('warehouse.inventory.message.qtyExceed'));
|
||||
return;
|
||||
}
|
||||
|
||||
submitting.value = true;
|
||||
try {
|
||||
await relocateWarehouseInventory({
|
||||
warehouseId: sku.warehouseId,
|
||||
skuId: sku.skuId,
|
||||
customerId: sku.customerId > 0 ? sku.customerId : undefined,
|
||||
sourceBinLocationId: form.sourceBinLocationId,
|
||||
targetBinLocationId: form.targetBinLocationId,
|
||||
qty: Number(form.qty) || 0,
|
||||
});
|
||||
showSuccess(t('warehouse.inventory.message.relocateSuccess'));
|
||||
resetForm();
|
||||
scanCode.value = '';
|
||||
await loadStockList();
|
||||
refocus();
|
||||
} catch (e: any) {
|
||||
showError(e?.message || t('warehouse.inventory.message.relocateFailed'));
|
||||
} finally {
|
||||
submitting.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
clearFeedback();
|
||||
await loadStockList();
|
||||
refocus();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
@import './ops-shared.less';
|
||||
|
||||
.h5-relocate__panel {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.h5-relocate__field {
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
font-size: 12px;
|
||||
color: var(--h5-text-2, #4e5969);
|
||||
position: relative;
|
||||
|
||||
input {
|
||||
height: 36px;
|
||||
padding: 0 10px;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
background: var(--h5-well-bg, #f0f3f4);
|
||||
font-size: 14px;
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
|
||||
.h5-relocate__qty-hint {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
font-size: 11px;
|
||||
color: var(--h5-text-3, #86909c);
|
||||
}
|
||||
|
||||
.h5-relocate__submit {
|
||||
width: 100%;
|
||||
height: 44px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.h5-ops__card {
|
||||
cursor: pointer;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
</style>
|
||||
@ -11,19 +11,21 @@
|
||||
</div>
|
||||
|
||||
<header class="h5-biz__top">
|
||||
<div class="h5-biz__identity">
|
||||
<Banner compact with-clock />
|
||||
<div class="h5-biz__top-row">
|
||||
<div class="h5-biz__identity">
|
||||
<Banner compact with-clock />
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="h5-biz__refresh"
|
||||
:disabled="loading"
|
||||
:aria-label="t('h5Admin.bizOps.refresh')"
|
||||
@click="refresh"
|
||||
>
|
||||
<IconRefresh :class="{ 'is-spinning': loading }" />
|
||||
</button>
|
||||
</div>
|
||||
<WorkplaceUrgentBar embedded class="h5-biz__inbox" />
|
||||
<button
|
||||
type="button"
|
||||
class="h5-biz__refresh"
|
||||
:disabled="loading"
|
||||
:aria-label="t('h5Admin.bizOps.refresh')"
|
||||
@click="refresh"
|
||||
>
|
||||
<IconRefresh :class="{ 'is-spinning': loading }" />
|
||||
</button>
|
||||
</header>
|
||||
|
||||
<section class="h5-biz__title-row">
|
||||
@ -46,7 +48,7 @@
|
||||
</section>
|
||||
|
||||
<section class="h5-biz__filters">
|
||||
<div class="h5-biz__filters-scroll">
|
||||
<div class="h5-biz__filters-primary">
|
||||
<WorkplaceSegmented
|
||||
v-model="range"
|
||||
variant="pill"
|
||||
@ -54,24 +56,26 @@
|
||||
:aria-label="t('h5Admin.bizOps.range')"
|
||||
:options="rangeOptions"
|
||||
/>
|
||||
<button type="button" class="h5-biz__threshold-btn" @click="thresholdVisible = true">
|
||||
{{ t('h5Admin.bizOps.threshold') }}
|
||||
</button>
|
||||
</div>
|
||||
<div class="h5-biz__filters-secondary">
|
||||
<WorkplaceSegmented
|
||||
v-model="laneDim"
|
||||
variant="pill"
|
||||
variant="soft"
|
||||
compact
|
||||
:aria-label="t('h5Admin.bizOps.laneDim')"
|
||||
:options="laneDimOptions"
|
||||
/>
|
||||
<WorkplaceSegmented
|
||||
v-model="latencyMode"
|
||||
variant="pill"
|
||||
variant="soft"
|
||||
compact
|
||||
:aria-label="t('h5Admin.bizOps.latencyMode')"
|
||||
:options="latencyModeOptions"
|
||||
/>
|
||||
</div>
|
||||
<button type="button" class="h5-biz__threshold-btn" @click="thresholdVisible = true">
|
||||
{{ t('h5Admin.bizOps.threshold') }}
|
||||
</button>
|
||||
</section>
|
||||
|
||||
<section class="h5-biz__map-card">
|
||||
@ -417,31 +421,104 @@ async function onTouchEnd() {
|
||||
}
|
||||
|
||||
.h5-biz__top {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto auto;
|
||||
align-items: center;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
padding: 10px 12px;
|
||||
border-radius: 12px;
|
||||
background: #fff;
|
||||
border: 1px solid rgba(26, 46, 56, 0.06);
|
||||
}
|
||||
|
||||
.h5-biz__identity {
|
||||
.h5-biz__top-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.h5-biz__identity {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
|
||||
:deep(.banner) {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
:deep(.banner-row) {
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
:deep(.banner-hello) {
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
:deep(.banner-hello__greet) {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
:deep(.banner-hello__name) {
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
:deep(.banner-hello__clock-date),
|
||||
:deep(.banner-hello__clock-sep) {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
:deep(.banner-hello__clock-time) {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.h5-biz__inbox {
|
||||
justify-self: end;
|
||||
width: 100%;
|
||||
margin: 0 !important;
|
||||
padding: 4px 6px 4px 10px !important;
|
||||
border-radius: 10px !important;
|
||||
background: rgba(15, 23, 42, 0.035) !important;
|
||||
border: none !important;
|
||||
|
||||
:deep(.wk-inbox__badge-label) {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
:deep(.wk-inbox__title) {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* 空态文案与「站内信」标签重复,H5 只保留入口 */
|
||||
:deep(p.wk-inbox__state) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:deep(.wk-inbox__stage:not(:has(.wk-inbox__ticker))) {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
:deep(.wk-inbox__all) {
|
||||
height: 26px;
|
||||
padding: 0 10px;
|
||||
border-radius: 999px;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
:deep(.wk-inbox__nav) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.h5-biz__refresh {
|
||||
flex: 0 0 auto;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
background: rgba(15, 23, 42, 0.04);
|
||||
color: rgba(26, 46, 56, 0.55);
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0 1px 2px rgba(26, 46, 56, 0.04);
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.5;
|
||||
@ -512,32 +589,60 @@ async function onTouchEnd() {
|
||||
}
|
||||
|
||||
.h5-biz__filters {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
padding: 10px;
|
||||
border-radius: 12px;
|
||||
background: #fff;
|
||||
border: 1px solid rgba(26, 46, 56, 0.06);
|
||||
}
|
||||
|
||||
.h5-biz__filters-primary,
|
||||
.h5-biz__filters-secondary {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.h5-biz__filters-scroll {
|
||||
.h5-biz__filters-primary,
|
||||
.h5-biz__filters-secondary {
|
||||
:deep(.wp-seg) {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
:deep(.wp-seg__item) {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex: 1 1 0;
|
||||
min-height: 30px;
|
||||
padding: 0 6px;
|
||||
}
|
||||
}
|
||||
|
||||
.h5-biz__filters-primary :deep(.wp-seg) {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
overflow-x: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
padding-bottom: 2px;
|
||||
}
|
||||
|
||||
.h5-biz__filters-secondary :deep(.wp-seg) {
|
||||
flex: 1 1 0;
|
||||
}
|
||||
|
||||
.h5-biz__threshold-btn {
|
||||
flex: 0 0 auto;
|
||||
height: 28px;
|
||||
padding: 0 10px;
|
||||
height: 30px;
|
||||
padding: 0 12px;
|
||||
border-radius: 999px;
|
||||
border: 1px solid rgba(26, 46, 56, 0.1);
|
||||
background: #fff;
|
||||
color: rgba(26, 46, 56, 0.7);
|
||||
background: #f7f8fa;
|
||||
color: rgba(26, 46, 56, 0.72);
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.h5-biz__map-card {
|
||||
|
||||
@ -136,6 +136,7 @@
|
||||
:options="provinceOptions"
|
||||
:loading="provinceLoading"
|
||||
allow-search
|
||||
allow-create
|
||||
allow-clear
|
||||
:disabled="!form.countryCode"
|
||||
@change="onProvinceChange"
|
||||
@ -148,8 +149,9 @@
|
||||
:options="cityOptions"
|
||||
:loading="cityLoading"
|
||||
allow-search
|
||||
allow-create
|
||||
allow-clear
|
||||
:disabled="!form.province"
|
||||
:disabled="!form.countryCode"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@ -270,6 +272,16 @@ function toSelectOptions(list: CountryRegionOption[]) {
|
||||
return list.map((x) => ({ label: x.label || x.value, value: x.value }));
|
||||
}
|
||||
|
||||
/** 主数据缺失时保留已有/手填值,避免回显空白 */
|
||||
function ensureOption(
|
||||
options: Array<{ label: string; value: string }>,
|
||||
value?: string,
|
||||
) {
|
||||
const v = String(value || '').trim();
|
||||
if (!v || options.some((x) => x.value === v)) return options;
|
||||
return [...options, { label: v, value: v }];
|
||||
}
|
||||
|
||||
async function loadCountryOptions() {
|
||||
countryLoading.value = true;
|
||||
try {
|
||||
@ -293,14 +305,16 @@ async function loadProvinceOptions(countryCode: string, keepValue = false) {
|
||||
try {
|
||||
provinceRaw.value = countryCode ? await getCountryProvinceOptions(countryCode) : [];
|
||||
provinceOptions.value = toSelectOptions(provinceRaw.value);
|
||||
if (!keepValue || !provinceOptions.value.some((x) => x.value === form.province)) {
|
||||
if (!keepValue) {
|
||||
form.province = '';
|
||||
form.city = '';
|
||||
cityOptions.value = [];
|
||||
} else {
|
||||
provinceOptions.value = ensureOption(provinceOptions.value, form.province);
|
||||
}
|
||||
} catch {
|
||||
provinceRaw.value = [];
|
||||
provinceOptions.value = [];
|
||||
provinceOptions.value = keepValue ? ensureOption([], form.province) : [];
|
||||
if (!keepValue) {
|
||||
form.province = '';
|
||||
form.city = '';
|
||||
@ -318,11 +332,13 @@ async function loadCityOptions(provinceName: string, keepValue = false) {
|
||||
cityOptions.value = province
|
||||
? toSelectOptions(await getCountryCityOptions(province.id))
|
||||
: [];
|
||||
if (!keepValue || !cityOptions.value.some((x) => x.value === form.city)) {
|
||||
if (!keepValue) {
|
||||
form.city = '';
|
||||
} else {
|
||||
cityOptions.value = ensureOption(cityOptions.value, form.city);
|
||||
}
|
||||
} catch {
|
||||
cityOptions.value = [];
|
||||
cityOptions.value = keepValue ? ensureOption([], form.city) : [];
|
||||
if (!keepValue) form.city = '';
|
||||
} finally {
|
||||
cityLoading.value = false;
|
||||
|
||||
@ -21,7 +21,15 @@
|
||||
@click="toggleHighlight(item.key)"
|
||||
>
|
||||
<span class="china-map__metric-k">{{ item.label }}</span>
|
||||
<span class="china-map__metric-v">{{ item.value }}</span>
|
||||
<span
|
||||
class="china-map__metric-v"
|
||||
:class="{
|
||||
'is-up': item.tone === 'up',
|
||||
'is-warn': item.tone === 'warn',
|
||||
}"
|
||||
>
|
||||
{{ item.value }}
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -58,13 +66,25 @@ onMounted(async () => {
|
||||
ready.value = true
|
||||
})
|
||||
|
||||
type MetricTone = 'up' | 'warn'
|
||||
|
||||
const metricItems = computed(() => {
|
||||
const s = props.slice.customerSummary
|
||||
return [
|
||||
{ key: 'total' as const, label: '客户总数', value: formatCount(s.total) },
|
||||
{ key: 'neu' as const, label: '新增', value: `+${formatCount(s.neu)}` },
|
||||
{
|
||||
key: 'neu' as const,
|
||||
label: '新增',
|
||||
value: `+${formatCount(s.neu)}`,
|
||||
tone: (s.neu > 0 ? 'up' : undefined) as MetricTone | undefined,
|
||||
},
|
||||
{ key: 'online' as const, label: '在线', value: formatCount(s.online) },
|
||||
{ key: 'idle7' as const, label: '超7天', value: formatCount(s.idle7) },
|
||||
{
|
||||
key: 'idle7' as const,
|
||||
label: '超7天',
|
||||
value: formatCount(s.idle7),
|
||||
tone: (s.idle7 > 0 ? 'warn' : undefined) as MetricTone | undefined,
|
||||
},
|
||||
]
|
||||
})
|
||||
|
||||
@ -319,6 +339,14 @@ function onClick(params: any) {
|
||||
font-variant-numeric: tabular-nums;
|
||||
color: #1a2e38;
|
||||
transition: color 0.15s ease;
|
||||
|
||||
&.is-up {
|
||||
color: #0f766e;
|
||||
}
|
||||
|
||||
&.is-warn {
|
||||
color: #c45c4a;
|
||||
}
|
||||
}
|
||||
|
||||
.china-map.is-dense {
|
||||
@ -331,27 +359,59 @@ function onClick(params: any) {
|
||||
}
|
||||
}
|
||||
|
||||
/* 指标条改文档流,避免盖住华南;四等分便于点按切换热力 */
|
||||
.china-map__metrics {
|
||||
left: 6px;
|
||||
right: 6px;
|
||||
bottom: 6px;
|
||||
width: auto;
|
||||
overflow-x: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
padding: 4px 2px;
|
||||
position: static;
|
||||
left: auto;
|
||||
right: auto;
|
||||
bottom: auto;
|
||||
width: 100%;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 4px;
|
||||
margin-top: 6px;
|
||||
padding: 4px;
|
||||
border-radius: 10px;
|
||||
background: #f7f8fa;
|
||||
border: 1px solid rgba(26, 46, 56, 0.06);
|
||||
box-shadow: none;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.china-map__metric {
|
||||
padding: 2px 8px;
|
||||
flex: 0 0 auto;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 2px;
|
||||
min-height: 40px;
|
||||
padding: 6px 4px;
|
||||
border-radius: 8px;
|
||||
flex: none;
|
||||
|
||||
& + &::before {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&:active,
|
||||
&.is-active {
|
||||
background: #fff;
|
||||
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--app-primary-color, #1d7281) 22%, transparent);
|
||||
|
||||
.china-map__metric-v {
|
||||
color: var(--app-primary-color, #1d7281);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.china-map__metric-k {
|
||||
font-size: 9px;
|
||||
font-size: 10px;
|
||||
line-height: 1.2;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.china-map__metric-v {
|
||||
font-size: 11px;
|
||||
font-size: 14px;
|
||||
line-height: 1.2;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -103,6 +103,16 @@ function toSelectOptions(list: CountryRegionOption[]) {
|
||||
return list.map((x) => ({ label: x.label || x.value, value: x.value }))
|
||||
}
|
||||
|
||||
/** 主数据缺失时保留已有/手填值,避免回显空白 */
|
||||
function ensureOption(
|
||||
options: Array<{ label: string; value: string }>,
|
||||
value?: string,
|
||||
) {
|
||||
const v = String(value || '').trim()
|
||||
if (!v || options.some((x) => x.value === v)) return options
|
||||
return [...options, { label: v, value: v }]
|
||||
}
|
||||
|
||||
async function loadCountryOptions() {
|
||||
countryLoading.value = true
|
||||
try {
|
||||
@ -126,14 +136,18 @@ async function loadProvinceOptions(countryCode: string, keepValue = false) {
|
||||
try {
|
||||
provinceRaw.value = countryCode ? await getCountryProvinceOptions(countryCode) : []
|
||||
provinceOptions.value = toSelectOptions(provinceRaw.value)
|
||||
if (!keepValue || !provinceOptions.value.some((x) => x.value === formModel.province)) {
|
||||
if (!keepValue) {
|
||||
formModel.province = ''
|
||||
formModel.city = ''
|
||||
cityOptions.value = []
|
||||
} else {
|
||||
provinceOptions.value = ensureOption(provinceOptions.value, formModel.province)
|
||||
}
|
||||
} catch {
|
||||
provinceRaw.value = []
|
||||
provinceOptions.value = []
|
||||
provinceOptions.value = keepValue
|
||||
? ensureOption([], formModel.province)
|
||||
: []
|
||||
if (!keepValue) {
|
||||
formModel.province = ''
|
||||
formModel.city = ''
|
||||
@ -151,11 +165,13 @@ async function loadCityOptions(provinceName: string, keepValue = false) {
|
||||
cityOptions.value = province
|
||||
? toSelectOptions(await getCountryCityOptions(province.id))
|
||||
: []
|
||||
if (!keepValue || !cityOptions.value.some((x) => x.value === formModel.city)) {
|
||||
if (!keepValue) {
|
||||
formModel.city = ''
|
||||
} else {
|
||||
cityOptions.value = ensureOption(cityOptions.value, formModel.city)
|
||||
}
|
||||
} catch {
|
||||
cityOptions.value = []
|
||||
cityOptions.value = keepValue ? ensureOption([], formModel.city) : []
|
||||
if (!keepValue) formModel.city = ''
|
||||
} finally {
|
||||
cityLoading.value = false
|
||||
@ -350,6 +366,10 @@ function validateForm() {
|
||||
$baseMessage(t('user.senderAddress.message.senderNameRequired'), 'warning')
|
||||
return false
|
||||
}
|
||||
if (!String(formModel.phone || '').trim()) {
|
||||
$baseMessage(t('user.senderAddress.message.phoneRequired'), 'warning')
|
||||
return false
|
||||
}
|
||||
if (!String(formModel.countryCode || '').trim()) {
|
||||
$baseMessage(t('user.senderAddress.message.countryRequired'), 'warning')
|
||||
return false
|
||||
@ -577,7 +597,7 @@ onMounted(() => {
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item>
|
||||
<a-form-item required>
|
||||
<template #label>{{ t('user.senderAddress.form.phone') }}</template>
|
||||
<a-input
|
||||
v-model="formModel.phone"
|
||||
@ -620,12 +640,21 @@ onMounted(() => {
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item required>
|
||||
<template #label>{{ t('user.senderAddress.form.province') }}</template>
|
||||
<template #label>
|
||||
<span class="label-with-tip">
|
||||
{{ t('user.senderAddress.form.province') }}
|
||||
<a-tooltip :content="t('user.senderAddress.tip.province')">
|
||||
<icon-question-circle class="tip-icon" />
|
||||
</a-tooltip>
|
||||
</span>
|
||||
</template>
|
||||
<a-select
|
||||
v-model="formModel.province"
|
||||
:options="provinceOptions"
|
||||
:loading="provinceLoading"
|
||||
allow-search
|
||||
allow-create
|
||||
allow-clear
|
||||
:placeholder="t('user.senderAddress.placeholder.province')"
|
||||
:disabled="!formModel.countryCode"
|
||||
@change="onProvinceChange"
|
||||
@ -634,14 +663,23 @@ onMounted(() => {
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item required>
|
||||
<template #label>{{ t('user.senderAddress.form.city') }}</template>
|
||||
<template #label>
|
||||
<span class="label-with-tip">
|
||||
{{ t('user.senderAddress.form.city') }}
|
||||
<a-tooltip :content="t('user.senderAddress.tip.city')">
|
||||
<icon-question-circle class="tip-icon" />
|
||||
</a-tooltip>
|
||||
</span>
|
||||
</template>
|
||||
<a-select
|
||||
v-model="formModel.city"
|
||||
:options="cityOptions"
|
||||
:loading="cityLoading"
|
||||
allow-search
|
||||
allow-create
|
||||
allow-clear
|
||||
:placeholder="t('user.senderAddress.placeholder.city')"
|
||||
:disabled="!formModel.province"
|
||||
:disabled="!formModel.countryCode"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user