Commit eb559879 by qinjianhui

feat: 调用后端接口

parent 6c1cd8d4
...@@ -53,17 +53,15 @@ export function getFactoryOrderNewLogApi(id: number | string) { ...@@ -53,17 +53,15 @@ export function getFactoryOrderNewLogApi(id: number | string) {
} }
export function confirmOrderApi(ids: (number | string)[]) { export function confirmOrderApi(ids: (number | string)[]) {
return axios.post<never, BaseRespData<void>>( return axios.post<never, BaseRespData<void>>('factory/orderNew/confirm', {
'factory/orderNew/confirm', ids,
{ ids }, })
)
} }
export function cancelOrderApi(ids: (number | string)[]) { export function cancelOrderApi(ids: (number | string)[]) {
return axios.post<never, BaseRespData<void>>( return axios.post<never, BaseRespData<void>>('factory/orderNew/cancel', {
'factory/orderNew/cancel', ids,
{ ids }, })
)
} }
export function refreshProductInfoApi(ids: (number | string)[]) { export function refreshProductInfoApi(ids: (number | string)[]) {
...@@ -86,7 +84,7 @@ export function confirmOrderWithWarehouseApi( ...@@ -86,7 +84,7 @@ export function confirmOrderWithWarehouseApi(
) { ) {
return axios.post<never, BaseRespData<void>>( return axios.post<never, BaseRespData<void>>(
'factory/podOrder/ordersAccepted', 'factory/podOrder/ordersAccepted',
{ ids, warehouseId }, { podOrderIds: ids, warehouseId },
) )
} }
...@@ -94,10 +92,13 @@ export function cancelOrderWithReasonApi( ...@@ -94,10 +92,13 @@ export function cancelOrderWithReasonApi(
ids: (number | string)[], ids: (number | string)[],
reason: string, reason: string,
) { ) {
return axios.post<never, BaseRespData<void>>('factory/podOrder/cancelOrders', { return axios.post<never, BaseRespData<void>>(
podOrderIds:ids, 'factory/podOrder/cancelOrders',
reason, {
}) podOrderIds: ids,
cancelReason: reason,
},
)
} }
export function suspendOrderApi( export function suspendOrderApi(
...@@ -106,17 +107,16 @@ export function suspendOrderApi( ...@@ -106,17 +107,16 @@ export function suspendOrderApi(
needCustomerHandle: string, needCustomerHandle: string,
) { ) {
return axios.post<never, BaseRespData<void>>('factory/orderNew/suspend', { return axios.post<never, BaseRespData<void>>('factory/orderNew/suspend', {
ids, podOrderIds: ids,
reason, pauseReason: reason,
needCustomerHandle, needCustomerHandle,
}) })
} }
export function cancelSuspendApi(ids: (number | string)[]) { export function cancelSuspendApi(ids: (number | string)[]) {
return axios.post<never, BaseRespData<void>>( return axios.post<never, BaseRespData<void>>('factory/podOrder/unSuspend', {
'factory/orderNew/cancelSuspend', podOrderIds: ids,
{ ids }, })
)
} }
export function archiveOrderApi(ids: (number | string)[]) { export function archiveOrderApi(ids: (number | string)[]) {
...@@ -141,8 +141,10 @@ export function applyReplenishApi(ids: (number | string)[]) { ...@@ -141,8 +141,10 @@ export function applyReplenishApi(ids: (number | string)[]) {
export function batchDeleteApi(ids: (number | string)[]) { export function batchDeleteApi(ids: (number | string)[]) {
return axios.post<never, BaseRespData<void>>( return axios.post<never, BaseRespData<void>>(
'factory/orderNew/batchDelete', 'factory/podOrderBatchDownload/delete',
{ ids }, {
ids: ids.join(','),
},
) )
} }
...@@ -232,4 +234,73 @@ export function createOutboundOrderApi(ids: (number | string)[]) { ...@@ -232,4 +234,73 @@ export function createOutboundOrderApi(ids: (number | string)[]) {
{ ids }, { ids },
) )
} }
// 获取跟踪号
export function getTrackingNumberApi(orderIds: (string | number)[]) {
return axios.post<never, BaseRespData<never>>(
'factory/podOrder/getTrackingNumber',
orderIds,
)
}
// 获取打印面单
export function getfaceSimplexFileApi(orderIds: (string | number)[]) {
return axios.post<never, BaseRespData<never>>(
'factory/podOrder/getfaceSimplexFile',
orderIds,
)
}
// 取消物流订单
export function cancelLogisticsOrderApi(orderIds: (string | number)[]) {
return axios.post<never, BaseRespData<never>>(
'factory/podOrder/cancelLogisticsOrder',
orderIds,
)
}
export function arrangeFinishApi(
url: string,
params: {
productIdList: number[]
templateWidth?: number
type?: string
},
) {
return axios.post<never, BaseRespData<never>>(url, params)
}
export function downloadMaterialApi(id: number[]) {
return axios.post<never, BaseRespData<never>>(
'factory/podOrder/downloadDesignImages',
id,
)
}
export function downloadBatchMaterialApi(id: number | string) {
return axios.post<never, BaseRespData<never>>(
'factory/podOrderBatchDownload/download',
id,
)
}
export function composingNewPodOrderDesignImages(
data: number[],
type?: string,
templateWidth?: number,
) {
return axios.post<never, BaseRespData<never>>(
`factory/podOrderOperation/replenishmentComposingDesignImages?type=${type}&templateWidth=${templateWidth}`,
data,
)
}
export function printNewPodOrderProductionOrderApi(ids: number[]) {
return axios.post<never, BaseRespData<never>>(
'factory/podOrderOperation/printProducePdf',
ids,
)
}
export function syncReceiverAddress(data: number[]) {
return axios.post<never, BaseRespData<never>>(
'factory/podOrder/syncReceiverAddress',
data,
)
}
...@@ -242,10 +242,7 @@ export function productionQueryApi(id: number, podJomallOrderCnId: number) { ...@@ -242,10 +242,7 @@ export function productionQueryApi(id: number, podJomallOrderCnId: number) {
) )
} }
export function printProductionOrderApi(url: string, orderIds: number[]) { export function printProductionOrderApi(url: string, orderIds: number[]) {
return axios.post<never, BaseRespData<string>>( return axios.post<never, BaseRespData<string>>(url, orderIds)
url,
orderIds,
)
} }
export function printPrintOrderApi(orderIds: number[]) { export function printPrintOrderApi(orderIds: number[]) {
return axios.post<never, BaseRespData<string>>( return axios.post<never, BaseRespData<string>>(
...@@ -630,11 +627,15 @@ export function updateToWaitShipmentApi(params: { ...@@ -630,11 +627,15 @@ export function updateToWaitShipmentApi(params: {
} }
//创建物流订单 //创建物流订单
export function createLogisticsOrdersApi(orderIdList: (string | number)[], logisticsWayId: number | null) { export function createLogisticsOrdersApi(
return axios.post<never, BaseRespData<never>>( url: string,
`factory/podJomallOrderCn/createLogisticsOrders`, orderIdList: (string | number)[],
{ orderIdList, logisticsWayId }, logisticsWayId: number | null,
) ) {
return axios.post<never, BaseRespData<never>>(url, {
orderIdList,
logisticsWayId,
})
} }
// 获取跟踪号 // 获取跟踪号
...@@ -747,13 +748,16 @@ export function allErpCodeListApi() { ...@@ -747,13 +748,16 @@ export function allErpCodeListApi() {
'/logisticsCompany/allErpCodeList', '/logisticsCompany/allErpCodeList',
) )
} }
export function updateCustomDeclarationInfoApi({ export function updateCustomDeclarationInfoApi(
params, url: string,
ids, {
}: { params,
params: CustomDeclarationInfoForm ids,
ids: string }: {
}) { params: CustomDeclarationInfoForm
ids: string
},
) {
const formData = new FormData() const formData = new FormData()
formData.append('ids', ids) formData.append('ids', ids)
Object.keys(params).forEach((key) => { Object.keys(params).forEach((key) => {
...@@ -763,13 +767,9 @@ export function updateCustomDeclarationInfoApi({ ...@@ -763,13 +767,9 @@ export function updateCustomDeclarationInfoApi({
} }
}) })
return axios.post<never, BaseRespData<never>>( return axios.post<never, BaseRespData<never>>(url, formData, {
'factory/podJomallOrderCn/batchUpdateCustomsClearanceInfo', headers: { 'content-type': 'multipart/form-data' },
formData, })
{
headers: { 'content-type': 'multipart/form-data' },
},
)
} }
// 标记缺货/移除缺货共用 // 标记缺货/移除缺货共用
export function updateProductOutOfStockApi(params: { export function updateProductOutOfStockApi(params: {
......
...@@ -50,11 +50,12 @@ ...@@ -50,11 +50,12 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue' import { ref } from 'vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { arrangeFinishApi } from '@/api/podCnOrder' import { arrangeFinishApi } from '@/api/factoryOrderNew'
type OpenPayload = { type OpenPayload = {
productIdList: number[] productIdList: number[]
title?: string title?: string
requestUrl: string
showAutoSwitch?: boolean showAutoSwitch?: boolean
} }
...@@ -99,7 +100,7 @@ const handleSubmit = async () => { ...@@ -99,7 +100,7 @@ const handleSubmit = async () => {
submitting.value = true submitting.value = true
try { try {
await arrangeFinishApi({ await arrangeFinishApi(payload.value.requestUrl, {
productIdList: payload.value.productIdList, productIdList: payload.value.productIdList,
templateWidth: isAuto.value ? templateWidth : undefined, templateWidth: isAuto.value ? templateWidth : undefined,
type: isAuto.value ? type : undefined, type: isAuto.value ? type : undefined,
......
...@@ -110,7 +110,12 @@ ...@@ -110,7 +110,12 @@
</el-tag> </el-tag>
</template> </template>
<template #operation="{ row }"> <template #operation="{ row }">
<ElButton type="primary" link size="small" @click="handleDownload()"> <ElButton
type="primary"
link
size="small"
@click="handleDownload(row)"
>
下载 下载
</ElButton> </ElButton>
<ElButton type="primary" link size="small" @click="handlePrintPick()"> <ElButton type="primary" link size="small" @click="handlePrintPick()">
...@@ -158,7 +163,11 @@ ...@@ -158,7 +163,11 @@
<script setup lang="tsx"> <script setup lang="tsx">
import { ref, reactive, onMounted } from 'vue' import { ref, reactive, onMounted } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
import { getBatchManageListApi, batchDeleteApi } from '@/api/factoryOrderNew' import {
getBatchManageListApi,
batchDeleteApi,
downloadBatchMaterialApi,
} from '@/api/factoryOrderNew'
import type { BatchManageData } from '@/types/api/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'
...@@ -166,6 +175,7 @@ import ArrangeDialog from './ArrangeDialog.vue' ...@@ -166,6 +175,7 @@ import ArrangeDialog from './ArrangeDialog.vue'
import { getEmployeeListApi } from '@/api/common' import { getEmployeeListApi } from '@/api/common'
import type { userData } from '@/types/api/user' import type { userData } from '@/types/api/user'
import usePageList from '@/utils/hooks/usePageList' import usePageList from '@/utils/hooks/usePageList'
import { filePath } from '@/api/axios'
const selectedRows = ref<BatchManageData[]>([]) const selectedRows = ref<BatchManageData[]>([])
const employeeList = ref<userData[]>([]) const employeeList = ref<userData[]>([])
...@@ -257,13 +267,16 @@ const columns = [ ...@@ -257,13 +267,16 @@ const columns = [
</div> </div>
) )
} }
const labels: string[] = row?.craftType?.split(',') ?? [] const labels: string[] =
.map((type: string) => type.trim()) row?.craftType?.split(',') ??
.map((type: string) => []
processType.value.find((e: ProcessTypeData) => e.value === type) .map((type: string) => type.trim())
?.label || type, .map(
) (type: string) =>
.filter((type: string | undefined) => type !== undefined) processType.value.find((e: ProcessTypeData) => e.value === type)
?.label || type,
)
.filter((type: string | undefined) => type !== undefined)
return ( return (
<div> <div>
...@@ -418,8 +431,21 @@ const handleBatchDelete = async () => { ...@@ -418,8 +431,21 @@ const handleBatchDelete = async () => {
} }
} }
const handleDownload = () => { const handleDownload = async (row: BatchManageData) => {
ElMessage.info('接口待提供') try {
await ElMessageBox.confirm('确定下载选中的批次吗?', '提示', {
type: 'warning',
})
} catch {
return
}
try {
const res = await downloadBatchMaterialApi(row.id)
if (res.code !== 200) return
window.open(filePath + res.message)
} catch (e) {
console.error(e)
}
} }
const handlePrintPick = () => { const handlePrintPick = () => {
...@@ -438,6 +464,7 @@ const handleReArrange = (row: BatchManageData) => { ...@@ -438,6 +464,7 @@ const handleReArrange = (row: BatchManageData) => {
arrangeDialogRef.value?.open({ arrangeDialogRef.value?.open({
productIdList: [row.id], productIdList: [row.id],
title: '重排', title: '重排',
requestUrl: 'factory/podOrderBatchDownload/reComposingDesignImages',
showAutoSwitch: false, showAutoSwitch: false,
}) })
} }
......
...@@ -7,17 +7,17 @@ ...@@ -7,17 +7,17 @@
@close="handleClose" @close="handleClose"
> >
<ElForm ref="formRef" :model="form" :rules="rules" label-width="130px"> <ElForm ref="formRef" :model="form" :rules="rules" label-width="130px">
<ElFormItem label="挂起原因" prop="reason"> <ElFormItem label="挂起原因" prop="pauseReason">
<ElSelect <ElSelect
v-model="form.reason" v-model="form.pauseReason"
placeholder="请选择挂起原因" placeholder="请选择挂起原因"
style="width: 100%" style="width: 100%"
> >
<ElOption <ElOption
v-for="item in suspendReasons" v-for="item in suspendReasons"
:key="item" :key="item"
:label="item" :label="item.label"
:value="item" :value="item.value"
/> />
</ElSelect> </ElSelect>
</ElFormItem> </ElFormItem>
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
<ElOption <ElOption
v-for="item in customerHandleOptions" v-for="item in customerHandleOptions"
:key="item" :key="item"
:label="item" :label="item.label"
:value="item" :value="item.value"
/> />
</ElSelect> </ElSelect>
</ElFormItem> </ElFormItem>
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive } from 'vue' import { ref, reactive } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage } from 'element-plus'
import type { FormInstance, FormRules } from 'element-plus' import type { FormInstance, FormRules } from 'element-plus'
import { suspendOrderApi } from '@/api/factoryOrderNew' import { suspendOrderApi } from '@/api/factoryOrderNew'
...@@ -60,16 +60,24 @@ const submitLoading = ref(false) ...@@ -60,16 +60,24 @@ const submitLoading = ref(false)
const formRef = ref<FormInstance>() const formRef = ref<FormInstance>()
const orderIds = ref<(number | string)[]>([]) const orderIds = ref<(number | string)[]>([])
const suspendReasons = ['客户拦截', '地址异常', '素材异常', '其他'] const suspendReasons = [
const customerHandleOptions = ['需要客户处理', '无需客户处理'] { label: '客户拦截', value: 4 },
{ label: '地址异常', value: 3 },
{ label: '素材异常', value: 2 },
{ label: '其他', value: 1 },
]
const customerHandleOptions = [
{ label: '需要客户处理', value: 'NEED_CUSTOMER_HANDLE' },
{ label: '无需客户处理', value: 'NO_CUSTOMER_HANDLE' },
]
const form = reactive({ const form = reactive({
reason: '', pauseReason: '',
needCustomerHandle: '', needCustomerHandle: '',
}) })
const rules: FormRules = { const rules: FormRules = {
reason: [{ required: true, message: '请选择挂起原因', trigger: 'change' }], pauseReason: [{ required: true, message: '请选择挂起原因', trigger: 'change' }],
needCustomerHandle: [ needCustomerHandle: [
{ required: true, message: '请选择是否需要客户处理', trigger: 'change' }, { required: true, message: '请选择是否需要客户处理', trigger: 'change' },
], ],
...@@ -77,7 +85,7 @@ const rules: FormRules = { ...@@ -77,7 +85,7 @@ const rules: FormRules = {
const open = (ids: (number | string)[]) => { const open = (ids: (number | string)[]) => {
orderIds.value = ids orderIds.value = ids
form.reason = '' form.pauseReason = ''
form.needCustomerHandle = '' form.needCustomerHandle = ''
visible.value = true visible.value = true
} }
...@@ -91,18 +99,12 @@ const handleSubmit = async () => { ...@@ -91,18 +99,12 @@ const handleSubmit = async () => {
await formRef.value.validate() await formRef.value.validate()
submitLoading.value = true submitLoading.value = true
try { try {
await suspendOrderApi( await suspendOrderApi(orderIds.value, form.pauseReason, form.needCustomerHandle)
orderIds.value,
form.reason,
form.needCustomerHandle,
)
ElMessage.success('挂起订单成功') ElMessage.success('挂起订单成功')
visible.value = false visible.value = false
emit('success') emit('success')
} catch (e: any) { } catch (e) {
ElMessageBox.alert(e?.message || '挂起订单失败', '挂起订单失败', { console.error(e)
type: 'error',
})
} finally { } finally {
submitLoading.value = false submitLoading.value = false
} }
......
...@@ -779,11 +779,13 @@ ...@@ -779,11 +779,13 @@
<CreateLogisticDialog <CreateLogisticDialog
ref="createLogisticDialogRef" ref="createLogisticDialogRef"
:new-order-selection="selectedRows"
@refresh-table="() => refreshCurrentView({ isRefreshTree: true })" @refresh-table="() => refreshCurrentView({ isRefreshTree: true })"
/> />
<UpdateCustomDeclarationInfoDialog <UpdateCustomDeclarationInfoDialog
v-model="updateCustomsDialogVisible" v-model="updateCustomsDialogVisible"
:order-selection="selectedRows" :order-selection="selectedRows"
:is-new-order="true"
@refresh-table="refreshCurrentView" @refresh-table="refreshCurrentView"
/> />
<WeightDialog ref="weightDialogRef" @update-list="refreshCurrentView" /> <WeightDialog ref="weightDialogRef" @update-list="refreshCurrentView" />
...@@ -801,6 +803,11 @@ ...@@ -801,6 +803,11 @@
@set-warehouse-id="handleWarehouseIdChange" @set-warehouse-id="handleWarehouseIdChange"
@refresh="() => refreshCurrentView({ isRefreshTree: true })" @refresh="() => refreshCurrentView({ isRefreshTree: true })"
/> />
<ResultInfo
ref="resultRefs"
:list="resultInfo"
@confirm="() => refreshCurrentView({ isRefreshTree: true })"
></ResultInfo>
</div> </div>
</template> </template>
...@@ -823,6 +830,7 @@ import type { TabsPaneContext } from 'element-plus' ...@@ -823,6 +830,7 @@ import type { TabsPaneContext } from 'element-plus'
import splitDiv from '@/components/splitDiv/splitDiv.vue' import splitDiv from '@/components/splitDiv/splitDiv.vue'
import TableView from '@/components/TableView.vue' import TableView from '@/components/TableView.vue'
import usePageList from '@/utils/hooks/usePageList' import usePageList from '@/utils/hooks/usePageList'
import type { BaseRespData } from '@/types/api'
import type { import type {
FactoryOrderNewListData, FactoryOrderNewListData,
LogListData, LogListData,
...@@ -845,19 +853,19 @@ import { ...@@ -845,19 +853,19 @@ import {
archiveOrderApi, archiveOrderApi,
printPickOrderApi, printPickOrderApi,
applyReplenishApi, applyReplenishApi,
getTrackingNumberApi,
getfaceSimplexFileApi,
cancelLogisticsOrderApi,
downloadMaterialApi,
composingNewPodOrderDesignImages,
printNewPodOrderProductionOrderApi,
syncReceiverAddress
} from '@/api/factoryOrderNew' } from '@/api/factoryOrderNew'
import { import {
getListCraftApi, getListCraftApi,
getCustomTagListCnApi, getCustomTagListCnApi,
allErpCodeListApi, allErpCodeListApi,
downloadMaterialApi,
composingDesignImages,
printProductionOrderApi,
updateToWaitShipmentApi, updateToWaitShipmentApi,
syncReceiverAddress,
getTrackingNumberApi,
getfaceSimplexFileApi,
cancelLogisticsOrderApi,
} from '@/api/podCnOrder' } from '@/api/podCnOrder'
import { getUserMarkList, loadWarehouseListApi } from '@/api/common' import { getUserMarkList, loadWarehouseListApi } from '@/api/common'
import { getAllCountryApi } from '@/api/logistics' import { getAllCountryApi } from '@/api/logistics'
...@@ -913,7 +921,15 @@ const suspendedTabs = [ ...@@ -913,7 +921,15 @@ const suspendedTabs = [
{ label: '其他', value: 'OTHER', count: 0 }, { label: '其他', value: 'OTHER', count: 0 },
] ]
const suspendedSubTab = ref('CUSTOMER_INTERCEPT') const suspendedSubTab = ref('CUSTOMER_INTERCEPT')
const resultInfo = ref<
{
id: string | number
status: boolean
factoryOrderNumber?: string
message: string
}[]
>([])
const resultRefs = ref()
const treeRef = ref<InstanceType<typeof ElTree>>() const treeRef = ref<InstanceType<typeof ElTree>>()
const searchForm = ref<SearchForm>({}) const searchForm = ref<SearchForm>({})
const dateRange = ref<string[]>([]) const dateRange = ref<string[]>([])
...@@ -1462,7 +1478,7 @@ const handleLogisticsCommand = async (command: string) => { ...@@ -1462,7 +1478,7 @@ const handleLogisticsCommand = async (command: string) => {
} }
const apiMap: Record< const apiMap: Record<
string, string,
(data: (number | string)[]) => Promise<{ code: number; message?: string }> (data: (number | string)[]) => Promise<BaseRespData<unknown>>
> = { > = {
getTrackingNumber: getTrackingNumberApi, getTrackingNumber: getTrackingNumberApi,
getPrintOrder: getfaceSimplexFileApi, getPrintOrder: getfaceSimplexFileApi,
...@@ -1475,20 +1491,33 @@ const handleLogisticsCommand = async (command: string) => { ...@@ -1475,20 +1491,33 @@ const handleLogisticsCommand = async (command: string) => {
} }
const api = apiMap[command] const api = apiMap[command]
if (!api) return if (!api) return
await ElMessageBox.confirm(`确定${labelMap[command]}吗?`, '提示', { try {
type: 'warning', await ElMessageBox.confirm(`确定${labelMap[command]}吗?`, '提示', {
type: 'warning',
})
} catch {
return
}
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
}) })
try { try {
const res = await api(ids) const res = await api(ids)
if (command === 'getPrintOrder' && res.message) { if (res.code === 200) {
window.open(filePath + res.message, '_blank') if (Array.isArray(res.data)) {
resultInfo.value = res.data as typeof resultInfo.value
resultRefs.value?.showDialog()
} else if (typeof res.data === 'string') {
window.open(filePath + res.data)
}
} }
ElMessage.success(`${labelMap[command]}成功`)
refreshCurrentView({
isRefreshTree: command === 'cancelLogistic',
})
} catch (e: unknown) { } catch (e: unknown) {
ElMessage.error((e as Error)?.message || `${labelMap[command]}失败`) resultInfo.value = []
console.error(e)
} finally {
loading.close()
} }
} }
const handleSuspend = () => { const handleSuspend = () => {
...@@ -1504,7 +1533,11 @@ const handleArrange = async () => { ...@@ -1504,7 +1533,11 @@ const handleArrange = async () => {
const productIdList = getSelectedIds() const productIdList = getSelectedIds()
.map((v) => Number(v)) .map((v) => Number(v))
.filter((n) => Number.isFinite(n)) as number[] .filter((n) => Number.isFinite(n)) as number[]
arrangeDialogRef.value?.open({ productIdList }) arrangeDialogRef.value?.open({
productIdList,
requestUrl: 'factory/podOrder/updateLogisticsToArrange',
showAutoSwitch: true,
})
} }
const podOrderVisible = ref(false) const podOrderVisible = ref(false)
const warehouseList = ref<WarehouseListData[]>([]) const warehouseList = ref<WarehouseListData[]>([])
...@@ -1681,39 +1714,50 @@ const handleDtfCommand = async (command: string) => { ...@@ -1681,39 +1714,50 @@ const handleDtfCommand = async (command: string) => {
const ids = getSelectedIds() const ids = getSelectedIds()
const [type, widthStr] = command.split('_') const [type, widthStr] = command.split('_')
const templateWidth = Number(widthStr) const templateWidth = Number(widthStr)
const url = const loading = ElLoading.service({
status.value === 'PENDING_REPLENISH' fullscreen: true,
? 'factory/podJomallOrderCn/replenishmentComposingDesignImages' text: '操作中...',
: 'factory/podJomallOrderProductCn/composingDesignImages' background: 'rgba(0, 0, 0, 0.3)',
})
try { try {
const res = await composingDesignImages( const res = await composingNewPodOrderDesignImages(
url,
ids as number[], ids as number[],
type, type,
templateWidth, templateWidth,
) )
if (type === 'tiff' && res.message) { if (res.message) {
window.open(filePath + res.message, '_blank') const filePathUrl =
type === 'tiff'
? res.message?.startsWith('/temp')
? `https://factory.jomalls.com/upload/factory` + res.message
: `https://ps.jomalls.com/tiff/` + res.message
: filePath + res.message
window.open(filePathUrl, '_blank')
} }
ElMessage.success('DTF排版成功') ElMessage.success('DTF排版成功')
} catch (e: unknown) { } catch (e) {
ElMessage.error((e as Error)?.message || 'DTF排版失败') console.error(e)
} finally {
loading.close()
} }
} }
const handlePrintProductionOrder = async () => { const handlePrintProductionOrder = async () => {
if (!ensureSelection()) return if (!ensureSelection()) return
const ids = getSelectedIds() const ids = getSelectedIds()
const url = const loading = ElLoading.service({
status.value === 'PENDING_REPLENISH' fullscreen: true,
? 'factory/podJomallOrderProductCn/replenishmentPrintProducePdf' text: '操作中...',
: 'factory/podJomallOrderProductCn/printProducePdf' background: 'rgba(0, 0, 0, 0.3)',
})
try { try {
const res = await printProductionOrderApi(url, ids as number[]) const res = await printNewPodOrderProductionOrderApi(ids as number[])
if (res.message) { if (res.message) {
window.open(filePath + res.message, '_blank') window.open(filePath + res.message, '_blank')
} }
} catch (e: unknown) { } catch (e) {
ElMessage.error((e as Error)?.message || '打印生产单失败') console.error(e)
} finally {
loading.close()
} }
} }
const handlePrintPickOrder = async () => { const handlePrintPickOrder = async () => {
......
...@@ -85,9 +85,12 @@ import { ...@@ -85,9 +85,12 @@ import {
} from '@/api/logistics' } from '@/api/logistics'
import { createLogisticsOrdersApi } from '@/api/podCnOrder' import { createLogisticsOrdersApi } from '@/api/podCnOrder'
import { FactoryOrderNewListData } from '@/types/api/factoryOrderNew'
const createLogisticDialogVisible = ref(false) const createLogisticDialogVisible = ref(false)
const props = defineProps<{
newOrderSelection?: FactoryOrderNewListData[],
}>()
const isAutoMatch = ref(false) const isAutoMatch = ref(false)
const logisticCompanyList = ref<ILogisticsCompany[]>([]) const logisticCompanyList = ref<ILogisticsCompany[]>([])
...@@ -129,7 +132,11 @@ const selectLogisticCompany = async (item: ILogisticsCompany) => { ...@@ -129,7 +132,11 @@ const selectLogisticCompany = async (item: ILogisticsCompany) => {
} }
const confirmDialog = async () => { const confirmDialog = async () => {
await createLogisticsOrdersApi(orderIdList.value, logisticsWayId.value) const url =
props.newOrderSelection && props.newOrderSelection.length > 0
? 'factory/podOrder/createLogisticsOrders'
: 'factory/podJomallOrderCn/createLogisticsOrders'
await createLogisticsOrdersApi(url, orderIdList.value, logisticsWayId.value)
.then((res) => { .then((res) => {
emits('show-result', res.data) emits('show-result', res.data)
}) })
......
...@@ -57,9 +57,10 @@ ...@@ -57,9 +57,10 @@
</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'; import { FactoryOrderNewListData } from '@/types/api/factoryOrderNew'
import { import {
CustomDeclarationInfoForm, CustomDeclarationInfoForm,
PodCnOrderListData,
} from '@/types/api/podCnOrder' } from '@/types/api/podCnOrder'
defineOptions({ defineOptions({
...@@ -67,7 +68,8 @@ defineOptions({ ...@@ -67,7 +68,8 @@ defineOptions({
}) })
const props = defineProps<{ const props = defineProps<{
modelValue: boolean modelValue: boolean
orderSelection: FactoryOrderNewListData[] orderSelection: FactoryOrderNewListData[] | PodCnOrderListData[]
isNewOrder?: boolean
}>() }>()
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'update:modelValue', value: boolean): void (e: 'update:modelValue', value: boolean): void
...@@ -101,8 +103,11 @@ const closeDialog = async () => { ...@@ -101,8 +103,11 @@ const closeDialog = async () => {
visible.value = false visible.value = false
} }
const submit = async () => { const submit = async () => {
const url = props.isNewOrder
? 'factory/podOrder/batchUpdateCustomsClearanceInfo'
: 'factory/podJomallOrderCn/batchUpdateCustomsClearanceInfo'
try { try {
const res = await updateCustomDeclarationInfoApi({ const res = await updateCustomDeclarationInfoApi(url, {
params: form.value, params: form.value,
ids: props.orderSelection.map((item) => item.id).join(','), ids: props.orderSelection.map((item) => item.id).join(','),
}) })
...@@ -119,7 +124,7 @@ defineExpose({ ...@@ -119,7 +124,7 @@ defineExpose({
}) })
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.dialog-footer { .dialog-footer {
text-align: center; text-align: center;
} }
</style> </style>
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