front/src/views/order/myOrders/index.vue
2026-04-27 09:09:31 +08:00

1099 lines
36 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.

<script lang="ts" setup>
import { ref, computed, onMounted, nextTick } from 'vue';
import { IconSettings } from '@arco-design/web-vue/es/icon';
import { Message, Modal } from '@arco-design/web-vue';
import HandsontablePro from '@/components/HandsontablePro/index.vue';
import PaginationPro from '@/components/PaginationPro/index.vue';
import { useTableContainerHeight } from '@/composables/useTableContainerHeight';
import { useI18n } from 'vue-i18n';
import {
postOrderList,
getOrderDetail,
postOrderPay,
postOrderPreDeclare,
postOrderIntercept,
postOrderCancelIntercept,
postOrderDelete,
postOrderPrint,
postOrderExport,
} from '@/api/order';
import OrderDetailDrawer from './components/OrderDetailDrawer.vue';
import OrderPrintModal from '@/components/PrintTemplate/OrderPrintModal.vue';
import { useHiprintClientState } from '@/utils/hiprint/hiprintClientState';
defineOptions({
name: 'MyOrders',
});
const { t } = useI18n();
const { tableContainerRef, tableHeight } = useTableContainerHeight();
// 订单详情抽屉
const detailDrawerRef = ref<InstanceType<typeof OrderDetailDrawer>>();
const currentOrder = ref<any>(null);
/** 兼容后端 camelCase / PascalCase */
function pick(raw: Record<string, any> | undefined, ...keys: string[]) {
if (!raw) return undefined;
for (const k of keys) {
const v = raw[k];
if (v !== undefined && v !== null && v !== '') return v;
}
return undefined;
}
/** 列表行与表格列对齐:接口用 serviceNo/clientNo/trackNo,表格用运单号/客户单号/跟踪号 */
function normalizeOrderRow(raw: any) {
const r = raw?.receiver || raw?.Receiver || {};
const wl = raw?.weightList || raw?.WeightList;
const lastW =
Array.isArray(wl) && wl.length ? wl[wl.length - 1] : undefined;
const serviceNo = pick(raw, 'serviceNo', 'ServiceNo', 'waybillNo', 'WaybillNo');
const clientNo = pick(raw, 'clientNo', 'ClientNo', 'customerOrderNo', 'CustomerOrderNo');
const trackNo = pick(raw, 'trackNo', 'TrackNo', 'trackingNo', 'TrackingNo');
const productCode = pick(raw, 'productCode', 'ProductCode');
const channelCode = pick(raw, 'channelCode', 'ChannelCode');
return {
...raw,
waybillNo: serviceNo ?? '',
customerOrderNo: clientNo ?? '',
trackingNo: trackNo ?? '',
consignee: pick(raw, 'consignee', 'Consignee') ?? pick(r, 'recipientsName', 'RecipientsName') ?? '',
consigneePhone: pick(raw, 'consigneePhone', 'ConsigneePhone') ?? pick(r, 'phone', 'Phone') ?? '',
consigneeAddress: pick(raw, 'consigneeAddress', 'ConsigneeAddress') ?? pick(r, 'streetAddress1', 'StreetAddress1') ?? '',
consigneePostcode: pick(raw, 'consigneePostcode', 'ConsigneePostcode') ?? pick(r, 'zipCode', 'ZipCode') ?? '',
consigneeState: pick(raw, 'consigneeState', 'ConsigneeState') ?? pick(r, 'province', 'Province') ?? '',
consigneeCity: pick(raw, 'consigneeCity', 'ConsigneeCity') ?? pick(r, 'city', 'City') ?? '',
consigneeCountry: pick(raw, 'consigneeCountry', 'ConsigneeCountry') ?? pick(r, 'country', 'Country') ?? '',
ioss: pick(raw, 'ioss', 'Ioss', 'IOSS') ?? '',
eori: pick(raw, 'eori', 'Eori', 'EORI') ?? pick(r, 'eori', 'Eori') ?? '',
shippingMethod:
pick(raw, 'shippingMethod', 'ShippingMethod') ||
[productCode, channelCode].filter(Boolean).join(' / ') ||
'',
chargeableWeight:
pick(raw, 'chargeableWeight', 'ChargeableWeight') ??
pick(lastW as any, 'chargeableWeight', 'ChargeableWeight') ??
'',
receivableAmount: pick(raw, 'receivableAmount', 'ReceivableAmount') ?? '',
orderStatus: pick(raw, 'orderStatus', 'OrderStatus') ?? raw?.orderStatus,
status: pick(raw, 'status', 'Status') ?? raw?.status,
cargoAttribute: pick(raw, 'cargoAttribute', 'CargoAttribute') ?? raw?.cargoAttribute,
createTime: pick(raw, 'createTime', 'CreateTime') ?? raw?.createTime,
receiveTime: pick(raw, 'receiveTime', 'ReceiveTime') ?? raw?.receiveTime,
shipTime: pick(raw, 'shipTime', 'ShipTime') ?? raw?.shipTime,
payTime: pick(raw, 'payTime', 'PayTime') ?? raw?.payTime,
signTime: pick(raw, 'signTime', 'SignTime') ?? raw?.signTime,
warehouse: pick(raw, 'warehouse', 'Warehouse') ?? raw?.warehouse,
};
}
async function openDetailWithOptionalFetch(row: any) {
currentOrder.value = row;
detailDrawerRef.value?.openDrawer();
const id = row?.id;
if (id == null || id === '') return;
try {
const detail = await getOrderDetail(id);
currentOrder.value = normalizeOrderRow({ ...row, ...detail });
} catch {
/* 保留列表行数据 */
}
}
const handleOrderDetailClick = (row: number) => {
if (row >= 0 && row < orderList.value.length) {
openDetailWithOptionalFetch(orderList.value[row]);
}
};
// 当前激活的标签页
const activeTab = ref('all');
// 标签页配置
const tabs = ref([
{ key: 'all', labelKey: 'order.myOrders.tabs.all', count: null },
{ key: 'draft', labelKey: 'order.myOrders.tabs.draft', count: null },
{ key: 'predeclared', labelKey: 'order.myOrders.tabs.predeclared', count: null },
{ key: 'received', labelKey: 'order.myOrders.tabs.received', count: null },
{ key: 'pendingPayment', labelKey: 'order.myOrders.tabs.pendingPayment', count: null },
{ key: 'pendingShip', labelKey: 'order.myOrders.tabs.pendingShip', count: null },
{ key: 'pendingOnline', labelKey: 'order.myOrders.tabs.pendingOnline', count: null },
{ key: 'shipping', labelKey: 'order.myOrders.tabs.shipping', count: null },
{ key: 'deliverySuccess', labelKey: 'order.myOrders.tabs.deliverySuccess', count: null },
{ key: 'deliveryFailed', labelKey: 'order.myOrders.tabs.deliveryFailed', count: null },
{ key: 'problematic', labelKey: 'order.myOrders.tabs.problematic', count: null },
{ key: 'deleted', labelKey: 'order.myOrders.tabs.deleted', count: null },
{ key: 'claimed', labelKey: 'order.myOrders.tabs.claimed', count: null },
]);
// 分页相关数据
const currentPage = ref(1);
const pageSize = ref(50);
const totalCount = ref(0);
const orderList = ref<any[]>([]);
const listLoading = ref(false);
const selectedRowCount = ref(0);
/** 表格选中行(用于批量操作) */
const selectedOrderRows = ref<any[]>([]);
const actionSubmitting = ref(false);
const printConnectionState = useHiprintClientState();
const singlePrintVisible = ref(false);
const batchPrintVisible = ref(false);
const singlePrintItems = ref<Array<{ id: number | string; label: string; url: string }>>([]);
const batchPrintItems = ref<Array<{ id: number | string; label: string; url: string }>>([]);
function getOrderRowId(row: any): number | string | undefined {
if (row == null) return undefined;
const id = row.id ?? row.Id;
if (id === undefined || id === null || id === '') return undefined;
return id;
}
function requireSelectedRows(): any[] {
const rows = selectedOrderRows.value.filter((r) => getOrderRowId(r) != null);
if (!rows.length) {
Message.warning('请先选择订单');
return [];
}
return rows;
}
const loadOrderList = async () => {
listLoading.value = true;
try {
const status = activeTab.value === 'all' ? 'all' : activeTab.value;
const { items, total } = await postOrderList({
page: currentPage.value,
pageSize: pageSize.value,
status,
});
totalCount.value = total;
orderList.value = (items || []).map((row) => normalizeOrderRow(row));
} catch (e: any) {
orderList.value = [];
totalCount.value = 0;
Message.error(e?.message || '加载订单列表失败');
} finally {
listLoading.value = false;
}
};
// 当前页数据(HandsontablePro 用)
const processedTableData = computed(() => orderList.value);
// 标签页切换
const handleTabChange = (key: string) => {
activeTab.value = key;
currentPage.value = 1;
loadOrderList();
};
// 操作按钮处理(依赖表格多选行;导出按当前 tab 条件,无需选行)
const handlePay = async () => {
const rows = requireSelectedRows();
if (!rows.length) return;
actionSubmitting.value = true;
try {
for (const row of rows) {
await postOrderPay({ id: getOrderRowId(row)! });
}
Message.success('支付请求已提交');
await loadOrderList();
} catch (e: any) {
Message.error(e?.message || '操作失败');
} finally {
actionSubmitting.value = false;
}
};
const handlePreDeclare = async () => {
const rows = requireSelectedRows();
if (!rows.length) return;
actionSubmitting.value = true;
try {
for (const row of rows) {
await postOrderPreDeclare({ id: getOrderRowId(row)! });
}
Message.success('预报已提交');
await loadOrderList();
} catch (e: any) {
Message.error(e?.message || '操作失败');
} finally {
actionSubmitting.value = false;
}
};
const handleIntercept = async () => {
const rows = requireSelectedRows();
if (!rows.length) return;
actionSubmitting.value = true;
try {
for (const row of rows) {
await postOrderIntercept({ id: getOrderRowId(row)! });
}
Message.success('拦截已提交');
await loadOrderList();
} catch (e: any) {
Message.error(e?.message || '操作失败');
} finally {
actionSubmitting.value = false;
}
};
const handleCancelIntercept = async () => {
const rows = requireSelectedRows();
if (!rows.length) return;
actionSubmitting.value = true;
try {
for (const row of rows) {
await postOrderCancelIntercept({ id: getOrderRowId(row)! });
}
Message.success('已取消拦截');
await loadOrderList();
} catch (e: any) {
Message.error(e?.message || '操作失败');
} finally {
actionSubmitting.value = false;
}
};
const handleDelete = () => {
const rows = requireSelectedRows();
if (!rows.length) return;
Modal.confirm({
title: '确认删除',
content: `确定删除选中的 ${rows.length} 条订单吗?`,
onOk: async () => {
actionSubmitting.value = true;
try {
for (const row of rows) {
await postOrderDelete({ id: getOrderRowId(row)! });
}
Message.success('已删除');
await loadOrderList();
} catch (e: any) {
Message.error(e?.message || '删除失败');
throw e;
} finally {
actionSubmitting.value = false;
}
},
});
};
function buildPrintItem(row: any, printUrl: string) {
const id = getOrderRowId(row)!;
const label = row?.waybillNo || row?.trackingNo || row?.customerOrderNo || String(id);
return { id, label, url: printUrl };
}
function isUsablePrintUrl(raw: unknown) {
const value = String(raw ?? '').trim();
if (!value) return false;
if (value.includes('获取中')) return false;
return true;
}
const handleSinglePrint = async () => {
singlePrintVisible.value = false;
singlePrintItems.value = [];
const rows = requireSelectedRows();
if (!rows.length) return;
if (rows.length > 1) {
Message.warning('单个打印仅支持选择 1 条订单');
return;
}
if (!printConnectionState.enabled || !printConnectionState.connected) {
Message.warning('请先在顶部打开并连接打印开关');
return;
}
actionSubmitting.value = true;
try {
const row = rows[0];
const { printUrl } = await postOrderPrint({ id: getOrderRowId(row)! });
if (!isUsablePrintUrl(printUrl)) {
Message.info('未获取到打印文件,已打开打印弹窗供预览布局');
singlePrintVisible.value = true;
return;
}
singlePrintItems.value = [buildPrintItem(row, printUrl)];
singlePrintVisible.value = true;
} catch (e: any) {
Message.error(e?.message || '打印失败');
} finally {
actionSubmitting.value = false;
}
};
const handleBatchPrint = async () => {
batchPrintVisible.value = false;
batchPrintItems.value = [];
const rows = requireSelectedRows();
if (!rows.length) return;
if (!printConnectionState.enabled || !printConnectionState.connected) {
Message.warning('请先在顶部打开并连接打印开关');
return;
}
actionSubmitting.value = true;
try {
const items: Array<{ id: number | string; label: string; url: string }> = [];
for (const row of rows) {
const { printUrl } = await postOrderPrint({ id: getOrderRowId(row)! });
if (isUsablePrintUrl(printUrl)) {
items.push(buildPrintItem(row, printUrl));
}
}
if (!items.length) {
Message.info('未获取到可打印文件,已打开打印弹窗供预览布局');
batchPrintVisible.value = true;
return;
}
batchPrintItems.value = items;
batchPrintVisible.value = true;
} catch (e: any) {
Message.error(e?.message || '批量打印失败');
} finally {
actionSubmitting.value = false;
}
};
const handleExport = async () => {
actionSubmitting.value = true;
try {
const status = activeTab.value === 'all' ? 'all' : activeTab.value;
const { downloadUrl } = await postOrderExport({
status,
keyword: '',
createTimeStart: '',
createTimeEnd: '',
});
if (downloadUrl) window.open(downloadUrl, '_blank');
Message.success(downloadUrl ? '导出链接已打开' : '导出已提交');
} catch (e: any) {
Message.error(e?.message || '导出失败');
} finally {
actionSubmitting.value = false;
}
};
const handleModifyOrder = () => {
};
const onMoreActionClick = (key: string) => {
if (key === 'intercept') return handleIntercept();
if (key === 'cancelIntercept') return handleCancelIntercept();
if (key === 'delete') return handleDelete();
if (key === 'export') return handleExport();
if (key === 'modifyOrder') return handleModifyOrder();
};
// 分页处理函数
const handlePageChange = (page: number) => {
currentPage.value = page;
loadOrderList();
};
const handlePageSizeChange = (size: number) => {
pageSize.value = size;
currentPage.value = 1;
loadOrderList();
};
// HandsontablePro 列定义
const hotColumns = computed(() => [
{ key: 'waybillNo', label: t('order.myOrders.table.waybillNo'), width: 90 },
{ key: 'customerOrderNo', label: t('order.myOrders.table.customerOrderNo'), width: 120 },
{ key: 'trackingNo', label: t('order.myOrders.table.trackingNo'), width: 120 },
{ key: 'shippingMethod', label: t('order.myOrders.table.shippingMethod'), width: 140 },
{ key: 'cargoAttribute', label: t('order.myOrders.table.cargoAttribute'), width: 85 },
{ key: 'consigneeCountry', label: t('order.myOrders.table.consigneeCountry'), width: 90 },
{ key: 'chargeableWeight', label: t('order.myOrders.table.chargeableWeight'), width: 95 },
{ key: 'receivableAmount', label: t('order.myOrders.table.receivableAmount'), width: 95 },
{ key: 'consignee', label: t('order.myOrders.table.consignee'), width: 90 },
{ key: 'consigneePhone', label: t('order.myOrders.table.consigneePhone'), width: 110 },
{ key: 'consigneeAddress', label: t('order.myOrders.table.consigneeAddress'), width: 140 },
{ key: 'consigneePostcode', label: t('order.myOrders.table.consigneePostcode'), width: 90 },
{ key: 'consigneeState', label: t('order.myOrders.table.consigneeState'), width: 90 },
{ key: 'consigneeCity', label: t('order.myOrders.table.consigneeCity'), width: 90 },
{ key: 'ioss', label: t('order.myOrders.table.ioss'), width: 100 },
{ key: 'eori', label: t('order.myOrders.table.eori'), width: 100 },
{ key: 'orderStatus', label: t('order.myOrders.table.orderStatus'), width: 90 },
{ key: 'createTime', label: t('order.myOrders.table.createTime'), width: 150 },
{ key: 'receiveTime', label: t('order.myOrders.table.receiveTime'), width: 150 },
{ key: 'shipTime', label: t('order.myOrders.table.shipTime'), width: 150 },
{ key: 'payTime', label: t('order.myOrders.table.payTime'), width: 150 },
{ key: 'signTime', label: t('order.myOrders.table.signTime'), width: 150 },
{ key: 'warehouse', label: t('order.myOrders.table.warehouse'), width: 90 },
]);
const iconView = '<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" style="width:16px;height:16px;color:var(--app-primary-color,#2D8C8C);"><path d="M8 2C4.5 2 1.73 4.11 0 7c1.73 2.89 4.5 5 8 5s6.27-2.11 8-5c-1.73-2.89-4.5-5-8-5zM8 11.5c-2.48 0-4.5-2.02-4.5-4.5S5.52 2.5 8 2.5s4.5 2.02 4.5 4.5S10.48 11.5 8 11.5zM8 4.5c-1.38 0-2.5 1.12-2.5 2.5S6.62 9.5 8 9.5s2.5-1.12 2.5-2.5S9.38 4.5 8 4.5z" fill="currentColor"/></svg>';
const actionRenderer = (row: any, rowIndex: number) => {
return `<div class="view-icon-wrapper" data-action="view" data-row-index="${rowIndex}" style="display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 4px; border-radius: 4px; transition: all 0.2s;">${iconView}</div>`;
};
const customCellRenderer = (row: number, col: number, value: any, rowData: any) => {
const colOffset = 2; // action + serialNo
const dataColIndex = col - colOffset;
if (dataColIndex < 0 || dataColIndex >= hotColumns.value.length) return null;
const colKey = hotColumns.value[dataColIndex].key;
if (colKey === 'cargoAttribute' && value) {
const cargoKey = `order.myOrders.drawer.cargoAttribute.${value}`;
const translated = t(cargoKey);
return translated !== cargoKey ? translated : value;
}
if (colKey === 'orderStatus') {
const status = rowData?.orderStatus || rowData?.status || '';
let tagColor = '#86909c';
let tagBgColor = '#f2f3f5';
let statusKey = '';
if (status === '待支付' || status === 'pendingPayment') {
tagColor = '#ff7d00';
tagBgColor = '#fff7e6';
statusKey = 'order.myOrders.status.pendingPayment';
} else if (status === '草稿' || status === 'draft') {
statusKey = 'order.myOrders.status.draft';
} else if (status === '已预报' || status === 'predeclared') {
tagColor = '#165dff';
tagBgColor = '#e8f3ff';
statusKey = 'order.myOrders.status.predeclared';
} else if (status === '已收货' || status === 'received') {
tagColor = '#00b42a';
tagBgColor = '#e8f8e8';
statusKey = 'order.myOrders.status.received';
} else if (status === '待发货' || status === 'pendingShip') {
tagColor = '#ff7d00';
tagBgColor = '#fff7e6';
statusKey = 'order.myOrders.status.pendingShip';
} else if (status === '待上网' || status === 'pendingOnline') {
tagColor = '#165dff';
tagBgColor = '#e8f3ff';
statusKey = 'order.myOrders.status.pendingOnline';
} else if (status === '运输中' || status === 'shipping') {
tagColor = '#165dff';
tagBgColor = '#e8f3ff';
statusKey = 'order.myOrders.status.shipping';
} else if (status === '派送成功' || status === 'deliverySuccess') {
tagColor = '#00b42a';
tagBgColor = '#e8f8e8';
statusKey = 'order.myOrders.status.deliverySuccess';
} else if (status === '派送失败' || status === 'deliveryFailed') {
tagColor = '#f53f3f';
tagBgColor = '#ffece8';
statusKey = 'order.myOrders.status.deliveryFailed';
} else if (status === '问题件' || status === 'problematic') {
tagColor = '#f53f3f';
tagBgColor = '#ffece8';
statusKey = 'order.myOrders.status.problematic';
} else if (status === '已删除' || status === 'deleted') {
statusKey = 'order.myOrders.status.deleted';
} else if (status === '已理赔' || status === 'claimed') {
tagColor = '#722ed1';
tagBgColor = '#f7e8ff';
statusKey = 'order.myOrders.status.claimed';
}
const statusText = statusKey ? t(statusKey) : status;
return `<span style="display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; color: ${tagColor}; background-color: ${tagBgColor}; white-space: nowrap;">${statusText}</span>`;
}
if (['chargeableWeight', 'receivableAmount'].includes(colKey)) {
return value != null && value !== '' ? Number(value).toLocaleString() : null;
}
// 首列添加 data-row-status 用于行背景样式
if (colKey === 'waybillNo') {
const status = rowData?.status || rowData?.orderStatus || '';
return `<span data-row-status="${status}">${value || '--'}</span>`;
}
return null;
};
const handleActionClick = (row: any) => {
openDetailWithOptionalFetch(row);
};
const handleSelectionChange = (rows: any[]) => {
selectedOrderRows.value = rows ?? [];
selectedRowCount.value = selectedOrderRows.value.length;
};
onMounted(() => {
nextTick(() => loadOrderList());
});
</script>
<template>
<div class="my-orders-container">
<!-- 标签页导航和操作按钮 -->
<div class="tabs-actions-section">
<div class="tabs-container">
<div
v-for="tab in tabs"
:key="tab.key"
:class="['tab-item', { active: activeTab === tab.key }]"
@click="handleTabChange(tab.key)"
>
<span class="tab-label">{{ tab.label || $t(tab.labelKey) }}</span>
<span v-if="tab.count !== null" class="tab-count">({{ tab.count }})</span>
</div>
</div>
<div class="actions-right">
<a-button class="btn-pay" :loading="actionSubmitting" @click="handlePay">{{ t('order.myOrders.actions.pay') }}</a-button>
<a-button class="btn-predeclare" :loading="actionSubmitting" @click="handlePreDeclare">{{ t('order.myOrders.actions.predeclare') }}</a-button>
<a-button class="btn-print" :loading="actionSubmitting" @click="handleSinglePrint">单个打印</a-button>
<a-button class="btn-print" :loading="actionSubmitting" @click="handleBatchPrint">批量打印</a-button>
<a-dropdown trigger="click" position="bl">
<a-button class="btn-settings">
<icon-settings />
</a-button>
<template #content>
<a-doption @click="onMoreActionClick('intercept')">{{ t('order.myOrders.actions.intercept') }}</a-doption>
<a-doption @click="onMoreActionClick('cancelIntercept')">{{ t('order.myOrders.actions.cancelIntercept') }}</a-doption>
<a-doption @click="onMoreActionClick('delete')">{{ t('order.myOrders.actions.delete') }}</a-doption>
<a-doption @click="onMoreActionClick('export')">{{ t('order.myOrders.actions.export') }}</a-doption>
<a-doption @click="onMoreActionClick('modifyOrder')">{{ t('order.myOrders.actions.modifyOrder') }}</a-doption>
</template>
</a-dropdown>
</div>
</div>
<!-- 订单表格区域 -->
<div class="table-section">
<!-- 表格操作按钮和分页控制 -->
<div class="table-toolbar">
<div class="toolbar-left">
<span class="selected-count">
{{ t('order.myOrders.selectedCount', { count: selectedRowCount }) }}
</span>
</div>
<div class="toolbar-right">
<div class="pagination-controls">
<PaginationPro
:total-count="totalCount"
v-model:current-page="currentPage"
v-model:page-size="pageSize"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
/>
</div>
</div>
</div>
<div ref="tableContainerRef" class="list-wrap">
<a-spin :loading="listLoading" class="table-spin">
<HandsontablePro
:columns="hotColumns"
:data="processedTableData"
:total="totalCount"
:current-page="currentPage"
:page-size="pageSize"
:show-action-column="true"
:action-column-position="'start'"
:action-column-width="60"
:action-renderer="actionRenderer"
:custom-cell-renderer="customCellRenderer"
:stretch-columns="true"
:height="tableHeight"
@action-click="handleActionClick"
@selection-change="handleSelectionChange"
/>
</a-spin>
</div>
</div>
<!-- 订单详情抽屉(左侧) -->
<OrderDetailDrawer
ref="detailDrawerRef"
:order="currentOrder"
/>
<OrderPrintModal v-model:visible="singlePrintVisible" mode="single" :items="singlePrintItems" />
<OrderPrintModal v-model:visible="batchPrintVisible" mode="batch" :items="batchPrintItems" />
</div>
</template>
<style lang="less" scoped>
.my-orders-container {
width: 100%;
box-sizing: border-box;
padding: 16px 16px 24px;
background-color: #f0f3f4;
flex: 1;
min-height: 0;
overflow-x: hidden;
overflow-y: hidden;
display: flex;
flex-direction: column;
}
.page-header {
margin-bottom: 24px;
h2 {
margin: 0;
font-size: 24px;
font-weight: 600;
color: #262626;
}
}
.tabs-actions-section {
background: #fff;
border-radius: 8px;
padding: 0 16px;
margin-bottom: 16px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
display: flex;
justify-content: space-between;
align-items: center;
flex-shrink: 0;
}
.tabs-container {
display: flex;
align-items: center;
gap: 0;
flex: 1;
}
.tab-item {
padding: 16px 20px;
cursor: pointer;
border-bottom: 3px solid transparent;
transition: all 0.3s;
position: relative;
&:hover {
background-color: #f8f9fa;
}
&.active {
border-bottom-color: var(--app-primary-color);
.tab-label {
color: var(--app-primary-color);
font-weight: 600;
}
}
.tab-label {
font-size: 14px;
color: #262626;
transition: color 0.3s;
}
.tab-count {
font-size: 12px;
color: #8c8c8c;
margin-left: 4px;
}
}
.actions-right {
display: flex;
gap: var(--app-button-gap, 8px);
align-items: center;
padding: 16px 0;
.arco-btn {
border-radius: 4px;
font-weight: 500;
transition: all 0.3s ease;
border: 2px solid;
position: relative;
overflow: hidden;
padding: 8px 16px;
height: auto;
// 支付按钮 - 淡黄色
&.btn-pay {
background: #fffbe6;
border-color: #ffd666;
color: #d46b08;
&:hover:not(:disabled) {
background: #fff7d1;
border-color: #ffc53d;
}
&:active:not(:disabled) {
background: #fff1b8;
border-color: #ffb020;
}
}
// 预报按钮 - 主题色
&.btn-predeclare {
background: var(--app-primary-color);
border-color: var(--app-primary-color);
color: #ffffff;
&:hover:not(:disabled) {
background: var(--app-primary-color-hover);
border-color: var(--app-primary-color-hover);
}
&:active:not(:disabled) {
background: var(--app-primary-color-hover);
border-color: var(--app-primary-color-hover);
}
}
// 拦截按钮 - 主题色
&.btn-intercept {
background: var(--app-primary-color);
border-color: var(--app-primary-color);
color: #ffffff;
&:hover:not(:disabled) {
background: var(--app-primary-color-hover);
border-color: var(--app-primary-color-hover);
}
&:active:not(:disabled) {
background: var(--app-primary-color-hover);
border-color: var(--app-primary-color-hover);
}
}
// 取消拦截按钮 - 主题色
&.btn-cancel-intercept {
background: var(--app-primary-color);
border-color: var(--app-primary-color);
color: #ffffff;
&:hover:not(:disabled) {
background: var(--app-primary-color-hover);
border-color: var(--app-primary-color-hover);
}
&:active:not(:disabled) {
background: var(--app-primary-color-hover);
border-color: var(--app-primary-color-hover);
}
}
// 删除按钮 - 主题色
&.btn-delete {
background: var(--app-primary-color);
border-color: var(--app-primary-color);
color: #ffffff;
&:hover:not(:disabled) {
background: var(--app-primary-color-hover);
border-color: var(--app-primary-color-hover);
}
&:active:not(:disabled) {
background: var(--app-primary-color-hover);
border-color: var(--app-primary-color-hover);
}
}
// 打印按钮 - 主题色
&.btn-print {
background: var(--app-primary-color);
border-color: var(--app-primary-color);
color: #ffffff;
&:hover:not(:disabled) {
background: var(--app-primary-color-hover);
border-color: var(--app-primary-color-hover);
}
&:active:not(:disabled) {
background: var(--app-primary-color-hover);
border-color: var(--app-primary-color-hover);
}
}
// 导出按钮 - 主题色
&.btn-export {
background: var(--app-primary-color);
border-color: var(--app-primary-color);
color: #ffffff;
&:hover:not(:disabled) {
background: var(--app-primary-color-hover);
border-color: var(--app-primary-color-hover);
}
&:active:not(:disabled) {
background: var(--app-primary-color-hover);
border-color: var(--app-primary-color-hover);
}
}
// 修改订单按钮 - 主题色
&.btn-modify {
background: var(--app-primary-color);
border-color: var(--app-primary-color);
color: #ffffff;
&:hover:not(:disabled) {
background: var(--app-primary-color-hover);
border-color: var(--app-primary-color-hover);
}
&:active:not(:disabled) {
background: var(--app-primary-color-hover);
border-color: var(--app-primary-color-hover);
}
}
// 设置按钮 - 主题色
&.btn-settings {
background: var(--app-primary-color);
border-color: var(--app-primary-color);
color: #ffffff;
padding: 8px 12px;
min-width: 36px;
&:hover:not(:disabled) {
background: var(--app-primary-color-hover);
border-color: var(--app-primary-color-hover);
}
&:active:not(:disabled) {
background: var(--app-primary-color-hover);
border-color: var(--app-primary-color-hover);
}
}
// 禁用状态
&:disabled {
opacity: 1;
cursor: not-allowed;
background: rgba(169, 169, 169, 0.8) !important;
border-color: rgba(169, 169, 169, 0.8) !important;
color: #ffffff !important;
transform: none !important;
box-shadow: none !important;
}
}
}
.table-section {
background: #fff;
border-radius: 8px;
padding: 0;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
.table-toolbar {
padding: 16px 16px 0;
margin-bottom: 16px;
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: nowrap;
.toolbar-left {
flex: 1;
.selected-count {
font-size: 14px;
color: #4e5969;
.count-number {
color: #f53f3f;
font-weight: 600;
margin: 0 2px;
}
}
}
.toolbar-right {
.pagination-controls {
display: flex;
align-items: center;
}
}
}
.table-spin {
width: 100%;
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
:deep(.arco-spin) {
width: 100%;
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
}
:deep(.arco-spin-children) {
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
}
}
.list-wrap {
width: 100%;
overflow: hidden;
flex: 1;
min-height: 0;
padding: 0 16px 16px;
box-sizing: border-box;
display: flex;
flex-direction: column;
overscroll-behavior: contain;
touch-action: pan-x pan-y;
:deep(.handsontable-pro-container) {
width: 100%;
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
}
.handsontable-wrapper {
width: 100%;
:deep(.handsontable) {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
border: none !important;
// 覆盖 Handsontable 默认的 table 边框
table {
border: none !important;
}
.ht_master,
.ht_clone_top,
.ht_clone_left,
.ht_clone_corner {
border: none !important;
}
.wtHolder {
border: none !important;
}
.htCore {
border-collapse: separate;
border-spacing: 0;
border: none !important;
td {
border-right: 0.5px solid #f0f0f0 !important;
border-bottom: 0.5px solid #f0f0f0 !important;
border-top: none !important;
border-left: none !important;
padding: 7px 16px;
font-size: 13px;
line-height: 1.4;
color: #262626;
transition: all 0.2s ease;
background: #fff;
text-align: center !important;
vertical-align: middle !important;
&:hover {
background-color: #fafafa;
}
}
tr {
transition: all 0.2s ease;
&:hover {
td {
// hover时,如果单元格已经有背景色(状态背景),则稍微加深
// 否则使用默认hover颜色
&:not([style*="background-color"]) {
background-color: #fafafa;
}
}
}
}
th {
background: #f5f5f5 !important; // 表头背景颜色改为淡灰色
border-right: 0.5px solid #f0f0f0 !important;
border-bottom: 0.5px solid #f0f0f0 !important;
border-top: none !important;
border-left: none !important;
}
// 根据订单状态设置行背景
tbody tr:has([data-row-status="problematic"]) td {
background-color: #fff1f0 !important;
}
tbody tr:has([data-row-status="pendingPayment"]) td {
background-color: #fffbe6 !important;
}
// 操作列眼睛图标 hover
.view-icon-wrapper {
&:hover {
background-color: var(--app-primary-color-light, #e6f7f7);
svg {
color: var(--app-primary-color-hover) !important;
}
}
}
// 隐藏筛选图标的边框
.changeType {
border: none !important;
box-shadow: none !important;
background: transparent !important;
}
// 隐藏筛选图标容器的边框
.ht_master .ht_clone_top th .changeType,
.ht_clone_top th .changeType,
.htCore th .changeType,
th .changeType {
border: none !important;
box-shadow: none !important;
background: transparent !important;
}
}
.ht_master .wtHolder {
overflow: auto;
}
.handsontableInput {
display: none;
}
}
}
}
// 响应式设计
@media (max-width: 768px) {
.tabs-container {
overflow-x: auto;
flex-wrap: nowrap;
}
.actions-right {
flex-wrap: wrap;
gap: 4px;
}
.action-btn {
font-size: 12px;
padding: 0 8px;
height: 28px;
}
}
</style>