Commit 852ad049 by wuqian

完善pod-cn

parent da364b1e
...@@ -7,8 +7,9 @@ import { ...@@ -7,8 +7,9 @@ import {
LogListData, LogListData,
WarehouseListData, WarehouseListData,
LogisticsData, LogisticsData,
ExportParams ExportParams,
} from '@/types/api/podCnOrder' } from '@/types/api/podCnOrder'
import { InterceptStateGroupData } from '@/types/api/podUsOrder'
import axios from './axios' import axios from './axios'
import { PodMakeOrderData } from '@/types/api/podMakeOrder' import { PodMakeOrderData } from '@/types/api/podMakeOrder'
export function exportPodCnInfo(data: ExportParams) { export function exportPodCnInfo(data: ExportParams) {
...@@ -17,6 +18,13 @@ export function exportPodCnInfo(data: ExportParams) { ...@@ -17,6 +18,13 @@ export function exportPodCnInfo(data: ExportParams) {
data, data,
) )
} }
// 拦截状态数量
export function getgetInterceptStateGroupList() {
return axios.get<never, BaseRespData<InterceptStateGroupData>>(
'factory/podJomallOrderCn/findInterceptStateGroupList',
)
}
// 同步收货地址 // 同步收货地址
export function syncReceiverAddress(data: number[]) { export function syncReceiverAddress(data: number[]) {
return axios.post<never, BaseRespData<never>>( return axios.post<never, BaseRespData<never>>(
...@@ -278,7 +286,54 @@ export function refreshMaterialApi(data: { ...@@ -278,7 +286,54 @@ export function refreshMaterialApi(data: {
data, data,
) )
} }
// 拦截状态改变
export function interceptUpdateApi(params: {
orderIds: (string | number)[]
interceptStatus: number
}) {
return axios.post<never, BaseRespData<never>>(
`factory/podJomallOrderCn/updateInterceptStatus`,
params,
)
}
// 驳回
export function rejectToApi(params: {
orderStatus: string
productList: ProductList[]
reasonStr: string
}) {
return axios.post<never, BaseRespData<never>>(
`factory/podJomallOrderCn/rejectTo`,
params,
)
}
// 状态推送
export function statusPushApi(params: (string | number)[]) {
return axios.post<never, BaseRespData<never>>(
`factory/podJomallOrderCn/statusPush`,
params,
)
}
// 完成发货
export function completeDeliveryApi(params: {
orderIdList: (string | number)[]
}) {
return axios.post<never, BaseRespData<never>>(
`factory/podJomallOrderCn/completeDelivery`,
params,
)
}
export function refreshProductInformationApi(data: {
orderIds?: string
productIds?: string
}) {
return axios.post<never, BaseRespData<never>>(
'factory/podJomallOrderProductCn/refreshProductInfo',
data,
)
}
// 设计图排版 // 设计图排版
export function composingDesignImages(data: number[], type: string) { export function composingDesignImages(data: number[], type: string) {
return axios.post<never, BaseRespData<never>>( return axios.post<never, BaseRespData<never>>(
...@@ -377,7 +432,7 @@ export function batchDownloadDownloadApi(params: { id: number; type: string }) { ...@@ -377,7 +432,7 @@ export function batchDownloadDownloadApi(params: { id: number; type: string }) {
} }
// 批量下载 删除 // 批量下载 删除
export function batchDownloadDeleteApi(params: { id: number }) { export function batchDownloadDeleteApi(params: { ids: string }) {
return axios.get<never, BaseRespData<never>>( return axios.get<never, BaseRespData<never>>(
`factory/podBatchDownload/delete`, `factory/podBatchDownload/delete`,
{ {
...@@ -452,7 +507,7 @@ export function changeLogisticsApi(params: { ...@@ -452,7 +507,7 @@ export function changeLogisticsApi(params: {
params, params,
) )
} }
// 修改自有物流信息 // 修改自有物流信息
export function updateSelfLogistics(params: { export function updateSelfLogistics(params: {
trackingNumber: string trackingNumber: string
expressSheet: string expressSheet: string
......
...@@ -294,7 +294,7 @@ export function refreshMaterialApi(data: { ...@@ -294,7 +294,7 @@ export function refreshMaterialApi(data: {
productIds?: string productIds?: string
}) { }) {
return axios.post<never, BaseRespData<never>>( return axios.post<never, BaseRespData<never>>(
'factory/podJomallOrderProductUs/refreshDesignImages ', 'factory/podJomallOrderProductUs/refreshDesignImages',
data, data,
) )
} }
......
...@@ -301,13 +301,28 @@ ...@@ -301,13 +301,28 @@
确认生产 确认生产
</ElButton> </ElButton>
</span> </span>
<span v-if="status === 'EXCEPTION_ORDER'" class="item">
<ElButton type="success" @click="updateOrder">
转至待确认
</ElButton>
</span>
<span v-if="status === 'CREATE_LOGISTICS'" class="item"> <span v-if="status === 'CREATE_LOGISTICS'" class="item">
<ElButton type="warning" @click="asyncOrderAddress"> <ElButton type="warning" @click="asyncOrderAddress">
同步收货地址 同步收货地址
</ElButton> </ElButton>
</span> </span>
<span <span
v-if="status === 'PICKING' || status === 'TO_BE_REPLENISHMENT'" v-if="status === 'EXCEPTION_ORDER' && exceptionStatus === 1"
class="item"
>
<ElButton type="warning" @click="assignOrder"> 分派 </ElButton>
</span>
<span
v-if="
status === 'PICKING' ||
status === 'TO_BE_REPLENISHMENT' ||
status === 'IN_PRODUCTION'
"
class="item" class="item"
> >
<ElButton type="primary" @click="printProductionOrder"> <ElButton type="primary" @click="printProductionOrder">
...@@ -332,8 +347,15 @@ ...@@ -332,8 +347,15 @@
<span v-if="status === 'PICKING'" class="item"> <span v-if="status === 'PICKING'" class="item">
<ElButton type="success" @click="toOutOfStock"> 转至缺货 </ElButton> <ElButton type="success" @click="toOutOfStock"> 转至缺货 </ElButton>
</span> </span>
<span v-if="status === 'TO_BE_CONFIRMED'" class="item"> <span v-if="status === 'TO_BE_CONFIRMED'" class="item">
<ElButton type="warning" @click="changeExceptionOrder">
转为异常单
</ElButton>
</span>
<span
v-if="status === 'TO_BE_CONFIRMED' || status === 'EXCEPTION_ORDER'"
class="item"
>
<ElButton type="danger" @click="cancelOrder">取消</ElButton> <ElButton type="danger" @click="cancelOrder">取消</ElButton>
</span> </span>
<span v-if="status === 'IN_PRODUCTION'" class="item"> <span v-if="status === 'IN_PRODUCTION'" class="item">
...@@ -361,6 +383,11 @@ ...@@ -361,6 +383,11 @@
转至待排单 转至待排单
</ElButton> </ElButton>
</span> </span>
<span v-if="status === 'WAIT_SHIPMENT'" class="item">
<ElButton type="primary" @click="completeDelivery()"
>完成发货</ElButton
>
</span>
<span <span
v-if="status === 'WAIT_SHIPMENT' || status === 'CREATE_LOGISTICS'" v-if="status === 'WAIT_SHIPMENT' || status === 'CREATE_LOGISTICS'"
class="item" class="item"
...@@ -431,13 +458,38 @@ ...@@ -431,13 +458,38 @@
<span v-if="status === 'TO_BE_ARRANGE'" class="item"> <span v-if="status === 'TO_BE_ARRANGE'" class="item">
<ElButton type="warning" @click="arrangeFinish">排单完成</ElButton> <ElButton type="warning" @click="arrangeFinish">排单完成</ElButton>
</span> </span>
<span v-if="status !== 'BATCH_DOWNLOAD'" class="item"> <span
v-if="status !== 'BATCH_DOWNLOAD' && status !== 'WAIT_SHIPMENT'"
class="item"
>
<ElButton type="primary" @click="downloadMaterial" <ElButton type="primary" @click="downloadMaterial"
>下载素材</ElButton >下载素材</ElButton
> >
</span> </span>
<span <span
v-if=" v-if="
status === 'INTERCEPTED' &&
(interceptCurrent === 1 || interceptCurrent === 4)
"
class="item"
>
<ElButton type="success" @click="interceptChange(true)">
拦截成功
</ElButton>
</span>
<span
v-if="
status === 'INTERCEPTED' &&
(interceptCurrent === 1 || interceptCurrent === 4)
"
class="item"
>
<ElButton type="danger" @click="interceptChange(false)">
拦截失败
</ElButton>
</span>
<span
v-if="
status === 'TO_BE_CONFIRMED' || status === 'TO_BE_CONFIRMED' ||
status === 'PICKING' || status === 'PICKING' ||
status === 'STOCK_OUT' || status === 'STOCK_OUT' ||
...@@ -450,6 +502,82 @@ ...@@ -450,6 +502,82 @@
刷新素材 刷新素材
</ElButton> </ElButton>
</span> </span>
<span
v-if="
[
'TO_BE_CONFIRMED',
'PICKING',
'STOCK_OUT',
'EXCEPTION_ORDER',
'TO_BE_REPLENISHMENT',
'IN_PRODUCTION',
'TO_BE_ARRANGE',
].includes(status)
"
class="item"
>
<ElButton type="success" @click="refreshProductInformation">
刷新商品信息
</ElButton>
</span>
<span
v-if="
status === 'STOCK_OUT' ||
status === 'CREATE_LOGISTICS' ||
status === 'TO_BE_ARRANGE' ||
status === 'PICKING' ||
status === 'IN_PRODUCTION'
"
class="item"
>
<ElDropdown>
<el-button type="warning">
驳回至<el-icon class="el-icon--right"><ArrowDown /></el-icon>
</el-button>
<template #dropdown>
<ElDropdownMenu>
<ElDropdownItem
:disabled="
selection.length === 0 && cardSelection.length === 0
"
@click="rejectOrder('TO_BE_CONFIRMED')"
>待确认</ElDropdownItem
>
<ElDropdownItem
v-if="
status === 'IN_PRODUCTION' ||
status === 'TO_BE_ARRANGE' ||
status === 'PICKING'
"
:disabled="
selection.length === 0 && cardSelection.length === 0
"
@click="rejectOrder('CREATE_LOGISTICS')"
>待创建物流</ElDropdownItem
>
<ElDropdownItem
v-if="status === 'PICKING' || status === 'IN_PRODUCTION'"
:disabled="
selection.length === 0 && cardSelection.length === 0
"
@click="rejectOrder('TO_BE_ARRANGE')"
>待排单</ElDropdownItem
>
<ElDropdownItem
v-if="status === 'IN_PRODUCTION'"
:disabled="
selection.length === 0 && cardSelection.length === 0
"
@click="rejectOrder('PICKING')"
>待拣胚</ElDropdownItem
>
</ElDropdownMenu>
</template>
</ElDropdown>
</span>
<span v-if="status === 'COMPLETE'" class="item">
<ElButton type="warning" @click="statusPush">状态推送</ElButton>
</span>
<span v-if="status === 'COMPLETE'" class="item"> <span v-if="status === 'COMPLETE'" class="item">
<ElButton <ElButton
:loading="exportLoading" :loading="exportLoading"
...@@ -458,6 +586,11 @@ ...@@ -458,6 +586,11 @@
>导出</ElButton >导出</ElButton
> >
</span> </span>
<span v-if="status === 'BATCH_DOWNLOAD'" class="item">
<ElButton type="danger" @click="handleBatchDelete('batch')"
>批量删除</ElButton
>
</span>
</ElFormItem> </ElFormItem>
</ElForm> </ElForm>
</div> </div>
...@@ -498,6 +631,103 @@ ...@@ -498,6 +631,103 @@
<span class="sub-status-item-label">国外</span> <span class="sub-status-item-label">国外</span>
</div> </div>
</div> </div>
<div v-if="status === 'EXCEPTION_ORDER'" class="sub-status mb-10">
<div
class="sub-status-item"
:class="exceptionStatus === 1 ? 'sub-active' : ''"
@click="handleExceptionCommand(1)"
>
<span class="sub-status-item-label">待分派</span>
</div>
<div
class="sub-status-item"
:class="exceptionStatus === 2 ? 'sub-active' : ''"
@click="handleExceptionCommand(2)"
>
<span class="sub-status-item-label">待处理</span>
</div>
<div
class="sub-status-item"
:class="exceptionStatus === 3 ? 'sub-active' : ''"
@click="handleExceptionCommand(3)"
>
<span class="sub-status-item-label">待同步</span>
</div>
</div>
<div v-if="status === 'INTERCEPTED'" class="sub-status mb-10">
<div
class="sub-status-item"
:class="interceptCurrent === 1 ? 'sub-active' : ''"
@click="handleInterceptionCommand(1, 0)"
>
<span class="sub-status-item-label">生产拦截申请</span>
<span
v-if="interceptionStatus.production['0']"
class="tabs-node_count blue"
>{{ interceptionStatus.production['0'] }}</span
>
</div>
<div
class="sub-status-item"
:class="interceptCurrent === 2 ? 'sub-active' : ''"
@click="handleInterceptionCommand(2, 1)"
>
<span class="sub-status-item-label">生产拦截成功</span>
<span
v-if="interceptionStatus.production['1']"
class="tabs-node_count blue"
>{{ interceptionStatus.production['1'] }}</span
>
</div>
<div
class="sub-status-item"
:class="interceptCurrent === 3 ? 'sub-active' : ''"
@click="handleInterceptionCommand(3, 2)"
>
<span class="sub-status-item-label">生产拦截失败</span>
<span
v-if="interceptionStatus.production['2']"
class="tabs-node_count red"
>{{ interceptionStatus.production['2'] }}</span
>
</div>
<div
class="sub-status-item"
:class="interceptCurrent === 4 ? 'sub-active' : ''"
@click="handleInterceptionCommand(4, 2)"
>
<span class="sub-status-item-label">发货拦截申请</span>
<span
v-if="interceptionStatus.shipment['0']"
class="tabs-node_count blue"
>{{ interceptionStatus.shipment['0'] }}</span
>
</div>
<div
class="sub-status-item"
:class="interceptCurrent === 5 ? 'sub-active' : ''"
@click="handleInterceptionCommand(5, 3)"
>
<span class="sub-status-item-label">发货拦截成功</span>
<span
v-if="interceptionStatus.shipment['1']"
class="tabs-node_count blue"
>{{ interceptionStatus.shipment['1'] }}</span
>
</div>
<div
class="sub-status-item"
:class="interceptCurrent === 6 ? 'sub-active' : ''"
@click="handleInterceptionCommand(6, 4)"
>
<span class="sub-status-item-label">发货拦截失败</span>
<span
v-if="interceptionStatus.shipment['2']"
class="tabs-node_count red"
>{{ interceptionStatus.shipment['2'] }}</span
>
</div>
</div>
<div <div
v-if=" v-if="
status !== 'IN_PRODUCTION' && status !== 'IN_PRODUCTION' &&
...@@ -794,6 +1024,15 @@ ...@@ -794,6 +1024,15 @@
</el-icon> </el-icon>
</div> </div>
<div class="order-detail-item"> <div class="order-detail-item">
<span class="order-detail-item-label">是否代发:</span>
<span
style="color: red; font-weight: 500"
class="order-detail-item-value"
>
{{ ['否', '是'][row.replaceShipment] }}
</span>
</div>
<div class="order-detail-item">
<span class="order-detail-item-label">物流类型:</span> <span class="order-detail-item-label">物流类型:</span>
<span <span
style="color: red; font-weight: 500" style="color: red; font-weight: 500"
...@@ -1037,7 +1276,11 @@ ...@@ -1037,7 +1276,11 @@
</ElButton> </ElButton>
</span> </span>
<span class="operate-item"> <span class="operate-item">
<ElButton link type="danger" @click="handleBatchDelete(row)"> <ElButton
link
type="danger"
@click="handleBatchDelete('single', row.id)"
>
删除 删除
</ElButton> </ElButton>
</span> </span>
...@@ -1616,6 +1859,64 @@ ...@@ -1616,6 +1859,64 @@
<el-dialog v-model="dialogVisible" width="35%"> <el-dialog v-model="dialogVisible" width="35%">
<img :src="dialogImageUrl" alt="商品预览图片" /> <img :src="dialogImageUrl" alt="商品预览图片" />
</el-dialog> </el-dialog>
<ElDialog
v-model="exceptionDialogVisible"
title="转为异常单"
width="500px"
:close-on-click-modal="false"
@open="handleExceptionDialogOpen"
>
<ElForm ref="exceptionFormRef" :model="exceptionForm" label-width="100px">
<ElFormItem
label="异常类型"
prop="exceptionType"
:rules="
status === 'EXCEPTION_ORDER'
? { required: true, message: '请选择异常类型' }
: {}
"
>
<ElSelect
v-model="exceptionForm.exceptionType"
style="width: 100%"
placeholder="请选择异常类型"
clearable
>
<ElOption
v-for="type in exceptionTypes"
:key="type.value"
:label="type.label"
:value="type.value"
/>
</ElSelect>
</ElFormItem>
<ElFormItem
label="异常原因"
prop="exceptionReason"
:rules="
status !== 'EXCEPTION_ORDER'
? { required: true, message: '请输入异常原因' }
: {}
"
>
<ElInput
v-model="exceptionForm.exceptionReason"
style="width: 100%"
type="textarea"
:rows="3"
placeholder="请输入异常原因"
/>
</ElFormItem>
</ElForm>
<template #footer>
<span class="dialog-footer">
<ElButton @click="exceptionDialogVisible = false">取消</ElButton>
<ElButton type="primary" @click="handleExceptionConfirm">
确定
</ElButton>
</span>
</template>
</ElDialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { getUserMarkList } from '@/api/common' import { getUserMarkList } from '@/api/common'
...@@ -1644,6 +1945,7 @@ import { ...@@ -1644,6 +1945,7 @@ import {
loadWarehouseListApi, loadWarehouseListApi,
getLogisticsCalculation, getLogisticsCalculation,
refreshMaterialApi, refreshMaterialApi,
refreshProductInformationApi,
composingDesignImages, composingDesignImages,
updateLogisticsToArrangeApi, updateLogisticsToArrangeApi,
syncReceiverAddress, syncReceiverAddress,
...@@ -1664,7 +1966,13 @@ import { ...@@ -1664,7 +1966,13 @@ import {
getTrackingNumberApi, getTrackingNumberApi,
getfaceSimplexFileApi, getfaceSimplexFileApi,
cancelLogisticsOrderApi, cancelLogisticsOrderApi,
changeLogisticsApi, getgetInterceptStateGroupList,
interceptUpdateApi,
changeExceptionOrderApi,
updateExceptionOrderApi,
rejectToApi,
statusPushApi,
completeDeliveryApi,
} from '@/api/podCnOrder' } from '@/api/podCnOrder'
import { BaseRespData } from '@/types/api' import { BaseRespData } from '@/types/api'
...@@ -1672,7 +1980,7 @@ import { BaseRespData } from '@/types/api' ...@@ -1672,7 +1980,7 @@ import { BaseRespData } from '@/types/api'
import UpdateAddress from './components/updateAddress.vue' import UpdateAddress from './components/updateAddress.vue'
import { getAllCountryApi } from '@/api/logistics.ts' import { getAllCountryApi } from '@/api/logistics.ts'
import { InterceptStateGroupData } from '@/types/api/podUsOrder'
import TableView from '@/components/TableView.vue' import TableView from '@/components/TableView.vue'
import { import {
LogListData, LogListData,
...@@ -1927,12 +2235,291 @@ const handleRefreshAddress = async (row: PodCnOrderListData) => { ...@@ -1927,12 +2235,291 @@ const handleRefreshAddress = async (row: PodCnOrderListData) => {
}, },
) )
} }
const exceptionTypes = [
{ value: '1', label: '客户' },
{ value: '2', label: '工厂' },
]
const currentOrderIds = ref<number[]>([])
const exceptionDialogVisible = ref(false)
const exceptionFormRef = ref()
const exceptionForm = ref({
exceptionType: '',
exceptionReason: '',
})
const changeExceptionOrder = async () => {
if (selection.value.length === 0) {
return ElMessage.warning('请选择数据')
}
currentOrderIds.value = selection.value.map((item) => item.id)
exceptionDialogVisible.value = true
}
const handleExceptionConfirm = async () => {
try {
await exceptionFormRef.value.validate()
} catch {
return
}
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
const url =
status.value === 'EXCEPTION_ORDER'
? 'factory/podJomallOrderCn/distributionExceptionOrders'
: 'factory/podJomallOrderCn/exceptionOrders'
try {
const res = await changeExceptionOrderApi(
url,
currentOrderIds.value,
exceptionForm.value.exceptionType,
exceptionForm.value.exceptionReason,
)
if (res.code !== 200) return
ElMessage.success('操作成功')
search()
loadTabData()
exceptionDialogVisible.value = false
} catch (e) {
console.error(e)
} finally {
loading.close()
}
}
const completeDelivery = async () => {
if (selection.value.length === 0) {
return ElMessage.warning('请选择订单')
}
try {
await ElMessageBox.confirm('确定完成发货吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
} catch (e) {
return
}
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try {
const res = await completeDeliveryApi({
orderIdList: selection.value.map((item) => item.id),
})
if (res.code !== 200) return
resultInfo.value =
(res.data as {
id: string | number
status: boolean
factoryOrderNumber?: string
message: string
}[]) || []
if (
Array.isArray(res.data) &&
(res.data as { status: boolean }[]).some((item) => !item.status)
) {
resultRefs.value?.showDialog()
} else {
search()
loadTabData()
}
ElMessage.success('操作成功')
// search()
// loadTabData()
} catch (e) {
resultInfo.value = []
console.error(e)
} finally {
loading.close()
}
}
const statusPush = async () => {
if (selection.value.length === 0) {
return ElMessage.warning('请选择数据')
}
try {
await ElMessageBox.confirm('是否确认状态推送?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
} catch {
return
}
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try {
const res = await statusPushApi(selection.value.map((item) => item.id))
if (res.code !== 200) return
ElMessage.success('操作成功')
search()
loadTabData()
} catch (e) {
resultInfo.value = []
console.error(e)
} finally {
loading.close()
}
}
const updateOrder = async () => {
if (selection.value.length === 0) {
return ElMessage.warning('请选择数据')
}
try {
await showConfirm('确定转至待确认吗?', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
})
} catch {
return
}
const ids = selection.value.map((item) => item.id)
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try {
const res = await updateExceptionOrderApi(ids)
if (res.code !== 200) return
ElMessage.success('操作成功')
search()
loadTabData()
} catch (e) {
console.error(e)
} finally {
loading.close()
}
}
const assignOrder = async () => {
if (selection.value.length === 0) {
return ElMessage.warning('请选择数据')
}
currentOrderIds.value = selection.value.map((item) => item.id)
exceptionDialogVisible.value = true
}
const handleUpdateAddress = async (row: PodCnOrderListData) => { const handleUpdateAddress = async (row: PodCnOrderListData) => {
const { data } = await getAllCountryApi() const { data } = await getAllCountryApi()
countryList.value = data countryList.value = data
currentRow.value = JSON.parse(JSON.stringify(row)) currentRow.value = JSON.parse(JSON.stringify(row))
updateAddVisible.value = true updateAddVisible.value = true
} }
const exceptionStatus = ref(1)
const handleExceptionCommand = (command: number) => {
exceptionStatus.value = command
search()
}
const interceptCurrent = ref(1)
const interceptStatus = ref(0)
// 拦截状态改变
const interceptChange = async (status: boolean) => {
if (selection.value.length === 0) {
return ElMessage.warning('请选择数据')
}
try {
await ElMessageBox.confirm(
`确定${status ? '拦截成功' : '拦截失败'}吗?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
},
)
} catch (e) {
return
}
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
const interceptStatus = status
? interceptCurrent.value === 1
? 1
: 3
: interceptCurrent.value === 1
? 2
: 4
try {
const res = await interceptUpdateApi({
orderIds: selection.value.map((item) => item.id),
interceptStatus,
})
if (res.code !== 200) return
ElMessage.success('操作成功')
search()
loadTabData()
} catch (e) {
resultInfo.value = []
console.error(e)
} finally {
loading.close()
}
}
const rejectOrder = async (type: string) => {
if (selection.value.length === 0 && cardSelection.value.length === 0) {
return ElMessage.warning('请选择数据')
}
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try {
const { value } = await ElMessageBox.prompt('驳回确认', {
confirmButtonText: '确认',
cancelButtonText: '取消',
inputType: 'textarea',
inputPlaceholder: '驳回原因',
inputPattern: /\S+/, // 非空验证,至少一个非空白字符
inputErrorMessage: '内容不能为空',
})
const res = await rejectToApi({
orderStatus: type,
productList: selection.value.length
? selection.value.flatMap(
(item: PodCnOrderListData) => item.productList || [],
)
: cardSelection.value,
reasonStr: value,
})
if (res.code !== 200) return
resultInfo.value = res.data
resultInfo.value = resultInfo.value.filter((item) => !item.status)
if (!resultInfo.value.length) {
ElMessage.success('操作成功')
search()
loadTabData()
} else {
resultRefs.value?.showDialog()
}
} catch (e) {
console.log(e)
} finally {
loading.close()
}
}
// 拦截分页
const handleInterceptionCommand = (current: number, command: number) => {
interceptCurrent.value = current
interceptStatus.value = command
search()
loadTabData()
}
// 批量下载 下载 // 批量下载 下载
const handleDownload = async (row: PodCnOrderListData, type: string) => { const handleDownload = async (row: PodCnOrderListData, type: string) => {
try { try {
...@@ -1982,7 +2569,11 @@ const handleDownload = async (row: PodCnOrderListData, type: string) => { ...@@ -1982,7 +2569,11 @@ const handleDownload = async (row: PodCnOrderListData, type: string) => {
} }
} }
// 批量下载 删除 // 批量下载 删除
const handleBatchDelete = async (row: PodCnOrderListData) => { const handleBatchDelete = async (type: string, id?: string) => {
if (type === 'batch' && selection.value.length === 0) {
ElMessage.error('请选择要删除的数据')
return
}
try { try {
await showConfirm('确定删除吗?', { await showConfirm('确定删除吗?', {
confirmButtonText: '确认', confirmButtonText: '确认',
...@@ -1998,7 +2589,12 @@ const handleBatchDelete = async (row: PodCnOrderListData) => { ...@@ -1998,7 +2589,12 @@ const handleBatchDelete = async (row: PodCnOrderListData) => {
background: 'rgba(0, 0, 0, 0.3)', background: 'rgba(0, 0, 0, 0.3)',
}) })
try { try {
const res = await batchDownloadDeleteApi({ id: row.id }) const res = await batchDownloadDeleteApi({
ids:
type === 'batch'
? selection.value.map((item) => item.id).join(',')
: id!,
})
if (res.code !== 200) return if (res.code !== 200) return
ElMessage.success(res.message) ElMessage.success(res.message)
search() search()
...@@ -2008,6 +2604,54 @@ const handleBatchDelete = async (row: PodCnOrderListData) => { ...@@ -2008,6 +2604,54 @@ const handleBatchDelete = async (row: PodCnOrderListData) => {
loading.close() loading.close()
} }
} }
const refreshProductInformation = async () => {
if (
[
'PICKING',
'TO_BE_REPLENISHMENT',
'IN_PRODUCTION',
'TO_BE_ARRANGE',
].includes(status.value)
) {
if (cardSelection.value.length === 0) {
return ElMessage.warning('请选择数据')
}
} else {
if (selection.value.length === 0) {
return ElMessage.warning('请选择数据')
}
}
const loading = ElLoading.service({
fullscreen: true,
text: '刷新中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try {
const res = await refreshProductInformationApi({
orderIds: !['PICKING', 'TO_BE_REPLENISHMENT', 'IN_PRODUCTION'].includes(
status.value,
)
? selection.value.map((item) => item.id).join(',')
: undefined,
productIds: [
'PICKING',
'TO_BE_REPLENISHMENT',
'IN_PRODUCTION',
'TO_BE_ARRANGE',
].includes(status.value)
? cardSelection.value.map((item) => item.id).join(',')
: undefined,
})
if (res.code !== 200) return
ElMessage.success('刷新成功')
search()
cardSelection.value = []
} catch (e) {
console.error(e)
} finally {
loading.close()
}
}
// 批量下载 重新排版 // 批量下载 重新排版
const handleReComposingDesign = async (row: PodCnOrderListData) => { const handleReComposingDesign = async (row: PodCnOrderListData) => {
try { try {
...@@ -2227,10 +2871,39 @@ const onCellStyle = ({ column }: { column: Column }) => { ...@@ -2227,10 +2871,39 @@ const onCellStyle = ({ column }: { column: Column }) => {
return { verticalAlign: 'top' } return { verticalAlign: 'top' }
} }
} }
const interceptionStatus = ref<InterceptStateGroupData>({
shipment: {},
production: {},
})
const loadTabData = async () => { const loadTabData = async () => {
try { try {
const res = await getOrderTabData() const res = await getOrderTabData()
tabsNav.value = res.data tabsNav.value = res.data
// 获取拦截数量
const statusRes = await getgetInterceptStateGroupList()
interceptionStatus.value = statusRes.data as InterceptStateGroupData
// 在 已完成 后面添加 拦截 标签页
const completeIndex = tabsNav.value.findIndex(
(item: Tab) => item.status === 'COMPLETE',
)
// 计算拦截总数)
const calculateTotal = (data: Record<string, number>): number => {
return Object.values(data).reduce(
(sum, value) => sum + (Number(value) || 0),
0,
)
}
const totalIntercepted =
calculateTotal(statusRes.data.shipment) +
calculateTotal(statusRes.data.production)
tabsNav.value.splice(completeIndex + 1, 0, {
status: 'INTERCEPTED',
statusName: '拦截',
quantity: totalIntercepted,
})
} catch (error) { } catch (error) {
// showError(error) // showError(error)
} }
...@@ -2629,6 +3302,9 @@ const inputBlur = () => { ...@@ -2629,6 +3302,9 @@ const inputBlur = () => {
} }
search() search()
} }
const handleExceptionDialogOpen = () => {
exceptionFormRef.value.resetFields()
}
const cancelOrder = async () => { const cancelOrder = async () => {
if (selection.value.length === 0) { if (selection.value.length === 0) {
return ElMessage.warning('请选择数据') return ElMessage.warning('请选择数据')
......
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