WEB/src/views/message/index.vue
2026-09-17 18:00:43 +08:00

697 lines
28 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="order-sub-container" :style="{ height: containerHeight }">
<scan-box
ref="scanBox"
cache-key="workOrder-list"
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"
/>
</div>
</div>
<div class="split-stack" ref="splitStackRef">
<div class="upper-wrapper" :style="detailVisible ? upperPaneStyle : upperPaneFullStyle">
<upper-table
ref="upperTable"
title="我的工单"
default-align="center"
:enable-column-config="true"
table-id="workOrder-list"
:data="tableData"
:columns="columns"
:table-size="tableSize"
:pagination="upperPagination"
:show-index="true"
:show-selection="true"
:show-actions="true"
:loading="loading"
:query-time="queryTime"
row-key="id"
@current-change="handleRowClick"
@selection-change="handleSelectionChange"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
@sort-change="handleSortChange"
@refresh="handleRefresh"
>
<!-- 售后类型 -->
<template #column-type="{ row }">
<span :class="getStatusTextClass(typeTagType(row.type))">
{{ typeLabel(row.type) }}
</span>
</template>
<!-- 子类型 -->
<template #column-sub_type="{ row }">
{{ subTypeLabel(row.sub_type) }}
</template>
<!-- 状态 -->
<template #column-status="{ row }">
<span :class="getStatusTextClass(statusTagType(row.status))">
{{ statusLabel(row.status) }}
</span>
</template>
<!-- 角色组 -->
<template #column-role_group="{ row }">
<span v-if="row.role_group" :class="getStatusTextClass(roleGroupTagType(row.role_group))">
{{ roleGroupLabel(row.role_group) }}
</span>
<span v-else>-</span>
</template>
<!-- 仓库理赔 -->
<template #column-claim_status="{ row }">
<span v-if="row.claim_status" :class="getStatusTextClass(claimStatusTagType(row.claim_status))">
{{ claimStatusLabel(row.claim_status) }}
</span>
<span v-else>-</span>
</template>
<!-- 运方理赔 -->
<template #column-carrier_claim_status="{ row }">
<span v-if="row.carrier_claim_status" :class="getStatusTextClass(claimStatusTagType(row.carrier_claim_status))">
{{ claimStatusLabel(row.carrier_claim_status) }}
</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>
</div>
</template>
<template #empty>
<div class="empty-tip">暂无待处理工单 🎉</div>
</template>
</upper-table>
</div>
<template v-if="detailVisible">
<div
class="pane-resizer"
title="拖动调整列表与详情区域高度"
@mousedown="beginSplitDrag"
/>
<div class="lower-level" v-if="selectedRow" :class="tableSize" :style="lowerPaneStyle">
<div class="detail-header">
<el-tabs v-model="activeTab" class="detail-tab">
<el-tab-pane label="工单详情" name="detail" />
</el-tabs>
</div>
<div class="detail-container">
<div v-if="activeTab === 'detail'" class="detail-page">
<!-- 工单信息 -->
<div class="section">
<div class="section-title">工单信息</div>
<el-descriptions :column="3" border size="small" class="detail-descriptions">
<el-descriptions-item label="工单号">{{ selectedRow.after_sale_no || '—' }}</el-descriptions-item>
<el-descriptions-item label="售后类型">
<span :class="getStatusTextClass(typeTagType(selectedRow.type))">
{{ typeLabel(selectedRow.type) }}
</span>
</el-descriptions-item>
<el-descriptions-item label="子类型">{{ subTypeLabel(selectedRow.sub_type) }}</el-descriptions-item>
<el-descriptions-item label="标题" :span="2">{{ selectedRow.title || '—' }}</el-descriptions-item>
<el-descriptions-item label="状态">
<span :class="getStatusTextClass(statusTagType(selectedRow.status))">
{{ statusLabel(selectedRow.status) }}
</span>
</el-descriptions-item>
<el-descriptions-item label="优先级">{{ selectedRow.priority ?? '—' }}</el-descriptions-item>
<el-descriptions-item label="角色组">
<span v-if="selectedRow.role_group" :class="getStatusTextClass(roleGroupTagType(selectedRow.role_group))">
{{ roleGroupLabel(selectedRow.role_group) }}
</span>
<span v-else>—</span>
</el-descriptions-item>
<el-descriptions-item label="工单ID">{{ selectedRow.id ?? '—' }}</el-descriptions-item>
</el-descriptions>
</div>
<!-- 归属信息 -->
<div class="section">
<div class="section-title">归属信息</div>
<el-descriptions :column="3" border size="small" class="detail-descriptions">
<el-descriptions-item label="仓库ID">{{ selectedRow.warehouse_id ?? '—' }}</el-descriptions-item>
<el-descriptions-item label="货主ID">{{ selectedRow.store_id ?? '—' }}</el-descriptions-item>
<el-descriptions-item label="货主名称">{{ selectedRow.store_name || '—' }}</el-descriptions-item>
<el-descriptions-item label="创建人ID">{{ selectedRow.creator_id ?? '—' }}</el-descriptions-item>
<el-descriptions-item label="站内信ID" :span="2">{{ selectedRow.inbox_message_id ?? '—' }}</el-descriptions-item>
</el-descriptions>
</div>
<!-- 理赔信息 -->
<div class="section">
<div class="section-title">理赔信息</div>
<el-descriptions :column="3" border size="small" class="detail-descriptions">
<el-descriptions-item label="仓库理赔">
<span v-if="selectedRow.claim_status" :class="getStatusTextClass(claimStatusTagType(selectedRow.claim_status))">
{{ claimStatusLabel(selectedRow.claim_status) }}
</span>
<span v-else>—</span>
</el-descriptions-item>
<el-descriptions-item label="需仓库理赔">{{ selectedRow.claim_needed ? '是' : '否' }}</el-descriptions-item>
<el-descriptions-item label="仓库理赔金额">{{ selectedRow.claim_amount ?? '—' }}</el-descriptions-item>
<el-descriptions-item label="运方理赔">
<span v-if="selectedRow.carrier_claim_status" :class="getStatusTextClass(claimStatusTagType(selectedRow.carrier_claim_status))">
{{ claimStatusLabel(selectedRow.carrier_claim_status) }}
</span>
<span v-else>—</span>
</el-descriptions-item>
<el-descriptions-item label="需运方理赔">{{ selectedRow.carrier_claim_needed ? '是' : '否' }}</el-descriptions-item>
<el-descriptions-item label="运方理赔金额">{{ selectedRow.carrier_claim_amount ?? '—' }}</el-descriptions-item>
</el-descriptions>
</div>
<!-- 关联单据 -->
<div class="section">
<div class="section-title">关联单据</div>
<el-descriptions :column="2" border size="small" class="detail-descriptions">
<el-descriptions-item label="关联运单号">{{ selectedRow.waybill_no || '—' }}</el-descriptions-item>
<el-descriptions-item label="关联发货订单号">{{ selectedRow.order_delivery_no || '—' }}</el-descriptions-item>
<el-descriptions-item label="关联入库单号">{{ selectedRow.entry_order_no || '—' }}</el-descriptions-item>
<el-descriptions-item label="关联出库单号">{{ selectedRow.order_stockout_no || '—' }}</el-descriptions-item>
<el-descriptions-item label="关联收货单号">{{ selectedRow.receiving_no || '—' }}</el-descriptions-item>
<el-descriptions-item label="运单ID">{{ selectedRow.waybill_id ?? '—' }}</el-descriptions-item>
<el-descriptions-item label="订单ID">{{ selectedRow.order_id ?? '—' }}</el-descriptions-item>
<el-descriptions-item label="入库单ID">{{ selectedRow.entry_order_id ?? '—' }}</el-descriptions-item>
<el-descriptions-item label="出库单ID">{{ selectedRow.order_stockout_id ?? '—' }}</el-descriptions-item>
<el-descriptions-item label="收货单ID">{{ selectedRow.receiving_id ?? '—' }}</el-descriptions-item>
</el-descriptions>
</div>
<!-- 时间信息 -->
<div class="section">
<div class="section-title">时间信息</div>
<el-descriptions :column="2" border size="small" class="detail-descriptions">
<el-descriptions-item label="创建时间">{{ selectedRow.created_at || '—' }}</el-descriptions-item>
<el-descriptions-item label="更新时间">{{ selectedRow.updated_at || '—' }}</el-descriptions-item>
<el-descriptions-item label="开始时间">{{ selectedRow.started_at || '—' }}</el-descriptions-item>
<el-descriptions-item label="完成时间">{{ selectedRow.completed_at || '—' }}</el-descriptions-item>
<el-descriptions-item label="删除时间" :span="2">{{ selectedRow.deleted_at || '—' }}</el-descriptions-item>
</el-descriptions>
</div>
<!-- 详细描述 -->
<div class="section">
<div class="section-title">详细描述</div>
<el-descriptions :column="1" border size="small" class="detail-descriptions">
<el-descriptions-item label="详细描述">{{ selectedRow.description || '—' }}</el-descriptions-item>
</el-descriptions>
</div>
<!-- 处理结果 -->
<div class="section">
<div class="section-title">处理结果</div>
<el-descriptions :column="1" border size="small" class="detail-descriptions">
<el-descriptions-item label="处理结果">{{ selectedRow.resolution || '—' }}</el-descriptions-item>
</el-descriptions>
</div>
<div class="detail-actions" style="margin-top:12px">
<el-button size="small" type="primary" plain @click.stop="handleViewDetail(selectedRow)">
查看完整详情
</el-button>
</div>
</div>
</div>
</div>
<div class="no-selection" v-else :style="lowerPaneStyle">
<div class="empty-tip">
<p>请从上方列表中选择一项查看详情</p>
</div>
</div>
</template>
</div>
</div>
<!-- 发起售后单弹窗 -->
<CreateAfterSaleDialog v-model:visible="createDialogVisible" @success="onCreateSuccess" />
<!-- 售后明细弹窗 -->
<AfterSaleDetailDialog
v-model:visible="detailDialogVisible"
:after-sale-id="detailAfterSaleId"
@success="handleRefresh"
/>
</div>
</template>
<script setup lang="ts">
import { onMounted, reactive, ref, computed, watch } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { afterSaleWorkList, afterSaleBatchSetPendingFeedback, afterSaleBatchClose, type AfterSaleListParams } from '@/api/aftersale/index'
import {
getAfterSaleAvailableFields,
afterSaleAvailableFields,
afterSaleColumns,
AFTER_SALE_TYPE_MAP,
AFTER_SALE_TYPE_TAG_MAP,
AFTER_SALE_SUB_TYPE_MAP,
AFTER_SALE_STATUS_MAP,
AFTER_SALE_STATUS_TAG_MAP,
AFTER_SALE_ROLE_GROUP_MAP,
AFTER_SALE_ROLE_GROUP_TAG_MAP,
CLAIM_STATUS_MAP,
CLAIM_STATUS_TAG_MAP,
} from '@/views/afterSale/list/afterSale-config'
import { loadStores } from '@/api/index/index'
import { extractStoreListFromResponse, fillStoreScanFieldOptions, getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-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 CreateAfterSaleDialog from './components/CreateAfterSaleDialog.vue'
import AfterSaleDetailDialog from '@/views/afterSale/detail/AfterSaleDetailDialog.vue'
import { useSettingsStore } from '@/stores/modules/settings'
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
import { safeInvoke } from '@/utils/safe-invoke'
// ==================== 工具函数 ====================
function typeLabel(t: string) { return AFTER_SALE_TYPE_MAP[t] ?? t ?? '-' }
function typeTagType(t: string) { return AFTER_SALE_TYPE_TAG_MAP[t] ?? 'info' }
function subTypeLabel(s: string) { return AFTER_SALE_SUB_TYPE_MAP[s] ?? s ?? '-' }
function statusLabel(s: string) { return AFTER_SALE_STATUS_MAP[s] ?? s ?? '-' }
function statusTagType(s: string) { return AFTER_SALE_STATUS_TAG_MAP[s] ?? 'info' }
function roleGroupLabel(r: string) { return AFTER_SALE_ROLE_GROUP_MAP[r] ?? r ?? '-' }
function roleGroupTagType(r: string) { return AFTER_SALE_ROLE_GROUP_TAG_MAP[r] ?? 'info' }
function claimStatusLabel(c: string) { return CLAIM_STATUS_MAP[c] ?? c ?? '-' }
function claimStatusTagType(c: string) { return CLAIM_STATUS_TAG_MAP[c] ?? 'info' }
// ==================== 布局 ====================
const settingsStore = useSettingsStore()
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
const containerHeight = computed(() => shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)')
const {
splitStackRef,
beginSplitDrag,
lowerPaneStyle,
upperPaneStyle,
} = useVerticalSplitPane({ defaultLowerPercent: 40 })
const upperPaneFullStyle = computed(() => ({
flex: '1 1 auto',
minHeight: '0',
overflow: 'hidden',
}))
const detailVisible = ref(true)
const activeTab = ref('detail')
// ==================== 售后明细弹窗 ====================
const detailDialogVisible = ref(false)
const detailAfterSaleId = ref<number | null>(null)
// 关闭弹窗时重置 ID,确保再次打开同一记录也能触发加载
watch(detailDialogVisible, (v) => {
if (!v) detailAfterSaleId.value = null
})
// ==================== 配置 ====================
const availableFields = computed(() => {
const typeVal = currentConditions.value.type?.value
return getAfterSaleAvailableFields(typeVal || undefined)
})
const columns = afterSaleColumns
const tableSize = 'small'
/** 工单工具栏按钮(排序与样式对齐 storage/receiving):
* 刷新 → 基础功能(白底黑字) → 页面功能(蓝底/白底蓝字) → 取消类(红字)
*/
const toolbarButtons: ToolbarButtonConfig[] = [
// 刷新
{ key: 'refresh', label: '刷新', category: 'refresh', size: 'small', loadingKey: 'loading', action: 'refresh' },
// 基础功能(白底黑字)
{ key: 'columnConfig', label: '字段设置', category: 'setting', size: 'small', action: 'openColumnConfigPanel' },
{
key: 'toggleDetail',
label: '显示详情',
dynamicLabelKey: 'detailToggleLabel',
category: 'setting',
size: 'small',
action: 'toggleDetailVisible'
},
// 页面功能:可直接点击=白底蓝字(对齐 storage/receiving "添加收货单")
{ key: 'create', label: '发起售后单', category: 'action', size: 'small', action: 'showCreateDialog' },
// 页面功能:需勾选=白底蓝字
{ key: 'batchPendingFeedback', label: '设为待反馈', category: 'action', size: 'small', loadingKey: 'batchPendingFeedbackLoading', disabledKey: 'batchPendingFeedbackDisabled', action: 'batchSetPendingFeedback' },
{ key: 'batchComplete', label: '批量完成', category: 'action', size: 'small', loadingKey: 'batchCompleteLoading', disabledKey: 'batchPendingFeedbackDisabled', action: 'batchComplete' },
// 取消类(红字)
{ key: 'batchClose', label: '批量关闭', category: 'cancel', size: 'small', loadingKey: 'batchCloseLoading', disabledKey: 'batchPendingFeedbackDisabled', action: 'batchClose' },
]
// ==================== 按钮状态 ====================
const batchPendingFeedbackLoading = ref(false)
const batchCompleteLoading = ref(false)
const batchCloseLoading = ref(false)
const selectedRows = ref<any[]>([])
const buttonLoadingMap = computed(() => ({
loading: loading.value,
batchPendingFeedbackLoading: batchPendingFeedbackLoading.value,
batchCompleteLoading: batchCompleteLoading.value,
batchCloseLoading: batchCloseLoading.value,
}))
const buttonDisabledMap = computed(() => ({
batchPendingFeedbackDisabled: selectedRows.value.length === 0,
}))
const buttonLabelMap = computed(() => ({
detailToggleLabel: detailVisible.value ? '隐藏详情' : '显示详情',
}))
const toolbarLayoutKey = computed(() =>
JSON.stringify({
loading: buttonLoadingMap.value,
disabled: buttonDisabledMap.value,
labels: buttonLabelMap.value,
})
)
function resolveButtonLoading(loadingKey?: string) {
if (!loadingKey) return false
return Boolean((buttonLoadingMap.value as Record<string, boolean>)[loadingKey])
}
function resolveButtonDisabled(disabledKey?: string) {
if (!disabledKey) return false
return Boolean((buttonDisabledMap.value as Record<string, boolean>)[disabledKey])
}
function resolveButtonLabel(defaultLabel: string, dynamicLabelKey?: string) {
if (!dynamicLabelKey) return defaultLabel
return (buttonLabelMap.value as Record<string, string>)[dynamicLabelKey] || defaultLabel
}
const toolbarActionMap: Record<string, () => void> = {
refresh: () => handleRefresh(),
showCreateDialog: () => { createDialogVisible.value = true },
batchSetPendingFeedback: () => handleBatchSetPendingFeedback(),
batchComplete: () => handleBatchStatus('completed', '批量完成', batchCompleteLoading),
batchClose: () => handleBatchStatus('closed', '批量关闭', batchCloseLoading),
openColumnConfigPanel: () => upperTable.value?.openColumnConfig?.(),
toggleDetailVisible: () => { detailVisible.value = !detailVisible.value },
}
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 selectedId = ref<number | null>(null)
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
const upperPagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
const selectedRow = computed(() => {
return tableData.value.find((i: any) => i.id === selectedId.value) || null
})
// ==================== 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) {
selectedId.value = row?.id ?? null
}
function handleSelectionChange(rows: any[]) {
selectedRows.value = rows
}
async function handleBatchSetPendingFeedback() {
if (selectedRows.value.length === 0) {
ElMessage.warning('请先勾选需要设为待反馈的工单')
return
}
try {
await ElMessageBox.confirm(
`确认将 ${selectedRows.value.length} 个工单设为"待反馈"状态?`,
'批量设待反馈',
{ confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }
)
} catch {
return // 用户取消
}
batchPendingFeedbackLoading.value = true
try {
const ids = selectedRows.value.map((r: any) => r.id)
const res: any = await afterSaleBatchSetPendingFeedback({ ids })
if (res && (res.flag === 'success' || res.code === 1 || res.code === 200 || res.code === 20000)) {
const data = res.data ?? res
const total = data.total ?? 0
const success = data.success ?? 0
const failed = data.failed ?? []
if (failed.length > 0) {
const failedList = failed.map((f: any) => `#${f.id}: ${f.reason}`).join('\n')
ElMessage.warning({
message: `成功 ${success}/${total} 个,失败 ${failed.length} 个`,
duration: 5000,
})
console.warn('批量设待反馈失败项:', failedList)
} else {
ElMessage.success(`成功将 ${success} 个工单设为待反馈`)
}
// 清除选择并刷新
upperTable.value?.clearSelection?.()
selectedRows.value = []
fetchData()
} else {
ElMessage.error(res?.message || '批量操作失败')
}
} catch (error) {
console.error('批量设待反馈失败:', error)
ElMessage.error('批量操作失败')
} finally {
batchPendingFeedbackLoading.value = false
}
}
/** 通用批量状态操作:completed(完成) / closed(关闭) */
async function handleBatchStatus(status: 'completed' | 'closed', label: string, loadingRef: ReturnType<typeof ref<boolean>>) {
if (selectedRows.value.length === 0) {
ElMessage.warning('请先勾选需要操作的工单')
return
}
try {
await ElMessageBox.confirm(
`确认将 ${selectedRows.value.length} 个工单${label}?`,
label,
{ confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }
)
} catch { return }
loadingRef.value = true
try {
const ids = selectedRows.value.map((r: any) => r.id)
const res: any = await afterSaleBatchClose({ ids, status })
if (res && (res.flag === 'success' || res.code === 1 || res.code === 200 || res.code === 20000)) {
const data = res.data ?? res
const total = data.total ?? 0
const success = data.success ?? 0
const failed = data.failed ?? []
if (failed.length > 0) {
ElMessage.warning(`成功 ${success}/${total} 个,失败 ${failed.length} 个,详见控制台`)
console.warn(`${label}失败项:`, failed)
} else {
ElMessage.success(`成功${label} ${success} 个工单`)
}
upperTable.value?.clearSelection?.()
selectedRows.value = []
fetchData()
} else {
ElMessage.error(res?.message || `${label}失败`)
}
} catch (error) {
console.error(`${label}失败:`, error)
ElMessage.error(`${label}失败`)
} finally {
loadingRef.value = false
}
}
// ==================== 数据查询 ====================
function buildWhereFromConditions(conditions: Record<string, any>): Record<string, any> {
const where: Record<string, any> = {}
for (const [key, cond] of Object.entries(conditions)) {
if (cond === undefined || cond === null || cond === '') continue
if (typeof cond === 'object' && cond.value !== undefined) {
const val = cond.value
const op = cond.operator || 'eq'
if (val === undefined || val === null || val === '' || (Array.isArray(val) && val.length === 0)) continue
where[key] = { operator: op, value: val }
} else {
where[key] = { operator: 'eq', value: cond }
}
}
return where
}
async function fetchData() {
loading.value = true
const start = Date.now()
try {
const where = buildWhereFromConditions(currentConditions.value)
const params: AfterSaleListParams = {
pagination: { page: pagination.currentPage, pageSize: pagination.pageSize },
where,
}
const res: any = await afterSaleWorkList(params)
if (res && (res.code === 1 || res.code === 200 || res.code === 20000 || res.flag === 'success')) {
const data = res.data ?? res
tableData.value = data.list ?? []
const total = data.total ?? (data.pagination?.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 {
loading.value = false
queryTime.value = Date.now() - start
}
}
function handleRefresh() {
upperPagination.currentPage = 1
fetchData()
}
function handleSortChange(_sort: { prop: string; order: string }) {}
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()
}
// ==================== 发起售后单 ====================
const createDialogVisible = ref(false)
function onCreateSuccess() {
handleRefresh()
}
// ==================== 查看详情 ====================
function handleViewDetail(row: any) {
detailAfterSaleId.value = row.id
detailDialogVisible.value = true
}
// ==================== 货主列表加载 ====================
async function loadStoreOptions() {
try {
const storesRes: any = await loadStores()
fillStoreScanFieldOptions(afterSaleAvailableFields, extractStoreListFromResponse(storesRes))
} catch {
fillStoreScanFieldOptions(afterSaleAvailableFields, [])
}
}
onMounted(() => {
loadStoreOptions()
fetchData()
})
</script>
<style scoped lang="scss">
@use "../order/orderManagement/styles/order-sub.scss";
/* 详情区外壳与 stock/external_stock 一致:不留上/下间距,左右 10px,
面板自身 padding: 6px 10px 8px(合计内容缩进 20px) */
.order-sub-container .main-content .lower-level .detail-container {
padding: 0 10px;
overflow: auto;
}
/* 工单详情面板:分区标题 + 带边框描述列表(对齐 stock/external_stock「基本信息」) */
.detail-page {
padding: 6px 10px 8px;
box-sizing: border-box;
.section {
margin-bottom: 12px;
&:last-child {
margin-bottom: 0;
}
}
.section-title {
font-size: 14px;
font-weight: 600;
color: #303133;
margin-bottom: 10px;
padding-left: 8px;
border-left: 3px solid #409eff;
line-height: 1.4;
}
.detail-descriptions :deep(.el-descriptions__label) {
width: 120px;
background: #fafbfc;
font-weight: 500;
}
}
</style>