Commit b309505b by linjinhong

添加更改物流按钮

parent 3eeced4b
......@@ -16,6 +16,7 @@ export interface LogisticsData {
status: boolean
logisticsWayCode: string // 物流编码
partition: string // 所在分区
logisticsWayId?: number | null
}
export function getOrderTabData() {
return axios.get<never, BaseRespData<Tab[]>>(
......@@ -270,3 +271,16 @@ export function cancelLogisticsOrderApi(orderIds: (string | number)[]) {
orderIds,
)
}
// 更改物流
export function changeLogisticsApi(params: {
UpdateByIdParam: {
id: string | number
dataVersion: string
}
logisticsTrialCalculation: LogisticsData
}) {
return axios.post<never, BaseRespData<never>>(
'factory/podJomallOrderUs/changeLogistics',
params,
)
}
......@@ -57,6 +57,7 @@ export interface PodUsOrderListData {
version?: number
productList?: ProductList[]
orderNumber?: string
logisticsWayId?: number | null
}
export interface ProductList {
id: number
......
......@@ -187,6 +187,9 @@
<ElDropdownItem @click="getOrderByIdApi('cancelLogisticsOrder')"
>取消物流订单</ElDropdownItem
>
<ElDropdownItem @click="getOrderByIdApi('batchChangeLogistics')"
>更换物流</ElDropdownItem
>
</ElDropdownMenu>
</template>
</ElDropdown>
......@@ -894,6 +897,60 @@
:list="resultInfo"
@confirm="resultConfim"
></ResultInfo>
<el-dialog
v-model="isChangeWay"
:close-on-click-modal="false"
title="更换物流"
>
<el-table
height="400px"
class="production-client-table"
:data="logisticsWayData"
border
highlight-current-row
@current-change="currentChangeWay"
>
<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 @click="isChangeWay = false">取消</el-button>
<el-button type="primary" @click="changeWaySubmit">确定</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { getUserMarkList } from '@/api/common'
......@@ -924,6 +981,7 @@ import {
getTrackingNumberApi,
getfaceSimplexFileApi,
cancelLogisticsOrderApi,
// changeLogisticsApi,
} from '@/api/podUsOrder'
import TableView from '@/components/TableView.vue'
import {
......@@ -968,7 +1026,9 @@ declare global {
const tabsNav = ref<Tab[]>()
const resultRefs = ref<InstanceType<typeof ResultInfo> | null>(null)
const confirmDialogShow = ref(false)
const isChangeWay = ref(false)
const confirmData = ref([])
const logisticsWayData = ref([])
const confirmSelectionData = ref<LogisticsData[]>([])
const confirmRowData = ref<ProductList | null>(null)
const status = ref('TO_BE_CONFIRMED')
......@@ -1586,7 +1646,6 @@ const printPodOrder = async () => {
/**
* @description: 获取跟踪号、获取打印面单、取消物流订单
*/
const resultInfo = ref([])
const getOrderByIdApi = async (type: string) => {
if (selection.value.length === 0) {
......@@ -1604,6 +1663,16 @@ const getOrderByIdApi = async (type: string) => {
} else if (type === 'cancelLogisticsOrder') {
message = '取消物流订单'
Fn = cancelLogisticsOrderApi
} else if (type === 'batchChangeLogistics') {
if (selection.value.length !== 1) {
return ElMessage.warning('请选择单条数据')
}
isChangeWay.value = true
const { data } = await getLogisticsCalculation(selection.value[0]?.id)
console.log(selection.value[0])
logisticsWayData.value = data
return
}
try {
await showConfirm(`确定对该订单 ${message}?`, {
......@@ -1638,6 +1707,35 @@ const getOrderByIdApi = async (type: string) => {
return
}
}
const changeWayRow = ref<LogisticsData>({} as LogisticsData)
const currentChangeWay = (row: LogisticsData) => {
changeWayRow.value = row
}
const changeWaySubmit = () => {
if (!changeWayRow.value?.logisticsWayId) {
return ElMessage.warning('请选择一条物流方式')
}
if (
changeWayRow.value.logisticsWayId === selection.value[0]?.logisticsWayId
) {
return ElMessage.warning('更改的物流方式不能相同')
}
if (!changeWayRow.value.status) {
return ElMessage.warning('请选择状态为成功的物流方式')
}
// const params = {
// UpdateByIdParam: {
// id: selection.value[0]?.id,
// dataVersion: selection.value[0]?.version,
// },
// logisticsTrialCalculation: { ...changeWayRow.value },
// }
isChangeWay.value = false
// changeLogisticsApi(params)
}
const resultInfo = ref([])
const resultConfim = () => {
search()
}
......
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