Commit 01701ca7 by qinjianhui

Merge branch 'dev_new_order_intercept' into 'dev'

Dev new order intercept

See merge request !203
parents 3aea5144 a640f575
...@@ -57,6 +57,7 @@ declare module 'vue' { ...@@ -57,6 +57,7 @@ declare module 'vue' {
ElTimePicker: typeof import('element-plus/es')['ElTimePicker'] ElTimePicker: typeof import('element-plus/es')['ElTimePicker']
ElTooltip: typeof import('element-plus/es')['ElTooltip'] ElTooltip: typeof import('element-plus/es')['ElTooltip']
ElTree: typeof import('element-plus/es')['ElTree'] ElTree: typeof import('element-plus/es')['ElTree']
ElTreeSelect: typeof import('element-plus/es')['ElTreeSelect']
ElUpload: typeof import('element-plus/es')['ElUpload'] ElUpload: typeof import('element-plus/es')['ElUpload']
Icon: typeof import('./src/components/Icon.vue')['default'] Icon: typeof import('./src/components/Icon.vue')['default']
ImageView: typeof import('./src/components/ImageView.vue')['default'] ImageView: typeof import('./src/components/ImageView.vue')['default']
......
import axios from './axios'
import type { BasePaginationData, BaseRespData } from '@/types/api'
import type { CancelOrderProcessStateGroupMap } from '@/types/api/cancelOrderProcess'
import type { operateOrderListData } from '@/types/api/factoryOrderNew'
function normalizePodOrderQueryPayload(
data: Record<string, unknown>,
): Record<string, unknown> {
const { receiverCountry, ...rest } = data
if (!Array.isArray(receiverCountry)) {
return data
}
return {
...rest,
...(receiverCountry.length
? { receiverCountry: receiverCountry.join(',') }
: {}),
}
}
export function getCancelOrderProcessStateGroupMapApi() {
return axios.get<never, BaseRespData<CancelOrderProcessStateGroupMap>>(
'factory/podOrderOperationForReclaim/findStateGroupMap',
)
}
export function getCancelOrderProcessListApi(
data: Record<string, unknown>,
currentPage: number,
pageSize: number,
alreadyInStock: boolean,
) {
const body = normalizePodOrderQueryPayload({ ...data })
return axios.post<never, BasePaginationData<operateOrderListData>>(
'factory/podOrderOperationForReclaim/list_page',
{ ...body, currentPage, pageSize, alreadyInStock },
)
}
export function getOperationInfoByNoApi(operationNo: string) {
return axios.get<never, BaseRespData<operateOrderListData>>(
`factory/podOrderOperationForReclaim/getByOperationNo?operationNo=${operationNo}`,
)
}
export function completeDeliveryByCancelOrderProcessApi(data: {
operationNo: string
inboundType: number
warehouseId: number
}) {
return axios.post<never, BaseRespData<never>>(
'factory/podOrderOperationForReclaim/storeAfterScan',
data,
)
}
...@@ -6,12 +6,11 @@ import type { ...@@ -6,12 +6,11 @@ import type {
LogListData, LogListData,
operateOrderListData, operateOrderListData,
PickCompleteData, PickCompleteData,
PickFailData,
ProductListData, ProductListData,
RestockData, RestockData,
SearchForm, SearchForm,
StatusTreeNode, StatusTreeNode,
} from '@/types/api/factoryOrderNew/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'
import type { OrderData } from '@/types/api/podMakeOrder' import type { OrderData } from '@/types/api/podMakeOrder'
...@@ -45,6 +44,7 @@ export function getFactoryOrderNewListApi( ...@@ -45,6 +44,7 @@ export function getFactoryOrderNewListApi(
status?: string, status?: string,
subStatus?: number, subStatus?: number,
pauseReason?: number, pauseReason?: number,
cancelSubType?: number,
) { ) {
const body = normalizePodOrderQueryPayload({ ...data } as Record< const body = normalizePodOrderQueryPayload({ ...data } as Record<
string, string,
...@@ -59,6 +59,7 @@ export function getFactoryOrderNewListApi( ...@@ -59,6 +59,7 @@ export function getFactoryOrderNewListApi(
status, status,
acceptedStatus: subStatus, acceptedStatus: subStatus,
pauseReason, pauseReason,
cancelSubType,
}, },
) )
} }
...@@ -113,6 +114,14 @@ export function getFactoryOrderNewLogApi(id: number | string) { ...@@ -113,6 +114,14 @@ export function getFactoryOrderNewLogApi(id: number | string) {
}, },
) )
} }
export function getOperationOrderByIdApi(id: number | string) {
return axios.get<never, BaseRespData<operateOrderListData[]>>(
'factory/podOrderOperation/getByPodOrderId',
{
params: { podOrderId: id },
},
)
}
export function refreshProductInfoApi(data: { export function refreshProductInfoApi(data: {
orderIds?: number | string orderIds?: number | string
...@@ -258,13 +267,6 @@ export function replenishmentCompleteApi(ids: (number | string)[]) { ...@@ -258,13 +267,6 @@ export function replenishmentCompleteApi(ids: (number | string)[]) {
) )
} }
export function pickFailApi(ids: (number | string)[]) {
return axios.post<never, BaseRespData<PickFailData[]>>(
'factory/podOrderOperation/listByIds',
{ ids },
)
}
export function getCardLayoutListApi( export function getCardLayoutListApi(
data: Record<string, unknown>, data: Record<string, unknown>,
currentPage: number, currentPage: number,
...@@ -309,6 +311,23 @@ export function getSuspendStatisticsApi( ...@@ -309,6 +311,23 @@ export function getSuspendStatisticsApi(
) )
} }
/** 已取消列表子 tab 数量统计(与挂起 suspendStatistics 用法一致) */
export function getCancelledOrderStatisticsApi(
data: SearchForm,
currentPage: number,
pageSize: number,
cancelSubType?: number,
) {
const body = normalizePodOrderQueryPayload({ ...data } as Record<
string,
unknown
>)
return axios.post<never, BaseRespData<Record<string, number>>>(
'factory/podOrder/cancelledStatistics',
{ ...body, currentPage, pageSize, cancelSubType },
)
}
export function getSuspendDetailApi(id: number | string) { export function getSuspendDetailApi(id: number | string) {
return axios.get<never, BaseRespData<ProductListData[]>>( return axios.get<never, BaseRespData<ProductListData[]>>(
'factory/podOrderPauseControl/get', 'factory/podOrderPauseControl/get',
...@@ -611,3 +630,19 @@ export function exportFactoryOrderInfo(data: ExportParams) { ...@@ -611,3 +630,19 @@ export function exportFactoryOrderInfo(data: ExportParams) {
data, data,
) )
} }
export function interceptUpdateApi(ids: (string | number)[]) {
return axios.post<never, BaseRespData<ResultInfoDataItem[]>>(
'factory/podOrder/factoryOrderUnblock',
ids,
)
}
export function interceptSuccessApi(
data: { factoryOrderNumber: string; suspendSussessType: number }[],
) {
return axios.post<never, BaseRespData<ResultInfoDataItem[]>>(
'factory/podOrder/factoryOrderBlockSuccess',
data,
)
}
...@@ -107,6 +107,14 @@ const router = createRouter({ ...@@ -107,6 +107,14 @@ const router = createRouter({
import('@/views/order/factoryOrderNew/index.vue'), import('@/views/order/factoryOrderNew/index.vue'),
}, },
{ {
path:'/order/cancel-order-process',
meta: {
title: '取消后订单处理',
},
component: () =>
import('@/views/order/cancelOrderProcess/index.vue'),
},
{
path: '/pod-cn-order/orderTracking', path: '/pod-cn-order/orderTracking',
meta: { meta: {
title: 'POD(CN)订单跟踪', title: 'POD(CN)订单跟踪',
......
...@@ -151,6 +151,11 @@ const menu: MenuItem[] = [ ...@@ -151,6 +151,11 @@ const menu: MenuItem[] = [
id: 12, id: 12,
label: '工厂订单(NEW)', label: '工厂订单(NEW)',
}, },
// {
// index: '/order/cancel-order-process',
// id: 13,
// label: '取消后订单处理',
// },
], ],
}, },
{ {
......
export interface CancelOrderProcessStateGroupMap {
alreadyInStock: number
NotInStock: number
}
import type { PaginationData } from '@/types/api'
export interface StatusTreeNode { export interface StatusTreeNode {
status: string status: string
statusName: string statusName: string
...@@ -271,3 +272,9 @@ export interface PickFailData { ...@@ -271,3 +272,9 @@ export interface PickFailData {
afterOutOccupied?: number afterOutOccupied?: number
afterOutAvailable?: number afterOutAvailable?: number
} }
export type CardLayoutListFetcher = (
payload: Record<string, unknown>,
currentPage: number,
pageSize: number,
) => Promise<PaginationData<operateOrderListData>>
...@@ -85,7 +85,7 @@ import { ...@@ -85,7 +85,7 @@ import {
} from '@/api/logistics' } from '@/api/logistics'
import { createLogisticsOrdersApi } from '@/api/podCnOrder' import { createLogisticsOrdersApi } from '@/api/podCnOrder'
import { FactoryOrderNewListData } from '@/types/api/factoryOrderNew/factoryOrderNew' import { FactoryOrderNewListData } from '@/types/api/factoryOrderNew'
const createLogisticDialogVisible = ref(false) const createLogisticDialogVisible = ref(false)
const props = defineProps<{ const props = defineProps<{
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { updateCustomDeclarationInfoApi } from '@/api/podCnOrder' import { updateCustomDeclarationInfoApi } from '@/api/podCnOrder'
import { FactoryOrderNewListData } from '@/types/api/factoryOrderNew/factoryOrderNew' import { FactoryOrderNewListData } from '@/types/api/factoryOrderNew'
import { import {
CustomDeclarationInfoForm, CustomDeclarationInfoForm,
PodCnOrderListData, PodCnOrderListData,
......
...@@ -196,7 +196,7 @@ import { ...@@ -196,7 +196,7 @@ import {
printPickPdfByBatchNumberApi, printPickPdfByBatchNumberApi,
printProductionPdfByBatchNumberApi, printProductionPdfByBatchNumberApi,
} from '@/api/factoryOrderNew' } from '@/api/factoryOrderNew'
import type { BatchManageData } from '@/types/api/factoryOrderNew/factoryOrderNew' import type { BatchManageData } from '@/types/api/factoryOrderNew'
import type { PaginationData } from '@/types/api' import type { PaginationData } from '@/types/api'
import TableView from '@/components/TableView.vue' import TableView from '@/components/TableView.vue'
import ArrangeDialog from './ArrangeDialog.vue' import ArrangeDialog from './ArrangeDialog.vue'
......
...@@ -293,19 +293,32 @@ import { ...@@ -293,19 +293,32 @@ import {
getFactoryOrderNewLogApi, getFactoryOrderNewLogApi,
} from '@/api/factoryOrderNew' } from '@/api/factoryOrderNew'
import type { PaginationData } from '@/types/api' import type { PaginationData } from '@/types/api'
import type { CardLayoutListFetcher } from '@/types/api/factoryOrderNew'
import usePageList from '@/utils/hooks/usePageList' import usePageList from '@/utils/hooks/usePageList'
import { operateOrderListData } from '@/types/api/factoryOrderNew/factoryOrderNew' import { operateOrderListData } from '@/types/api/factoryOrderNew'
import type { LogListData } from '@/types/api/order' import type { LogListData } from '@/types/api/order'
import LogList from '@/components/LogList.vue' import LogList from '@/components/LogList.vue'
import RightClickMenu from '@/components/RightClickMenu.vue' import RightClickMenu from '@/components/RightClickMenu.vue'
import platformJson from '../../../../json/platform.json' import platformJson from '../../../../json/platform.json'
const props = defineProps<{ const props = defineProps<{
status: string status?: string
queryPayload: Record<string, unknown> queryPayload?: Record<string, unknown>
initPageSize?: number initPageSize?: number
fetchList?: CardLayoutListFetcher
}>() }>()
const buildListPayload = () => {
const payload = { ...props.queryPayload }
if (props.fetchList || props.status === undefined) {
return payload
}
return {
...payload,
status: props.status === 'ALL' ? undefined : props.status,
}
}
const emit = defineEmits<{ const emit = defineEmits<{
'selection-change': [items: operateOrderListData[]] 'selection-change': [items: operateOrderListData[]]
'view-detail': [item: operateOrderListData] 'view-detail': [item: operateOrderListData]
...@@ -324,9 +337,9 @@ const { ...@@ -324,9 +337,9 @@ const {
initPageSize: props.initPageSize || 100, initPageSize: props.initPageSize || 100,
initLoad: false, initLoad: false,
query: async (current, size) => { query: async (current, size) => {
const payload = { const payload = buildListPayload()
...props.queryPayload, if (props.fetchList) {
status: props.status === 'ALL' ? undefined : props.status, return props.fetchList(payload, current, size)
} }
const res = await getCardLayoutListApi(payload, current, size) const res = await getCardLayoutListApi(payload, current, size)
return res.data as unknown as PaginationData<operateOrderListData> return res.data as unknown as PaginationData<operateOrderListData>
...@@ -411,13 +424,20 @@ const rightChange = (code: string) => { ...@@ -411,13 +424,20 @@ const rightChange = (code: string) => {
const openLogDialog = async (item: operateOrderListData) => { const openLogDialog = async (item: operateOrderListData) => {
if (!item.podOrderId) return if (!item.podOrderId) return
const loading = ElLoading.service({
fullscreen: true,
text: '加载中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try { try {
const res = await getFactoryOrderNewLogApi(item.podOrderId as number) const res = await getFactoryOrderNewLogApi(item.podOrderId as number)
logList.value = (res.data || []) as unknown as LogListData[] logList.value = (res.data || []) as unknown as LogListData[]
logVisible.value = true logVisible.value = true
} catch (e) { } catch (e) {
// ignore // ignore
} } finally {
loading.close()
}
} }
const clearSelection = () => { const clearSelection = () => {
......
...@@ -257,7 +257,7 @@ import platformJson from '../../../../json/platform.json' ...@@ -257,7 +257,7 @@ import platformJson from '../../../../json/platform.json'
import type { import type {
operateOrderListData, operateOrderListData,
PickCompleteData, PickCompleteData,
} from '@/types/api/factoryOrderNew/factoryOrderNew' } from '@/types/api/factoryOrderNew'
const emit = defineEmits(['adjustPickOrderSuccess']) const emit = defineEmits(['adjustPickOrderSuccess'])
const props = defineProps<{ const props = defineProps<{
......
...@@ -123,7 +123,7 @@ import { ...@@ -123,7 +123,7 @@ import {
replenishmentCompleteApi, replenishmentCompleteApi,
markStockOutOfApi, markStockOutOfApi,
} from '@/api/factoryOrderNew' } from '@/api/factoryOrderNew'
import type { PickCompleteData } from '@/types/api/factoryOrderNew/factoryOrderNew' import type { PickCompleteData } from '@/types/api/factoryOrderNew'
import type { BaseRespData } from '@/types/api' import type { BaseRespData } from '@/types/api'
import type { import type {
InterProductList, InterProductList,
......
...@@ -71,7 +71,7 @@ import { ref } from 'vue' ...@@ -71,7 +71,7 @@ import { ref } from 'vue'
import { ElMessage, ElMessageBox, ElLoading } from 'element-plus' import { ElMessage, ElMessageBox, ElLoading } from 'element-plus'
import BigNumber from 'bignumber.js' import BigNumber from 'bignumber.js'
import { pickCompleteByIdsDataApi } from '@/api/factoryOrderNew' import { pickCompleteByIdsDataApi } from '@/api/factoryOrderNew'
import type { PickCompleteData } from '@/types/api/factoryOrderNew/factoryOrderNew' import type { PickCompleteData } from '@/types/api/factoryOrderNew'
import TableView from '@/components/TableView.vue' import TableView from '@/components/TableView.vue'
import _ from 'lodash' import _ from 'lodash'
import CreateOutboundDialog from './CreateOutboundDialog.vue' import CreateOutboundDialog from './CreateOutboundDialog.vue'
......
...@@ -63,7 +63,7 @@ const formRef = ref<FormInstance>() ...@@ -63,7 +63,7 @@ const formRef = ref<FormInstance>()
const orderIds = ref<(number | string)[]>([]) const orderIds = ref<(number | string)[]>([])
const suspendReasons = [ const suspendReasons = [
{ label: '客户拦截', value: 1 }, // { label: '客户拦截', value: 1 },
{ label: '地址异常', value: 2 }, { label: '地址异常', value: 2 },
{ label: '素材异常', value: 3 }, { label: '素材异常', value: 3 },
{ label: '其他', value: 4 }, { label: '其他', value: 4 },
......
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
import { reactive } from 'vue' import { reactive } from 'vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { getRestockListApi, restockCheckApi } from '@/api/factoryOrderNew' import { getRestockListApi, restockCheckApi } from '@/api/factoryOrderNew'
import type { RestockData } from '@/types/api/factoryOrderNew/factoryOrderNew' import type { RestockData } from '@/types/api/factoryOrderNew'
import TableView from '@/components/TableView.vue' import TableView from '@/components/TableView.vue'
import usePageList from '@/utils/hooks/usePageList' import usePageList from '@/utils/hooks/usePageList'
......
...@@ -50,8 +50,11 @@ export function useOrderBatchActions(options: UseOrderBatchActionsOptions) { ...@@ -50,8 +50,11 @@ export function useOrderBatchActions(options: UseOrderBatchActionsOptions) {
const res = await action.api(ids) const res = await action.api(ids)
if (res.code !== 200) return if (res.code !== 200) return
if (action.successText) ElMessage.success(action.successText) if (action.successText) ElMessage.success(action.successText)
if (action.onSuccess) await action.onSuccess(res) if (action.onSuccess) {
await refreshCurrentView({ isRefreshTree: !!action.refreshTree }) await action.onSuccess(res)
} else {
await refreshCurrentView({ isRefreshTree: !!action.refreshTree })
}
if (action.onAfter) await action.onAfter() if (action.onAfter) await action.onAfter()
} catch (e) { } catch (e) {
console.error(e) console.error(e)
......
...@@ -141,8 +141,6 @@ export function useOrderDictionaries() { ...@@ -141,8 +141,6 @@ export function useOrderDictionaries() {
getUserMark(), getUserMark(),
getCustomTagList(), getCustomTagList(),
getLogisticsCompanyAllCodelist(), getLogisticsCompanyAllCodelist(),
getReceiverCountryList(),
loadWarehouseList(),
]) ])
} }
......
...@@ -5,8 +5,9 @@ import { ...@@ -5,8 +5,9 @@ import {
getFactoryOrderNewDetailApi, getFactoryOrderNewDetailApi,
getFactoryOrderNewListApi, getFactoryOrderNewListApi,
getFactoryOrderNewLogApi, getFactoryOrderNewLogApi,
getOperationOrderByIdApi,
} from '@/api/factoryOrderNew' } from '@/api/factoryOrderNew'
import type { SearchForm } from '@/types/api/factoryOrderNew/factoryOrderNew' import type { SearchForm } from '@/types/api/factoryOrderNew'
import type { import type {
FactoryOrderNewListData, FactoryOrderNewListData,
LogListData, LogListData,
...@@ -23,6 +24,7 @@ interface UseOrderListAndDetailOptions { ...@@ -23,6 +24,7 @@ interface UseOrderListAndDetailOptions {
getQueryPayload: () => Record<string, unknown> getQueryPayload: () => Record<string, unknown>
getListPageAcceptedSubStatus: () => number | undefined getListPageAcceptedSubStatus: () => number | undefined
suspendedSubTab: Ref<number> suspendedSubTab: Ref<number>
cancelledSubTab: Ref<number>
} }
export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) { export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) {
...@@ -34,11 +36,13 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) { ...@@ -34,11 +36,13 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) {
getQueryPayload, getQueryPayload,
getListPageAcceptedSubStatus, getListPageAcceptedSubStatus,
suspendedSubTab, suspendedSubTab,
cancelledSubTab,
} = options } = options
const subLoading = ref(false) const subLoading = ref(false)
const activeTab = ref<'product' | 'log'>('product') const activeTab = ref<'product' | 'operation' | 'log'>('product')
const productList = ref<ProductListData[]>([]) const productList = ref<ProductListData[]>([])
const operationOrderList = ref<operateOrderListData[]>([])
const logList = ref<LogListData[]>([]) const logList = ref<LogListData[]>([])
const tableRef = ref() const tableRef = ref()
const currentRow = ref<FactoryOrderNewListData | null>(null) const currentRow = ref<FactoryOrderNewListData | null>(null)
...@@ -73,6 +77,7 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) { ...@@ -73,6 +77,7 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) {
} = usePageList<FactoryOrderNewListData>({ } = usePageList<FactoryOrderNewListData>({
query: (page, size) => { query: (page, size) => {
const isSuspendTree = treeStatus.value === 'SUSPEND' const isSuspendTree = treeStatus.value === 'SUSPEND'
const isCancelled = status.value === 'CANCELLED'
return getFactoryOrderNewListApi( return getFactoryOrderNewListApi(
buildListQueryBody(), buildListQueryBody(),
page, page,
...@@ -80,6 +85,7 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) { ...@@ -80,6 +85,7 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) {
status.value === 'ALL' ? undefined : status.value, status.value === 'ALL' ? undefined : status.value,
getListPageAcceptedSubStatus(), getListPageAcceptedSubStatus(),
isSuspendTree ? suspendedSubTab.value : undefined, isSuspendTree ? suspendedSubTab.value : undefined,
isCancelled ? cancelledSubTab.value : undefined,
).then(async (res) => { ).then(async (res) => {
const records = res.data.records || [] const records = res.data.records || []
await nextTick(() => { await nextTick(() => {
...@@ -101,6 +107,7 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) { ...@@ -101,6 +107,7 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) {
selectedRows.value = [] selectedRows.value = []
cardSelectList.value = [] cardSelectList.value = []
productList.value = [] productList.value = []
operationOrderList.value = []
logList.value = [] logList.value = []
currentRow.value = null currentRow.value = null
listSortProp.value = null listSortProp.value = null
...@@ -160,9 +167,12 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) { ...@@ -160,9 +167,12 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) {
cardSelectList.value = items cardSelectList.value = items
} }
const getOrderDetailsById = async (tabName?: 'product' | 'log') => { const getOrderDetailsById = async (
tabName?: 'product' | 'operation' | 'log',
) => {
if (!currentRow.value) { if (!currentRow.value) {
productList.value = [] productList.value = []
operationOrderList.value = []
logList.value = [] logList.value = []
return return
} }
...@@ -181,6 +191,11 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) { ...@@ -181,6 +191,11 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) {
productList.value = Array.isArray(productRes.data) productList.value = Array.isArray(productRes.data)
? productRes.data ? productRes.data
: [] : []
} else if (effectiveTab === 'operation') {
operationOrderList.value = []
const opRes = await getOperationOrderByIdApi(id)
if (opRes.code !== 200) return
operationOrderList.value = opRes.data
} else { } else {
logList.value = [] logList.value = []
// const logRes = isSuspend // const logRes = isSuspend
...@@ -200,6 +215,7 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) { ...@@ -200,6 +215,7 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) {
watch(currentRow, (row) => { watch(currentRow, (row) => {
if (!row) { if (!row) {
productList.value = [] productList.value = []
operationOrderList.value = []
logList.value = [] logList.value = []
return return
} }
...@@ -217,7 +233,7 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) { ...@@ -217,7 +233,7 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) {
const handleTabClick = (tab: TabsPaneContext) => { const handleTabClick = (tab: TabsPaneContext) => {
if (!currentRow.value) return if (!currentRow.value) return
const name = tab?.props?.name as 'product' | 'log' | undefined const name = tab?.props?.name as 'product' | 'operation' | 'log' | undefined
void getOrderDetailsById(name) void getOrderDetailsById(name)
} }
...@@ -225,6 +241,7 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) { ...@@ -225,6 +241,7 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) {
subLoading, subLoading,
activeTab, activeTab,
productList, productList,
operationOrderList,
logList, logList,
tableRef, tableRef,
currentRow, currentRow,
......
import { computed, ref, nextTick } from 'vue' import { computed, ref, nextTick } from 'vue'
import { import {
getCancelledOrderStatisticsApi,
getPodOrderAcceptedStatisticsApi, getPodOrderAcceptedStatisticsApi,
getPodOrderStateGroupListApi, getPodOrderStateGroupListApi,
getSuspendStatisticsApi, getSuspendStatisticsApi,
} from '@/api/factoryOrderNew' } from '@/api/factoryOrderNew'
import type { StatusTreeNode } from '@/types/api/order/factoryOrderNew' import type { StatusTreeNode } from '@/types/api/order/factoryOrderNew'
import type { SearchForm } from '@/types/api/factoryOrderNew'
interface UseOrderStatusTreeOptions { interface UseOrderStatusTreeOptions {
getQueryPayload: () => Record<string, unknown> getQueryPayload: () => Record<string, unknown>
currentPage: { value: number } currentPage: { value: number }
pageSize: { value: number } pageSize: { value: number }
onClearTableState: () => void
onRefreshCurrentView: () => void
} }
export function useOrderStatusTree(options: UseOrderStatusTreeOptions) { export function useOrderStatusTree(options: UseOrderStatusTreeOptions) {
...@@ -19,8 +19,6 @@ export function useOrderStatusTree(options: UseOrderStatusTreeOptions) { ...@@ -19,8 +19,6 @@ export function useOrderStatusTree(options: UseOrderStatusTreeOptions) {
getQueryPayload, getQueryPayload,
currentPage, currentPage,
pageSize, pageSize,
onClearTableState,
onRefreshCurrentView,
} = options } = options
const cardLayoutStatuses = [ const cardLayoutStatuses = [
...@@ -46,12 +44,19 @@ export function useOrderStatusTree(options: UseOrderStatusTreeOptions) { ...@@ -46,12 +44,19 @@ export function useOrderStatusTree(options: UseOrderStatusTreeOptions) {
acceptedOutOfStockCount: 0, acceptedOutOfStockCount: 0,
}) })
const suspendedTabs = ref([ const suspendedTabs = ref([
{ label: '客户拦截', key: 'customerInterceptCount', value: 1, count: 0 }, { label: '客户拦截-取消订单', key: 'customerInterceptCount', value: 1, count: 0 },
{ label: '地址异常', key: 'addressExceptionCount', value: 2, count: 0 }, { label: '地址异常', key: 'addressExceptionCount', value: 2, count: 0 },
{ label: '素材异常', key: 'materialExceptionCount', value: 3, count: 0 }, { label: '素材异常', key: 'materialExceptionCount', value: 3, count: 0 },
{ label: '其他', key: 'otherReasonCount', value: 4, count: 0 }, { label: '其他', key: 'otherReasonCount', value: 4, count: 0 },
]) ])
const suspendedSubTab = ref(1) const suspendedSubTab = ref(1)
/** 已取消:子 tab 与 list_page 的 cancelSubType 取值 1/2/3 对应 */
const cancelledTabs = ref([
{ label: '客户拦截', key: 'customerInterceptCount', value: 1, count: 0 },
{ label: '协商取消', key: 'mutualAgreeCancelCount', value: 2, count: 0 },
{ label: '其他', key: 'otherReasonCount', value: 3, count: 0 },
])
const cancelledSubTab = ref(1)
const treeRef = ref() const treeRef = ref()
const isCardLayout = computed(() => cardLayoutStatuses.includes(status.value)) const isCardLayout = computed(() => cardLayoutStatuses.includes(status.value))
...@@ -107,6 +112,25 @@ export function useOrderStatusTree(options: UseOrderStatusTreeOptions) { ...@@ -107,6 +112,25 @@ export function useOrderStatusTree(options: UseOrderStatusTreeOptions) {
} }
} }
const getCancelledCounts = async () => {
try {
const res = await getCancelledOrderStatisticsApi(
getQueryPayload() as SearchForm,
currentPage.value,
pageSize.value,
cancelledSubTab.value,
)
if (res.code !== 200 || !res.data) return
const data = res.data || {}
cancelledTabs.value = cancelledTabs.value.map((tab) => ({
...tab,
count: data[String(tab.key)] ?? 0,
}))
} catch (e) {
console.error(e)
}
}
const loadStatusTreeCounts = async () => { const loadStatusTreeCounts = async () => {
try { try {
const res = await getPodOrderStateGroupListApi() const res = await getPodOrderStateGroupListApi()
...@@ -121,22 +145,6 @@ export function useOrderStatusTree(options: UseOrderStatusTreeOptions) { ...@@ -121,22 +145,6 @@ export function useOrderStatusTree(options: UseOrderStatusTreeOptions) {
} }
} }
const handleStatusNodeClick = (node: StatusTreeNode) => {
status.value = node.status
if (node.status !== 'PENDING_RECEIVE') {
pendingAcceptSubTab.value = 'PENDING_RECEIVE'
}
if (node.status !== 'SUSPEND') {
suspendedSubTab.value = 1
}
onClearTableState()
if (!isSpecialLayout.value) {
onRefreshCurrentView()
}
if (node.status === 'SUSPEND') {
void getSuspendCounts()
}
}
const handlePendingAcceptTabClick = ( const handlePendingAcceptTabClick = (
tab: 'PENDING_RECEIVE' | 'ACCEPT_FAIL_OUT_OF_STOCK', tab: 'PENDING_RECEIVE' | 'ACCEPT_FAIL_OUT_OF_STOCK',
...@@ -160,6 +168,8 @@ export function useOrderStatusTree(options: UseOrderStatusTreeOptions) { ...@@ -160,6 +168,8 @@ export function useOrderStatusTree(options: UseOrderStatusTreeOptions) {
pendingAcceptCounts, pendingAcceptCounts,
suspendedTabs, suspendedTabs,
suspendedSubTab, suspendedSubTab,
cancelledTabs,
cancelledSubTab,
treeRef, treeRef,
isCardLayout, isCardLayout,
isSpecialLayout, isSpecialLayout,
...@@ -167,9 +177,9 @@ export function useOrderStatusTree(options: UseOrderStatusTreeOptions) { ...@@ -167,9 +177,9 @@ export function useOrderStatusTree(options: UseOrderStatusTreeOptions) {
getListPageAcceptedSubStatus, getListPageAcceptedSubStatus,
getPendingReceiveCounts, getPendingReceiveCounts,
getSuspendCounts, getSuspendCounts,
getCancelledCounts,
loadStatusTreeCounts, loadStatusTreeCounts,
handleStatusNodeClick,
handlePendingAcceptTabClick, handlePendingAcceptTabClick,
toggleExpand, toggleExpand
} }
} }
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