1
This commit is contained in:
parent
50bf6ad735
commit
e042da850d
@ -111,6 +111,21 @@ export type PendingOrderImportOrdersFromExcelParams = {
|
|||||||
file_base64: string;
|
file_base64: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** 批量拦截提交参数 */
|
||||||
|
export type PendingOrderBatchInterceptParams = {
|
||||||
|
order_ids?: number[]
|
||||||
|
orderIds?: number[]
|
||||||
|
ids?: number[]
|
||||||
|
task_id?: string
|
||||||
|
taskId?: string
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 批量拦截任务进度查询参数 */
|
||||||
|
export type PendingOrderBatchInterceptProgressParams = {
|
||||||
|
task_id?: string
|
||||||
|
taskId?: string
|
||||||
|
};
|
||||||
|
|
||||||
export type PendingOrderParseAddressParams = {
|
export type PendingOrderParseAddressParams = {
|
||||||
address: string;
|
address: string;
|
||||||
};
|
};
|
||||||
@ -480,6 +495,126 @@ export function orderPendingOrderParseAddress(
|
|||||||
} as any);
|
} as any);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** order.pendingOrder.batchIntercept:批量提交订单拦截请求 */
|
||||||
|
export function orderPendingOrderBatchIntercept(data: PendingOrderBatchInterceptParams): Promise<any> {
|
||||||
|
return request({
|
||||||
|
url: "/system",
|
||||||
|
method: "post",
|
||||||
|
params: {
|
||||||
|
method: "order.pendingOrder.batchIntercept",
|
||||||
|
v,
|
||||||
|
timestamp: Date.now()
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** order.pendingOrder.batchInterceptTaskProgress:查询批量拦截任务进度 */
|
||||||
|
export function orderPendingOrderBatchInterceptTaskProgress(data: PendingOrderBatchInterceptProgressParams): Promise<any> {
|
||||||
|
return request({
|
||||||
|
url: "/system",
|
||||||
|
method: "post",
|
||||||
|
params: {
|
||||||
|
method: "order.pendingOrder.batchInterceptTaskProgress",
|
||||||
|
v,
|
||||||
|
timestamp: Date.now()
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** order.pendingOrder.batchUnintercept:批量解除拦截 */
|
||||||
|
export function orderPendingOrderBatchUnintercept(data: PendingOrderBatchInterceptParams): Promise<any> {
|
||||||
|
return request({
|
||||||
|
url: "/system",
|
||||||
|
method: "post",
|
||||||
|
params: {
|
||||||
|
method: "order.pendingOrder.batchUnintercept",
|
||||||
|
v,
|
||||||
|
timestamp: Date.now()
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** order.pendingOrder.batchUninterceptTaskProgress:查询批量解除拦截进度 */
|
||||||
|
export function orderPendingOrderBatchUninterceptTaskProgress(data: PendingOrderBatchInterceptProgressParams): Promise<any> {
|
||||||
|
return request({
|
||||||
|
url: "/system",
|
||||||
|
method: "post",
|
||||||
|
params: {
|
||||||
|
method: "order.pendingOrder.batchUninterceptTaskProgress",
|
||||||
|
v,
|
||||||
|
timestamp: Date.now()
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** order.pendingOrder.batchLock:批量锁定 */
|
||||||
|
export function orderPendingOrderBatchLock(data: PendingOrderBatchInterceptParams): Promise<any> {
|
||||||
|
return request({
|
||||||
|
url: "/system",
|
||||||
|
method: "post",
|
||||||
|
params: {
|
||||||
|
method: "order.pendingOrder.batchLock",
|
||||||
|
v,
|
||||||
|
timestamp: Date.now()
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** order.pendingOrder.batchLockTaskProgress:查询批量锁定进度 */
|
||||||
|
export function orderPendingOrderBatchLockTaskProgress(data: PendingOrderBatchInterceptProgressParams): Promise<any> {
|
||||||
|
return request({
|
||||||
|
url: "/system",
|
||||||
|
method: "post",
|
||||||
|
params: {
|
||||||
|
method: "order.pendingOrder.batchLockTaskProgress",
|
||||||
|
v,
|
||||||
|
timestamp: Date.now()
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** order.pendingOrder.batchUnlock:批量解锁 */
|
||||||
|
export function orderPendingOrderBatchUnlock(data: PendingOrderBatchInterceptParams): Promise<any> {
|
||||||
|
return request({
|
||||||
|
url: "/system",
|
||||||
|
method: "post",
|
||||||
|
params: {
|
||||||
|
method: "order.pendingOrder.batchUnlock",
|
||||||
|
v,
|
||||||
|
timestamp: Date.now()
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** order.pendingOrder.batchUnlockTaskProgress:查询批量解锁进度 */
|
||||||
|
export function orderPendingOrderBatchUnlockTaskProgress(data: PendingOrderBatchInterceptProgressParams): Promise<any> {
|
||||||
|
return request({
|
||||||
|
url: "/system",
|
||||||
|
method: "post",
|
||||||
|
params: {
|
||||||
|
method: "order.pendingOrder.batchUnlockTaskProgress",
|
||||||
|
v,
|
||||||
|
timestamp: Date.now()
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|
||||||
export type OrderPendingOrderApi = {
|
export type OrderPendingOrderApi = {
|
||||||
list: typeof orderPendingOrderList;
|
list: typeof orderPendingOrderList;
|
||||||
detail: typeof orderPendingOrderDetail;
|
detail: typeof orderPendingOrderDetail;
|
||||||
@ -498,6 +633,10 @@ export type OrderPendingOrderApi = {
|
|||||||
createOrder: typeof orderPendingOrderCreateOrder;
|
createOrder: typeof orderPendingOrderCreateOrder;
|
||||||
importOrdersFromExcel: typeof orderPendingOrderImportOrdersFromExcel;
|
importOrdersFromExcel: typeof orderPendingOrderImportOrdersFromExcel;
|
||||||
parseAddress: typeof orderPendingOrderParseAddress;
|
parseAddress: typeof orderPendingOrderParseAddress;
|
||||||
|
batchIntercept: typeof orderPendingOrderBatchIntercept;
|
||||||
|
batchUnintercept: typeof orderPendingOrderBatchUnintercept;
|
||||||
|
batchLock: typeof orderPendingOrderBatchLock;
|
||||||
|
batchUnlock: typeof orderPendingOrderBatchUnlock;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const orderPendingOrder: OrderPendingOrderApi = {
|
export const orderPendingOrder: OrderPendingOrderApi = {
|
||||||
@ -518,4 +657,8 @@ export const orderPendingOrder: OrderPendingOrderApi = {
|
|||||||
createOrder: orderPendingOrderCreateOrder,
|
createOrder: orderPendingOrderCreateOrder,
|
||||||
importOrdersFromExcel: orderPendingOrderImportOrdersFromExcel,
|
importOrdersFromExcel: orderPendingOrderImportOrdersFromExcel,
|
||||||
parseAddress: orderPendingOrderParseAddress,
|
parseAddress: orderPendingOrderParseAddress,
|
||||||
|
batchIntercept: orderPendingOrderBatchIntercept,
|
||||||
|
batchUnintercept: orderPendingOrderBatchUnintercept,
|
||||||
|
batchLock: orderPendingOrderBatchLock,
|
||||||
|
batchUnlock: orderPendingOrderBatchUnlock
|
||||||
};
|
};
|
||||||
|
|||||||
@ -93,3 +93,23 @@ export function unlockWavePlatformPrintDataByGroup(data: UnlockWavePlatformPrint
|
|||||||
isSystemApi: true
|
isSystemApi: true
|
||||||
} as any)
|
} as any)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type GetOrderPrintDataParams = {
|
||||||
|
order_ids: Array<number | string>
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 按订单 ID 拉取平台打印中间态数据(order.print.getOrderPrintData)
|
||||||
|
* 返回结构与 getWavePlatformPrintData 一致,不限制打印锁定状态 */
|
||||||
|
export function getOrderPrintData(data: GetOrderPrintDataParams) {
|
||||||
|
return request({
|
||||||
|
url: '/system',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
method: 'order.print.getOrderPrintData',
|
||||||
|
v,
|
||||||
|
timestamp: new Date().getTime()
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|||||||
@ -77,6 +77,25 @@ export function scanWaybill(data: RecheckScanOrderParams): Promise<any> {
|
|||||||
return scanOrder(data)
|
return scanOrder(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type RecheckScanTaskParams = {
|
||||||
|
task_id: number
|
||||||
|
}
|
||||||
|
|
||||||
|
/** order.recheckOrder.scanTask:按拣货任务 ID 拉取复核扫描视图 */
|
||||||
|
export function scanTask(data: RecheckScanTaskParams): Promise<any> {
|
||||||
|
return request({
|
||||||
|
url: '/system',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
method: 'order.recheckOrder.scanTask',
|
||||||
|
v,
|
||||||
|
timestamp: Date.now()
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|
||||||
/** 订单 ID;优先 order_id,兼容 id、orderId */
|
/** 订单 ID;优先 order_id,兼容 id、orderId */
|
||||||
export type ConfirmRecheckParams = {
|
export type ConfirmRecheckParams = {
|
||||||
order_id?: string | number
|
order_id?: string | number
|
||||||
@ -122,7 +141,23 @@ export function confirmRecheck(data: ConfirmRecheckParams): Promise<any> {
|
|||||||
} as any)
|
} as any)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** order.recheckOrder.confirmIntercept:确认拦截,入参 order_id,匹配单个订单并标记拦截 */
|
||||||
|
export function confirmIntercept(data: ConfirmRecheckParams): Promise<any> {
|
||||||
|
return request({
|
||||||
|
url: '/system',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
method: 'order.recheckOrder.confirmIntercept',
|
||||||
|
v,
|
||||||
|
timestamp: Date.now()
|
||||||
|
},
|
||||||
|
data: pickConfirmRecheckBody(data),
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|
||||||
export const orderRecheckOrder = {
|
export const orderRecheckOrder = {
|
||||||
scanOrder,
|
scanOrder,
|
||||||
confirmRecheck
|
confirmRecheck,
|
||||||
|
confirmIntercept
|
||||||
}
|
}
|
||||||
|
|||||||
@ -248,6 +248,11 @@ export const ORDER_TOOLBAR_BUTTONS: Record<string, ToolbarButtonConfig> = {
|
|||||||
cloneOrder: { key: 'cloneOrder', label: '克隆订单', size: 'small', type: 'warning', plain: true, loadingKey: 'cloneOrderLoading', disabledKey: 'notSingleSelection', action: 'openCloneOrderDialog' },
|
cloneOrder: { key: 'cloneOrder', label: '克隆订单', size: 'small', type: 'warning', plain: true, loadingKey: 'cloneOrderLoading', disabledKey: 'notSingleSelection', action: 'openCloneOrderDialog' },
|
||||||
syncOrderIds: { key: 'syncOrderIds', label: '同步订单', size: 'small', type: 'primary', plain: true, loadingKey: 'syncOrderIdsLoading', disabledKey: 'hasNoSelection', action: 'openSyncOrderIdsDialog' },
|
syncOrderIds: { key: 'syncOrderIds', label: '同步订单', size: 'small', type: 'primary', plain: true, loadingKey: 'syncOrderIdsLoading', disabledKey: 'hasNoSelection', action: 'openSyncOrderIdsDialog' },
|
||||||
cancelOrder: { key: 'cancelOrder', label: '取消订单', size: 'small', type: 'danger', loadingKey: 'actionLoading', disabledKey: 'hasNoSelection', action: 'handleCancelOrder' },
|
cancelOrder: { key: 'cancelOrder', label: '取消订单', size: 'small', type: 'danger', loadingKey: 'actionLoading', disabledKey: 'hasNoSelection', action: 'handleCancelOrder' },
|
||||||
|
batchIntercept: { key: 'batchIntercept', label: '批量拦截', size: 'small', type: 'danger', plain: true, loadingKey: 'actionLoading', disabledKey: 'hasNoSelection', action: 'handleBatchIntercept' },
|
||||||
|
batchUnintercept: { key: 'batchUnintercept', label: '解除拦截', size: 'small', type: 'warning', plain: true, loadingKey: 'actionLoading', disabledKey: 'hasNoSelection', action: 'handleBatchUnintercept' },
|
||||||
|
batchLock: { key: 'batchLock', label: '批量锁定', size: 'small', type: 'warning', plain: true, loadingKey: 'actionLoading', disabledKey: 'hasNoSelection', action: 'handleBatchLock' },
|
||||||
|
batchUnlock: { key: 'batchUnlock', label: '批量解锁', size: 'small', type: 'primary', plain: true, loadingKey: 'actionLoading', disabledKey: 'hasNoSelection', action: 'handleBatchUnlock' },
|
||||||
|
batchPrint: { key: 'batchPrint', label: '批量打印', size: 'small', type: 'primary', loadingKey: 'batchPrintLoading', disabledKey: 'hasNoSelection', action: 'handleBatchPrint' },
|
||||||
batchReview: { key: 'batchReview', label: '批量审核通过', size: 'small', type: 'success', loadingKey: 'reviewSubmitting', disabledKey: 'hasNoSelection', action: 'handleBatchReview' },
|
batchReview: { key: 'batchReview', label: '批量审核通过', size: 'small', type: 'success', loadingKey: 'reviewSubmitting', disabledKey: 'hasNoSelection', action: 'handleBatchReview' },
|
||||||
manualOutboundMigrate: {
|
manualOutboundMigrate: {
|
||||||
key: 'manualOutboundMigrate',
|
key: 'manualOutboundMigrate',
|
||||||
@ -302,6 +307,42 @@ export const PENDING_TOOLBAR_API_ACTIONS: ToolbarApiActionConfig[] = [
|
|||||||
confirmType: 'error',
|
confirmType: 'error',
|
||||||
successText: '取消订单成功',
|
successText: '取消订单成功',
|
||||||
failText: '取消订单失败'
|
failText: '取消订单失败'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: 'handleBatchIntercept',
|
||||||
|
apiMethod: 'batchIntercept',
|
||||||
|
payloadKey: 'order_ids',
|
||||||
|
confirmText: '确定对选中的 {count} 条订单提交拦截请求吗?',
|
||||||
|
confirmType: 'error',
|
||||||
|
successText: '拦截请求已提交,异步处理中',
|
||||||
|
failText: '拦截请求提交失败'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: 'handleBatchUnintercept',
|
||||||
|
apiMethod: 'batchUnintercept',
|
||||||
|
payloadKey: 'order_ids',
|
||||||
|
confirmText: '确定对选中的 {count} 条订单提交解除拦截吗?',
|
||||||
|
confirmType: 'warning',
|
||||||
|
successText: '解除拦截请求已提交,异步处理中',
|
||||||
|
failText: '解除拦截请求提交失败'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: 'handleBatchLock',
|
||||||
|
apiMethod: 'batchLock',
|
||||||
|
payloadKey: 'order_ids',
|
||||||
|
confirmText: '确定对选中的 {count} 条订单提交锁定请求吗?',
|
||||||
|
confirmType: 'warning',
|
||||||
|
successText: '锁定请求已提交,异步处理中',
|
||||||
|
failText: '锁定请求提交失败'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: 'handleBatchUnlock',
|
||||||
|
apiMethod: 'batchUnlock',
|
||||||
|
payloadKey: 'order_ids',
|
||||||
|
confirmText: '确定对选中的 {count} 条订单提交解锁请求吗?',
|
||||||
|
confirmType: 'info',
|
||||||
|
successText: '解锁请求已提交,异步处理中',
|
||||||
|
failText: '解锁请求提交失败'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -377,6 +418,29 @@ export function translateOrderField(field: string, value: any) {
|
|||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const INTERCEPT_STATUS_MAP: Record<string, string> = {
|
||||||
|
none: '—',
|
||||||
|
requesting: '请求拦截中',
|
||||||
|
requested: '已请求拦截',
|
||||||
|
intercepting: '拦截中',
|
||||||
|
intercepted_in_transit: '在途拦截成功',
|
||||||
|
intercepted_at_warehouse: '仓库拦截成功',
|
||||||
|
returning: '退回中',
|
||||||
|
returned: '已退回',
|
||||||
|
delivered_by_mistake: '已误派送',
|
||||||
|
timeout: '超时',
|
||||||
|
cancelled: '已取消',
|
||||||
|
failed: '失败',
|
||||||
|
exception: '异常'
|
||||||
|
}
|
||||||
|
|
||||||
|
export function translateInterceptStatus(value: any): string {
|
||||||
|
if (value === null || value === undefined || value === '' || value === 'none') {
|
||||||
|
return '—'
|
||||||
|
}
|
||||||
|
return INTERCEPT_STATUS_MAP[String(value)] || String(value)
|
||||||
|
}
|
||||||
|
|
||||||
function pad2(value: number) {
|
function pad2(value: number) {
|
||||||
return String(value).padStart(2, '0')
|
return String(value).padStart(2, '0')
|
||||||
}
|
}
|
||||||
@ -995,6 +1059,7 @@ export const pendingCloums = [
|
|||||||
{ prop: 'post_status', label: '快递', width: '100' },
|
{ prop: 'post_status', label: '快递', width: '100' },
|
||||||
{ prop: 'pick_status', label: '拣货状态', width: '100' },
|
{ prop: 'pick_status', label: '拣货状态', width: '100' },
|
||||||
{ prop: 'pack_status', label: '打包状态', width: '100' },
|
{ prop: 'pack_status', label: '打包状态', width: '100' },
|
||||||
|
{ prop: 'intercept_status', label: '拦截状态', width: '100', tag: true },
|
||||||
{ prop: 'waybill_codes', label: '快递单号', width: '160', formatter: waybillCodesFormatter },
|
{ prop: 'waybill_codes', label: '快递单号', width: '160', formatter: waybillCodesFormatter },
|
||||||
{ prop: 'items_count', label: '商品种类', width: '100' },
|
{ prop: 'items_count', label: '商品种类', width: '100' },
|
||||||
{ prop: 'items_total', label: '商品总数', width: '100' },
|
{ prop: 'items_total', label: '商品总数', width: '100' },
|
||||||
@ -1116,7 +1181,12 @@ export const pendingToolbarButtonKeys = [
|
|||||||
'createOrder',
|
'createOrder',
|
||||||
'cloneOrder',
|
'cloneOrder',
|
||||||
'syncOrderIds',
|
'syncOrderIds',
|
||||||
'cancelOrder'
|
'cancelOrder',
|
||||||
|
'batchIntercept',
|
||||||
|
'batchUnintercept',
|
||||||
|
'batchLock',
|
||||||
|
'batchUnlock',
|
||||||
|
'batchPrint'
|
||||||
]
|
]
|
||||||
|
|
||||||
/** 页面级按钮列表:pendingOrder 直接消费,避免页面内重复拼装 */
|
/** 页面级按钮列表:pendingOrder 直接消费,避免页面内重复拼装 */
|
||||||
@ -1268,6 +1338,7 @@ export const expectionColumns = [
|
|||||||
{ prop: 'post_status', label: '快递状态', width: '100' },
|
{ prop: 'post_status', label: '快递状态', width: '100' },
|
||||||
{ prop: 'pick_status', label: '拣货状态', width: '100' },
|
{ prop: 'pick_status', label: '拣货状态', width: '100' },
|
||||||
{ prop: 'pack_status', label: '打包状态', width: '100' },
|
{ prop: 'pack_status', label: '打包状态', width: '100' },
|
||||||
|
{ prop: 'intercept_status', label: '拦截状态', width: '100', tag: true },
|
||||||
{ prop: 'name', label: '收货人', width: '110' },
|
{ prop: 'name', label: '收货人', width: '110' },
|
||||||
{ prop: 'mobile', label: '手机号', width: '120' },
|
{ prop: 'mobile', label: '手机号', width: '120' },
|
||||||
{ prop: 'logistics_name', label: '快递', width: '120' },
|
{ prop: 'logistics_name', label: '快递', width: '120' },
|
||||||
|
|||||||
@ -130,6 +130,13 @@
|
|||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template #column-intercept_status="{ row }">
|
||||||
|
<el-tag v-if="row.intercept_status && row.intercept_status !== 'none'" type="danger" size="small">
|
||||||
|
{{ translateInterceptStatus(row.intercept_status) }}
|
||||||
|
</el-tag>
|
||||||
|
<span v-else style="color:#909399">—</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
<template #column-post_status="{ row }">
|
<template #column-post_status="{ row }">
|
||||||
<el-tag :type="getTagType('post_status', row.post_status)" size="small">
|
<el-tag :type="getTagType('post_status', row.post_status)" size="small">
|
||||||
{{ translateOrderField('post_status', row.post_status) }}
|
{{ translateOrderField('post_status', row.post_status) }}
|
||||||
@ -326,6 +333,15 @@
|
|||||||
|
|
||||||
<create-pending-order-dialog v-model="createOrderDialogVisible" @success="loadData" />
|
<create-pending-order-dialog v-model="createOrderDialogVisible" @success="loadData" />
|
||||||
<qrcode-dialog v-model:visible="qrDialogVisible" :code="currentWaybillCode" />
|
<qrcode-dialog v-model:visible="qrDialogVisible" :code="currentWaybillCode" />
|
||||||
|
|
||||||
|
<wave-platform-print-preview-dialog
|
||||||
|
v-model="batchPrintDialogVisible"
|
||||||
|
:error-message="batchPrintErrorMessage"
|
||||||
|
:payload="batchPrintPayload"
|
||||||
|
:request-meta="batchPrintRequestMeta"
|
||||||
|
@refresh="handleBatchPrintRefresh"
|
||||||
|
@print-success="onBatchPrintSuccess"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<order-export-progress-dialog
|
<order-export-progress-dialog
|
||||||
@ -358,6 +374,7 @@ import {
|
|||||||
exceptionToolbarButtons,
|
exceptionToolbarButtons,
|
||||||
type ToolbarButtonConfig,
|
type ToolbarButtonConfig,
|
||||||
translateOrderField,
|
translateOrderField,
|
||||||
|
translateInterceptStatus,
|
||||||
getTagType,
|
getTagType,
|
||||||
fillExpressCompanyScanFieldOptions,
|
fillExpressCompanyScanFieldOptions,
|
||||||
fillStoreScanFieldOptions,
|
fillStoreScanFieldOptions,
|
||||||
@ -379,9 +396,15 @@ import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
|||||||
import { createPendingToolbarController } from './utils/toolbar-actions'
|
import { createPendingToolbarController } from './utils/toolbar-actions'
|
||||||
import { safeInvoke } from '@/utils/safe-invoke'
|
import { safeInvoke } from '@/utils/safe-invoke'
|
||||||
import QrcodeDialog from '@/components/QR/qrcode.vue'
|
import QrcodeDialog from '@/components/QR/qrcode.vue'
|
||||||
|
import WavePlatformPrintPreviewDialog from '@/views/order/waveOrder/component/WavePlatformPrintPreviewDialog.vue'
|
||||||
|
import { getOrderPrintData } from '@/api/order.print/orderprint'
|
||||||
|
import type { WavePlatformPrintDataPayload } from '@/api/order.print/orderprint'
|
||||||
|
import { unwrapWavePlatformPrintPayload } from '@/views/order/waveOrder/config/wave-config'
|
||||||
|
import { useUserStore } from '@/stores/modules/user'
|
||||||
|
|
||||||
const scanBox = ref<any>(null)
|
const scanBox = ref<any>(null)
|
||||||
const upperTable = ref<any>(null)
|
const upperTable = ref<any>(null)
|
||||||
|
const userStore = useUserStore()
|
||||||
|
|
||||||
const presetTree = ref<any[]>([])
|
const presetTree = ref<any[]>([])
|
||||||
const availableFieldsRef = reactive(JSON.parse(JSON.stringify(expectionOrderAvailableFields)))
|
const availableFieldsRef = reactive(JSON.parse(JSON.stringify(expectionOrderAvailableFields)))
|
||||||
@ -397,6 +420,14 @@ const createOrderDialogVisible = ref(false)
|
|||||||
const resolveExceptionDialogVisible = ref(false)
|
const resolveExceptionDialogVisible = ref(false)
|
||||||
const resolveExceptionLoading = ref(false)
|
const resolveExceptionLoading = ref(false)
|
||||||
const resolveExceptionOrderIds = ref<number[]>([])
|
const resolveExceptionOrderIds = ref<number[]>([])
|
||||||
|
|
||||||
|
// 批量打印
|
||||||
|
const batchPrintDialogVisible = ref(false)
|
||||||
|
const batchPrintLoading = ref(false)
|
||||||
|
const batchPrintErrorMessage = ref('')
|
||||||
|
const batchPrintPayload = ref<WavePlatformPrintDataPayload | null>(null)
|
||||||
|
const batchPrintRequestMeta = ref<{ warehouse_id: number; wave_ids: Array<number | string> } | null>(null)
|
||||||
|
|
||||||
const expressCodeOptions = ref<Array<{ label: string; value: string }>>([])
|
const expressCodeOptions = ref<Array<{ label: string; value: string }>>([])
|
||||||
const platformCodeOptions = ref<Array<{ label: string; value: string }>>([])
|
const platformCodeOptions = ref<Array<{ label: string; value: string }>>([])
|
||||||
|
|
||||||
@ -924,7 +955,8 @@ const {
|
|||||||
|
|
||||||
const toolbarActionMap: Record<string, () => void | Promise<void>> = {
|
const toolbarActionMap: Record<string, () => void | Promise<void>> = {
|
||||||
...pendingToolbarActionMap,
|
...pendingToolbarActionMap,
|
||||||
openResolveExceptionDialog
|
openResolveExceptionDialog,
|
||||||
|
handleBatchPrint
|
||||||
}
|
}
|
||||||
|
|
||||||
const buttonLoadingMap = computed<Record<string, boolean>>(() => ({
|
const buttonLoadingMap = computed<Record<string, boolean>>(() => ({
|
||||||
@ -936,7 +968,8 @@ const buttonLoadingMap = computed<Record<string, boolean>>(() => ({
|
|||||||
updateOrderMetaLoading: updateOrderMetaLoading.value,
|
updateOrderMetaLoading: updateOrderMetaLoading.value,
|
||||||
cloneOrderLoading: cloneOrderLoading.value,
|
cloneOrderLoading: cloneOrderLoading.value,
|
||||||
resolveExceptionLoading: resolveExceptionLoading.value,
|
resolveExceptionLoading: resolveExceptionLoading.value,
|
||||||
waveSingleFetchLoading: waveSingleFetchLoading.value
|
waveSingleFetchLoading: waveSingleFetchLoading.value,
|
||||||
|
batchPrintLoading: batchPrintLoading.value
|
||||||
}))
|
}))
|
||||||
|
|
||||||
function resolveButtonLoading(loadingKey?: string) {
|
function resolveButtonLoading(loadingKey?: string) {
|
||||||
@ -960,6 +993,75 @@ function handleToolbarButtonClick(action: ToolbarButtonConfig['action']) {
|
|||||||
safeInvoke(() => handler())
|
safeInvoke(() => handler())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function handleBatchPrint() {
|
||||||
|
const rows = selectionRows.value
|
||||||
|
if (!rows.length) {
|
||||||
|
ElMessage.warning('请先勾选需要批量打印的订单')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (batchPrintLoading.value) return
|
||||||
|
|
||||||
|
const orderIds: Array<number | string> = []
|
||||||
|
for (const row of rows) {
|
||||||
|
const id = row?.id
|
||||||
|
if (id !== undefined && id !== null && id !== '') {
|
||||||
|
orderIds.push(id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!orderIds.length) {
|
||||||
|
ElMessage.warning('当前勾选记录缺少可用的订单 ID')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const warehouseId = Number(rows[0]?.warehouse_id ?? userStore.user?.warehouse_id ?? userStore.user?.store_id)
|
||||||
|
if (!Number.isFinite(warehouseId) || warehouseId <= 0) {
|
||||||
|
ElMessage.error('无法确定仓库 ID,请确认列表中的仓库字段或当前登录仓库上下文')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
batchPrintRequestMeta.value = { warehouse_id: warehouseId, wave_ids: orderIds }
|
||||||
|
batchPrintErrorMessage.value = ''
|
||||||
|
batchPrintPayload.value = null
|
||||||
|
batchPrintLoading.value = true
|
||||||
|
try {
|
||||||
|
const res: any = await getOrderPrintData({ order_ids: orderIds })
|
||||||
|
if (res?.code !== undefined && res?.code !== null && res?.code !== 1 && res?.code !== 200 && res?.code !== 0) {
|
||||||
|
throw new Error(res?.message || '获取打印数据失败')
|
||||||
|
}
|
||||||
|
batchPrintPayload.value = unwrapWavePlatformPrintPayload(res)
|
||||||
|
batchPrintDialogVisible.value = true
|
||||||
|
ElMessage.success(res?.message || '已获取打印数据')
|
||||||
|
} catch (error: any) {
|
||||||
|
batchPrintPayload.value = null
|
||||||
|
batchPrintErrorMessage.value = error?.message || '获取打印数据失败'
|
||||||
|
batchPrintDialogVisible.value = true
|
||||||
|
ElMessage.error(batchPrintErrorMessage.value)
|
||||||
|
} finally {
|
||||||
|
batchPrintLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleBatchPrintRefresh() {
|
||||||
|
const meta = batchPrintRequestMeta.value
|
||||||
|
if (!meta) return
|
||||||
|
try {
|
||||||
|
const res: any = await getOrderPrintData({ order_ids: meta.wave_ids })
|
||||||
|
if (res?.code !== undefined && res?.code !== null && res?.code !== 1 && res?.code !== 200 && res?.code !== 0) {
|
||||||
|
throw new Error(res?.message || '刷新打印数据失败')
|
||||||
|
}
|
||||||
|
batchPrintPayload.value = unwrapWavePlatformPrintPayload(res)
|
||||||
|
batchPrintErrorMessage.value = ''
|
||||||
|
} catch (error: any) {
|
||||||
|
batchPrintPayload.value = null
|
||||||
|
batchPrintErrorMessage.value = error?.message || '刷新打印数据失败'
|
||||||
|
ElMessage.error(batchPrintErrorMessage.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onBatchPrintSuccess() {
|
||||||
|
loadData()
|
||||||
|
}
|
||||||
|
|
||||||
function parseWaybillCodes(raw: unknown): string[] {
|
function parseWaybillCodes(raw: unknown): string[] {
|
||||||
if (Array.isArray(raw)) {
|
if (Array.isArray(raw)) {
|
||||||
return raw.map((item) => String(item ?? '').trim()).filter(Boolean)
|
return raw.map((item) => String(item ?? '').trim()).filter(Boolean)
|
||||||
|
|||||||
@ -97,6 +97,13 @@
|
|||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template #column-intercept_status="{ row }">
|
||||||
|
<el-tag v-if="row.intercept_status && row.intercept_status !== 'none'" type="danger" size="small">
|
||||||
|
{{ translateInterceptStatus(row.intercept_status) }}
|
||||||
|
</el-tag>
|
||||||
|
<span v-else style="color:#909399">—</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
<template #column-print_status="{ row }">
|
<template #column-print_status="{ row }">
|
||||||
<el-tag :type="getTagType('print_status', row.print_status)" size="small">
|
<el-tag :type="getTagType('print_status', row.print_status)" size="small">
|
||||||
{{ translateOrderField('print_status', row.print_status) }}
|
{{ translateOrderField('print_status', row.print_status) }}
|
||||||
@ -264,6 +271,15 @@
|
|||||||
|
|
||||||
<create-pending-order-dialog v-model="createOrderDialogVisible" @success="loadData" />
|
<create-pending-order-dialog v-model="createOrderDialogVisible" @success="loadData" />
|
||||||
<qrcode-dialog v-model:visible="qrDialogVisible" :code="currentWaybillCode" />
|
<qrcode-dialog v-model:visible="qrDialogVisible" :code="currentWaybillCode" />
|
||||||
|
|
||||||
|
<wave-platform-print-preview-dialog
|
||||||
|
v-model="batchPrintDialogVisible"
|
||||||
|
:error-message="batchPrintErrorMessage"
|
||||||
|
:payload="batchPrintPayload"
|
||||||
|
:request-meta="batchPrintRequestMeta"
|
||||||
|
@refresh="handleBatchPrintRefresh"
|
||||||
|
@print-success="onBatchPrintSuccess"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<order-export-progress-dialog
|
<order-export-progress-dialog
|
||||||
@ -295,6 +311,7 @@ import {
|
|||||||
pendingToolbarButtons,
|
pendingToolbarButtons,
|
||||||
type ToolbarButtonConfig,
|
type ToolbarButtonConfig,
|
||||||
translateOrderField,
|
translateOrderField,
|
||||||
|
translateInterceptStatus,
|
||||||
getTagType,
|
getTagType,
|
||||||
fillExpressCompanyScanFieldOptions,
|
fillExpressCompanyScanFieldOptions,
|
||||||
fillStoreScanFieldOptions,
|
fillStoreScanFieldOptions,
|
||||||
@ -318,11 +335,17 @@ import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
|||||||
import { createPendingToolbarController } from './utils/toolbar-actions'
|
import { createPendingToolbarController } from './utils/toolbar-actions'
|
||||||
import { safeInvoke } from '@/utils/safe-invoke'
|
import { safeInvoke } from '@/utils/safe-invoke'
|
||||||
import QrcodeDialog from '@/components/QR/qrcode.vue'
|
import QrcodeDialog from '@/components/QR/qrcode.vue'
|
||||||
|
import WavePlatformPrintPreviewDialog from '@/views/order/waveOrder/component/WavePlatformPrintPreviewDialog.vue'
|
||||||
|
import { getOrderPrintData } from '@/api/order.print/orderprint'
|
||||||
|
import type { WavePlatformPrintDataPayload } from '@/api/order.print/orderprint'
|
||||||
|
import { unwrapWavePlatformPrintPayload } from '@/views/order/waveOrder/config/wave-config'
|
||||||
|
import { useUserStore } from '@/stores/modules/user'
|
||||||
|
|
||||||
const scanBox = ref<any>(null)
|
const scanBox = ref<any>(null)
|
||||||
const upperTable = ref<any>(null)
|
const upperTable = ref<any>(null)
|
||||||
const scrollContainerRef = ref<HTMLElement | null>(null)
|
const scrollContainerRef = ref<HTMLElement | null>(null)
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
const userStore = useUserStore()
|
||||||
|
|
||||||
const { splitStackRef, beginSplitDrag, lowerPaneStyle, upperPaneStyle } = useVerticalSplitPane({
|
const { splitStackRef, beginSplitDrag, lowerPaneStyle, upperPaneStyle } = useVerticalSplitPane({
|
||||||
defaultLowerPercent: 38,
|
defaultLowerPercent: 38,
|
||||||
@ -376,6 +399,13 @@ const columns = ref(buildPendingColumns())
|
|||||||
|
|
||||||
const selectionRows = ref<any[]>([])
|
const selectionRows = ref<any[]>([])
|
||||||
const hasSelection = ref(false)
|
const hasSelection = ref(false)
|
||||||
|
|
||||||
|
// 批量打印
|
||||||
|
const batchPrintDialogVisible = ref(false)
|
||||||
|
const batchPrintLoading = ref(false)
|
||||||
|
const batchPrintErrorMessage = ref('')
|
||||||
|
const batchPrintPayload = ref<WavePlatformPrintDataPayload | null>(null)
|
||||||
|
const batchPrintRequestMeta = ref<{ warehouse_id: number; wave_ids: Array<number | string> } | null>(null)
|
||||||
const selectedOrderId = ref<number | string | null>(null)
|
const selectedOrderId = ref<number | string | null>(null)
|
||||||
const detailVisible = ref(true)
|
const detailVisible = ref(true)
|
||||||
|
|
||||||
@ -688,6 +718,79 @@ const {
|
|||||||
platformCodeOptions
|
platformCodeOptions
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 注册批量打印处理函数
|
||||||
|
toolbarActionMap['handleBatchPrint'] = handleBatchPrint
|
||||||
|
|
||||||
|
async function handleBatchPrint() {
|
||||||
|
const rows = selectionRows.value
|
||||||
|
if (!rows.length) {
|
||||||
|
ElMessage.warning('请先勾选需要批量打印的订单')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (batchPrintLoading.value) return
|
||||||
|
|
||||||
|
const orderIds: Array<number | string> = []
|
||||||
|
for (const row of rows) {
|
||||||
|
const id = row?.id
|
||||||
|
if (id !== undefined && id !== null && id !== '') {
|
||||||
|
orderIds.push(id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!orderIds.length) {
|
||||||
|
ElMessage.warning('当前勾选记录缺少可用的订单 ID')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const warehouseId = Number(rows[0]?.warehouse_id ?? userStore.user?.warehouse_id ?? userStore.user?.store_id)
|
||||||
|
if (!Number.isFinite(warehouseId) || warehouseId <= 0) {
|
||||||
|
ElMessage.error('无法确定仓库 ID,请确认列表中的仓库字段或当前登录仓库上下文')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
batchPrintRequestMeta.value = { warehouse_id: warehouseId, wave_ids: orderIds }
|
||||||
|
batchPrintErrorMessage.value = ''
|
||||||
|
batchPrintPayload.value = null
|
||||||
|
batchPrintLoading.value = true
|
||||||
|
try {
|
||||||
|
const res: any = await getOrderPrintData({ order_ids: orderIds })
|
||||||
|
if (res?.code !== undefined && res?.code !== null && res?.code !== 1 && res?.code !== 200 && res?.code !== 0) {
|
||||||
|
throw new Error(res?.message || '获取打印数据失败')
|
||||||
|
}
|
||||||
|
batchPrintPayload.value = unwrapWavePlatformPrintPayload(res)
|
||||||
|
batchPrintDialogVisible.value = true
|
||||||
|
ElMessage.success(res?.message || '已获取打印数据')
|
||||||
|
} catch (error: any) {
|
||||||
|
batchPrintPayload.value = null
|
||||||
|
batchPrintErrorMessage.value = error?.message || '获取打印数据失败'
|
||||||
|
batchPrintDialogVisible.value = true
|
||||||
|
ElMessage.error(batchPrintErrorMessage.value)
|
||||||
|
} finally {
|
||||||
|
batchPrintLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleBatchPrintRefresh() {
|
||||||
|
const meta = batchPrintRequestMeta.value
|
||||||
|
if (!meta) return
|
||||||
|
try {
|
||||||
|
const res: any = await getOrderPrintData({ order_ids: meta.wave_ids })
|
||||||
|
if (res?.code !== undefined && res?.code !== null && res?.code !== 1 && res?.code !== 200 && res?.code !== 0) {
|
||||||
|
throw new Error(res?.message || '刷新打印数据失败')
|
||||||
|
}
|
||||||
|
batchPrintPayload.value = unwrapWavePlatformPrintPayload(res)
|
||||||
|
batchPrintErrorMessage.value = ''
|
||||||
|
} catch (error: any) {
|
||||||
|
batchPrintPayload.value = null
|
||||||
|
batchPrintErrorMessage.value = error?.message || '刷新打印数据失败'
|
||||||
|
ElMessage.error(batchPrintErrorMessage.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onBatchPrintSuccess() {
|
||||||
|
// 打印成功后刷新列表
|
||||||
|
loadData()
|
||||||
|
}
|
||||||
|
|
||||||
const buttonLoadingMap = computed<Record<string, boolean>>(() => ({
|
const buttonLoadingMap = computed<Record<string, boolean>>(() => ({
|
||||||
exportLoading: exportLoading.value,
|
exportLoading: exportLoading.value,
|
||||||
exportSelectionLoading: exportSelectionLoading.value,
|
exportSelectionLoading: exportSelectionLoading.value,
|
||||||
@ -697,7 +800,8 @@ const buttonLoadingMap = computed<Record<string, boolean>>(() => ({
|
|||||||
updateOrderMetaLoading: updateOrderMetaLoading.value,
|
updateOrderMetaLoading: updateOrderMetaLoading.value,
|
||||||
cloneOrderLoading: cloneOrderLoading.value,
|
cloneOrderLoading: cloneOrderLoading.value,
|
||||||
syncOrderIdsLoading: syncOrderIdsLoading.value,
|
syncOrderIdsLoading: syncOrderIdsLoading.value,
|
||||||
waveSingleFetchLoading: waveSingleFetchLoading.value
|
waveSingleFetchLoading: waveSingleFetchLoading.value,
|
||||||
|
batchPrintLoading: batchPrintLoading.value
|
||||||
}))
|
}))
|
||||||
|
|
||||||
function resolveButtonLoading(loadingKey?: string) {
|
function resolveButtonLoading(loadingKey?: string) {
|
||||||
|
|||||||
498
src/views/order/orderreview/component/RecheckOrderPanel.vue
Normal file
498
src/views/order/orderreview/component/RecheckOrderPanel.vue
Normal file
@ -0,0 +1,498 @@
|
|||||||
|
<template>
|
||||||
|
<div class="recheck-order-panel">
|
||||||
|
<!-- 顶部:输入框 -->
|
||||||
|
<div class="panel-input">
|
||||||
|
<template v-if="effectiveScanMode === 'recheck'">
|
||||||
|
<div class="panel-input-mode">
|
||||||
|
<el-tag size="small" type="warning" effect="dark">复核扫描</el-tag>
|
||||||
|
<div class="panel-scan-qty">
|
||||||
|
<span class="qty-label">数量</span>
|
||||||
|
<el-input-number
|
||||||
|
v-model="scanQty"
|
||||||
|
:min="1"
|
||||||
|
:max="999"
|
||||||
|
:controls="true"
|
||||||
|
controls-position="right"
|
||||||
|
size="small"
|
||||||
|
class="qty-input"
|
||||||
|
@keyup.enter="inputRef?.focus?.()"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<el-input
|
||||||
|
ref="inputRef"
|
||||||
|
v-model="keyword"
|
||||||
|
placeholder="扫描商品条码(全部扫完后回车确认)"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
:disabled="loading"
|
||||||
|
@keyup.enter="handleInputEnter"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<el-input
|
||||||
|
ref="inputRef"
|
||||||
|
v-model="keyword"
|
||||||
|
placeholder="输入运单号/车号,回车查询"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
:disabled="loading"
|
||||||
|
@keyup.enter="handleInputEnter"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 中间:订单列表 -->
|
||||||
|
<div class="panel-list" v-loading="loading">
|
||||||
|
<div
|
||||||
|
v-for="(order, idx) in orders"
|
||||||
|
:key="getOrderKey(order, idx)"
|
||||||
|
class="panel-list-item"
|
||||||
|
:class="{
|
||||||
|
'is-active': effectiveActiveWaybill === getOrderWaybill(order),
|
||||||
|
'is-reviewed': getOrderIsReviewed(order),
|
||||||
|
'is-intercepted': getOrderInterceptStatus(order) !== 'none'
|
||||||
|
}"
|
||||||
|
@click="handleSelectOrder(order)"
|
||||||
|
>
|
||||||
|
<div class="waybill-row">
|
||||||
|
<el-tag
|
||||||
|
v-if="getOrderIsReviewed(order)"
|
||||||
|
size="small"
|
||||||
|
type="info"
|
||||||
|
effect="plain"
|
||||||
|
class="status-tag"
|
||||||
|
>已复核</el-tag>
|
||||||
|
<el-tag
|
||||||
|
v-else
|
||||||
|
size="small"
|
||||||
|
type="warning"
|
||||||
|
effect="plain"
|
||||||
|
class="status-tag"
|
||||||
|
>未复核</el-tag>
|
||||||
|
<span class="wave-index" v-if="order.wave_index != null">[{{ order.wave_index }}]</span>
|
||||||
|
<span class="waybill-text">{{ getOrderWaybill(order) || '—' }}</span>
|
||||||
|
</div>
|
||||||
|
<el-tag
|
||||||
|
v-if="getOrderIsPrinted(order)"
|
||||||
|
size="small"
|
||||||
|
type="danger"
|
||||||
|
effect="plain"
|
||||||
|
>已打印</el-tag>
|
||||||
|
<el-tag
|
||||||
|
v-else
|
||||||
|
size="small"
|
||||||
|
type="success"
|
||||||
|
effect="plain"
|
||||||
|
>未打印</el-tag>
|
||||||
|
<el-tag
|
||||||
|
v-if="getOrderInterceptStatus(order) !== 'none'"
|
||||||
|
size="small"
|
||||||
|
type="danger"
|
||||||
|
effect="dark"
|
||||||
|
>拦截</el-tag>
|
||||||
|
</div>
|
||||||
|
<div v-if="!orders.length && !loading" class="panel-empty">请输入关键词查询</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 底部:汇总 -->
|
||||||
|
<div class="panel-summary" v-if="totalCount > 0">
|
||||||
|
<span>波次总单数:<strong>{{ totalCount }}</strong></span>
|
||||||
|
<span class="summary-divider">|</span>
|
||||||
|
<span>剩余未复核:<strong class="text-remaining">{{ remainingCount }}</strong></span>
|
||||||
|
<span v-if="taskId != null" class="summary-divider">|</span>
|
||||||
|
<el-button
|
||||||
|
v-if="taskId != null"
|
||||||
|
link
|
||||||
|
size="small"
|
||||||
|
type="primary"
|
||||||
|
:loading="refreshTaskLoading"
|
||||||
|
@click="handleRefreshTask"
|
||||||
|
>
|
||||||
|
刷新任务数据
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, ref, watch, nextTick, onBeforeUnmount, onMounted } from 'vue'
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: 'RecheckOrderPanel'
|
||||||
|
})
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
orders: {
|
||||||
|
type: Array as any,
|
||||||
|
default: () => []
|
||||||
|
},
|
||||||
|
totalCount: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
remainingCount: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
loading: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
/** 当前选中运单号 */
|
||||||
|
activeWaybill: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
/** 订单对象中运单号的字段路径,如 'waybill_no' 或 'order.waybill_no' */
|
||||||
|
waybillField: {
|
||||||
|
type: String,
|
||||||
|
default: 'waybill_no'
|
||||||
|
},
|
||||||
|
/** 订单对象中复核状态的字段路径 */
|
||||||
|
recheckStatusField: {
|
||||||
|
type: String,
|
||||||
|
default: 'recheck_status'
|
||||||
|
},
|
||||||
|
/** 订单对象中唯一键的字段路径 */
|
||||||
|
rowKeyField: {
|
||||||
|
type: String,
|
||||||
|
default: 'id'
|
||||||
|
},
|
||||||
|
/** 订单对象中是否已打印的字段路径 */
|
||||||
|
isPrintedField: {
|
||||||
|
type: String,
|
||||||
|
default: 'is_printed'
|
||||||
|
},
|
||||||
|
/** 扫描模式:search=查询订单, recheck=复核扫描商品条码 */
|
||||||
|
scanMode: {
|
||||||
|
type: String,
|
||||||
|
default: 'search'
|
||||||
|
},
|
||||||
|
/** 所有商品是否已扫完 */
|
||||||
|
allScanned: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
/** 拣货任务 ID,用于刷新任务数据 */
|
||||||
|
taskId: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: null
|
||||||
|
},
|
||||||
|
/** 刷新任务数据 loading */
|
||||||
|
refreshTaskLoading: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
search: [keyword: string]
|
||||||
|
select: [order: any]
|
||||||
|
'scan-barcode': [barcode: string, qty: number]
|
||||||
|
/** 全部扫完后空输入回车,触发确认复核 */
|
||||||
|
confirm: []
|
||||||
|
/** 刷新任务数据 */
|
||||||
|
'refresh-task': [taskId: number]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const keyword = ref('')
|
||||||
|
const scanQty = ref(1)
|
||||||
|
const inputRef = ref<any>(null)
|
||||||
|
/** 本地扫描模式,点击订单即时切换,不依赖父组件 prop 回传 */
|
||||||
|
const localScanMode = ref<'search' | 'recheck'>('search')
|
||||||
|
/** 本地选中运单号,用于即时高亮 */
|
||||||
|
const localActiveWaybill = ref('')
|
||||||
|
|
||||||
|
/** 全局键盘监听:按下可打印字符时自动聚焦输入框 */
|
||||||
|
function handleGlobalKeydown(e: KeyboardEvent) {
|
||||||
|
if (document.activeElement?.tagName === 'INPUT' || document.activeElement?.tagName === 'TEXTAREA') return
|
||||||
|
if (e.ctrlKey || e.altKey || e.metaKey) return
|
||||||
|
if (e.key.length > 1 && !['Tab', 'Enter'].includes(e.key)) return
|
||||||
|
inputRef.value?.focus?.()
|
||||||
|
}
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
document.removeEventListener('keydown', handleGlobalKeydown)
|
||||||
|
})
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
document.addEventListener('keydown', handleGlobalKeydown)
|
||||||
|
void nextTick(() => {
|
||||||
|
inputRef.value?.focus?.()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 当前生效的扫描模式:父组件 prop 优先,本地仅用于即时 UI 反馈 */
|
||||||
|
const effectiveScanMode = computed(() => props.scanMode || localScanMode.value)
|
||||||
|
/** 当前生效的选中运单号:本地优先(即时高亮),其次父组件 prop */
|
||||||
|
const effectiveActiveWaybill = computed(() => localActiveWaybill.value || props.activeWaybill)
|
||||||
|
|
||||||
|
function handleInputEnter() {
|
||||||
|
const kw = keyword.value.trim()
|
||||||
|
if (!kw) {
|
||||||
|
// 复核模式下空输入回车 = 全部扫完,触发确认
|
||||||
|
if (effectiveScanMode.value === 'recheck' && props.allScanned) {
|
||||||
|
emit('confirm')
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (effectiveScanMode.value === 'recheck') {
|
||||||
|
const qty = scanQty.value
|
||||||
|
emit('scan-barcode', kw, qty)
|
||||||
|
keyword.value = ''
|
||||||
|
scanQty.value = 1
|
||||||
|
} else {
|
||||||
|
emit('search', kw)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleSearch() {
|
||||||
|
const kw = keyword.value.trim()
|
||||||
|
if (!kw) return
|
||||||
|
emit('search', kw)
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleSelectOrder(order: any) {
|
||||||
|
const waybill = getOrderWaybill(order) || String(order?.order_id ?? order?.id ?? '')
|
||||||
|
localActiveWaybill.value = waybill || `_idx_${Date.now()}`
|
||||||
|
// 根据复核状态决定模式:已复核切回搜索,未复核进入扫描
|
||||||
|
localScanMode.value = getOrderIsReviewed(order) ? 'search' : 'recheck'
|
||||||
|
emit('select', order)
|
||||||
|
}
|
||||||
|
|
||||||
|
function getOrderWaybill(order: any): string {
|
||||||
|
const field = props.waybillField
|
||||||
|
// 支持点号路径:'order.waybill_no' -> order.order.waybill_no
|
||||||
|
const val = field.split('.').reduce((obj: any, key: string) => obj?.[key], order)
|
||||||
|
return String(val ?? '').trim()
|
||||||
|
}
|
||||||
|
|
||||||
|
function getOrderRecheckStatus(order: any): string {
|
||||||
|
const field = props.recheckStatusField
|
||||||
|
const val = field.split('.').reduce((obj: any, key: string) => obj?.[key], order)
|
||||||
|
return String(val ?? '').trim()
|
||||||
|
}
|
||||||
|
|
||||||
|
function getOrderIsReviewed(order: any): boolean {
|
||||||
|
// 优先 is_reviewed 布尔字段,其次 recheck_status
|
||||||
|
const reviewed = (order as any)?.is_reviewed
|
||||||
|
if (reviewed === true || reviewed === 'true' || reviewed === 1 || reviewed === '1') return true
|
||||||
|
const status = getOrderRecheckStatus(order)
|
||||||
|
return status === 'fin'
|
||||||
|
}
|
||||||
|
|
||||||
|
function getOrderIsPrinted(order: any): boolean {
|
||||||
|
const field = props.isPrintedField
|
||||||
|
const val = field.split('.').reduce((obj: any, key: string) => obj?.[key], order)
|
||||||
|
if (val === true || val === 'true' || val === 1 || val === '1') return true
|
||||||
|
if (val === false || val === 'false' || val === 0 || val === '0') return false
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
function getOrderInterceptStatus(order: any): string {
|
||||||
|
return String((order as any)?.intercept_status ?? 'none').trim()
|
||||||
|
}
|
||||||
|
|
||||||
|
function getOrderKey(order: any, index: number): string {
|
||||||
|
const field = props.rowKeyField
|
||||||
|
const val = field.split('.').reduce((obj: any, key: string) => obj?.[key], order)
|
||||||
|
return String(val ?? index)
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleRefreshTask() {
|
||||||
|
const tid = props.taskId
|
||||||
|
if (tid == null || tid === '') return
|
||||||
|
emit('refresh-task', Number(tid))
|
||||||
|
}
|
||||||
|
|
||||||
|
// 网络请求完成后清除输入框
|
||||||
|
watch(() => props.loading, (newVal, oldVal) => {
|
||||||
|
if (oldVal === true && newVal === false) {
|
||||||
|
keyword.value = ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 切换到复核扫描模式时自动聚焦输入框并启动空闲定时器
|
||||||
|
watch(effectiveScanMode, (mode) => {
|
||||||
|
if (mode === 'recheck') {
|
||||||
|
void nextTick(() => {
|
||||||
|
inputRef.value?.focus?.()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// 父组件 prop 变化时同步本地状态(如:确认复核后自动跳转下一单)
|
||||||
|
watch(() => props.activeWaybill, (val) => {
|
||||||
|
if (val) localActiveWaybill.value = val
|
||||||
|
})
|
||||||
|
watch(() => props.scanMode, (val) => {
|
||||||
|
if (val) localScanMode.value = val as 'search' | 'recheck'
|
||||||
|
})
|
||||||
|
// 暴露重置方法给父组件
|
||||||
|
defineExpose({
|
||||||
|
resetLocalState: () => {
|
||||||
|
localActiveWaybill.value = ''
|
||||||
|
localScanMode.value = 'search'
|
||||||
|
keyword.value = ''
|
||||||
|
scanQty.value = 1
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.recheck-order-panel {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 100%;
|
||||||
|
background: #fff;
|
||||||
|
border-right: 1px solid #e4e7ed;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-input {
|
||||||
|
padding: 10px;
|
||||||
|
border-bottom: 1px solid #ebeef5;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-input-mode {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-scan-qty {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.qty-label {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #606266;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.qty-input {
|
||||||
|
width: 90px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.qty-input :deep(.el-input-number__decrease),
|
||||||
|
.qty-input :deep(.el-input-number__increase) {
|
||||||
|
width: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-list {
|
||||||
|
flex: 1;
|
||||||
|
overflow-y: auto;
|
||||||
|
padding: 4px 0;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-list-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 4px;
|
||||||
|
padding: 6px 12px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 13px;
|
||||||
|
border-bottom: 1px solid #f2f3f5;
|
||||||
|
transition: background-color 0.15s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-list-item:hover {
|
||||||
|
background-color: #f5f7fa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-list-item.is-active {
|
||||||
|
background-color: #ecf5ff;
|
||||||
|
color: #409eff;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-list-item.is-reviewed {
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-list-item.is-reviewed:hover {
|
||||||
|
background-color: #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-list-item.is-reviewed.is-active {
|
||||||
|
background-color: #e6f0fa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-list-item.is-intercepted {
|
||||||
|
background-color: #fef0f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-list-item.is-intercepted:hover {
|
||||||
|
background-color: #fde2e2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-list-item.is-intercepted.is-active {
|
||||||
|
background-color: #fde2e2;
|
||||||
|
border-left: 3px solid #f56c6c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.waybill-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-tag {
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wave-index {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #909399;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.waybill-text {
|
||||||
|
font-family: monospace;
|
||||||
|
font-size: 13px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-empty {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
height: 80px;
|
||||||
|
color: #c0c4cc;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-summary {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 8px;
|
||||||
|
padding: 10px;
|
||||||
|
border-top: 1px solid #ebeef5;
|
||||||
|
font-size: 13px;
|
||||||
|
color: #606266;
|
||||||
|
flex-shrink: 0;
|
||||||
|
background: #fafafa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-divider {
|
||||||
|
color: #dcdfe6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-remaining {
|
||||||
|
color: #e6a23c;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
File diff suppressed because it is too large
Load Diff
@ -46,6 +46,29 @@
|
|||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template #column-access_token="{ row }">
|
||||||
|
<div v-if="row.access_token" class="token-cell">
|
||||||
|
<span class="token-text">{{ tokenVisibleMap[row.id] ? row.access_token : '●●●●●●●●●●●●●●●●●●●●●●●●' }}</span>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
@click.stop="toggleTokenVisible(row)"
|
||||||
|
>
|
||||||
|
{{ tokenVisibleMap[row.id] ? '隐藏' : '查看' }}
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="success"
|
||||||
|
size="small"
|
||||||
|
@click.stop="copyToken(row.access_token)"
|
||||||
|
>
|
||||||
|
复制
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
<span v-else class="token-empty">--</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
<template #column-status="{ row }">
|
<template #column-status="{ row }">
|
||||||
<el-tag :type="formatShopStatus(row.status).type" size="small">
|
<el-tag :type="formatShopStatus(row.status).type" size="small">
|
||||||
{{ formatShopStatus(row.status).text }}
|
{{ formatShopStatus(row.status).text }}
|
||||||
@ -200,6 +223,7 @@ const authConfirmLoading = ref(false)
|
|||||||
const authFormRef = ref<FormInstance>()
|
const authFormRef = ref<FormInstance>()
|
||||||
const tableData = ref<ShopRecord[]>([])
|
const tableData = ref<ShopRecord[]>([])
|
||||||
const platformOptions = ref<PlatformOption[]>([])
|
const platformOptions = ref<PlatformOption[]>([])
|
||||||
|
const tokenVisibleMap = reactive<Record<number, boolean>>({})
|
||||||
const queryTime = ref(0)
|
const queryTime = ref(0)
|
||||||
const tableSize = ref<'small' | 'default' | 'large'>('small')
|
const tableSize = ref<'small' | 'default' | 'large'>('small')
|
||||||
const currentConditionRaw = ref<any>(null)
|
const currentConditionRaw = ref<any>(null)
|
||||||
@ -313,6 +337,21 @@ function isAuthExpired(value: unknown): boolean {
|
|||||||
return ts < Date.now()
|
return ts < Date.now()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggleTokenVisible(row: ShopRecord) {
|
||||||
|
if (!row.id) return
|
||||||
|
tokenVisibleMap[row.id] = !tokenVisibleMap[row.id]
|
||||||
|
}
|
||||||
|
|
||||||
|
async function copyToken(token: string) {
|
||||||
|
if (!token) return
|
||||||
|
try {
|
||||||
|
await navigator.clipboard.writeText(token)
|
||||||
|
ElMessage.success('密钥已复制到剪贴板')
|
||||||
|
} catch {
|
||||||
|
ElMessage.error('复制失败,请手动复制')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function loadList() {
|
async function loadList() {
|
||||||
if (loading.value) return
|
if (loading.value) return
|
||||||
loading.value = true
|
loading.value = true
|
||||||
@ -648,4 +687,22 @@ onMounted(async () => {
|
|||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.token-cell {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.token-text {
|
||||||
|
font-family: 'Courier New', monospace;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #303133;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
|
||||||
|
.token-empty {
|
||||||
|
color: #c0c4cc;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -6,6 +6,7 @@ export type ShopRecord = {
|
|||||||
shop_name?: string
|
shop_name?: string
|
||||||
auth_expire_at?: string | number
|
auth_expire_at?: string | number
|
||||||
status?: string | number
|
status?: string | number
|
||||||
|
access_token?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export const shopColumns = [
|
export const shopColumns = [
|
||||||
@ -15,6 +16,7 @@ export const shopColumns = [
|
|||||||
{ prop: 'custom_name', label: '自定义名称', minWidth: '160', showOverflowTooltip: true },
|
{ prop: 'custom_name', label: '自定义名称', minWidth: '160', showOverflowTooltip: true },
|
||||||
{ prop: 'shop_name', label: '店铺名称', minWidth: '160', showOverflowTooltip: true },
|
{ prop: 'shop_name', label: '店铺名称', minWidth: '160', showOverflowTooltip: true },
|
||||||
{ prop: 'auth_expire_at', label: '授权过期时间', minWidth: '180', align: 'center' },
|
{ prop: 'auth_expire_at', label: '授权过期时间', minWidth: '180', align: 'center' },
|
||||||
|
{ prop: 'access_token', label: '密钥', minWidth: '200', showOverflowTooltip: true },
|
||||||
{ prop: 'status', label: '状态', width: '100', align: 'center' },
|
{ prop: 'status', label: '状态', width: '100', align: 'center' },
|
||||||
{ prop: 'actions', label: '操作', width: '220', align: 'center', fixed: 'right' }
|
{ prop: 'actions', label: '操作', width: '220', align: 'center', fixed: 'right' }
|
||||||
]
|
]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user