优化客服群聊订单信息展示

This commit is contained in:
yml
2026-06-18 00:44:45 +08:00
parent 0add23dedb
commit 272b2cb71e
15 changed files with 479 additions and 55 deletions
@@ -35,6 +35,26 @@ const refundStatus = ref<RefundStatus | null>(null)
const listingCode = computed(() =>
order.value ? formatListingNo(order.value.listing_no, order.value.listing_id) : '-'
)
const returnTarget = computed(() => {
const from = firstQueryValue(route.query.from)
const chatID = firstQueryValue(route.query.chat_id)
const chatFilter = firstQueryValue(route.query.chat_filter)
if (from === 'chat' && chatID) {
return {
path: adminPath('chats'),
query: {
chat_id: chatID,
...(chatFilter ? { chat_filter: chatFilter } : {}),
},
}
}
return adminPath('orders')
})
const returnLabel = computed(() =>
firstQueryValue(route.query.from) === 'chat' && firstQueryValue(route.query.chat_id)
? '返回会话'
: '返回列表'
)
const refunding = ref(false)
const snapshotText = computed(() => JSON.stringify(order.value?.account_snapshot || {}, null, 2))
@@ -184,6 +204,11 @@ function moneyCent(value: number) {
return formatCentWithSymbol(value)
}
function firstQueryValue(value: unknown) {
if (Array.isArray(value)) return typeof value[0] === 'string' ? value[0] : ''
return typeof value === 'string' ? value : ''
}
function formatHandoffRecordType(type: string) {
const typeMap: Record<string, string> = {
owner_handoff: '卖家交接',
@@ -209,8 +234,8 @@ function formatHandoffRecordType(type: string) {
</p>
</div>
<div class="toolbar-actions">
<RouterLink :to="adminPath('orders')">
<el-button>返回列表</el-button>
<RouterLink :to="returnTarget">
<el-button>{{ returnLabel }}</el-button>
</RouterLink>
<el-button v-if="canResetHandoff" type="success" @click="openAction('reset')"
>重置交接</el-button