feat: 新增退回收件登记页面(returnReceived) & 售后详情/文案调整
This commit is contained in:
parent
b3be2e11e6
commit
40ea445e4f
129
src/api/returnReceived/index.ts
Normal file
129
src/api/returnReceived/index.ts
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
const v = '1.0'
|
||||||
|
|
||||||
|
// ============ returnReceived.create ============
|
||||||
|
|
||||||
|
/** returnReceived.create 请求参数 */
|
||||||
|
export type ReturnReceivedCreateParams = {
|
||||||
|
/** 退回收件运单号(扫描到的退回包裹单号) */
|
||||||
|
waybill_code: string
|
||||||
|
/** 备注 */
|
||||||
|
remark?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/** returnReceived.create:退回包裹扫码登记(30日内同仓库同单号幂等,以第一次为准) */
|
||||||
|
export function returnReceivedCreate(data: ReturnReceivedCreateParams): Promise<any> {
|
||||||
|
return request({
|
||||||
|
url: '/system',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
method: 'returnReceived.create',
|
||||||
|
v,
|
||||||
|
timestamp: new Date().getTime()
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============ returnReceived.list ============
|
||||||
|
|
||||||
|
/** returnReceived.list 的 where 筛选条件 */
|
||||||
|
export type ReturnReceivedListWhere = {
|
||||||
|
/** 退回收件运单号(模糊搜索,传 {operator:'like',value} 或直接值) */
|
||||||
|
waybill_code?: string | { operator: string; value: any }
|
||||||
|
/** 扫描日期范围 { operator:'between'|'gte'|'lte', value:[start,end] 或单值 } */
|
||||||
|
scan_date?: { operator: 'between' | 'gte' | 'lte'; value: [string, string] | string }
|
||||||
|
/** 扫描人员工号ID(等值) */
|
||||||
|
scanner_id?: number
|
||||||
|
/** 货主ID(等值) */
|
||||||
|
store_id?: number
|
||||||
|
/** 是否原单退回:true=有关联原运单,false=无关联 */
|
||||||
|
is_original_return?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
/** returnReceived.list 排序参数 */
|
||||||
|
export type ReturnReceivedListSort = {
|
||||||
|
/** 排序字段:id / scan_date / created_at / updated_at / waybill_code */
|
||||||
|
sortField?: 'id' | 'scan_date' | 'created_at' | 'updated_at' | 'waybill_code'
|
||||||
|
/** 排序方向:asc / desc */
|
||||||
|
sortOrder?: 'asc' | 'desc'
|
||||||
|
}
|
||||||
|
|
||||||
|
/** returnReceived.list 请求参数 */
|
||||||
|
export type ReturnReceivedListParams = {
|
||||||
|
pagination?: { page?: number; pageSize?: number }
|
||||||
|
where?: ReturnReceivedListWhere
|
||||||
|
sort?: ReturnReceivedListSort
|
||||||
|
}
|
||||||
|
|
||||||
|
/** returnReceived.list:退回收到登记分页列表(仓库隔离,服务端注入 warehouse_id) */
|
||||||
|
export function returnReceivedList(data: ReturnReceivedListParams = {}): Promise<any> {
|
||||||
|
return request({
|
||||||
|
url: '/system',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
method: 'returnReceived.list',
|
||||||
|
v,
|
||||||
|
timestamp: new Date().getTime()
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============ returnReceived.detail ============
|
||||||
|
|
||||||
|
/** returnReceived.detail 请求参数 */
|
||||||
|
export type ReturnReceivedDetailParams = {
|
||||||
|
/** 登记记录主键ID */
|
||||||
|
id: number
|
||||||
|
}
|
||||||
|
|
||||||
|
/** returnReceived.detail:退回收到登记详情(含原运单与货主合约备注,命中时) */
|
||||||
|
export function returnReceivedDetail(data: ReturnReceivedDetailParams): Promise<any> {
|
||||||
|
return request({
|
||||||
|
url: '/system',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
method: 'returnReceived.detail',
|
||||||
|
v,
|
||||||
|
timestamp: new Date().getTime()
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============ returnReceived.delete ============
|
||||||
|
|
||||||
|
/** returnReceived.delete 请求参数 */
|
||||||
|
export type ReturnReceivedDeleteParams = {
|
||||||
|
/** 登记记录主键ID */
|
||||||
|
id: number
|
||||||
|
}
|
||||||
|
|
||||||
|
/** returnReceived.delete:删除退回收到登记记录(物理删除,仅本仓库记录) */
|
||||||
|
export function returnReceivedDelete(data: ReturnReceivedDeleteParams): Promise<any> {
|
||||||
|
return request({
|
||||||
|
url: '/system',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
method: 'returnReceived.delete',
|
||||||
|
v,
|
||||||
|
timestamp: new Date().getTime()
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============ 模块导出 ============
|
||||||
|
|
||||||
|
export const returnReceivedModule = {
|
||||||
|
create: returnReceivedCreate,
|
||||||
|
list: returnReceivedList,
|
||||||
|
detail: returnReceivedDetail,
|
||||||
|
delete: returnReceivedDelete
|
||||||
|
}
|
||||||
@ -77,15 +77,6 @@ export default {
|
|||||||
'waybill':'waybill',
|
'waybill':'waybill',
|
||||||
'inbox_messages':'messages',
|
'inbox_messages':'messages',
|
||||||
'inbox_groups':'groups',
|
'inbox_groups':'groups',
|
||||||
'':'',
|
|
||||||
'':'',
|
|
||||||
'':'',
|
|
||||||
'':'',
|
|
||||||
'':'',
|
|
||||||
'':'',
|
|
||||||
'':'',
|
|
||||||
'':'',
|
|
||||||
'':'',
|
|
||||||
},
|
},
|
||||||
"login": {
|
"login": {
|
||||||
"title": "Login",
|
"title": "Login",
|
||||||
|
|||||||
@ -80,13 +80,6 @@ export default {
|
|||||||
'waybill':'运单',
|
'waybill':'运单',
|
||||||
'inbox_messages':'消息',
|
'inbox_messages':'消息',
|
||||||
'inbox_groups':'群组',
|
'inbox_groups':'群组',
|
||||||
'':'',
|
|
||||||
'':'',
|
|
||||||
'':'',
|
|
||||||
'':'',
|
|
||||||
'':'',
|
|
||||||
'':'',
|
|
||||||
'':'',
|
|
||||||
},
|
},
|
||||||
"login": {
|
"login": {
|
||||||
"title": "登录",
|
"title": "登录",
|
||||||
|
|||||||
@ -68,6 +68,9 @@ export const componentMap: Record<string, any> = {
|
|||||||
'data/packingflow': () => import('@/views/data/packingflow/index.vue'),
|
'data/packingflow': () => import('@/views/data/packingflow/index.vue'),
|
||||||
'system/setting/printcomputer/index':() => import('@/views/system/setting/printcomputer/index.vue'),
|
'system/setting/printcomputer/index':() => import('@/views/system/setting/printcomputer/index.vue'),
|
||||||
'express/index':() => import('@/views/express/waybill/index.vue'),
|
'express/index':() => import('@/views/express/waybill/index.vue'),
|
||||||
|
/** 退回收件登记 */
|
||||||
|
'express/returnReceived/index':() => import('@/views/express/returnReceived/index.vue'),
|
||||||
|
'express/returnReceived':() => import('@/views/express/returnReceived/index.vue'),
|
||||||
'system/setting/storeExpressBindingPolicy/index':() => import('@/views/system/setting/storeExpressBindingPolicy/index.vue'),
|
'system/setting/storeExpressBindingPolicy/index':() => import('@/views/system/setting/storeExpressBindingPolicy/index.vue'),
|
||||||
'inbox/message/index': () => import('@/views/inbox/message/index.vue'),
|
'inbox/message/index': () => import('@/views/inbox/message/index.vue'),
|
||||||
'inbox/group/index': () => import('@/views/inbox/group/index.vue'),
|
'inbox/group/index': () => import('@/views/inbox/group/index.vue'),
|
||||||
|
|||||||
@ -135,6 +135,8 @@
|
|||||||
<el-descriptions-item label="平台单号" :span="2">{{ detail.related.order.source_order_codes }}</el-descriptions-item>
|
<el-descriptions-item label="平台单号" :span="2">{{ detail.related.order.source_order_codes }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="商品总数">{{ detail.related.order.items_total }}</el-descriptions-item>
|
<el-descriptions-item label="商品总数">{{ detail.related.order.items_total }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="总重(g)">{{ detail.related.order.items_weight }}</el-descriptions-item>
|
<el-descriptions-item label="总重(g)">{{ detail.related.order.items_weight }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="订单总金额">{{ formatMoney((detail.related.order as any).total_amount) }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="商品总金额">{{ formatMoney((detail.related.order as any).item_amount) }}</el-descriptions-item>
|
||||||
</el-descriptions>
|
</el-descriptions>
|
||||||
<!-- 操作状态 -->
|
<!-- 操作状态 -->
|
||||||
<div class="status-bar">
|
<div class="status-bar">
|
||||||
@ -280,6 +282,11 @@ const claimStatusLabel = (c: string) => CLAIM_STATUS_MAP[c] ?? c ?? '-'
|
|||||||
const claimStatusTagType = (c: string) => CLAIM_STATUS_TAG_MAP[c] ?? 'info'
|
const claimStatusTagType = (c: string) => CLAIM_STATUS_TAG_MAP[c] ?? 'info'
|
||||||
const parseOperatorName = (s: string) => { try { const o = JSON.parse(s); return o.name || o.id || '-' } catch { return s || '-' } }
|
const parseOperatorName = (s: string) => { try { const o = JSON.parse(s); return o.name || o.id || '-' } catch { return s || '-' } }
|
||||||
const statusTimelineType = (s: any) => ({ pending: 'warning', processing: 'primary', completed: 'success', closed: 'info' } as any)[s] ?? 'info'
|
const statusTimelineType = (s: any) => ({ pending: 'warning', processing: 'primary', completed: 'success', closed: 'info' } as any)[s] ?? 'info'
|
||||||
|
const formatMoney = (v: any) => {
|
||||||
|
if (v === null || v === undefined || v === '') return '-'
|
||||||
|
const n = Number(v)
|
||||||
|
return isNaN(n) ? '-' : '¥' + n.toFixed(2)
|
||||||
|
}
|
||||||
|
|
||||||
// ==================== 订单操作状态映射 ====================
|
// ==================== 订单操作状态映射 ====================
|
||||||
const ORDER_OP_LABELS: Record<string, Record<string, string>> = {
|
const ORDER_OP_LABELS: Record<string, Record<string, string>> = {
|
||||||
@ -290,11 +297,29 @@ const ORDER_OP_LABELS: Record<string, Record<string, string>> = {
|
|||||||
pick: { none: '未拣货', padding: '拣货中', fin: '已拣货' },
|
pick: { none: '未拣货', padding: '拣货中', fin: '已拣货' },
|
||||||
pack: { none: '未打包', padding: '打包中', fin: '已打包' },
|
pack: { none: '未打包', padding: '打包中', fin: '已打包' },
|
||||||
post: { none: '未分配运单号', padding: '分配中', fin: '已分配运单号', timeout: '超时', error: '错误' },
|
post: { none: '未分配运单号', padding: '分配中', fin: '已分配运单号', timeout: '超时', error: '错误' },
|
||||||
intercept:{ none: '未拦截', pending: '待拦截', success: '已拦截' },
|
intercept:{
|
||||||
|
none: '无拦截',
|
||||||
|
requesting: '请求拦截中',
|
||||||
|
requested: '已请求拦截',
|
||||||
|
intercepting: '拦截执行中',
|
||||||
|
intercepted_in_transit: '运输途中已拦截',
|
||||||
|
intercepted_at_warehouse: '仓库已拦截',
|
||||||
|
returning: '退回中',
|
||||||
|
returned: '已退回',
|
||||||
|
delivered_by_mistake: '误派送',
|
||||||
|
timeout: '拦截超时',
|
||||||
|
cancelled: '已取消拦截',
|
||||||
|
failed: '拦截失败',
|
||||||
|
exception: '拦截异常',
|
||||||
|
},
|
||||||
}
|
}
|
||||||
const ORDER_OP_TAGS: Record<string, string> = {
|
const ORDER_OP_TAGS: Record<string, string> = {
|
||||||
fin: 'success', padding: 'warning', pedding: 'warning', pending: 'warning',
|
fin: 'success', padding: 'warning', pedding: 'warning', pending: 'warning',
|
||||||
none: 'info', error: 'danger', timeout: 'danger', reject: 'danger', success: 'success',
|
none: 'info', error: 'danger', timeout: 'danger', reject: 'danger', success: 'success',
|
||||||
|
requesting: 'warning', requested: 'warning', intercepting: 'warning',
|
||||||
|
intercepted_in_transit: 'success', intercepted_at_warehouse: 'success',
|
||||||
|
returning: 'warning', returned: 'success',
|
||||||
|
delivered_by_mistake: 'danger', cancelled: 'info', failed: 'danger', exception: 'danger',
|
||||||
}
|
}
|
||||||
function orderOpLabel(cat: string, val: string) { return ORDER_OP_LABELS[cat]?.[val] ?? val ?? '-' }
|
function orderOpLabel(cat: string, val: string) { return ORDER_OP_LABELS[cat]?.[val] ?? val ?? '-' }
|
||||||
function orderOpTag(val: string) { return ORDER_OP_TAGS[val] ?? 'info' }
|
function orderOpTag(val: string) { return ORDER_OP_TAGS[val] ?? 'info' }
|
||||||
|
|||||||
520
src/views/express/returnReceived/index.vue
Normal file
520
src/views/express/returnReceived/index.vue
Normal file
@ -0,0 +1,520 @@
|
|||||||
|
<template>
|
||||||
|
<div class="order-sub-container">
|
||||||
|
<scan-box
|
||||||
|
ref="scanBox"
|
||||||
|
cache-key="express:returnReceived"
|
||||||
|
width="220px"
|
||||||
|
:tree-props="{ children: 'children', label: 'label' }"
|
||||||
|
:auto-submit="false"
|
||||||
|
:available-fields="availableFields"
|
||||||
|
@condition-change="handleConditionChange"
|
||||||
|
@reset="handleConditionReset"
|
||||||
|
@condition-clear="handleConditionClear"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div class="main-content">
|
||||||
|
<div class="toolbar">
|
||||||
|
<div class="toolbar-left">
|
||||||
|
<order-toolbar-button-group
|
||||||
|
:buttons="toolbarButtons"
|
||||||
|
:resolve-disabled="resolveButtonDisabled"
|
||||||
|
:resolve-loading="resolveButtonLoading"
|
||||||
|
:resolve-label="resolveButtonLabel"
|
||||||
|
:layout-key="toolbarLayoutKey"
|
||||||
|
@action="handleToolbarButtonClick"
|
||||||
|
/>
|
||||||
|
<el-divider direction="vertical" />
|
||||||
|
<div class="scan-register">
|
||||||
|
<el-input
|
||||||
|
v-model="registerForm.waybillCode"
|
||||||
|
size="small"
|
||||||
|
class="register-input"
|
||||||
|
placeholder="退回运单号(扫码/输入)"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleRegister"
|
||||||
|
/>
|
||||||
|
<el-input
|
||||||
|
v-model="registerForm.remark"
|
||||||
|
size="small"
|
||||||
|
class="register-remark"
|
||||||
|
placeholder="备注(可选)"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleRegister"
|
||||||
|
/>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
:loading="registerLoading"
|
||||||
|
@click="handleRegister"
|
||||||
|
>扫码登记</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="split-stack">
|
||||||
|
<div class="upper-wrapper">
|
||||||
|
<upper-table
|
||||||
|
ref="upperTable"
|
||||||
|
title="退回收件登记列表"
|
||||||
|
default-align="center"
|
||||||
|
table-id="express-returnReceived-list"
|
||||||
|
:data="tableData"
|
||||||
|
:columns="columns"
|
||||||
|
:table-size="tableSize"
|
||||||
|
:pagination="upperPagination"
|
||||||
|
:show-index="true"
|
||||||
|
:show-actions="true"
|
||||||
|
:enable-column-config="true"
|
||||||
|
:loading="loading"
|
||||||
|
:query-time="queryTime"
|
||||||
|
@current-change="handleRowClick"
|
||||||
|
@page-change="handlePageChange"
|
||||||
|
@page-size-change="handlePageSizeChange"
|
||||||
|
@refresh="handleRefresh"
|
||||||
|
@sort-change="handleSortChange"
|
||||||
|
>
|
||||||
|
<template #column-is_original_return="{ row }">
|
||||||
|
<el-tag :type="row.is_original_return ? 'success' : 'info'" size="small">
|
||||||
|
{{ row.is_original_return ? '是' : '否' }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #column-order_express_id="{ row }">
|
||||||
|
<span v-if="row.order_express_id != null">{{ row.order_express_id }}</span>
|
||||||
|
<span v-else>-</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #column-order_id="{ row }">
|
||||||
|
<span v-if="row.order_id != null">{{ row.order_id }}</span>
|
||||||
|
<span v-else>-</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #column-actions="{ row }">
|
||||||
|
<div class="wave-operation-actions">
|
||||||
|
<el-button size="small" type="primary" link @click.stop="handleViewDetail(row)">详情</el-button>
|
||||||
|
<el-button size="small" type="danger" link @click.stop="handleDelete(row)">删除</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #empty>
|
||||||
|
<div class="empty-tip">暂无退回收件登记数据</div>
|
||||||
|
</template>
|
||||||
|
</upper-table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ========== 详情弹窗 ========== -->
|
||||||
|
<el-dialog v-model="detailVisible" title="退回收件登记详情" width="860px" destroy-on-close align-center>
|
||||||
|
<div v-loading="detailLoading" class="detail-content">
|
||||||
|
<template v-if="detailData">
|
||||||
|
<!-- 登记记录 -->
|
||||||
|
<el-descriptions title="登记信息" :column="3" border size="small" class="detail-section">
|
||||||
|
<el-descriptions-item label="登记ID">{{ detailData.record?.id ?? '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="退回运单号">{{ detailData.record?.waybill_code ?? '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="扫描日期">{{ formatTime(detailData.record?.scan_date) }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="扫描人员工号">{{ detailData.record?.scanner_id ?? '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="扫描人员">{{ detailData.record?.scanner_name ?? '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="是否原单退回">
|
||||||
|
<el-tag :type="detailData.record?.is_original_return ? 'success' : 'info'" size="small">
|
||||||
|
{{ detailData.record?.is_original_return ? '是' : '否' }}
|
||||||
|
</el-tag>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="原运单ID">{{ detailData.record?.order_express_id ?? '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="原订单ID">{{ detailData.record?.order_id ?? '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="货主备注">{{ detailData.record?.store_remark || '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="登记时间">{{ formatTime(detailData.record?.created_at) }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="备注" :span="3">{{ detailData.record?.remark || '-' }}</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
|
||||||
|
<!-- 原运单 -->
|
||||||
|
<el-descriptions v-if="detailData.order_express" title="原运单" :column="3" border size="small" class="detail-section">
|
||||||
|
<el-descriptions-item label="运单ID">{{ detailData.order_express.id ?? '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="运单号">{{ detailData.order_express.waybill_code ?? '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="订单ID">{{ detailData.order_express.order_id ?? '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="货主ID">{{ detailData.order_express.store_id ?? '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="仓库ID">{{ detailData.order_express.warehouse_id ?? '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="物流公司">{{ detailData.order_express.logistics_name ?? '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="物流编码">{{ detailData.order_express.logistics_code ?? '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="是否退回">{{ formatFlag(detailData.order_express.is_back) }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="是否拦截">{{ formatFlag(detailData.order_express.is_intercept) }}</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
|
||||||
|
<!-- 货主合约备注 -->
|
||||||
|
<el-descriptions v-if="detailData.store_contract" title="货主合约备注" :column="2" border size="small" class="detail-section">
|
||||||
|
<el-descriptions-item label="货主合约备注">{{ detailData.store_contract.store_remask ?? '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="仓库合约备注">{{ detailData.store_contract.warehouse_remask ?? '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="货主使用状态">{{ detailData.store_contract.store_use_status ?? '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="仓库使用状态">{{ detailData.store_contract.warehouse_use_status ?? '-' }}</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
|
||||||
|
<div v-if="!detailData.order_express && !detailData.store_contract" class="detail-none">
|
||||||
|
非原单退回,无原运单与货主合约备注
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, onMounted, reactive, ref } from 'vue'
|
||||||
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
|
import { returnReceivedList, returnReceivedCreate, returnReceivedDetail, returnReceivedDelete } from '@/api/returnReceived'
|
||||||
|
import { loadStores } from '@/api/index/index'
|
||||||
|
import { extractStoreListFromResponse, fillStoreScanFieldOptions } from '@/views/order/orderManagement/config/order-common-config'
|
||||||
|
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||||
|
import { returnReceivedAvailableFields, returnReceivedColumns, returnReceivedToolbarButtons } from './returnReceived-config'
|
||||||
|
import ScanBox from '@/components/ScanBox/index.vue'
|
||||||
|
import UpperTable from '@/components/UpperTable/index.vue'
|
||||||
|
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||||
|
import { safeInvoke } from '@/utils/safe-invoke'
|
||||||
|
|
||||||
|
// ==================== 常量 / 工具 ====================
|
||||||
|
|
||||||
|
function formatTime(val: any): string {
|
||||||
|
if (val === null || val === undefined || val === '') return '-'
|
||||||
|
const d = new Date(val)
|
||||||
|
if (isNaN(d.getTime())) return String(val)
|
||||||
|
return d.toLocaleString('zh-CN', { hour12: false })
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatFlag(val: any): string {
|
||||||
|
if (val === 'Y' || val === 'y' || val === true || val === 1) return '是'
|
||||||
|
if (val === 'N' || val === 'n' || val === false || val === 0) return '否'
|
||||||
|
return val == null || val === '' ? '-' : String(val)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== 配置 ====================
|
||||||
|
|
||||||
|
const availableFields = returnReceivedAvailableFields
|
||||||
|
const columns = returnReceivedColumns
|
||||||
|
const tableSize = 'small'
|
||||||
|
const toolbarButtons: ToolbarButtonConfig[] = returnReceivedToolbarButtons
|
||||||
|
|
||||||
|
const buttonLoadingMap = ref<Record<string, boolean>>({ loading: false })
|
||||||
|
const buttonDisabledMap = ref<Record<string, boolean>>({})
|
||||||
|
const buttonLabelMap = ref<Record<string, string>>({})
|
||||||
|
const toolbarLayoutKey = ref('')
|
||||||
|
|
||||||
|
function resolveButtonLoading(loadingKey?: string) {
|
||||||
|
if (!loadingKey) return false
|
||||||
|
return Boolean(buttonLoadingMap.value[loadingKey])
|
||||||
|
}
|
||||||
|
function resolveButtonDisabled(disabledKey?: string) {
|
||||||
|
if (!disabledKey) return false
|
||||||
|
return Boolean(buttonDisabledMap.value[disabledKey])
|
||||||
|
}
|
||||||
|
function resolveButtonLabel(defaultLabel: string, dynamicLabelKey?: string) {
|
||||||
|
return dynamicLabelKey ? (buttonLabelMap.value[dynamicLabelKey] || defaultLabel) : defaultLabel
|
||||||
|
}
|
||||||
|
|
||||||
|
const toolbarActionMap: Record<string, () => void> = {
|
||||||
|
loadData: () => { handleRefresh() },
|
||||||
|
openColumnConfigPanel: () => openColumnConfigPanel(),
|
||||||
|
}
|
||||||
|
|
||||||
|
function openColumnConfigPanel() {
|
||||||
|
upperTable.value?.openColumnConfig?.()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleToolbarButtonClick(action: string) {
|
||||||
|
const handler = toolbarActionMap[action]
|
||||||
|
if (!handler) return
|
||||||
|
safeInvoke(() => handler())
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== 数据状态 ====================
|
||||||
|
|
||||||
|
const scanBox = ref<any>(null)
|
||||||
|
const upperTable = ref<any>(null)
|
||||||
|
const loading = ref(false)
|
||||||
|
const queryTime = ref(0)
|
||||||
|
const tableData = ref<any[]>([])
|
||||||
|
const currentConditions = ref<Record<string, any>>({})
|
||||||
|
const currentSort = ref<{ prop: string; order: string }>({ prop: '', order: '' })
|
||||||
|
|
||||||
|
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
|
||||||
|
const upperPagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
|
||||||
|
|
||||||
|
// ==================== ScanBox 事件 ====================
|
||||||
|
|
||||||
|
function handleConditionChange(conditions: Record<string, any>) {
|
||||||
|
currentConditions.value = conditions ?? {}
|
||||||
|
pagination.currentPage = 1
|
||||||
|
upperPagination.currentPage = 1
|
||||||
|
fetchData()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleConditionReset() {
|
||||||
|
currentConditions.value = {}
|
||||||
|
pagination.currentPage = 1
|
||||||
|
upperPagination.currentPage = 1
|
||||||
|
fetchData()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleConditionClear() {
|
||||||
|
currentConditions.value = {}
|
||||||
|
pagination.currentPage = 1
|
||||||
|
upperPagination.currentPage = 1
|
||||||
|
fetchData()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleRowClick(row: any) {
|
||||||
|
/* 点击行无默认行为,详情通过操作列触发 */
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== 条件转换 ====================
|
||||||
|
|
||||||
|
function buildWhereFromConditions(conditions: Record<string, any>) {
|
||||||
|
const where: Record<string, any> = {}
|
||||||
|
for (const [key, cond] of Object.entries(conditions || {})) {
|
||||||
|
if (cond === undefined || cond === null || cond === '') continue
|
||||||
|
const value = cond && typeof cond === 'object' && 'value' in cond ? cond.value : cond
|
||||||
|
if (value === undefined || value === null || value === '' || (Array.isArray(value) && value.length === 0)) continue
|
||||||
|
|
||||||
|
switch (key) {
|
||||||
|
case 'waybill_code':
|
||||||
|
where.waybill_code = { operator: 'like', value: String(value) }
|
||||||
|
break
|
||||||
|
case 'scan_date':
|
||||||
|
where.scan_date = { operator: 'between', value }
|
||||||
|
break
|
||||||
|
case 'scanner_id':
|
||||||
|
case 'store_id': {
|
||||||
|
const n = Number(value)
|
||||||
|
if (!Number.isNaN(n)) where[key] = n
|
||||||
|
break
|
||||||
|
}
|
||||||
|
case 'is_original_return':
|
||||||
|
where.is_original_return = Boolean(value)
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
where[key] = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return where
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== 数据查询 ====================
|
||||||
|
|
||||||
|
async function fetchData() {
|
||||||
|
loading.value = true
|
||||||
|
const start = Date.now()
|
||||||
|
try {
|
||||||
|
const where = buildWhereFromConditions(currentConditions.value)
|
||||||
|
const params: any = {
|
||||||
|
pagination: { page: pagination.currentPage, pageSize: pagination.pageSize },
|
||||||
|
where,
|
||||||
|
}
|
||||||
|
if (currentSort.value.prop) {
|
||||||
|
params.sort = {
|
||||||
|
sortField: currentSort.value.prop,
|
||||||
|
sortOrder: currentSort.value.order === 'ascending' ? 'asc' : 'desc',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const res: any = await returnReceivedList(params)
|
||||||
|
if (res && (res.code === 1 || res.code === 200 || res.code === 20000)) {
|
||||||
|
const data = res.data ?? res
|
||||||
|
tableData.value = data.list ?? data.items ?? []
|
||||||
|
const total = data.pagination?.total ?? data.total ?? 0
|
||||||
|
pagination.total = total
|
||||||
|
upperPagination.total = total
|
||||||
|
} else {
|
||||||
|
tableData.value = []
|
||||||
|
pagination.total = 0
|
||||||
|
upperPagination.total = 0
|
||||||
|
ElMessage.error(res?.message || '获取退回收件列表失败')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取退回收件列表失败:', error)
|
||||||
|
tableData.value = []
|
||||||
|
pagination.total = 0
|
||||||
|
upperPagination.total = 0
|
||||||
|
} finally {
|
||||||
|
queryTime.value = Date.now() - start
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleRefresh() {
|
||||||
|
fetchData()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePageChange(page: number) {
|
||||||
|
pagination.currentPage = page
|
||||||
|
upperPagination.currentPage = page
|
||||||
|
fetchData()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePageSizeChange(size: number) {
|
||||||
|
pagination.pageSize = size
|
||||||
|
upperPagination.pageSize = size
|
||||||
|
pagination.currentPage = 1
|
||||||
|
upperPagination.currentPage = 1
|
||||||
|
fetchData()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleSortChange({ prop, order }: any) {
|
||||||
|
currentSort.value = { prop: prop ?? '', order: order ?? '' }
|
||||||
|
pagination.currentPage = 1
|
||||||
|
upperPagination.currentPage = 1
|
||||||
|
fetchData()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== 扫码登记 ====================
|
||||||
|
|
||||||
|
const registerLoading = ref(false)
|
||||||
|
const registerForm = reactive({ waybillCode: '', remark: '' })
|
||||||
|
|
||||||
|
async function handleRegister() {
|
||||||
|
const code = registerForm.waybillCode.trim()
|
||||||
|
if (!code) {
|
||||||
|
ElMessage.warning('请先扫描或输入退回收件运单号')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
registerLoading.value = true
|
||||||
|
try {
|
||||||
|
const res: any = await returnReceivedCreate({
|
||||||
|
waybill_code: code,
|
||||||
|
remark: registerForm.remark ? registerForm.remark.trim() : undefined,
|
||||||
|
})
|
||||||
|
if (res && (res.code === 1 || res.code === 200 || res.code === 20000)) {
|
||||||
|
const data = res.data ?? res
|
||||||
|
if (data.duplicated) {
|
||||||
|
ElMessage.warning(`该运单号 30 日内已登记(记录ID ${data.id}),已返回第一次登记结果`)
|
||||||
|
} else if (data.is_original_return) {
|
||||||
|
ElMessage.success(`登记成功:命中原单退回,原运单ID ${data.order_express_id}`)
|
||||||
|
} else {
|
||||||
|
ElMessage.success('登记成功')
|
||||||
|
}
|
||||||
|
registerForm.waybillCode = ''
|
||||||
|
registerForm.remark = ''
|
||||||
|
fetchData()
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res?.message || '登记失败')
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// 请求层已提示错误
|
||||||
|
} finally {
|
||||||
|
registerLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== 详情 ====================
|
||||||
|
|
||||||
|
const detailVisible = ref(false)
|
||||||
|
const detailLoading = ref(false)
|
||||||
|
const detailData = ref<any>(null)
|
||||||
|
|
||||||
|
async function handleViewDetail(row: any) {
|
||||||
|
detailVisible.value = true
|
||||||
|
detailLoading.value = true
|
||||||
|
detailData.value = null
|
||||||
|
try {
|
||||||
|
const res: any = await returnReceivedDetail({ id: row.id })
|
||||||
|
if (res && (res.code === 1 || res.code === 200 || res.code === 20000)) {
|
||||||
|
detailData.value = res.data ?? res
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res?.message || '获取详情失败')
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// 请求层已提示错误
|
||||||
|
} finally {
|
||||||
|
detailLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== 删除 ====================
|
||||||
|
|
||||||
|
async function handleDelete(row: any) {
|
||||||
|
try {
|
||||||
|
await ElMessageBox.confirm(
|
||||||
|
`确认删除登记记录「${row.waybill_code}」?删除后不可恢复。`,
|
||||||
|
'删除确认',
|
||||||
|
{ type: 'warning', confirmButtonText: '删除', cancelButtonText: '取消' }
|
||||||
|
)
|
||||||
|
} catch {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const res: any = await returnReceivedDelete({ id: row.id })
|
||||||
|
if (res && (res.code === 1 || res.code === 200 || res.code === 20000)) {
|
||||||
|
ElMessage.success('删除成功')
|
||||||
|
fetchData()
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res?.message || '删除失败')
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// 请求层已提示错误
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== 货主选项加载 ====================
|
||||||
|
|
||||||
|
async function loadStoreOptions() {
|
||||||
|
try {
|
||||||
|
const storesRes: any = await loadStores()
|
||||||
|
fillStoreScanFieldOptions(availableFields, extractStoreListFromResponse(storesRes))
|
||||||
|
} catch {
|
||||||
|
fillStoreScanFieldOptions(availableFields, [])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
loadStoreOptions()
|
||||||
|
fetchData()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
@use "../../order/orderManagement/styles/order-sub.scss";
|
||||||
|
|
||||||
|
.scan-register {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
flex: 0 0 auto;
|
||||||
|
|
||||||
|
.register-input {
|
||||||
|
width: 220px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.register-remark {
|
||||||
|
width: 160px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.wave-operation-actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 4px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-content {
|
||||||
|
min-height: 160px;
|
||||||
|
|
||||||
|
.detail-section {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-none {
|
||||||
|
text-align: center;
|
||||||
|
padding: 24px;
|
||||||
|
color: #909399;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-tip {
|
||||||
|
color: #909399;
|
||||||
|
font-size: 13px;
|
||||||
|
padding: 16px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
67
src/views/express/returnReceived/returnReceived-config.ts
Normal file
67
src/views/express/returnReceived/returnReceived-config.ts
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 退回收件(returnReceived) - ScanBox 筛选字段
|
||||||
|
// 对齐 returnReceived.list 接口文档 where 参数
|
||||||
|
// ============================================================
|
||||||
|
export const returnReceivedAvailableFields = [
|
||||||
|
{
|
||||||
|
value: 'waybill_code',
|
||||||
|
label: '退回收件运单号',
|
||||||
|
type: 'text',
|
||||||
|
placeholder: '运单号模糊搜索',
|
||||||
|
operators: ['like'],
|
||||||
|
defaultOperator: 'like',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'scan_date',
|
||||||
|
label: '扫描时间',
|
||||||
|
type: 'datetimerange',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'scanner_id',
|
||||||
|
label: '扫描人员工号',
|
||||||
|
type: 'number',
|
||||||
|
placeholder: '工号ID等值匹配',
|
||||||
|
operators: ['eq'],
|
||||||
|
defaultOperator: 'eq',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'store_id',
|
||||||
|
label: '货主',
|
||||||
|
type: 'select',
|
||||||
|
placeholder: '请选择货主',
|
||||||
|
options: [] as { label: string; value: unknown }[],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'is_original_return',
|
||||||
|
label: '是否原单退回',
|
||||||
|
type: 'boolean',
|
||||||
|
placeholder: '请选择是否原单退回',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 退回收件(returnReceived) - UpperTable 列配置
|
||||||
|
// 对齐 returnReceived.list 实际响应字段
|
||||||
|
// ============================================================
|
||||||
|
export const returnReceivedColumns = [
|
||||||
|
{ prop: 'waybill_code', label: '退回收件运单号', minWidth: '180', showOverflowTooltip: true, sortable: 'custom' },
|
||||||
|
{ prop: 'scan_date', label: '扫描日期', width: '170', sortable: 'custom' },
|
||||||
|
{ prop: 'scanner_name', label: '扫描人员', minWidth: '100', showOverflowTooltip: true },
|
||||||
|
{ prop: 'is_original_return', label: '是否原单退回', width: '110' },
|
||||||
|
{ prop: 'store_remark', label: '货主备注', minWidth: '140', showOverflowTooltip: true },
|
||||||
|
{ prop: 'order_express_id', label: '原运单ID', width: '100' },
|
||||||
|
{ prop: 'order_id', label: '原订单ID', width: '100' },
|
||||||
|
{ prop: 'remark', label: '备注', minWidth: '120', showOverflowTooltip: true },
|
||||||
|
{ prop: 'created_at', label: '登记时间', width: '170', sortable: 'custom' },
|
||||||
|
{ prop: 'actions', label: '操作', width: '140', fixed: 'right' },
|
||||||
|
]
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 工具栏按钮
|
||||||
|
// ============================================================
|
||||||
|
export const returnReceivedToolbarButtons: ToolbarButtonConfig[] = [
|
||||||
|
{ key: 'refresh', label: '刷新', category: 'refresh', size: 'small', loadingKey: 'loading', action: 'loadData' },
|
||||||
|
{ key: 'columnConfig', label: '字段设置', category: 'setting', size: 'small', action: 'openColumnConfigPanel' },
|
||||||
|
]
|
||||||
Loading…
x
Reference in New Issue
Block a user