Commit 1991c11a by wusiyi

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

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