Commit ed1ad3ce by linjinhong

podcn添加创建物流和更改物流接口

parent 557a5411
......@@ -312,7 +312,7 @@ export function getSuperPodBoxListApi(factoryNo: number | string) {
}
// 超级播种墙配货 获取pod订单拣货箱子详情
export function printNormalPdf(ids: string) {
export function printNormalPdf(ids: string) {
return axios.get<never, BaseRespData<string>>(
'factory/podJomallOrderCn/printPickPdf',
{ params: { ids } },
......
<template>
<el-dialog
v-model="isChangeWay"
:close-on-click-modal="false"
:title="wayDialogTitle"
>
<el-table
ref="changeWayRef"
v-loading="isChangeWayLoading"
height="400px"
class="production-client-table"
:data="logisticsWayData"
border
highlight-current-row
@row-click="(v:LogisticsData) =>rowClick(v, wayDialogTitle)"
>
<el-table-column
label="序号"
width="60"
align="center"
type="index"
></el-table-column>
<el-table-column
label="物流名称"
align="center"
prop="logisticsWayName"
></el-table-column>
<el-table-column
label="发货仓库"
align="center"
prop="warehouseName"
></el-table-column>
<el-table-column
label="物流编码"
align="center"
prop="logisticsWayCode"
></el-table-column>
<el-table-column
label="所在分区"
align="center"
prop="partition"
></el-table-column>
<el-table-column label="状态" align="center">
<template #default="{ row }">
<b v-if="row.status" style="color: green">成功</b>
<b v-else-if="!row.status" style="color: red">失败</b>
</template>
</el-table-column>
<el-table-column label="预计运费($)" align="center" prop="payFreight">
</el-table-column>
</el-table>
<template #footer>
<el-button :disabled="isChangeWayLoading" @click="cancelWayDialog">
取消
</el-button>
<el-button
:loading="isChangeWayLoading"
type="primary"
@click="changeWaySubmit(wayDialogTitle)"
>
确定
</el-button>
</template>
</el-dialog>
</template>
<script lang="ts" setup>
import { PodCnOrderListData, LogisticsData } from '@/types/api/podCnOrder'
const isChangeWay = ref(false)
const isChangeWayLoading = ref(false)
const changeWayRow = ref<LogisticsData>({} as LogisticsData)
const currentItem = ref<PodCnOrderListData | null>(null)
const selection = ref([])
const logisticsWayData = ref([])
const changeWayRef = ref()
const wayDialogTitle = ref('')
const props = withDefaults(
defineProps<{
rowData: PodCnOrderListData | null
getTableFn?: (...args: any[]) => any
submitFn?: (...args: any[]) => any
changeLogisticsApi?: (...args: any[]) => any
}>(),
{
rowData: () => ({} as PodCnOrderListData),
getTableFn: () => {},
submitFn: () => {},
changeLogisticsApi: () => {},
},
)
const rowClick = (row: LogisticsData, title?: string) => {
console.log(title, 'title')
try {
// if (title == '创建物流订单') {
// changeWayRow.value = row
// } else {
// if (row.logisticsWayId === selection.value[0]?.logisticsWayId) {
// ElMessage.warning('不能选择相同的物流方式')
// changeWayRow.value = {} as LogisticsData
// changeWayRef.value?.setCurrentRow()
// return
// }
changeWayRow.value = row
// }
} catch (error) {
console.log(error)
}
}
const cancelWayDialog = () => {
changeWayRow.value = {} as LogisticsData
changeWayRef.value?.setCurrentRow()
isChangeWay.value = false
}
//确认物流
const changeWaySubmit = async (title: string) => {
const { changeLogisticsApi, submitFn } = props
if (!changeWayRow.value?.logisticsWayId) {
return ElMessage.warning('请选择一条物流方式')
}
if (!changeWayRow.value.status) {
return ElMessage.warning('请选择状态为成功的物流方式')
}
let Fn
if (title !== '创建物流订单') {
// if (
// changeWayRow.value.logisticsWayId === selection.value[0]?.logisticsWayId
// ) {
// return ElMessage.warning('更改的物流方式不能相同')
// }
Fn = changeLogisticsApi
} else {
Fn = submitFn
}
isChangeWayLoading.value = true
try {
const params = {
updateByIdParam: {
id: currentItem.value?.id || '',
dataVersion: currentItem.value?.version as number,
},
logisticsTrialCalculation: { ...changeWayRow.value },
}
await Fn(params)
isChangeWay.value = false
isChangeWayLoading.value = false
ElMessage.success('操作成功')
emits('confirm')
} catch (error) {
console.log(error)
} finally {
isChangeWayLoading.value = false
}
}
const showDialog = async () => {
const { rowData, getTableFn } = props
try {
if (rowData) {
wayDialogTitle.value = `切换物流(当前物流方式:${rowData.logisticsWayName})`
isChangeWay.value = true
const { data } = await getTableFn(rowData.id as number)
logisticsWayData.value = data
}
} catch (error) {
console.error(error)
}
}
const emits = defineEmits<{
(e: 'confirm'): void
}>()
defineExpose({
showDialog,
})
</script>
<style lang="scss" scoped></style>
......@@ -612,8 +612,7 @@
<!-- 代发:0.自有物流 1.工厂物流; 不代发: 0.自提 1.快递-->
<template
v-if="
(status === 'CREATE_LOGISTICS' && shipmentArea === 1) ||
status === 'WAIT_SHIPMENT'
status === 'CREATE_LOGISTICS' || status === 'WAIT_SHIPMENT'
"
#dropdown
>
......@@ -1685,6 +1684,18 @@
</span>
<span
v-if="
(status === 'WAIT_SHIPMENT' ||
status === 'CREATE_LOGISTICS') &&
row.shipmentType === 1
"
class="operate-item"
>
<ElButton link type="primary" @click="handleStockOut(row)">
更换物流
</ElButton>
</span>
<span
v-if="
(row.replaceShipment === 1 &&
['CREATE_LOGISTICS', 'WAIT_SHIPMENT'].includes(status)) ||
(row.replaceShipment === 0 &&
......@@ -2487,6 +2498,19 @@
<el-button type="primary" @click="submitTypesetting">确认</el-button>
</template>
</ElDialog>
<ChangeWayDialog
ref="changeWayDialogRef"
:rowData="currentItem"
:getTableFn="getLogisticsCalculation"
:submitFn="changeLogisticsApi"
:changeLogisticsApi="createLogisticsOrdersApi"
:confirm="
() => {
search()
loadTabData()
}
"
></ChangeWayDialog>
</template>
<script setup lang="ts">
import { getUserMarkList } from '@/api/common'
......@@ -2552,10 +2576,11 @@ import {
batchDownloadRecomposingApi,
getCustomTagListCnApi,
printNormalPdf,
changeLogisticsApi,
} from '@/api/podCnOrder'
import { BaseRespData } from '@/types/api'
import ChangeWayDialog from './components/ChangeWayDialog.vue'
import UpdateAddress from './components/updateAddress.vue'
import { useEnterKeyTrigger } from '@/utils/hooks/useEnterKeyTrigger.ts'
......@@ -4552,8 +4577,14 @@ const getOrderByIdApi = async (type: string) => {
message: '创建物流订单',
Fn: createLogisticsOrdersApi,
},
getTrackingNumber: { message: '获取跟踪号', Fn: getTrackingNumberApi },
getPrintOrder: { message: '获取打印面单', Fn: getfaceSimplexFileApi },
getTrackingNumber: {
message: '获取跟踪号',
Fn: getTrackingNumberApi,
},
getPrintOrder: {
message: '获取打印面单',
Fn: getfaceSimplexFileApi,
},
cancelLogisticsOrder: {
message: '取消物流订单',
Fn: cancelLogisticsOrderApi,
......@@ -5326,6 +5357,16 @@ const getTagName = (row: ProductList) => {
: ''
}
const currentItem = ref<PodCnOrderListData | null>(null)
const changeWayDialogRef = ref()
const handleStockOut = async (row: PodCnOrderListData) => {
currentItem.value = row
nextTick(() => {
changeWayDialogRef.value?.showDialog()
})
}
useRouter().beforeEach((to, from, next) => {
handleBeforeRouteLeave(to, from, next)
})
......
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