feat: 支持取消分配储位与状态展示

This commit is contained in:
liufumingren 2026-04-20 23:52:22 +08:00
parent 67bd0bb7c5
commit 411df459f5
12 changed files with 79 additions and 39 deletions

View File

@ -136,11 +136,28 @@ export function orderPendingOrderAllocateStorage(
} as any)
}
export function orderPendingOrderCancelAllocateStorage(
data: PendingOrderAllocateStorageParams
): Promise<any> {
return request({
url: '/system',
method: 'post',
params: {
method: 'order.pendingOrder.cancelAllocateStorage',
v,
timestamp: Date.now()
},
data,
isSystemApi: true
} as any)
}
export const orderPendingOrder = {
list: orderPendingOrderList,
reverseReviewOrder: orderPendingOrderReverseReviewOrder,
markPendingOutboundOrder: orderPendingOrderMarkPendingOutboundOrder,
cancelOrder: orderPendingOrderCancelOrder,
allocateExpressCode: orderPendingOrderAllocateExpressCode,
allocateStorage: orderPendingOrderAllocateStorage
allocateStorage: orderPendingOrderAllocateStorage,
cancelAllocateStorage: orderPendingOrderCancelAllocateStorage
}

View File

@ -41,7 +41,7 @@
<script setup lang="ts">
import { reactive, ref } from 'vue'
import { ElMessage } from 'element-plus'
import { orderOutboundOrder } from '@/api/order.outboundorder/orderoutboundOrder'
import { orderOutboundOrder } from '@/api/order.outboundOrder/orderoutboundOrder'
const emit = defineEmits<{
(e: 'success', data: any): void

View File

@ -157,18 +157,18 @@ export const deliveryAvailableFields = [
]
export const deliveryColumns = [
{ prop: 'delivery_order_code', label: '配送单号', width: '170' },
{ prop: 'shop_nick', label: '店铺名称', width: '140' },
{ prop: 'delivery_order_code', label: '配送单号', width: '170' },
{ prop: 'source_platform_code', label: '平台来源', width: '100' },
{ prop: 'name', label: '收货人', width: '100' },
{ prop: 'mobile', label: '手机号', width: '120' },
{ prop: 'status', label: '订单状态', width: '100' },
{ prop: 'outbound_status', label: '出库状态', width: '100' },
{ prop: 'sync_status', label: '同步状态', width: '100' },
{ prop: 'storage_status', label: '分配状态', width: '100' },
{ prop: 'post_status', label: '快递状态', width: '100' },
{ prop: 'pick_status', label: '拣货状态', width: '100' },
{ prop: 'pack_status', label: '打包状态', width: '100' },
{ prop: 'storage_status', label: '储位', width: '100' },
{ prop: 'post_status', label: '快递', width: '100' },
{ prop: 'pick_status', label: '拣货', width: '100' },
{ prop: 'pack_status', label: '打包', width: '100' },
{ prop: 'logistics_name', label: '物流公司', width: '120' },
{ prop: 'express_code', label: '物流单号', width: '160' },
{ prop: 'is_urgency', label: '紧急', width: '80' },

View File

@ -144,7 +144,7 @@ import { ref, reactive, onMounted, computed } from 'vue'
import { ElMessage } from 'element-plus'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import { orderDeliveryOrder } from '@/api/order.deliveryorder/orderdeliveryOrder'
import { orderDeliveryOrder } from '@/api/order.deliveryOrder/orderdeliveryOrder'
import {
deliveryAvailableFields,

View File

@ -217,7 +217,7 @@ import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import * as indexApi from '@/api/index/index'
import { orderExpectionOrder } from '@/api/order.expectionorder/orderexpectionorder'
import { orderPendingOrder } from '@/api/order.pendingorder/orderpendingOrder'
import { orderPendingOrder } from '@/api/order.pendingOrder/orderpendingOrder'
import {
expectionColumns,

View File

@ -148,7 +148,7 @@ import { computed, nextTick, onMounted, reactive, ref } from 'vue'
import { ElMessage } from 'element-plus'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import { orderOutboundOrder } from '@/api/order.outboundorder/orderoutboundOrder'
import { orderOutboundOrder } from '@/api/order.outboundOrder/orderoutboundOrder'
import {
outboundAvailableFields,
outboundColumns,

View File

@ -29,6 +29,16 @@
>
分配储位
</el-button>
<el-button
size="small"
type="danger"
plain
:disabled="!hasSelection"
:loading="storageAllocateLoading"
@click="openStorageCancelDialog"
>
取消分配储位
</el-button>
<el-button
size="small"
type="success"
@ -92,7 +102,12 @@
</template>
<template #column-storage_status="{ row }">
{{ translateOrderField('storage_status', row.storage_status) }}
<el-tag
:type="['fin', 'done', 'finished'].includes(row.storage_status) ? 'success' : ['padding', 'pending', 'pedding', 'processing'].includes(row.storage_status) ? 'warning' : ['error', 'failed'].includes(row.storage_status) ? 'danger' : 'info'"
size="small"
>
{{ translateOrderField('storage_status', row.storage_status) }}
</el-tag>
</template>
<template #column-print_status="{ row }">
@ -175,7 +190,7 @@
<el-dialog
v-model="storageDialogVisible"
title="按订单批量分配储位"
:title="storageDialogMode === 'cancel' ? '按订单批量取消分配储位' : '按订单批量分配储位'"
width="520px"
align-center
destroy-on-close
@ -193,14 +208,14 @@
<el-form-item label="已选订单数">
<span>{{ storagePendingOrderIds.length }} 条</span>
</el-form-item>
<el-form-item label="允许存储储位">
<el-form-item v-if="storageDialogMode !== 'cancel'" label="允许存储储位">
<el-switch v-model="storageForm.allowStorageLocation" active-text="是" inactive-text="否" />
</el-form-item>
</el-form>
<template #footer>
<el-button @click="storageDialogVisible = false">取消</el-button>
<el-button type="primary" :loading="storageAllocateLoading" @click="submitStorageAllocate">
开始分配
{{ storageDialogMode === 'cancel' ? '确认取消' : '开始分配' }}
</el-button>
</template>
</el-dialog>
@ -213,7 +228,7 @@ import { ref, reactive, onMounted, computed } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import { orderPendingOrder } from '@/api/order.pendingorder/orderpendingOrder'
import { orderPendingOrder } from '@/api/order.pendingOrder/orderpendingOrder'
import {
pendingCloums,
@ -257,6 +272,7 @@ const allocateDialogVisible = ref(false)
const allocatePendingRows = ref<any[]>([])
const storageDialogVisible = ref(false)
const storageDialogMode = ref<'allocate' | 'cancel'>('allocate')
/** 打开储位弹窗时快照的订单 ID,避免提交前勾选变化 */
const storagePendingOrderIds = ref<Array<number | string>>([])
const storageForm = reactive<{
@ -405,9 +421,9 @@ function getSelectedIds() {
.filter((id: any) => id !== undefined && id !== null)
}
function openStorageAllocateDialog() {
function openStorageDialog(mode: 'allocate' | 'cancel') {
if (!selectionRows.value.length) {
ElMessage.warning('请先勾选需要分配储位的订单')
ElMessage.warning(mode === 'cancel' ? '请先勾选需要取消分配储位的订单' : '请先勾选需要分配储位的订单')
return
}
const ids = getSelectedIds()
@ -415,12 +431,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
}
@ -428,38 +454,35 @@ function resetStorageAllocateDialog() {
async function submitStorageAllocate() {
const order_ids = [...storagePendingOrderIds.value]
if (!order_ids.length || storageAllocateLoading.value) return
try {
await ElMessageBox.confirm(
`确定对 ${order_ids.length} 条订单发起储位分配吗?`,
'确认',
{ type: 'warning' }
)
} catch {
return
}
const isCancel = storageDialogMode.value === 'cancel'
storageAllocateLoading.value = true
try {
const payload: Record<string, any> = {
order_ids,
allowStorageLocation: storageForm.allowStorageLocation
}
const res = await orderPendingOrder.allocateStorage(payload)
const payload: Record<string, any> = isCancel
? { order_ids }
: {
order_ids,
allowStorageLocation: 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
}

View File

@ -122,7 +122,7 @@ import { ref, reactive, onMounted, computed } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import { orderReviewOrder } from '@/api/order.revieworder/orderreviewOrder'
import { orderReviewOrder } from '@/api/order.reviewOrder/orderreviewOrder'
import {
reviewAvailableFields,

View File

@ -264,7 +264,7 @@ import {
printFormConfig,
addReceivingFields
} from './receiving-config'
import * as templateApi from '@/api/setting.printtemplate/printTemplate'
import * as templateApi from '@/api/setting.printTemplate/printTemplate'
import * as stationApi from '@/api/print/print'
import JsBarcode from 'jsbarcode'
import * as XLSX from 'xlsx'

View File

@ -732,7 +732,7 @@
import { ref, reactive, onMounted, computed } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { Search, Plus, Refresh, QuestionFilled } from '@element-plus/icons-vue'
import { storeWarehouseList, storeWarehouseSign, storeWarehouseUnbind, storeWarehouseRename, storeWarehouseGetPolicyConfig, storeWarehouseGetPolicyConfigFields, storeWarehouseSavePolicyConfig, saveApiConfig, storeWarehouseDeleteQimenConfig, storeWarehouseAdjustPrintQuantity, listApiConfig } from '@/api/storewarehouse.store/storeWarehouse'
import { storeWarehouseList, storeWarehouseSign, storeWarehouseUnbind, storeWarehouseRename, storeWarehouseGetPolicyConfig, storeWarehouseGetPolicyConfigFields, storeWarehouseSavePolicyConfig, saveApiConfig, storeWarehouseDeleteQimenConfig, storeWarehouseAdjustPrintQuantity, listApiConfig } from '@/api/storeWarehouse.store/storeWarehouse'
import { listInterfaceTypes } from '@/api/index/index'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'

View File

@ -271,7 +271,7 @@ import {
expressInterfaceList,
expressInterfaceListByWarehousePlatformCode,
expressInterfaceUpdate
} from '@/api/setting.expressinterface/expressInterface'
} from '@/api/setting.expressInterface/expressInterface'
import { useUserStore } from '@/stores/modules/user'
type ExpressOption = { code: string; name: string; label?: string }

View File

@ -53,7 +53,7 @@ import { ref, computed, onMounted } from 'vue'
import { ElMessage } from 'element-plus'
import { Document, Folder } from '@element-plus/icons-vue'
import TemplateEditor from './components/TemplateEditor.vue'
import * as TemplatesApi from '@/api/setting.printtemplate/printTemplate'
import * as TemplatesApi from '@/api/setting.printTemplate/printTemplate'
import { usePrintTemplateStore } from '@/stores/modules/printTemplate'
import { storeToRefs } from 'pinia'