Commit 4118f798 by wuqian

feat:工厂订单筛选操作单状态、订单列表展示延期时间#ID1011328

parent 54195e1d
...@@ -11,6 +11,7 @@ import type { ...@@ -11,6 +11,7 @@ import type {
RestockData, RestockData,
SearchForm, SearchForm,
StatusTreeNode, StatusTreeNode,
StatusListNode,
} from '@/types/api/factoryOrderNew' } from '@/types/api/factoryOrderNew'
import { ResultInfoDataItem } from '@/types/api/order/common' import { ResultInfoDataItem } from '@/types/api/order/common'
import { ExportParams } from '@/types/api/order/factoryOrderNew' import { ExportParams } from '@/types/api/order/factoryOrderNew'
...@@ -37,6 +38,11 @@ export function getPodOrderStateGroupListApi() { ...@@ -37,6 +38,11 @@ export function getPodOrderStateGroupListApi() {
'factory/podOrder/findStateGroupList', 'factory/podOrder/findStateGroupList',
) )
} }
export function getStatusPushApi() {
return axios.get<never, BaseRespData<StatusListNode[]>>(
'factory/podOrderOperation/get-operation-order-status',
)
}
export function getFactoryOrderNewListApi( export function getFactoryOrderNewListApi(
data: SearchForm, data: SearchForm,
......
...@@ -5,7 +5,10 @@ export interface StatusTreeNode { ...@@ -5,7 +5,10 @@ export interface StatusTreeNode {
quantity: number quantity: number
children: StatusTreeNode[] | null children: StatusTreeNode[] | null
} }
export interface StatusListNode {
status: string
statusName: string
}
export interface SearchForm { export interface SearchForm {
status?: string status?: string
pauseReason?: number pauseReason?: number
......
...@@ -7,6 +7,7 @@ export interface StatusTreeNode { ...@@ -7,6 +7,7 @@ export interface StatusTreeNode {
export interface SearchForm { export interface SearchForm {
status?: string status?: string
operationStatus?: string | string[]
pauseReason?: number pauseReason?: number
platform?: string platform?: string
craftCode?: string | string[] craftCode?: string | string[]
...@@ -103,6 +104,7 @@ export interface FactoryOrderNewListData { ...@@ -103,6 +104,7 @@ export interface FactoryOrderNewListData {
totalCustomsValue?: number totalCustomsValue?: number
pauseStatus?: number pauseStatus?: number
statusName?: string statusName?: string
finishTime?:string
thirdOrderNumber?: string thirdOrderNumber?: string
customTagList?: { id: string; name: string }[] customTagList?: { id: string; name: string }[]
} }
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
class="search-form" class="search-form"
:model="searchForm" :model="searchForm"
:inline="true" :inline="true"
label-width="70px" label-width="110px"
> >
<ElFormItem v-if="status === 'ALL'" label="订单状态"> <ElFormItem v-if="status === 'ALL'" label="订单状态">
<ElTreeSelect <ElTreeSelect
...@@ -178,7 +178,24 @@ ...@@ -178,7 +178,24 @@
width="140px" width="140px"
/> />
</ElFormItem> </ElFormItem>
<ElFormItem v-if="status === 'PICKING'" label="操作单状态">
<ElSelect
v-model="searchFormOperationStatusSelect"
placeholder="请选择"
clearable
multiple
collapse-tags
filterable
style="width: 170px"
>
<ElOption
v-for="(item, index) in statusList"
:key="index"
:value="item.status"
:label="item.statusName"
></ElOption>
</ElSelect>
</ElFormItem>
<ElFormItem label="数量"> <ElFormItem label="数量">
<el-radio-group v-model="searchForm.multi"> <el-radio-group v-model="searchForm.multi">
<el-radio-button :value="false" @click="toggleMulti(false)" <el-radio-button :value="false" @click="toggleMulti(false)"
...@@ -1241,6 +1258,7 @@ ...@@ -1241,6 +1258,7 @@
</template> </template>
<script setup lang="tsx"> <script setup lang="tsx">
import dayjs from 'dayjs'
import { import {
ArrowDown, ArrowDown,
ArrowUp, ArrowUp,
...@@ -1298,6 +1316,7 @@ import { ...@@ -1298,6 +1316,7 @@ import {
interceptUpdateApi, interceptUpdateApi,
interceptSuccessApi, interceptSuccessApi,
deliveryCompleteApi, deliveryCompleteApi,
getStatusPushApi,
} from '@/api/factoryOrderNew' } from '@/api/factoryOrderNew'
import { getConfigApi } from '@/api/order' import { getConfigApi } from '@/api/order'
import { getLogisticsWayApi } from '@/api/podUsOrder' import { getLogisticsWayApi } from '@/api/podUsOrder'
...@@ -1329,6 +1348,7 @@ import ChangeWayDialog from '@/views/order/podCN/components/ChangeWayDialog.vue' ...@@ -1329,6 +1348,7 @@ import ChangeWayDialog from '@/views/order/podCN/components/ChangeWayDialog.vue'
import { ResultInfoDataItem } from '@/types/api/order/common' import { ResultInfoDataItem } from '@/types/api/order/common'
import type { FactoryOrderSearchQueryVisibilityContext } from '@/types/api/factoryOrderNew/searchQueryVisibility' import type { FactoryOrderSearchQueryVisibilityContext } from '@/types/api/factoryOrderNew/searchQueryVisibility'
import type { StatusTreeNode } from '@/types/api/order/factoryOrderNew' import type { StatusTreeNode } from '@/types/api/order/factoryOrderNew'
import type { StatusListNode } from '@/types/api/factoryOrderNew'
import { useOrderDictionaries } from './hooks/useOrderDictionaries' import { useOrderDictionaries } from './hooks/useOrderDictionaries'
import { useOrderSearchForm } from './hooks/useOrderSearchForm' import { useOrderSearchForm } from './hooks/useOrderSearchForm'
import { useOrderStatusTree } from './hooks/useOrderStatusTree' import { useOrderStatusTree } from './hooks/useOrderStatusTree'
...@@ -1456,7 +1476,17 @@ const searchFormStatusSelect = computed({ ...@@ -1456,7 +1476,17 @@ const searchFormStatusSelect = computed({
searchForm.value.status = arr.length ? arr.join(',') : undefined searchForm.value.status = arr.length ? arr.join(',') : undefined
}, },
}) })
const searchFormOperationStatusSelect = computed({
get() {
const val = searchForm.value.operationStatus
if (!val) return []
return String(val).split(',').filter(Boolean)
},
set(val: string | string[] | undefined) {
const arr = Array.isArray(val) ? val : val ? [val] : []
searchForm.value.operationStatus = arr.length ? arr.join(',') : undefined
},
})
getFactoryOrderSearchVisibilityContext = () => ({ getFactoryOrderSearchVisibilityContext = () => ({
status: searchForm.value.status ?? status.value, status: searchForm.value.status ?? status.value,
isCardLayout: isCardLayout.value, isCardLayout: isCardLayout.value,
...@@ -1699,11 +1729,28 @@ const handleStatusNodeClick = (node: { status: string }) => { ...@@ -1699,11 +1729,28 @@ const handleStatusNodeClick = (node: { status: string }) => {
if (node.status !== 'CANCELLED') { if (node.status !== 'CANCELLED') {
cancelledSubTab.value = 1 cancelledSubTab.value = 1
} }
if (node.status === 'PICKING') {
getOrderStatus()
}
clearTableState() clearTableState()
if (!isSpecialLayout.value) { if (!isSpecialLayout.value) {
refreshCurrentView() refreshCurrentView()
} }
} }
const statusList = ref<StatusListNode[]>([])
const getOrderStatus = async () => {
try {
const res = await getStatusPushApi()
if (res.code === 200) {
statusList.value = res.data
} else {
ElMessage.error(res.message)
}
} catch (error) {
console.error(error)
ElMessage.error('订单状态刷新失败')
}
}
const handlePendingAcceptTabClick = ( const handlePendingAcceptTabClick = (
tab: 'PENDING_RECEIVE' | 'ACCEPT_FAIL_OUT_OF_STOCK', tab: 'PENDING_RECEIVE' | 'ACCEPT_FAIL_OUT_OF_STOCK',
) => handlePendingAcceptTabClickRaw(tab, refreshTableList) ) => handlePendingAcceptTabClickRaw(tab, refreshTableList)
...@@ -1896,6 +1943,28 @@ const mainColumns = computed(() => [ ...@@ -1896,6 +1943,28 @@ const mainColumns = computed(() => [
width: 140, width: 140,
align: 'center', align: 'center',
}, },
// 订单状态为已取消时隐藏延期时间列
...(status.value === 'CANCELLED'
? []
: [
{
prop: 'createTime',
label: '延期时间',
width: 140,
align: 'center',
render: (row: FactoryOrderNewListData) => {
const delayText = getOrderDelayText(
row.createTime ?? '',
row.finishTime ?? '',
)
return (
<div style={{ color: 'red', fontWeight: 'bolder' }}>
{delayText}
</div>
)
},
},
]),
{ {
prop: 'logisticsWayName', prop: 'logisticsWayName',
label: '物流类型', label: '物流类型',
...@@ -2588,6 +2657,35 @@ const handleUpdateCustomsInfo = async () => { ...@@ -2588,6 +2657,35 @@ const handleUpdateCustomsInfo = async () => {
await nextTick() await nextTick()
updateCustomsDialogRef.value?.resetForm() updateCustomsDialogRef.value?.resetForm()
} }
// 值为空:待接单
const PENDING_RECEIVE_STATUSES = ['PENDING_RECEIVE']
// 终态订单:已完成/已归档
const TERMINAL_ORDER_STATUSES = ['COMPLETED', 'ARCHIVE']
const getOrderDelayText = (
createTime?: string | null,
finishTime?: string | null,
) => {
if (!createTime) return ''
if (TERMINAL_ORDER_STATUSES.includes(status.value) && !finishTime) return ''
const createAt = dayjs(createTime)
if (!createAt.isValid()) return ''
// 终态订单用 finishTime - createTime 的差值
// 其他状态用 当前时间 - createTime 的差值
const endTime =
TERMINAL_ORDER_STATUSES.includes(status.value) && finishTime
? dayjs(finishTime)
: dayjs()
const diffMinutes = Math.max(0, endTime.diff(createAt, 'minute'))
const baseHours = Math.floor(diffMinutes / 60)
const remainMinutes = diffMinutes % 60
const hours = baseHours + (remainMinutes > 30 ? 1 : 0)
// 待接单状态不显示时间,其余显示小时数
const result = !PENDING_RECEIVE_STATUSES.includes(status?.value)
? `${hours}h`
: ''
return result
}
const handleTransferToArrange = async () => { const handleTransferToArrange = async () => {
if (!ensureSelection('请选择订单')) return if (!ensureSelection('请选择订单')) return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment