Commit 1991c11a by wusiyi

feat: 工厂订单发货前支持更换地址,重新创建物流订单 #1004198

parent a89226e3
...@@ -15,6 +15,7 @@ import type { ...@@ -15,6 +15,7 @@ import type {
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'
import type { LogisticsData } from '@/types/api/podCnOrder'
import type { PrintData } from '@/types/api/podOrder' import type { PrintData } from '@/types/api/podOrder'
function normalizePodOrderQueryPayload( function normalizePodOrderQueryPayload(
data: Record<string, unknown>, data: Record<string, unknown>,
...@@ -467,6 +468,26 @@ export function syncReceiverAddress(data: number[]) { ...@@ -467,6 +468,26 @@ export function syncReceiverAddress(data: number[]) {
) )
} }
export function getLogisticsCalculation(id: number) {
return axios.get<never, BaseRespData<never>>(
'factory/podOrder/getLogisticsCalculation',
{ params: { id } },
)
}
export function changeLogisticsApi(params: {
updateByIdParam: {
id: string | number
dataVersion: number
}
logisticsTrialCalculation: LogisticsData
}) {
return axios.post<never, BaseRespData<never>>(
'factory/podOrder/changeLogistics',
params,
)
}
export function updateReceiverAddressApi(data: object) { export function updateReceiverAddressApi(data: object) {
return axios.post<never, BaseRespData<never>>( return axios.post<never, BaseRespData<never>>(
'factory/podOrder/updateReceiverAddress', 'factory/podOrder/updateReceiverAddress',
......
...@@ -90,6 +90,8 @@ export interface FactoryOrderNewListData { ...@@ -90,6 +90,8 @@ export interface FactoryOrderNewListData {
source?: string source?: string
logisticsCompanyName?: string logisticsCompanyName?: string
logisticsCompanyCode?: string logisticsCompanyCode?: string
logisticsWayId?: number | string
logisticsWayName?: string
selfOwned?: boolean selfOwned?: boolean
createTime?: string createTime?: string
updateTime?: string updateTime?: string
......
...@@ -725,14 +725,35 @@ ...@@ -725,14 +725,35 @@
修改地址 修改地址
</ElButton> </ElButton>
<ElButton <ElButton
v-if="status === 'PENDING_CREATE_LOGISTICS'" v-if="showChangeLogistics(row)"
type="primary" type="warning"
link
size="small"
@click.stop="handleChangeLogistics(row)"
>
更换物流
</ElButton>
<ElButton
v-if="
[
'PENDING_RECEIVE',
'PENDING_CREATE_LOGISTICS',
'PENDING_SCHEDULE',
'PICKING',
'PENDING_DELIVERY',
'SUSPEND',
].includes(status)
"
type="success"
link link
size="small" size="small"
@click.stop="handleRefreshReceiverAddress(row)" @click.stop="handleRefreshReceiverAddress(row)"
> >
刷新地址 {{
row.shipmentType === 0 ? '同步物流/地址' : '同步地址'
}}
</ElButton> </ElButton>
<ElButton <ElButton
v-if="status === 'SUSPEND'" v-if="status === 'SUSPEND'"
type="primary" type="primary"
...@@ -915,6 +936,13 @@ ...@@ -915,6 +936,13 @@
:submit-address-api="submitFactoryOrderReceiverAddress" :submit-address-api="submitFactoryOrderReceiverAddress"
@success="() => refreshCurrentView({ isRefreshTree: true })" @success="() => refreshCurrentView({ isRefreshTree: true })"
/> />
<ChangeWayDialog
ref="changeWayDialogRef"
:row-data="changeWayCurrentItem"
:get-table-fn="getLogisticsCalculation"
:change-logistics-api="changeLogisticsApi"
@confirm="() => refreshCurrentView({ isRefreshTree: true })"
/>
<ElDialog <ElDialog
v-model="exportVisible" v-model="exportVisible"
title="导出选项" title="导出选项"
...@@ -977,6 +1005,8 @@ import { ...@@ -977,6 +1005,8 @@ import {
composingNewPodOrderDesignImages, composingNewPodOrderDesignImages,
printNewPodOrderProductionOrderApi, printNewPodOrderProductionOrderApi,
syncReceiverAddress, syncReceiverAddress,
getLogisticsCalculation,
changeLogisticsApi,
updateReceiverAddressApi, updateReceiverAddressApi,
updateRemarkApi, updateRemarkApi,
completeDeliveryApi, completeDeliveryApi,
...@@ -1015,6 +1045,7 @@ import PodMakeOrder from '@/views/order/podUs/PodMakeOrder.vue' ...@@ -1015,6 +1045,7 @@ import PodMakeOrder from '@/views/order/podUs/PodMakeOrder.vue'
import PodDistributionOrder from '@/views/order/podCN/PodDistributionOrder.vue' import PodDistributionOrder from '@/views/order/podCN/PodDistributionOrder.vue'
import PrintWarehouseSkuTag from '@/views/order/components/printWarehouseSkuTag.vue' import PrintWarehouseSkuTag from '@/views/order/components/printWarehouseSkuTag.vue'
import UpdateAddress from '@/views/order/podCN/components/updateAddress.vue' import UpdateAddress from '@/views/order/podCN/components/updateAddress.vue'
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 { useOrderDictionaries } from './hooks/useOrderDictionaries' import { useOrderDictionaries } from './hooks/useOrderDictionaries'
...@@ -1222,11 +1253,33 @@ const receiverAddressForm = ref<AddressInfo>({ ...@@ -1222,11 +1253,33 @@ const receiverAddressForm = ref<AddressInfo>({
}) })
const showPendingLogisticsUpdateAddress = (row: FactoryOrderNewListData) => const showPendingLogisticsUpdateAddress = (row: FactoryOrderNewListData) =>
status.value === 'PENDING_CREATE_LOGISTICS' && row.shipmentType === 1 [
'PENDING_RECEIVE',
'PENDING_CREATE_LOGISTICS',
'PENDING_SCHEDULE',
'PICKING',
'PENDING_DELIVERY',
'SUSPEND',
].includes(status.value) && row.shipmentType === 1
const showChangeLogistics = (row: FactoryOrderNewListData) =>
['PENDING_SCHEDULE', 'PICKING', 'PENDING_DELIVERY', 'SUSPEND'].includes(
status.value,
) && row.shipmentType === 1
const submitFactoryOrderReceiverAddress = (data: AddressInfo) => const submitFactoryOrderReceiverAddress = (data: AddressInfo) =>
updateReceiverAddressApi(data) updateReceiverAddressApi(data)
const changeWayDialogRef = ref<InstanceType<typeof ChangeWayDialog>>()
const changeWayCurrentItem = ref<FactoryOrderNewListData | null>(null)
const handleChangeLogistics = (row: FactoryOrderNewListData) => {
changeWayCurrentItem.value = row
nextTick(() => {
changeWayDialogRef.value?.showDialog()
})
}
const openUpdateReceiverAddress = (row: FactoryOrderNewListData) => { const openUpdateReceiverAddress = (row: FactoryOrderNewListData) => {
receiverAddressForm.value = { receiverAddressForm.value = {
rfcNumber: '', rfcNumber: '',
...@@ -1246,25 +1299,33 @@ const openUpdateReceiverAddress = (row: FactoryOrderNewListData) => { ...@@ -1246,25 +1299,33 @@ const openUpdateReceiverAddress = (row: FactoryOrderNewListData) => {
const handleRefreshReceiverAddress = async (row: FactoryOrderNewListData) => { const handleRefreshReceiverAddress = async (row: FactoryOrderNewListData) => {
try { try {
await ElMessageBox.confirm('确定刷新地址吗?', '提示', { await ElMessageBox.confirm(
confirmButtonText: '确定', row.shipmentType === 0 ? '确定同步物流/地址吗?' : '确定同步地址吗?',
cancelButtonText: '取消', '提示',
type: 'warning', {
}) confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
},
)
} catch { } catch {
return return
} }
await syncReceiverAddress([row.id]) await syncReceiverAddress([row.id])
await ElMessageBox.alert( if (row.shipmentType === 1) {
'请修改/刷新地址后取消物流或者更换物流再重新创建物流订单、获取跟踪号、获取打印面单', await ElMessageBox.alert(
'提示', '请修改/刷新地址后取消物流或者更换物流再重新创建物流订单、获取跟踪号、获取打印面单',
{ '提示',
type: 'warning', {
confirmButtonText: '确定', type: 'warning',
cancelButtonText: '取消', confirmButtonText: '确定',
showCancelButton: true, cancelButtonText: '取消',
}, showCancelButton: true,
) },
)
} else {
ElMessage.success('操作成功')
}
refreshCurrentView({ isRefreshTree: true }) refreshCurrentView({ isRefreshTree: true })
} }
...@@ -1446,7 +1507,7 @@ const mainColumns = computed(() => [ ...@@ -1446,7 +1507,7 @@ const mainColumns = computed(() => [
{ {
prop: 'operation', prop: 'operation',
label: '操作', label: '操作',
minWidth: 200, minWidth: 220,
align: 'center', align: 'center',
slot: 'operation', slot: 'operation',
fixed: 'right', fixed: 'right',
......
...@@ -65,7 +65,14 @@ ...@@ -65,7 +65,14 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { PodCnOrderListData, LogisticsData } from '@/types/api/podCnOrder' import { LogisticsData } from '@/types/api/podCnOrder'
export interface ChangeWayRowData {
id?: number | string
version?: number
logisticsWayId?: number | string | null
logisticsWayName?: string
}
const isChangeWay = ref(false) const isChangeWay = ref(false)
const isChangeWayLoading = ref(false) const isChangeWayLoading = ref(false)
const changeWayRow = ref<LogisticsData>({} as LogisticsData) const changeWayRow = ref<LogisticsData>({} as LogisticsData)
...@@ -76,13 +83,13 @@ const wayDialogTitle = ref('') ...@@ -76,13 +83,13 @@ const wayDialogTitle = ref('')
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
rowData: PodCnOrderListData | null rowData: ChangeWayRowData | null
getTableFn?: (...args: any[]) => any getTableFn?: (...args: any[]) => any
submitFn?: (...args: any[]) => any submitFn?: (...args: any[]) => any
changeLogisticsApi?: (...args: any[]) => any changeLogisticsApi?: (...args: any[]) => any
}>(), }>(),
{ {
rowData: () => ({} as PodCnOrderListData), rowData: () => ({} as ChangeWayRowData),
getTableFn: () => {}, getTableFn: () => {},
submitFn: () => {}, submitFn: () => {},
changeLogisticsApi: () => {}, changeLogisticsApi: () => {},
......
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