Commit d5ac8e57 by wuqian

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

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