This commit is contained in:
liufumingren 2026-06-16 08:58:37 +08:00
parent dddb132893
commit 54cf1b3d17
4 changed files with 132 additions and 9 deletions

View File

@ -106,6 +106,26 @@
</span>
</el-tooltip>
</template>
<template v-else-if="column.prop === 'buyer_message'">
<template v-if="scope.row[column.prop]">
<el-tooltip
:content="scope.row[column.prop]"
placement="top"
:show-after="400"
>
<span
class="buyer-message-text buyer-message-copyable"
role="button"
tabindex="0"
@click.stop="copyBuyerMessage(scope.row[column.prop])"
@keydown.enter.prevent="copyBuyerMessage(scope.row[column.prop])"
>
{{ truncateBuyerMessage(scope.row[column.prop]) }}
</span>
</el-tooltip>
</template>
<span v-else style="color:#909399">—</span>
</template>
<template v-else-if="column.template">
<component
:is="column.template"
@ -833,9 +853,51 @@ function getDefaultCellTextClass(prop: string | undefined, value: unknown) {
if (prop === 'order_flag' && value !== undefined && value !== null && String(value).trim() !== '') {
return 'order-flag-text order-flag-copyable'
}
if (prop === 'buyer_message' && value !== undefined && value !== null && String(value).trim() !== '') {
return 'buyer-message-text buyer-message-copyable'
}
return ''
}
function truncateBuyerMessage(value: unknown) {
if (value == null) return '—'
const text = String(value).trim()
if (!text) return '—'
const max = 30
return text.length > max ? `${text.slice(0, max)}…` : text
}
async function copyBuyerMessage(value: unknown) {
const text = value != null ? String(value).trim() : ''
if (!text) {
ElMessage.warning('当前订单无买家留言可复制')
return
}
try {
if (navigator.clipboard?.writeText) {
await navigator.clipboard.writeText(text)
} else {
throw new Error('no clipboard api')
}
ElMessage.success('买家留言已复制到剪贴板')
} catch {
try {
const textarea = document.createElement('textarea')
textarea.value = text
textarea.setAttribute('readonly', 'readonly')
textarea.style.position = 'fixed'
textarea.style.left = '-9999px'
document.body.appendChild(textarea)
textarea.select()
document.execCommand('copy')
document.body.removeChild(textarea)
ElMessage.success('买家留言已复制到剪贴板')
} catch {
ElMessage.error('复制失败,请手动复制')
}
}
}
function getOrderFlagFullText(value: unknown) {
if (value == null) return ''
return String(value).trim()
@ -1675,6 +1737,14 @@ watch(
cursor: pointer;
}
.buyer-message-text {
color: #409eff;
}
.buyer-message-copyable {
cursor: pointer;
}
/* 表格尺寸样式 */
.upper-table-container.small :deep(.el-table) {
font-size: 12px;

View File

@ -125,6 +125,12 @@ export const COMMON_TRANSLATIONS: Record<string, Record<string, string>> = {
print_lock_status: {
none: '未锁定',
warehouse: '仓库锁定'
},
weight_type: {
'0': '常规',
'1': '轻货',
'2': '重货',
'3': '冷链'
}
}
@ -230,6 +236,12 @@ export const COMMON_TAG_TYPES: Record<string, Record<string, string>> = {
print_lock_status: {
none: 'info',
warehouse: 'warning'
},
weight_type: {
'0': 'info',
'1': '',
'2': 'warning',
'3': 'danger'
}
}
@ -614,6 +626,10 @@ function orderTypeFormatter(_row: any, _column: any, cellValue: unknown) {
return translateOrderField('order_type', cellValue)
}
function weightTypeFormatter(_row: any, _column: any, cellValue: unknown) {
return translateOrderField('weight_type', cellValue)
}
/** 订单详情 descriptions 中需格式化为本地时间的字段(与列表 formatter 一致) */
export const ORDER_DETAIL_TIME_FIELDS = new Set([
'place_order_time',
@ -725,7 +741,7 @@ export const pendingOrderDetailSections: OrderDetailSectionConfig[] = [
{ prop: 'service_fee', label: '服务费', amount: true },
{ prop: 'items_count', label: '商品种类' },
{ prop: 'items_total', label: '商品总数' },
{ prop: 'items_weight', label: '总重量' }
{ prop: 'items_weight', label: '商品重量kg' }
]
},
{
@ -793,6 +809,11 @@ export const isUrgencyFilterOptions = [
{ label: '否', value: 'N' },
]
export const buyerMessageHasFilterOptions = [
{ label: '有留言', value: 'has' },
{ label: '无留言', value: 'none' },
]
export const syncStatusFilterOptionsBasic = [
{ label: '待同步', value: 'padding' },
{ label: '已同步', value: 'fin' },
@ -1013,6 +1034,8 @@ export const deliveryAvailableFields = [
// 收货信息
receiverNameScanField,
receiverMobileScanField,
scanField('receiver', { label: '有无留言', value: 'buyer_message_has', type: 'select', options: buyerMessageHasFilterOptions }),
scanField('receiver', { label: '买家留言', value: 'buyer_message', type: 'text' }),
// 物流信息
logisticsNameScanField,
expressCompanyScanField,
@ -1043,6 +1066,7 @@ export const deliveryColumns = [
{ prop: 'seller_nick', label: '卖家昵称', width: '120' },
{ prop: 'name', label: '收件人', width: '100' },
{ prop: 'mobile', label: '电话', width: '120' },
{ prop: 'buyer_message', label: '买家留言', minWidth: '180' },
{ prop: 'province', label: '省份', width: '90' },
{ prop: 'city', label: '城市', width: '90' },
{ prop: 'area', label: '区/县', width: '90' },
@ -1066,12 +1090,12 @@ export const deliveryColumns = [
{ prop: 'source_order_codes', label: '平台交易单号', width: '140' },
{ prop: 'is_urgency', label: '是否紧急', width: '80' },
{ prop: 'invoice_flag', label: '发票', width: '80' },
{ prop: 'weight_type', label: '重量类型', width: '90' },
{ prop: 'weight_type', label: '重量类型', width: '90', formatter: weightTypeFormatter },
{ prop: 'delivery_type', label: '配送类型', width: '100' },
{ prop: 'basket_number', label: '篮号', width: '90' },
{ prop: 'items_count', label: '商品种类', width: '90' },
{ prop: 'items_total', label: '商品总数', width: '90' },
{ prop: 'items_weight', label: '总重量', width: '90' },
{ prop: 'items_weight', label: '商品重量kg', width: '90' },
{ prop: 'total_amount', label: '订单金额', width: '100' },
{ prop: 'item_amount', label: '商品金额', width: '100' },
{ prop: 'freight', label: '运费', width: '90' },
@ -1140,7 +1164,7 @@ export const deliverydetail = [
{ label: '商品SKU', prop: 'items' },
{ label: '商品种类数', prop: 'items_count' },
{ label: '商品总数', prop: 'items_total' },
{ label: '总重量', prop: 'items_weight' },
{ label: '商品重量kg', prop: 'items_weight' },
{ label: '货主', prop: 'store_id' },
{ label: '国家编码', prop: 'country_code' },
{ label: '详细地址', prop: 'detail_address' },
@ -1198,6 +1222,8 @@ export const reviewAvailableFields = [
// 收货信息
receiverNameScanField,
receiverMobileScanField,
scanField('receiver', { label: '有无留言', value: 'buyer_message_has', type: 'select', options: buyerMessageHasFilterOptions }),
scanField('receiver', { label: '买家留言', value: 'buyer_message', type: 'text' }),
// 物流信息
expressCompanyScanField,
// 订单状态
@ -1223,11 +1249,13 @@ export const reviewColums = [
{ prop: 'logistics_name', label: '快递', width: '120' },
{ prop: 'items_total', label: '商品总数', width: '100' },
{ prop: 'items_count', label: '商品种类', width: '100' },
{ prop: 'items_weight', label: '商品重量kg', width: '110' },
{ prop: 'total_amount', label: '订单金额', width: '110' },
{ prop: 'pay_time', label: '支付时间', width: '165', formatter: orderTimeFormatter },
{ prop: 'operator_name', label: '审核人', width: '100' },
{ prop: 'operate_time', label: '审核时间', width: '165', formatter: orderTimeFormatter },
{ prop: 'create_at', label: '创建时间', width: '165', formatter: orderTimeFormatter },
{ prop: 'buyer_message', label: '买家留言', minWidth: '180' },
]
export const reviewOrderDetail = [
@ -1259,7 +1287,7 @@ export const reviewOrderDetail = [
{ prop: 'items', label: '商品清单', span: 3 },
{ prop: 'items_count', label: '商品种类' },
{ prop: 'items_total', label: '商品总数' },
{ prop: 'items_weight', label: '总重量' },
{ prop: 'items_weight', label: '商品重量kg' },
// 收货与物流
{ prop: 'name', label: '收件人' },
@ -1360,6 +1388,8 @@ export const pendingAvailableFields = [
receiverProvinceScanField,
receiverCityScanField,
receiverAreaScanField,
scanField('receiver', { label: '有无留言', value: 'buyer_message_has', type: 'select', options: buyerMessageHasFilterOptions }),
scanField('receiver', { label: '买家留言', value: 'buyer_message', type: 'text' }),
// 时间范围
placeOrderTimeRangeScanField,
createAtRangeScanField,
@ -1372,6 +1402,7 @@ export const pendingCloums = [
{ prop: 'shop_nick', label: '店铺名称', width: '140' },
{ prop: 'name', label: '收件人', width: '110' },
{ prop: 'mobile', label: '电话', width: '120' },
{ prop: 'buyer_message', label: '买家留言', minWidth: '180' },
{ prop: 'is_urgency', label: '是否紧急', width: '100' },
{ prop: 'status', label: '订单状态', width: '100' },
{ prop: 'sync_status', label: '同步状态', width: '100' },
@ -1383,6 +1414,7 @@ export const pendingCloums = [
{ prop: 'express_numbers', label: '运单号', width: '160', formatter: waybillCodesFormatter },
{ prop: 'items_count', label: '商品种类', width: '100' },
{ prop: 'items_total', label: '商品总数', width: '100' },
{ prop: 'items_weight', label: '商品重量kg', width: '110' },
{ prop: 'province', label: '省份', width: '100' },
{ prop: 'create_at', label: '创建时间', width: '165', formatter: orderTimeFormatter },
{ prop: 'pay_time', label: '支付时间', width: '160', formatter: orderTimeFormatter },
@ -1406,10 +1438,12 @@ export const ORDER_LIST_FIELD_LABELS: Record<string, string> = {
source_order_codes: '平台交易单号',
order_type: '订单类型',
buyer_nick: '买家昵称',
buyer_message: '买家留言',
pre_delivery_order_code: '前置单号',
delivery_time: '配送时间',
items_weight: '总重量',
items_weight: '商品重量kg',
waybill_codes: '运单号',
weight_type: '重量类型',
}
export function applyOrderListColumnLabels<T extends { prop: string; label: string }>(columns: T[]): T[] {
@ -1471,7 +1505,7 @@ export const pendingOrderDetail = [
{ prop: 'items', label: '商品清单', span: 3 },
{ prop: 'items_count', label: '商品种类' },
{ prop: 'items_total', label: '商品总数' },
{ prop: 'items_weight', label: '总重量' },
{ prop: 'items_weight', label: '商品重量kg' },
// 收货与物流
{ prop: 'name', label: '收件人' },
@ -1600,6 +1634,9 @@ export const workbenchAvailableFields = [
// 订单状态
scanField('status', { label: '订单状态', value: 'status', type: 'select', options: workbenchStatusOptions }),
scanField('status', { label: '是否紧急', value: 'is_urgency', type: 'select', options: isUrgencyFilterOptions }),
// 收货信息
scanField('receiver', { label: '有无留言', value: 'buyer_message_has', type: 'select', options: buyerMessageHasFilterOptions }),
scanField('receiver', { label: '买家留言', value: 'buyer_message', type: 'text' }),
]
export const workbenchColumns = [
@ -1611,6 +1648,7 @@ export const workbenchColumns = [
{ prop: 'buyer_nick', label: '买家昵称', minWidth: 140 },
{ prop: 'name', label: '收件人', minWidth: 100 },
{ prop: 'mobile', label: '电话', minWidth: 120 },
{ prop: 'buyer_message', label: '买家留言', minWidth: 180 },
{ prop: 'is_urgency', label: '是否紧急', minWidth: 100 },
{ prop: 'status', label: '订单状态', minWidth: 120 },
{ prop: 'sync_status', label: '同步状态', minWidth: 110 },
@ -1619,6 +1657,7 @@ export const workbenchColumns = [
{ prop: 'logistics_name', label: '快递', minWidth: 120 },
{ prop: 'waybill_codes', label: '运单号', minWidth: 140, formatter: waybillCodesFormatter },
{ prop: 'items_total', label: '商品总数', minWidth: 100 },
{ prop: 'items_weight', label: '商品重量kg', minWidth: 110 },
{ prop: 'total_amount', label: '订单金额', minWidth: 110 },
{ prop: 'create_at', label: '创建时间', minWidth: 170, formatter: orderTimeFormatter },
{ prop: 'updated_at', label: '更新时间', minWidth: 170, formatter: orderTimeFormatter }
@ -1665,6 +1704,9 @@ export const expectionOrderAvailableFields = [
scanField('warehouse', { label: '打印状态', value: 'print_status', type: 'select', options: printStatusFilterOptions }),
scanField('warehouse', { label: '拣货状态', value: 'pick_status', type: 'select', options: pickStatusFilterOptions }),
scanField('warehouse', { label: '打包状态', value: 'pack_status', type: 'select', options: packStatusFilterOptions }),
// 收货信息
scanField('receiver', { label: '有无留言', value: 'buyer_message_has', type: 'select', options: buyerMessageHasFilterOptions }),
scanField('receiver', { label: '买家留言', value: 'buyer_message', type: 'text' }),
// 时间范围
createAtRangeScanField,
]
@ -1685,10 +1727,12 @@ export const expectionColumns = [
{ prop: 'express_numbers', label: '运单号', width: '160', formatter: waybillCodesFormatter },
{ prop: 'name', label: '收件人', width: '110' },
{ prop: 'mobile', label: '电话', width: '120' },
{ prop: 'buyer_message', label: '买家留言', minWidth: '180' },
{ prop: 'logistics_name', label: '快递', width: '120' },
{ prop: 'pre_delivery_order_code', label: '前置单号', width: '140' },
{ prop: 'order_flag', label: '订单标记', minWidth: '260' },
{ prop: 'items_total', label: '商品总数', width: '100' },
{ prop: 'items_weight', label: '商品重量kg', width: '110' },
{ prop: 'total_amount', label: '订单金额', width: '110' },
{ prop: 'pay_time', label: '支付时间', width: '165', formatter: orderTimeFormatter },
{ prop: 'create_at', label: '创建时间', width: '165', formatter: orderTimeFormatter },
@ -1725,7 +1769,7 @@ export const expectionOrderDetail = [
// 统计信息
{ prop: 'items_count', label: '商品种类' },
{ prop: 'items_total', label: '商品总数' },
{ prop: 'items_weight', label: '总重量' },
{ prop: 'items_weight', label: '商品重量kg' },
// 时间信息
{ prop: 'create_at', label: '创建时间' },
@ -1769,6 +1813,8 @@ export const archiveAvailableFields = [
// 收货信息
receiverNameScanField,
receiverMobileScanField,
scanField('receiver', { label: '有无留言', value: 'buyer_message_has', type: 'select', options: buyerMessageHasFilterOptions }),
scanField('receiver', { label: '买家留言', value: 'buyer_message', type: 'text' }),
]
export const archiveColumns = [
@ -1780,6 +1826,8 @@ export const archiveColumns = [
{ prop: 'shop_nick', label: '店铺名称', width: '140' },
{ prop: 'name', label: '收件人', width: '120' },
{ prop: 'mobile', label: '电话', width: '120' },
{ prop: 'buyer_message', label: '买家留言', minWidth: '180' },
{ prop: 'items_weight', label: '商品重量kg', width: '110' },
{ prop: 'logistics_name', label: '快递', width: '120' },
{ prop: 'status', label: '订单状态', width: '100' },
{ prop: 'create_at', label: '创建时间', width: '160' },

View File

@ -15,6 +15,7 @@
/>
<div class="main-content">
<div class="toolbar">
<div class="toolbar-left">
<order-toolbar-button-group

View File

@ -102,7 +102,9 @@ export const fallbackOrderAvailableFields = [
{ label: '商品总数最大值', value: 'items_total_max', type: 'number' },
{ label: '物流公司', value: 'sys_logistics_name', type: 'select', options: [] },
{ label: '店铺名称', value: 'store_name', type: 'text' },
{ label: '平台', value: 'sys_platform_name', type: 'select', options: [] }
{ label: '平台', value: 'sys_platform_name', type: 'select', options: [] },
{ label: '有无留言', value: 'buyer_message_has', type: 'select', options: [{ label: '有留言', value: 'has' }, { label: '无留言', value: 'none' }] },
{ label: '买家留言', value: 'buyer_message', type: 'text' },
// { label: '货主', value: 'owner_name', type: 'select', options: [] },
// { label: '省份', value: 'province', type: 'text' },
// { label: '来源平台', value: 'sys_platform_name', type: 'select', options: [] }
@ -118,8 +120,10 @@ export const fallbackOrderColumns = [
{ prop: 'province', label: '省份', minWidth: 100 },
{ prop: 'items_count', label: '商品种数', minWidth: 100, align: 'right' },
{ prop: 'items_total', label: '商品总数', minWidth: 100, align: 'right' },
{ prop: 'items_weight', label: '商品重量kg', minWidth: 110, align: 'right' },
{ prop: 'item_snapshot', label: '商品快照', minWidth: 260 },
{ prop: 'wave_scan_result', label: '扫描结果', minWidth: 110, align: 'center' },
{ prop: 'buyer_message', label: '买家留言', minWidth: 180 },
{ prop: 'updated_at', label: '更新时间', minWidth: 170 }
]