-
+ (null)
+const manualCreateDialogVisible = ref(false)
const loading = ref(false)
const queryTime = ref(0)
const quickSearch = ref('')
diff --git a/src/views/order/orderManagement/pendingOrder.vue b/src/views/order/orderManagement/pendingOrder.vue
index 1e2e61ec..eef6ea8f 100644
--- a/src/views/order/orderManagement/pendingOrder.vue
+++ b/src/views/order/orderManagement/pendingOrder.vue
@@ -76,8 +76,8 @@
>
修改平台
- 手动建单
-
+ 手动建单
+
Excel导入建单
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 选择
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 删除
-
-
-
-
-
- 取消
- 确认创建
-
-
-
-
-
-
-
-
-
-
- 取消
- 确认选择
-
-
-
-
-
- 导入结果
-
-
-
-
-
- 关闭
-
- 开始导入
-
-
-
+
+
+
刷新
导出
+
+ 反审回待审核
+
+
+ 标记待出库
+
分配储位
+
+ 取消分配储位
+
修改平台
+ 手动建单
+ Excel导入建单
+
+ 克隆订单
+
+
+ 取消订单
+
处理异常订单
+
@@ -110,7 +150,7 @@
-
@@ -167,6 +207,8 @@
+
+
@@ -174,14 +216,23 @@
- (null)
@@ -353,14 +430,22 @@ const storageAllocateLoading = ref(false)
const updateOrderMetaLoading = ref(false)
const queryTime = ref(0)
+const actionLoading = ref(false)
const allocateDialogVisible = ref(false)
const allocatePendingRows = ref([])
const storageDialogVisible = ref(false)
+const storageDialogMode = ref<'allocate' | 'cancel'>('allocate')
const storagePendingOrderIds = ref>([])
const storageForm = reactive<{ allowStorageLocation: boolean }>({
allowStorageLocation: false
})
+const cloneOrderDialogVisible = ref(false)
+const cloneOrderLoading = ref(false)
+const cloneSourceOrderId = ref(null)
+const cloneSourceOrderCode = ref('')
+const manualCreateDialogVisible = ref(false)
+const importOrderDialogVisible = ref(false)
const resolveExceptionDialogVisible = ref(false)
const resolveExceptionLoading = ref(false)
const resolveExceptionOrderIds = ref([])
@@ -384,6 +469,37 @@ const selectedOrderId = ref(null)
const quickSearch = ref('')
+const scrollContainerRef = ref(null)
+const isDragging = ref(false)
+const startX = ref(0)
+const scrollLeftStart = ref(0)
+
+const handleToolbarWheel = (e: WheelEvent) => {
+ if (scrollContainerRef.value) {
+ e.preventDefault()
+ scrollContainerRef.value.scrollLeft += e.deltaY
+ }
+}
+
+const handleMouseDown = (e: MouseEvent) => {
+ if (!scrollContainerRef.value) return
+ isDragging.value = true
+ startX.value = e.pageX - scrollContainerRef.value.offsetLeft
+ scrollLeftStart.value = scrollContainerRef.value.scrollLeft
+}
+
+const handleMouseMove = (e: MouseEvent) => {
+ if (!isDragging.value || !scrollContainerRef.value) return
+ e.preventDefault()
+ const x = e.pageX - scrollContainerRef.value.offsetLeft
+ const walk = (x - startX.value) * 1.5
+ scrollContainerRef.value.scrollLeft = scrollLeftStart.value - walk
+}
+
+const handleMouseUp = () => {
+ isDragging.value = false
+}
+
const selectedRow = computed(() => {
return list.value.find((i: any) => i.id === selectedOrderId.value) || null
})
@@ -475,9 +591,9 @@ function getSelectedIds(): number[] {
return ids
}
-function openStorageAllocateDialog() {
+function openStorageDialog(mode: 'allocate' | 'cancel') {
if (!selectionRows.value.length) {
- ElMessage.warning('请先勾选需要分配储位的订单')
+ ElMessage.warning(mode === 'cancel' ? '请先勾选需要取消分配储位的订单' : '请先勾选需要分配储位的订单')
return
}
const ids = getSelectedIds()
@@ -485,12 +601,22 @@ function openStorageAllocateDialog() {
ElMessage.error('选中行缺少订单 id,请刷新后重试')
return
}
+ storageDialogMode.value = mode
storagePendingOrderIds.value = [...ids]
storageForm.allowStorageLocation = false
storageDialogVisible.value = true
}
+function openStorageAllocateDialog() {
+ openStorageDialog('allocate')
+}
+
+function openStorageCancelDialog() {
+ openStorageDialog('cancel')
+}
+
function resetStorageAllocateDialog() {
+ storageDialogMode.value = 'allocate'
storagePendingOrderIds.value = []
storageForm.allowStorageLocation = false
}
@@ -499,31 +625,143 @@ async function submitStorageAllocate() {
const order_ids = [...storagePendingOrderIds.value]
if (!order_ids.length || storageAllocateLoading.value) return
+ const isCancel = storageDialogMode.value === 'cancel'
+
storageAllocateLoading.value = true
try {
- const payload: Record = {
- order_ids,
- allowStorageLocation: storageForm.allowStorageLocation
- }
- const res = await orderPendingOrder.allocateStorage(payload)
+ const payload: Record = isCancel
+ ? { order_ids }
+ : {
+ order_ids,
+ allow_storage_location: storageForm.allowStorageLocation
+ }
+ const res = isCancel
+ ? await orderPendingOrder.cancelAllocateStorage(payload)
+ : await orderPendingOrder.allocateStorage(payload)
const ok = res && (res.code === 1 || res.code === 200 || res.flag === 'success')
if (ok) {
- ElMessage.success(res.message || '储位分配已提交')
+ ElMessage.success(res.message || (isCancel ? '取消分配储位已提交' : '储位分配已提交'))
storageDialogVisible.value = false
upperTable.value?.clearSelection?.()
selectionRows.value = []
hasSelection.value = false
await loadData()
} else {
- ElMessage.error(res?.message || '储位分配失败')
+ ElMessage.error(res?.message || (isCancel ? '取消分配储位失败' : '储位分配失败'))
}
} catch {
- ElMessage.error('储位分配失败')
+ ElMessage.error(isCancel ? '取消分配储位失败' : '储位分配失败')
} finally {
storageAllocateLoading.value = false
}
}
+async function callAction(title: string, action: () => Promise, successText: string) {
+ if (actionLoading.value) return
+ actionLoading.value = true
+ try {
+ const res = await action()
+ if (res && (res.code === 1 || res.code === 200 || res.flag === 'success')) {
+ ElMessage.success(`${successText} ${res.data?.updated_count || 0} 条`)
+ upperTable.value?.clearSelection?.()
+ selectionRows.value = []
+ hasSelection.value = false
+ await loadData()
+ } else {
+ ElMessage.error(res?.message || `${title}失败`)
+ }
+ } catch {
+ ElMessage.error(`${title}失败`)
+ } finally {
+ actionLoading.value = false
+ }
+}
+
+async function handleReverseReview() {
+ const ids = getSelectedIds()
+ if (!ids.length) {
+ ElMessage.warning('请先选择订单')
+ return
+ }
+ try {
+ await ElMessageBox.confirm(`确定将选中的 ${ids.length} 条订单反审回待审核吗?`, '确认', { type: 'warning' })
+ await callAction('反审', () => orderPendingOrder.reverseReviewOrder({ ids }), '反审成功')
+ } catch {}
+}
+
+async function handleMarkPendingOutbound() {
+ const ids = getSelectedIds()
+ if (!ids.length) {
+ ElMessage.warning('请先选择订单')
+ return
+ }
+ try {
+ await ElMessageBox.confirm(`确定将选中的 ${ids.length} 条订单标记为待出库吗?`, '确认', { type: 'warning' })
+ await callAction(
+ '标记待出库',
+ () => orderPendingOrder.markPendingOutboundOrder({ ids }),
+ '标记待出库成功'
+ )
+ } catch {}
+}
+
+async function handleCancelOrder() {
+ const ids = getSelectedIds()
+ if (!ids.length) {
+ ElMessage.warning('请先选择订单')
+ return
+ }
+ try {
+ await ElMessageBox.confirm(`确定取消选中的 ${ids.length} 条订单吗?`, '确认', { type: 'error' })
+ await callAction('取消订单', () => orderPendingOrder.cancelOrder({ ids }), '取消订单成功')
+ } catch {}
+}
+
+function openCloneOrderDialog() {
+ if (selectionRows.value.length !== 1) {
+ ElMessage.warning('请选择 1 条订单进行克隆')
+ return
+ }
+ const row = selectionRows.value[0] || {}
+ const orderId = normalizePositiveIntId(row?.order_id ?? row?.id)
+ if (!orderId) {
+ ElMessage.error('未识别到有效订单ID')
+ return
+ }
+ cloneSourceOrderId.value = orderId
+ cloneSourceOrderCode.value = String(row?.delivery_order_code || '')
+ cloneOrderDialogVisible.value = true
+}
+
+function resetCloneOrderDialog() {
+ cloneSourceOrderId.value = null
+ cloneSourceOrderCode.value = ''
+}
+
+async function submitCloneOrder() {
+ if (!cloneSourceOrderId.value || cloneOrderLoading.value) return
+ cloneOrderLoading.value = true
+ try {
+ const res = await orderPendingOrder.cloneOrder({ order_id: cloneSourceOrderId.value })
+ const ok = res && (res.code === 1 || res.code === 200 || res.flag === 'success')
+ if (!ok) {
+ ElMessage.error(res?.message || '克隆订单失败')
+ return
+ }
+ const data = res?.data || {}
+ ElMessage.success(`克隆成功:原订单 ${data.source_order_id ?? cloneSourceOrderId.value} -> 新订单 ${data.new_order_id ?? '-'}`)
+ cloneOrderDialogVisible.value = false
+ upperTable.value?.clearSelection?.()
+ selectionRows.value = []
+ hasSelection.value = false
+ await loadData()
+ } catch {
+ ElMessage.error('克隆订单失败')
+ } finally {
+ cloneOrderLoading.value = false
+ }
+}
+
function computeAvailableBusinessKeys(expressNumbers: any, count = 1): number[] {
const used = new Set()
if (Array.isArray(expressNumbers)) {
@@ -551,9 +789,12 @@ function openAllocateExpressDialog() {
ElMessage.warning('请先勾选需要分配快递号的订单')
return
}
- const invalid = selectionRows.value.filter((row: any) => row?.id == null && row?.order_id == null)
+ const invalid = selectionRows.value.filter((row: any) => {
+ const oid = row?.order_id ?? row?.id
+ return normalizePositiveIntId(oid) === null
+ })
if (invalid.length) {
- ElMessage.error('存在无法识别 order_id 的行,请刷新列表后重试')
+ ElMessage.error('存在无法识别有效 order_id 的行,请刷新列表后重试')
return
}
allocatePendingRows.value = selectionRows.value.map((row: any) => ({ ...row }))
@@ -565,16 +806,19 @@ function resetAllocateDialog() {
}
function buildAllocateExpressPayload(rows: any[]): Array> {
- return rows.map((row) => {
+ const out: Array> = []
+ for (const row of rows) {
const base = { ...row }
- const order_id = base.order_id ?? base.id
+ const order_id = normalizePositiveIntId(base.order_id ?? base.id)
+ if (order_id === null) continue
const business_key = computeAvailableBusinessKeys(row.express_numbers, 1)
- return {
+ out.push({
...base,
order_id,
business_key
- }
- })
+ })
+ }
+ return out
}
async function submitAllocateExpress() {
@@ -584,6 +828,10 @@ async function submitAllocateExpress() {
allocateLoading.value = true
try {
const orders = buildAllocateExpressPayload(rows)
+ if (!orders.length) {
+ ElMessage.error('没有有效的订单 ID,无法分配快递号')
+ return
+ }
const res = await orderPendingOrder.allocateExpressCode({ orders })
const ok = res && (res.code === 1 || res.code === 200 || res.flag === 'success')
if (ok) {
@@ -978,5 +1226,50 @@ async function handleExport() {
line-height: 1.6;
word-break: break-all;
}
+
+.order-sub-container .main-content {
+ .toolbar {
+ .toolbar-left {
+ cursor: grab;
+
+ &:active {
+ cursor: grabbing;
+ }
+
+ .toolbar-scroll-container {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ overflow-x: auto;
+ scrollbar-width: none;
+ &::-webkit-scrollbar {
+ display: none;
+ }
+ }
+ }
+ }
+}
+
+.clone-order-meta {
+ margin-top: 12px;
+ color: #606266;
+}
+
+.clone-order-meta p {
+ margin: 4px 0;
+}
+
+.detail-page {
+ height: 100%;
+ overflow-x: hidden;
+ overflow-y: auto;
+}
+
+.order-detail-wrapper,
+.order-picking-wrapper,
+.order-archive-wrapper,
+.order-log-wrapper {
+ height: 100%;
+}
diff --git a/src/views/order/orderManagement/orderWorkbench.vue b/src/views/order/orderManagement/orderWorkbench.vue
index 99e7f9ce..00625e6d 100644
--- a/src/views/order/orderManagement/orderWorkbench.vue
+++ b/src/views/order/orderManagement/orderWorkbench.vue
@@ -17,7 +17,7 @@
刷新数据
-
+ 手动建单
+
+
@@ -136,6 +138,7 @@ import { ElMessage } from 'element-plus'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import ManualOutboundPanel from './component/ManualOutboundPanel.vue'
+import ManualCreatePendingOrderDialog from './component/ManualCreatePendingOrderDialog.vue'
import WorkbenchOrderDetail from './component/WorkbenchOrderDetail.vue'
import log from './component/log.vue'
import { orderBadgeCount, orderList } from '@/api/order.index/orderindex'
@@ -149,6 +152,7 @@ import {
} from './config/order-common-config'
const scanBox = ref暂无异常订单
+ 暂无待处理异常订单
+
-
@@ -335,6 +408,10 @@ const EXPORT_TIME_PROPS = new Set([
'delivery_time'
])
import WorkbenchOrderDetail from './component/WorkbenchOrderDetail.vue'
+import ArchiveOrderPanel from './component/ArchiveOrderPanel.vue'
+import log from './component/log.vue'
+import ManualCreatePendingOrderDialog from './component/ManualCreatePendingOrderDialog.vue'
+import ExcelImportPendingOrderDialog from './component/ExcelImportPendingOrderDialog.vue'
import { exportUpperTableRows } from './utils/export'
const scanBox = ref
-
+
{{ storagePendingOrderIds.length }} 条
-
+
取消
- 开始分配
+ {{ storageDialogMode === 'cancel' ? '确认取消' : '开始分配' }}
+
+
+ 取消
+ 确认克隆
+
+
+
+
+
+
+
- 配货明细加载中...
-
@@ -212,7 +263,7 @@
操作日志暂无
+
+
+
+
+
+
+
+
+
+
+ 原订单ID:{{ cloneSourceOrderId || '-' }}
+订单号:{{ cloneSourceOrderCode || '-' }}
+
订单工作台总列表
@@ -126,6 +126,8 @@
-
- 智能识别(即将上线)
-
-
- 订单明细
-
-
- 选择商品(多选)
- 新增空白明细
-
-
-
- 查询
-
-
-
-
-
-
-
- 下载导入模板
-
- 选择Excel文件
- {{ importOrderFile?.name || '未选择文件' }}
-
-
-
-
- 总数 {{ importOrderResult.total || 0 }}
- 成功 {{ importOrderResult.success_count || 0 }}
- 失败 {{ importOrderResult.fail_count || 0 }}
-
- 尚未执行导入
-