Commit d5ac8e57 by wuqian

订单的loading放在点击原因弹窗后

parent 166291a2
......@@ -3619,38 +3619,40 @@ const interceptChange = async (status: boolean) => {
}
}
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)',
})
const targets = selection.value.length
? selection.value.flatMap((v: PodCnOrderListData) => v.productList || [])
: cardSelection.value
if (!targets.length) return ElMessage.warning('请选择数据')
let reason = ''
try {
const { value } = await ElMessageBox.prompt('驳回确认', {
const { value } = await ElMessageBox.prompt<string>('驳回确认', {
confirmButtonText: '确认',
cancelButtonText: '取消',
inputType: 'textarea',
inputPlaceholder: '驳回原因',
inputPattern: /\S+/, // 非空验证,至少一个非空白字符
inputPattern: /\S+/,
inputErrorMessage: '内容不能为空',
})
reason = value.trim()
} catch {
return
}
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try {
const res = await rejectToApi({
orderStatus: type,
productList: selection.value.length
? selection.value.flatMap(
(item: PodCnOrderListData) => item.productList || [],
)
: cardSelection.value,
reasonStr: value,
productList: targets,
reasonStr: reason,
})
if (res.code !== 200) return
resultInfo.value = res.data
resultInfo.value = resultInfo.value.filter((item) => !item.status)
if (res.code !== 200) return
resultInfo.value = (res.data || []).filter((item) => !item.status)
if (!resultInfo.value.length) {
ElMessage.success('操作成功')
search()
......@@ -3658,8 +3660,6 @@ const rejectOrder = async (type: string) => {
} else {
resultRefs.value?.showDialog()
}
} catch (e) {
console.log(e)
} finally {
loading.close()
}
......
......@@ -5594,38 +5594,38 @@ const getOrderByIdApi = async (type: string) => {
// 驳回
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)',
})
const targets = selection.value.length
? selection.value.flatMap((v: PodUsOrderListData) => v.productList || [])
: cardSelection.value
if (!targets.length) return ElMessage.warning('请选择数据')
let reason = ''
try {
const { value } = await ElMessageBox.prompt('驳回确认', {
const { value } = await ElMessageBox.prompt<string>('驳回确认', {
confirmButtonText: '确认',
cancelButtonText: '取消',
inputType: 'textarea',
inputPlaceholder: '驳回原因',
inputPattern: /\S+/, // 非空验证,至少一个非空白字符
inputPattern: /\S+/,
inputErrorMessage: '内容不能为空',
})
reason = value.trim()
} catch {
return
}
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try {
const res = await rejectToApi({
orderStatus: type,
productList: selection.value.length
? selection.value.flatMap(
(item: PodUsOrderListData) => item.productList || [],
)
: cardSelection.value,
reasonStr: value,
productList: targets,
reasonStr: reason,
})
if (res.code !== 200) return
resultInfo.value = res.data
resultInfo.value = resultInfo.value.filter((item) => !item.status)
resultInfo.value = (res.data || []).filter((item) => !item.status)
if (!resultInfo.value.length) {
ElMessage.success('操作成功')
search()
......@@ -5633,8 +5633,6 @@ const rejectOrder = async (type: string) => {
} else {
resultRefs.value?.showDialog()
}
} catch (e) {
console.log(e)
} finally {
loading.close()
}
......
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