修改订单复核页面

This commit is contained in:
zm2000 2026-08-30 18:31:53 +08:00
parent 0274ce46aa
commit d7638e8668
2 changed files with 92 additions and 28 deletions

View File

@ -149,3 +149,25 @@ export function fetchPrintList(
options
)
}
/**
* 订单复核-确认拦截(order.recheckOrder.confirmIntercept)
* 通过订单 ID 列表批量匹配订单,将拦截状态更新为 intercepted_at_warehouse(仓库已拦截),
* 同步标记运单退回与拦截、释放储位分配与订单锁,并创建售后工单 + 通知快递群。
* 仅拦截当前指定订单,不波及波次内其他订单。
* @param params.ids 订单 ID 列表,支持数组或以逗号分隔的字符串;兼容 id/order_id/orderId 单值写法
* 响应:success 成功列表 / failed 失败列表(含失败原因)/ success_count / failed_count
*/
export function confirmIntercept(
params: { ids: Array<number | string> | string },
options?: RequestOptions
) {
return request<ApiBody>(
'order.recheckOrder.confirmIntercept',
{
...workerPayload,
...params,
},
options
)
}

View File

@ -44,7 +44,7 @@
<text class="table-cell cell-wave-index">{{ formatWaveIndex(item) }}</text>
<text class="table-cell cell-wave-no">{{ getScanOrderNo(item) }}</text>
<text :class="['table-cell', 'cell-print-status', getWavePrintStatus(item) === '未打印' ? 'cell-print-status--unprinted' : '']">{{ getWavePrintStatus(item) }}</text>
<view v-if="isIntercepted(item)" class="cell-intercept" @click.stop="handleIntercept(item)">拦截</view>
<view v-if="isIntercepted(item)" class="cell-intercept">拦截</view>
</view>
</view>
</scroll-view>
@ -228,7 +228,7 @@
<script>
import TopNav from '@/components/top-nav.vue'
import { scanReviewOrder, scanReviewTask, fetchPrintList } from '@/api/order'
import { scanReviewOrder, scanReviewTask, fetchPrintList, confirmIntercept } from '@/api/order'
// 扫码枪识别参数
// 无回车结束符时:停止输入超过该毫秒数视为一次完整扫码,自动提交
@ -1008,16 +1008,68 @@ export default {
this.storeRemark = this.getRowValue(source, ['store_remark', 'storeRemark']) || ''
},
handleConfirmReview() {
// 拦截确认模式下,执行确认拦截;否则执行确认复核
// 拦截确认模式下,弹窗确认后执行拦截;否则执行确认复核
if (this.interceptMode) {
const orderNo = this.interceptTarget?.orderNo || this.selectedOrderNo || ''
uni.showToast({ title: `确认拦截:${orderNo}`, icon: 'none' })
this.interceptMode = false
this.interceptTarget = null
uni.showModal({
title: '确认拦截',
content: `确认对订单「${orderNo}」执行拦截操作?`,
confirmText: '确定',
cancelText: '取消',
success: (res) => {
if (res.confirm) {
this.doConfirmIntercept()
}
},
})
return
}
uni.showToast({ title: '确认复核', icon: 'none' })
},
// 执行确认拦截:调用 order.recheckOrder.confirmIntercept
async doConfirmIntercept() {
const orderNo = this.interceptTarget?.orderNo || this.selectedOrderNo || ''
const orderId = this.interceptTarget?.orderId ?? ''
if (orderId === '' || orderId === null || orderId === undefined) {
uni.showToast({ title: '订单ID为空,无法拦截', icon: 'none' })
return
}
try {
const body = await confirmIntercept({ ids: [orderId] })
const payload = body?.data || body?.result || body || {}
const successList = Array.isArray(payload?.success) ? payload.success : []
const failedList = Array.isArray(payload?.failed) ? payload.failed : []
const successCount =
payload?.success_count != null ? Number(payload.success_count) : successList.length
const failedCount =
payload?.failed_count != null ? Number(payload.failed_count) : failedList.length
if (failedCount > 0) {
const reasons = failedList
.map((f) => {
const id = f?.order_id ?? f?.orderId ?? f?.id ?? ''
const reason = f?.reason ?? f?.msg ?? f?.message ?? ''
return `订单${id}${reason ? `:${reason}` : ''}`
})
.join('\n')
uni.showModal({
title: '拦截结果',
content: `成功 ${successCount} 单,失败 ${failedCount} 单${reasons ? `\n失败原因:\n${reasons}` : ''}`,
showCancel: false,
confirmText: '确定',
})
} else {
uni.showToast({ title: `拦截成功:${successCount} 单`, icon: 'none' })
}
// 拦截完成,退出拦截确认模式
this.interceptMode = false
this.interceptTarget = null
} catch (error) {
// 接口调用失败:保留拦截确认模式,便于重试
uni.showToast({ title: '拦截失败,请重试', icon: 'none' })
}
},
handleClear() {
this.scanOrderList = []
this.activeKeyword = ''
@ -1229,22 +1281,6 @@ export default {
const src = this.getScanOrderSource(item)
return this.getRowValue(src, ['intercept_status', 'interceptStatus']) === 'requested'
},
// 拦截按钮点击:进入拦截确认模式,确认按钮变为"确认拦截"
handleIntercept(item) {
// 选中该订单,右侧展示明细
this.handleScanOrderClick(item)
const src = this.getScanOrderSource(item)
const orderNo = this.getScanOrderNo(item) || this.getRowValue(src, ['order_id', 'orderId'])
this.interceptMode = true
this.interceptTarget = {
orderNo,
orderId: this.getRowValue(src, ['order_id', 'orderId']),
}
uni.showToast({
title: `已进入拦截确认:${orderNo}`,
icon: 'none',
})
},
handleScanOrderClick(item) {
// 切换选中订单时退出拦截确认模式
this.interceptMode = false
@ -1274,6 +1310,17 @@ export default {
this.currentWaybillInfo = null
this.displayOrders = (inlineItems || []).map((inlineItem) => this.normalizeOrderDetailItem(inlineItem))
this.syncDetailStats(src, this.displayOrders)
// 该行有拦截标识时:点击行即进入拦截确认模式(顶部确认按钮变为"确认拦截")
if (this.isIntercepted(item)) {
const orderNo = this.getScanOrderNo(item) || this.getRowValue(src, ['order_id', 'orderId'])
this.interceptMode = true
this.interceptTarget = {
orderNo,
orderId: this.getScanOrderId(item),
}
uni.showToast({ title: `已进入拦截确认:${orderNo}`, icon: 'none' })
}
},
getWaveKey(wave) {
return String(this.getRowValue(wave, ['wave_id', 'waveId', 'wave_no', 'waveNo']) || '')
@ -1905,7 +1952,7 @@ export default {
color: #34c759;
}
/* 左侧列表:拦截按钮(intercept_status=requested 时显示) */
/* 左侧列表:拦截标识(intercept_status=requested 时显示;点击整行进入拦截确认) */
.cell-intercept {
flex-shrink: 0;
height: 40rpx;
@ -1916,14 +1963,9 @@ export default {
color: #fff;
background-color: #e64340;
border-radius: 8rpx;
cursor: pointer;
user-select: none;
}
.cell-intercept:active {
background-color: #c9302c;
}
/* 左侧订单/波次列表:整行内容完整显示不省略;需换行时优先对运单号/波次号列换行 */
.table-wrap--current-wave .table-cell:not(.cell-wave-no) {
white-space: nowrap;