Commit 5b734766 by qinjianhui

feat: 工厂订单挂起状态增加拦截成功和拦截失败功能

parent ff5bc346
...@@ -590,3 +590,20 @@ export function exportFactoryOrderInfo(data: ExportParams) { ...@@ -590,3 +590,20 @@ export function exportFactoryOrderInfo(data: ExportParams) {
data, data,
) )
} }
export function interceptUpdateApi(ids: (string | number)[]) {
return axios.post<never, BaseRespData<never>>(
'factory/podOrder/interceptUpdate',
ids,
)
}
export function interceptSuccessApi(data: {
ids: (string | number)[]
interceptType: number
}) {
return axios.post<never, BaseRespData<never>>(
'factory/podOrder/interceptSuccess',
data,
)
}
...@@ -384,10 +384,7 @@ ...@@ -384,10 +384,7 @@
}} }}
</ElButton> </ElButton>
</span> </span>
<span <span v-if="status === 'PENDING_RECEIVE'" class="item">
v-if="status === 'PENDING_RECEIVE' || status === 'SUSPEND'"
class="item"
>
<ElButton type="danger" @click="handleCancelOrder">取消订单</ElButton> <ElButton type="danger" @click="handleCancelOrder">取消订单</ElButton>
</span> </span>
...@@ -571,6 +568,16 @@ ...@@ -571,6 +568,16 @@
> >
</span> </span>
<span class="item"> <span class="item">
<ElButton type="success" @click="handleInterceptionSuccess"
>拦截成功</ElButton
>
</span>
<span class="item">
<ElButton type="danger" @click="handleInterceptionFail"
>拦截失败</ElButton
>
</span>
<span class="item">
<ElButton type="primary" @click="handleSyncAddress" <ElButton type="primary" @click="handleSyncAddress"
>同步收货地址</ElButton >同步收货地址</ElButton
> >
...@@ -916,6 +923,53 @@ ...@@ -916,6 +923,53 @@
@success="() => refreshCurrentView({ isRefreshTree: true })" @success="() => refreshCurrentView({ isRefreshTree: true })"
/> />
<ElDialog <ElDialog
v-model="interceptSuccessDialogVisible"
title="提示"
width="480px"
:close-on-click-modal="false"
>
<ElForm ref="interceptSuccessFormRef" :model="interceptSuccessForm">
<ElFormItem
label="拦截成功类型"
prop="interceptType"
:rules="[
{
required: true,
message: '请选择拦截成功类型',
trigger: 'change',
},
]"
>
<ElSelect
v-model="interceptSuccessForm.interceptType"
placeholder="请选择"
style="width: 100%"
clearable
>
<ElOption
v-for="opt in interceptSuccessTypeOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value"
/>
</ElSelect>
</ElFormItem>
</ElForm>
<p style="padding-left: 12px">
拦截成功,订单会流转到已取消,确认是否通过拦截申请?
</p>
<template #footer>
<div class="dialog-footer" style="text-align: center">
<ElButton @click="interceptSuccessDialogVisible = false"
>取消</ElButton
>
<ElButton type="primary" @click="submitInterceptSuccess"
>确定</ElButton
>
</div>
</template>
</ElDialog>
<ElDialog
v-model="exportVisible" v-model="exportVisible"
title="导出选项" title="导出选项"
width="500px" width="500px"
...@@ -989,6 +1043,8 @@ import { ...@@ -989,6 +1043,8 @@ import {
statusPushApi, statusPushApi,
arrangeFinishApi, arrangeFinishApi,
exportFactoryOrderInfo, exportFactoryOrderInfo,
interceptUpdateApi,
interceptSuccessApi,
} from '@/api/factoryOrderNew' } from '@/api/factoryOrderNew'
import { getLogisticsWayApi } from '@/api/podUsOrder' import { getLogisticsWayApi } from '@/api/podUsOrder'
import BigNumber from 'bignumber.js' import BigNumber from 'bignumber.js'
...@@ -1035,6 +1091,16 @@ const exportForm = ref({ ...@@ -1035,6 +1091,16 @@ const exportForm = ref({
resource: '', resource: '',
}) })
const interceptSuccessDialogVisible = ref(false)
const interceptSuccessFormRef = ref()
const interceptSuccessTypeOptions = [
{ label: '生产拦截成功', value: 1 },
{ label: '发货拦截成功', value: 2 },
]
const interceptSuccessForm = ref<{ interceptType: number | undefined }>({
interceptType: undefined,
})
const { const {
userMarkList, userMarkList,
receiverCountryList, receiverCountryList,
...@@ -2483,6 +2549,54 @@ const getLogisticsWay = async () => { ...@@ -2483,6 +2549,54 @@ const getLogisticsWay = async () => {
const { data } = await getLogisticsWayApi() const { data } = await getLogisticsWayApi()
logisticsWayList.value = data logisticsWayList.value = data
} }
const handleInterceptionSuccess = () => {
if (!ensureSelection()) return
interceptSuccessForm.value.interceptType = undefined
interceptSuccessDialogVisible.value = true
nextTick(() => interceptSuccessFormRef.value?.clearValidate())
}
const submitInterceptSuccess = async () => {
const form = interceptSuccessFormRef.value
if (!form) return
try {
await form.validate()
} catch {
return
}
const interceptType = interceptSuccessForm.value.interceptType
if (interceptType === undefined) return
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try {
const res = await interceptSuccessApi({
ids: getSelectedIds(),
interceptType,
})
if (res.code !== 200) return
ElMessage.success('操作成功')
interceptSuccessDialogVisible.value = false
refreshCurrentView({ isRefreshTree: true })
} catch (e) {
console.error(e)
} finally {
loading.close()
}
}
const handleInterceptionFail = async () => {
await executeBatchAction({
getIds: getSelectedIds,
api: (ids) => interceptUpdateApi(ids as number[]),
confirmText: '拦截失败,订单会恢复到拦截前的状态,确认是否拒绝拦截申请?',
successText: '拦截失败成功',
})
}
onMounted(() => { onMounted(() => {
loadStatusTreeCounts() loadStatusTreeCounts()
loadAllDictionaries() loadAllDictionaries()
......
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